diff --git a/accessible/src/atk/nsAccessibleWrap.cpp b/accessible/src/atk/nsAccessibleWrap.cpp index 64cda371cc8..9fabeea3637 100644 --- a/accessible/src/atk/nsAccessibleWrap.cpp +++ b/accessible/src/atk/nsAccessibleWrap.cpp @@ -450,10 +450,9 @@ nsAccessibleWrap::CreateMaiInterfaces(void) interfacesBits |= 1 << MAI_INTERFACE_IMAGE; } - // HyperLinkAccessible - if (IsHyperLink()) { - interfacesBits |= 1 << MAI_INTERFACE_HYPERLINK_IMPL; - } + // HyperLinkAccessible + if (IsLink()) + interfacesBits |= 1 << MAI_INTERFACE_HYPERLINK_IMPL; if (!nsAccUtils::MustPrune(this)) { // These interfaces require children //nsIAccessibleHypertext @@ -1077,6 +1076,16 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent) } } break; + case nsIAccessibleEvent::EVENT_NAME_CHANGE: + { + nsString newName; + accessible->GetName(newName); + NS_ConvertUTF16toUTF8 utf8Name(newName); + if (!utf8Name.Equals(atkObj->name)) + atk_object_set_name(atkObj, utf8Name.get()); + + break; + } case nsIAccessibleEvent::EVENT_VALUE_CHANGE: { MAI_LOG_DEBUG(("\n\nReceived: EVENT_VALUE_CHANGE\n")); diff --git a/accessible/src/atk/nsApplicationAccessibleWrap.cpp b/accessible/src/atk/nsApplicationAccessibleWrap.cpp index 4bc80c417c0..9a3ac4d1c68 100644 --- a/accessible/src/atk/nsApplicationAccessibleWrap.cpp +++ b/accessible/src/atk/nsApplicationAccessibleWrap.cpp @@ -705,7 +705,7 @@ nsApplicationAccessibleWrap::AppendChild(nsAccessible *aChild) PRBool nsApplicationAccessibleWrap::RemoveChild(nsAccessible* aChild) { - PRInt32 index = aChild->GetIndexInParent(); + PRInt32 index = aChild->IndexInParent(); AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aChild); atk_object_set_parent(atkAccessible, NULL); diff --git a/accessible/src/atk/nsMaiHyperlink.cpp b/accessible/src/atk/nsMaiHyperlink.cpp index c003274b8e9..fbc7523b870 100644 --- a/accessible/src/atk/nsMaiHyperlink.cpp +++ b/accessible/src/atk/nsMaiHyperlink.cpp @@ -135,16 +135,16 @@ MaiHyperlink::~MaiHyperlink() } } -AtkHyperlink * +AtkHyperlink* MaiHyperlink::GetAtkHyperlink(void) { - NS_ENSURE_TRUE(mHyperlink, nsnull); + NS_ENSURE_TRUE(mHyperlink, nsnull); - if (mMaiAtkHyperlink) - return mMaiAtkHyperlink; + if (mMaiAtkHyperlink) + return mMaiAtkHyperlink; - if (!mHyperlink->IsHyperLink()) - return nsnull; + if (!mHyperlink->IsLink()) + return nsnull; mMaiAtkHyperlink = reinterpret_cast @@ -215,9 +215,7 @@ getUriCB(AtkHyperlink *aLink, gint aLinkIndex) nsAccessible* hyperlink = get_accessible_hyperlink(aLink); NS_ENSURE_TRUE(hyperlink, nsnull); - MaiAtkHyperlink *maiAtkHyperlink = MAI_ATK_HYPERLINK(aLink); - - nsCOMPtr uri = hyperlink->GetAnchorURI(aLinkIndex); + nsCOMPtr uri = hyperlink->AnchorURIAt(aLinkIndex); if (!uri) return nsnull; @@ -234,7 +232,7 @@ getObjectCB(AtkHyperlink *aLink, gint aLinkIndex) nsAccessible* hyperlink = get_accessible_hyperlink(aLink); NS_ENSURE_TRUE(hyperlink, nsnull); - nsAccessible* anchor = hyperlink->GetAnchor(aLinkIndex); + nsAccessible* anchor = hyperlink->AnchorAt(aLinkIndex); NS_ENSURE_TRUE(anchor, nsnull); AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(anchor); @@ -266,7 +264,7 @@ isValidCB(AtkHyperlink *aLink) nsAccessible* hyperlink = get_accessible_hyperlink(aLink); NS_ENSURE_TRUE(hyperlink, FALSE); - return static_cast(hyperlink->IsValid()); + return static_cast(hyperlink->IsLinkValid()); } gint diff --git a/accessible/src/atk/nsMaiHyperlink.h b/accessible/src/atk/nsMaiHyperlink.h index 5e187b84073..a32ebd15fcd 100644 --- a/accessible/src/atk/nsMaiHyperlink.h +++ b/accessible/src/atk/nsMaiHyperlink.h @@ -58,9 +58,8 @@ public: public: AtkHyperlink *GetAtkHyperlink(void); - nsAccessible* GetAccHyperlink(void) { - return mHyperlink && mHyperlink->IsHyperLink() ? mHyperlink : nsnull; - } + nsAccessible* GetAccHyperlink() + { return mHyperlink && mHyperlink->IsLink() ? mHyperlink : nsnull; } protected: nsAccessible* mHyperlink; diff --git a/accessible/src/atk/nsMaiInterfaceComponent.cpp b/accessible/src/atk/nsMaiInterfaceComponent.cpp index c8a38d7da04..022422df965 100644 --- a/accessible/src/atk/nsMaiInterfaceComponent.cpp +++ b/accessible/src/atk/nsMaiInterfaceComponent.cpp @@ -98,7 +98,7 @@ refAccessibleAtPointHelper(nsAccessibleWrap* aAccWrap, gint aX, gint aY, if (!aAccWrap || aAccWrap->IsDefunct() || nsAccUtils::MustPrune(aAccWrap)) return nsnull; - // nsAccessible::GetChildAtPoint(x,y) is in screen pixels. + // nsAccessible::ChildAtPoint(x,y) is in screen pixels. if (aCoordType == ATK_XY_WINDOW) { nsIntPoint winCoords = nsCoreUtils::GetScreenCoordsForWindow(aAccWrap->GetNode()); @@ -106,8 +106,8 @@ refAccessibleAtPointHelper(nsAccessibleWrap* aAccWrap, gint aX, gint aY, aY += winCoords.y; } - nsAccessible* accAtPoint = aAccWrap->GetChildAtPoint(aX, aY, - nsAccessible::eDirectChild); + nsAccessible* accAtPoint = aAccWrap->ChildAtPoint(aX, aY, + nsAccessible::eDirectChild); if (!accAtPoint) return nsnull; diff --git a/accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp b/accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp index 9e0b7bfeaac..7d136206cb6 100644 --- a/accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp +++ b/accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp @@ -49,16 +49,15 @@ hyperlinkImplInterfaceInitCB(AtkHyperlinkImplIface *aIface) } AtkHyperlink* -getHyperlinkCB(AtkHyperlinkImpl *aImpl) +getHyperlinkCB(AtkHyperlinkImpl* aImpl) { - nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aImpl)); - if (!accWrap) - return nsnull; + nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImpl)); + if (!accWrap) + return nsnull; - NS_ENSURE_TRUE(accWrap->IsHyperLink(), nsnull); - - MaiHyperlink *maiHyperlink = accWrap->GetMaiHyperlink(); - NS_ENSURE_TRUE(maiHyperlink, nsnull); - return maiHyperlink->GetAtkHyperlink(); + NS_ENSURE_TRUE(accWrap->IsLink(), nsnull); + MaiHyperlink* maiHyperlink = accWrap->GetMaiHyperlink(); + NS_ENSURE_TRUE(maiHyperlink, nsnull); + return maiHyperlink->GetAtkHyperlink(); } diff --git a/accessible/src/base/AccGroupInfo.cpp b/accessible/src/base/AccGroupInfo.cpp index 039091536b7..191487fad70 100644 --- a/accessible/src/base/AccGroupInfo.cpp +++ b/accessible/src/base/AccGroupInfo.cpp @@ -47,7 +47,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) : if (!parent) return; - PRInt32 indexInParent = aItem->GetIndexInParent(); + PRInt32 indexInParent = aItem->IndexInParent(); PRInt32 level = nsAccUtils::GetARIAOrDefaultLevel(aItem); // Compute position in set. diff --git a/accessible/src/base/Makefile.in b/accessible/src/base/Makefile.in index a12edbbe574..49462013174 100644 --- a/accessible/src/base/Makefile.in +++ b/accessible/src/base/Makefile.in @@ -87,6 +87,7 @@ EXPORTS = \ nsAccessible.h \ nsAccessNode.h \ nsARIAMap.h \ + States.h \ $(NULL) # we don't want the shared lib, but we want to force the creation of a static lib. diff --git a/accessible/src/base/NotificationController.cpp b/accessible/src/base/NotificationController.cpp index b54e0f65575..b1266f8a116 100644 --- a/accessible/src/base/NotificationController.cpp +++ b/accessible/src/base/NotificationController.cpp @@ -515,14 +515,14 @@ NotificationController::CoalesceTextChangeEventsFor(AccShowEvent* aTailEvent, if (!textEvent) return; - if (aTailEvent->mAccessible->GetIndexInParent() == - aThisEvent->mAccessible->GetIndexInParent() + 1) { + if (aTailEvent->mAccessible->IndexInParent() == + aThisEvent->mAccessible->IndexInParent() + 1) { // If tail target was inserted after this target, i.e. tail target is next // sibling of this target. aTailEvent->mAccessible->AppendTextTo(textEvent->mModifiedText); - } else if (aTailEvent->mAccessible->GetIndexInParent() == - aThisEvent->mAccessible->GetIndexInParent() -1) { + } else if (aTailEvent->mAccessible->IndexInParent() == + aThisEvent->mAccessible->IndexInParent() -1) { // If tail target was inserted before this target, i.e. tail target is // previous sibling of this target. nsAutoString startText; diff --git a/accessible/src/base/nsARIAGridAccessible.cpp b/accessible/src/base/nsARIAGridAccessible.cpp index 62514a26e35..43243ce55ee 100644 --- a/accessible/src/base/nsARIAGridAccessible.cpp +++ b/accessible/src/base/nsARIAGridAccessible.cpp @@ -981,7 +981,7 @@ nsARIAGridCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex) *aColumnIndex = 0; - PRInt32 indexInRow = GetIndexInParent(); + PRInt32 indexInRow = IndexInParent(); for (PRInt32 idx = 0; idx < indexInRow; idx++) { nsAccessible* cell = row->GetChildAt(idx); PRUint32 role = cell->Role(); @@ -1013,7 +1013,7 @@ nsARIAGridCellAccessible::GetRowIndex(PRInt32 *aRowIndex) *aRowIndex = 0; - PRInt32 indexInTable = row->GetIndexInParent(); + PRInt32 indexInTable = row->IndexInParent(); for (PRInt32 idx = 0; idx < indexInTable; idx++) { row = table->GetChildAt(idx); if (row->Role() == nsIAccessibleRole::ROLE_ROW) diff --git a/accessible/src/base/nsAccDocManager.cpp b/accessible/src/base/nsAccDocManager.cpp index f1ddec6fee8..702421f29c6 100644 --- a/accessible/src/base/nsAccDocManager.cpp +++ b/accessible/src/base/nsAccDocManager.cpp @@ -50,7 +50,7 @@ #include "nsIChannel.h" #include "nsIContentViewer.h" #include "nsIDOMDocument.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsIDOMEventTarget.h" #include "nsIDOMWindow.h" #include "nsIInterfaceRequestorUtils.h" @@ -391,16 +391,16 @@ nsAccDocManager::AddListeners(nsIDocument *aDocument, PRBool aAddDOMContentLoadedListener) { nsPIDOMWindow *window = aDocument->GetWindow(); - nsPIDOMEventTarget *target = window->GetChromeEventHandler(); - nsIEventListenerManager* elm = target->GetListenerManager(PR_TRUE); + nsIDOMEventTarget *target = window->GetChromeEventHandler(); + nsEventListenerManager* elm = target->GetListenerManager(PR_TRUE); elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"), - NS_EVENT_FLAG_CAPTURE, nsnull); + NS_EVENT_FLAG_CAPTURE); NS_LOG_ACCDOCCREATE_TEXT(" added 'pagehide' listener") if (aAddDOMContentLoadedListener) { elm->AddEventListenerByType(this, NS_LITERAL_STRING("DOMContentLoaded"), - NS_EVENT_FLAG_CAPTURE, nsnull); + NS_EVENT_FLAG_CAPTURE); NS_LOG_ACCDOCCREATE_TEXT(" added 'DOMContentLoaded' listener") } } diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index 4c6b7a0d3c6..c91166ca653 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -174,7 +174,7 @@ nsresult nsAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr) } if (aIID.Equals(NS_GET_IID(nsIAccessibleHyperLink))) { - if (IsHyperLink()) { + if (IsLink()) { *aInstancePtr = static_cast(this); NS_ADDREF_THIS(); return NS_OK; @@ -588,7 +588,7 @@ nsAccessible::GetIndexInParent(PRInt32 *aIndexInParent) { NS_ENSURE_ARG_POINTER(aIndexInParent); - *aIndexInParent = GetIndexInParent(); + *aIndexInParent = IndexInParent(); return *aIndexInParent != -1 ? NS_OK : NS_ERROR_FAILURE; } @@ -772,10 +772,10 @@ nsAccessible::GetFocusedChild(nsIAccessible **aFocusedChild) return NS_OK; } -// nsAccessible::GetChildAtPoint() +// nsAccessible::ChildAtPoint() nsAccessible* -nsAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild) +nsAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild) { // If we can't find the point in a child, we will return the fallback answer: // we return |this| if the point is within it, otherwise nsnull. @@ -839,7 +839,7 @@ nsAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, (child->State() & states::INVISIBLE) == 0) { if (aWhichChild == eDeepestChild) - return child->GetChildAtPoint(aX, aY, eDeepestChild); + return child->ChildAtPoint(aX, aY, eDeepestChild); return child; } @@ -881,7 +881,7 @@ nsAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, if (IsDefunct()) return NS_ERROR_FAILURE; - NS_IF_ADDREF(*aAccessible = GetChildAtPoint(aX, aY, eDirectChild)); + NS_IF_ADDREF(*aAccessible = ChildAtPoint(aX, aY, eDirectChild)); return NS_OK; } @@ -896,7 +896,7 @@ nsAccessible::GetDeepestChildAtPoint(PRInt32 aX, PRInt32 aY, if (IsDefunct()) return NS_ERROR_FAILURE; - NS_IF_ADDREF(*aAccessible = GetChildAtPoint(aX, aY, eDeepestChild)); + NS_IF_ADDREF(*aAccessible = ChildAtPoint(aX, aY, eDeepestChild)); return NS_OK; } @@ -2581,7 +2581,7 @@ nsAccessible::GetURI(PRInt32 aIndex, nsIURI **aURI) if (aIndex < 0 || aIndex >= static_cast(AnchorCount())) return NS_ERROR_INVALID_ARG; - *aURI = GetAnchorURI(aIndex).get(); + *aURI = AnchorURIAt(aIndex).get(); return NS_OK; } @@ -2598,7 +2598,7 @@ nsAccessible::GetAnchor(PRInt32 aIndex, nsIAccessible** aAccessible) if (aIndex < 0 || aIndex >= static_cast(AnchorCount())) return NS_ERROR_INVALID_ARG; - NS_IF_ADDREF(*aAccessible = GetAnchor(aIndex)); + NS_IF_ADDREF(*aAccessible = AnchorAt(aIndex)); return NS_OK; } @@ -2612,7 +2612,7 @@ nsAccessible::GetValid(PRBool *aValid) if (IsDefunct()) return NS_ERROR_FAILURE; - *aValid = IsValid(); + *aValid = IsLinkValid(); return NS_OK; } @@ -2626,7 +2626,7 @@ nsAccessible::GetSelected(PRBool *aSelected) if (IsDefunct()) return NS_ERROR_FAILURE; - *aSelected = IsSelected(); + *aSelected = IsLinkSelected(); return NS_OK; } @@ -2844,11 +2844,11 @@ nsAccessible::GetChildCount() PRInt32 nsAccessible::GetIndexOf(nsAccessible* aChild) { - return (aChild->mParent != this) ? -1 : aChild->GetIndexInParent(); + return (aChild->mParent != this) ? -1 : aChild->IndexInParent(); } PRInt32 -nsAccessible::GetIndexInParent() const +nsAccessible::IndexInParent() const { return mIndexInParent; } @@ -2895,7 +2895,7 @@ nsAccessible::GetIndexOfEmbeddedChild(nsAccessible* aChild) // HyperLinkAccessible methods bool -nsAccessible::IsHyperLink() +nsAccessible::IsLink() { // Every embedded accessible within hypertext accessible implements // hyperlink interface. @@ -2905,7 +2905,7 @@ nsAccessible::IsHyperLink() PRUint32 nsAccessible::StartOffset() { - NS_PRECONDITION(IsHyperLink(), "StartOffset is called not on hyper link!"); + NS_PRECONDITION(IsLink(), "StartOffset is called not on hyper link!"); nsHyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull; return hyperText ? hyperText->GetChildOffset(this) : 0; @@ -2914,49 +2914,30 @@ nsAccessible::StartOffset() PRUint32 nsAccessible::EndOffset() { - NS_PRECONDITION(IsHyperLink(), "EndOffset is called on not hyper link!"); + NS_PRECONDITION(IsLink(), "EndOffset is called on not hyper link!"); nsHyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull; return hyperText ? (hyperText->GetChildOffset(this) + 1) : 0; } -bool -nsAccessible::IsValid() -{ - NS_PRECONDITION(IsHyperLink(), "IsValid is called on not hyper link!"); - - return (0 == (State() & states::INVALID)); - // XXX In order to implement this we would need to follow every link - // Perhaps we can get information about invalid links from the cache - // In the mean time authors can use role="link" aria-invalid="true" - // to force it for links they internally know to be invalid -} - -bool -nsAccessible::IsSelected() -{ - NS_PRECONDITION(IsHyperLink(), "IsSelected is called on not hyper link!"); - return (gLastFocusedNode == GetNode()); -} - PRUint32 nsAccessible::AnchorCount() { - NS_PRECONDITION(IsHyperLink(), "AnchorCount is called on not hyper link!"); + NS_PRECONDITION(IsLink(), "AnchorCount is called on not hyper link!"); return 1; } nsAccessible* -nsAccessible::GetAnchor(PRUint32 aAnchorIndex) +nsAccessible::AnchorAt(PRUint32 aAnchorIndex) { - NS_PRECONDITION(IsHyperLink(), "GetAnchor is called on not hyper link!"); + NS_PRECONDITION(IsLink(), "GetAnchor is called on not hyper link!"); return aAnchorIndex == 0 ? this : nsnull; } already_AddRefed -nsAccessible::GetAnchorURI(PRUint32 aAnchorIndex) +nsAccessible::AnchorURIAt(PRUint32 aAnchorIndex) { - NS_PRECONDITION(IsHyperLink(), "GetAnchorURI is called on not hyper link!"); + NS_PRECONDITION(IsLink(), "AnchorURIAt is called on not hyper link!"); if (aAnchorIndex != 0) return nsnull; diff --git a/accessible/src/base/nsAccessible.h b/accessible/src/base/nsAccessible.h index 39fe741575b..ab7d285c9c1 100644 --- a/accessible/src/base/nsAccessible.h +++ b/accessible/src/base/nsAccessible.h @@ -40,6 +40,7 @@ #define _nsAccessible_H_ #include "nsAccessNodeWrap.h" +#include "States.h" #include "nsIAccessible.h" #include "nsIAccessibleHyperLink.h" @@ -197,7 +198,7 @@ public: virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes); /** - * Used by GetChildAtPoint() method to get direct or deepest child at point. + * Used by ChildAtPoint() method to get direct or deepest child at point. */ enum EWhichChildAtPoint { eDirectChild, @@ -212,8 +213,8 @@ public: * @param aWhichChild [in] flag points if deepest or direct child * should be returned */ - virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild); + virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild); /** * Return calculated group level based on accessible hierarchy. @@ -297,7 +298,7 @@ public: /** * Return index in parent accessible. */ - virtual PRInt32 GetIndexInParent() const; + virtual PRInt32 IndexInParent() const; /** * Return true if accessible has children; @@ -406,7 +407,7 @@ public: /** * Return true if the accessible is hyper link accessible. */ - virtual bool IsHyperLink(); + virtual bool IsLink(); /** * Return the start offset of the link within the parent accessible. @@ -421,12 +422,26 @@ public: /** * Return true if the link is valid (e. g. points to a valid URL). */ - virtual bool IsValid(); + inline bool IsLinkValid() + { + NS_PRECONDITION(IsLink(), "IsLinkValid is called on not hyper link!"); + + // XXX In order to implement this we would need to follow every link + // Perhaps we can get information about invalid links from the cache + // In the mean time authors can use role="link" aria-invalid="true" + // to force it for links they internally know to be invalid + return (0 == (State() & states::INVALID)); + } /** * Return true if the link currently has the focus. */ - virtual bool IsSelected(); + inline bool IsLinkSelected() + { + NS_PRECONDITION(IsLink(), + "IsLinkSelected() called on something that is not a hyper link!"); + return gLastFocusedNode == GetNode(); + } /** * Return the number of anchors within the link. @@ -436,12 +451,12 @@ public: /** * Returns an anchor accessible at the given index. */ - virtual nsAccessible* GetAnchor(PRUint32 aAnchorIndex); + virtual nsAccessible* AnchorAt(PRUint32 aAnchorIndex); /** * Returns an anchor URI at the given index. */ - virtual already_AddRefed GetAnchorURI(PRUint32 aAnchorIndex); + virtual already_AddRefed AnchorURIAt(PRUint32 aAnchorIndex); ////////////////////////////////////////////////////////////////////////////// // SelectAccessible diff --git a/accessible/src/base/nsApplicationAccessible.cpp b/accessible/src/base/nsApplicationAccessible.cpp index fba48922181..08c352bbc2c 100644 --- a/accessible/src/base/nsApplicationAccessible.cpp +++ b/accessible/src/base/nsApplicationAccessible.cpp @@ -169,8 +169,8 @@ nsApplicationAccessible::GroupPosition(PRInt32 *aGroupLevel, } nsAccessible* -nsApplicationAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild) +nsApplicationAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild) { return nsnull; } diff --git a/accessible/src/base/nsApplicationAccessible.h b/accessible/src/base/nsApplicationAccessible.h index 2d1e88e123c..f653f97fdc3 100644 --- a/accessible/src/base/nsApplicationAccessible.h +++ b/accessible/src/base/nsApplicationAccessible.h @@ -63,7 +63,6 @@ class nsApplicationAccessible: public nsAccessibleWrap, public nsIAccessibleApplication { public: - using nsAccessible::GetChildAtPoint; nsApplicationAccessible(); @@ -126,8 +125,8 @@ public: virtual PRUint32 NativeRole(); virtual PRUint64 State(); virtual PRUint64 NativeState(); - virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild); + virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild); virtual void InvalidateChildren(); diff --git a/accessible/src/base/nsBaseWidgetAccessible.cpp b/accessible/src/base/nsBaseWidgetAccessible.cpp index 49cea016674..6dffa52e44b 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.cpp +++ b/accessible/src/base/nsBaseWidgetAccessible.cpp @@ -69,8 +69,8 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsLeafAccessible, nsAccessible) // nsLeafAccessible: nsAccessible public nsAccessible* -nsLeafAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild) +nsLeafAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild) { // Don't walk into leaf accessibles. return this; @@ -200,14 +200,14 @@ nsLinkableAccessible::Shutdown() // nsLinkableAccessible: HyperLinkAccessible already_AddRefed -nsLinkableAccessible::GetAnchorURI(PRUint32 aAnchorIndex) +nsLinkableAccessible::AnchorURIAt(PRUint32 aAnchorIndex) { if (mIsLink) { - NS_ASSERTION(mActionAcc->IsHyperLink(), + NS_ASSERTION(mActionAcc->IsLink(), "nsIAccessibleHyperLink isn't implemented."); - if (mActionAcc->IsHyperLink()) - return mActionAcc->GetAnchorURI(aAnchorIndex); + if (mActionAcc->IsLink()) + return mActionAcc->AnchorURIAt(aAnchorIndex); } return nsnull; diff --git a/accessible/src/base/nsBaseWidgetAccessible.h b/accessible/src/base/nsBaseWidgetAccessible.h index d8b0866ce57..c90d4992945 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.h +++ b/accessible/src/base/nsBaseWidgetAccessible.h @@ -55,7 +55,6 @@ class nsLeafAccessible : public nsAccessibleWrap { public: - using nsAccessible::GetChildAtPoint; nsLeafAccessible(nsIContent *aContent, nsIWeakReference *aShell); @@ -63,8 +62,8 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsAccessible - virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild); + virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild); protected: @@ -102,7 +101,7 @@ public: virtual PRUint64 NativeState(); // HyperLinkAccessible - virtual already_AddRefed GetAnchorURI(PRUint32 aAnchorIndex); + virtual already_AddRefed AnchorURIAt(PRUint32 aAnchorIndex); protected: // nsAccessible diff --git a/accessible/src/base/nsCoreUtils.cpp b/accessible/src/base/nsCoreUtils.cpp index 4db09eeb8cf..bc76f2bbfe1 100644 --- a/accessible/src/base/nsCoreUtils.cpp +++ b/accessible/src/base/nsCoreUtils.cpp @@ -52,7 +52,7 @@ #include "nsIDOMXULElement.h" #include "nsIDocShell.h" #include "nsIContentViewer.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsIPresShell.h" #include "nsPresContext.h" #include "nsIScrollableFrame.h" @@ -78,7 +78,7 @@ PRBool nsCoreUtils::HasClickListener(nsIContent *aContent) { NS_ENSURE_TRUE(aContent, PR_FALSE); - nsIEventListenerManager* listenerManager = + nsEventListenerManager* listenerManager = aContent->GetListenerManager(PR_FALSE); return listenerManager && diff --git a/accessible/src/base/nsOuterDocAccessible.cpp b/accessible/src/base/nsOuterDocAccessible.cpp index 239c6407a3b..c34c5de7c07 100644 --- a/accessible/src/base/nsOuterDocAccessible.cpp +++ b/accessible/src/base/nsOuterDocAccessible.cpp @@ -74,8 +74,8 @@ nsOuterDocAccessible::NativeState() } nsAccessible* -nsOuterDocAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild) +nsOuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild) { PRInt32 docX = 0, docY = 0, docWidth = 0, docHeight = 0; nsresult rv = GetBounds(&docX, &docY, &docWidth, &docHeight); @@ -90,7 +90,7 @@ nsOuterDocAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, NS_ENSURE_TRUE(child, nsnull); if (aWhichChild == eDeepestChild) - return child->GetChildAtPoint(aX, aY, eDeepestChild); + return child->ChildAtPoint(aX, aY, eDeepestChild); return child; } diff --git a/accessible/src/base/nsOuterDocAccessible.h b/accessible/src/base/nsOuterDocAccessible.h index f1a00ad9c93..d5d996269c1 100644 --- a/accessible/src/base/nsOuterDocAccessible.h +++ b/accessible/src/base/nsOuterDocAccessible.h @@ -70,8 +70,8 @@ public: virtual PRUint32 NativeRole(); virtual PRUint64 NativeState(); virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes); - virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild); + virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild); virtual void InvalidateChildren(); virtual PRBool AppendChild(nsAccessible *aAccessible); diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp index 6fa4fca298d..2b389d3fb91 100644 --- a/accessible/src/base/nsRootAccessible.cpp +++ b/accessible/src/base/nsRootAccessible.cpp @@ -65,7 +65,7 @@ #include "nsIDOMXULSelectCntrlItemEl.h" #include "nsIDOMXULPopupElement.h" #include "nsIDocument.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsIFrame.h" #include "nsIMenuFrame.h" #include "nsIHTMLDocument.h" @@ -76,7 +76,6 @@ #include "nsIWebBrowserChrome.h" #include "nsReadableUtils.h" #include "nsRootAccessible.h" -#include "nsIDOMNSEventTarget.h" #include "nsIPrivateDOMEvent.h" #include "nsFocusManager.h" @@ -251,11 +250,11 @@ const char* const docEvents[] = { nsresult nsRootAccessible::AddEventListeners() { - // nsIDOMNSEventTarget interface allows to register event listeners to + // nsIDOMEventTarget interface allows to register event listeners to // receive untrusted events (synthetic events generated by untrusted code). // For example, XBL bindings implementations for elements that are hosted in // non chrome document fire untrusted events. - nsCOMPtr nstarget(do_QueryInterface(mDocument)); + nsCOMPtr nstarget(do_QueryInterface(mDocument)); if (nstarget) { for (const char* const* e = docEvents, diff --git a/accessible/src/base/nsTextEquivUtils.cpp b/accessible/src/base/nsTextEquivUtils.cpp index 8623ecea8d9..2f2c6a600f6 100644 --- a/accessible/src/base/nsTextEquivUtils.cpp +++ b/accessible/src/base/nsTextEquivUtils.cpp @@ -519,7 +519,7 @@ PRUint32 nsTextEquivUtils::gRoleToNameRulesMap[] = eNoRule, // ROLE_AUTOCOMPLETE eNoRule, // ROLE_EDITBAR eFromValue, // ROLE_ENTRY - eNoRule, // ROLE_CAPTION + eFromSubtreeIfRec, // ROLE_CAPTION eNoRule, // ROLE_DOCUMENT_FRAME eFromSubtreeIfRec, // ROLE_HEADING eNoRule, // ROLE_PAGE diff --git a/accessible/src/html/nsHTMLImageMapAccessible.cpp b/accessible/src/html/nsHTMLImageMapAccessible.cpp index 4d356ad0902..23159ddde01 100644 --- a/accessible/src/html/nsHTMLImageMapAccessible.cpp +++ b/accessible/src/html/nsHTMLImageMapAccessible.cpp @@ -85,13 +85,13 @@ nsHTMLImageMapAccessible::AnchorCount() } nsAccessible* -nsHTMLImageMapAccessible::GetAnchor(PRUint32 aAnchorIndex) +nsHTMLImageMapAccessible::AnchorAt(PRUint32 aAnchorIndex) { return GetChildAt(aAnchorIndex); } already_AddRefed -nsHTMLImageMapAccessible::GetAnchorURI(PRUint32 aAnchorIndex) +nsHTMLImageMapAccessible::AnchorURIAt(PRUint32 aAnchorIndex) { nsAccessible* area = GetChildAt(aAnchorIndex); if (!area) @@ -243,8 +243,8 @@ nsHTMLAreaAccessible::NativeState() } nsAccessible* -nsHTMLAreaAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild) +nsHTMLAreaAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild) { // Don't walk into area accessibles. return this; @@ -261,13 +261,13 @@ nsHTMLAreaAccessible::StartOffset() // We return index in parent because image map contains area links only which // are embedded objects. // XXX: image map should be a hypertext accessible. - return GetIndexInParent(); + return IndexInParent(); } PRUint32 nsHTMLAreaAccessible::EndOffset() { - return GetIndexInParent() + 1; + return IndexInParent() + 1; } //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/src/html/nsHTMLImageMapAccessible.h b/accessible/src/html/nsHTMLImageMapAccessible.h index 86ac94a5937..8c88f8420a1 100644 --- a/accessible/src/html/nsHTMLImageMapAccessible.h +++ b/accessible/src/html/nsHTMLImageMapAccessible.h @@ -62,8 +62,8 @@ public: // HyperLinkAccessible virtual PRUint32 AnchorCount(); - virtual nsAccessible* GetAnchor(PRUint32 aAnchorIndex); - virtual already_AddRefed GetAnchorURI(PRUint32 aAnchorIndex); + virtual nsAccessible* AnchorAt(PRUint32 aAnchorIndex); + virtual already_AddRefed AnchorURIAt(PRUint32 aAnchorIndex); protected: @@ -82,7 +82,6 @@ private: class nsHTMLAreaAccessible : public nsHTMLLinkAccessible { public: - using nsAccessible::GetChildAtPoint; nsHTMLAreaAccessible(nsIContent *aContent, nsIWeakReference *aShell); @@ -94,8 +93,8 @@ public: virtual void Description(nsString& aDescription); virtual nsresult GetNameInternal(nsAString& aName); virtual PRUint64 NativeState(); - virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild); + virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild); // HyperLinkAccessible virtual PRUint32 StartOffset(); diff --git a/accessible/src/html/nsHTMLLinkAccessible.cpp b/accessible/src/html/nsHTMLLinkAccessible.cpp index 86abd171855..b4e8f7cf35a 100644 --- a/accessible/src/html/nsHTMLLinkAccessible.cpp +++ b/accessible/src/html/nsHTMLLinkAccessible.cpp @@ -166,14 +166,14 @@ nsHTMLLinkAccessible::DoAction(PRUint8 aIndex) // HyperLinkAccessible bool -nsHTMLLinkAccessible::IsHyperLink() +nsHTMLLinkAccessible::IsLink() { // Expose HyperLinkAccessible unconditionally. return true; } already_AddRefed -nsHTMLLinkAccessible::GetAnchorURI(PRUint32 aAnchorIndex) +nsHTMLLinkAccessible::AnchorURIAt(PRUint32 aAnchorIndex) { return aAnchorIndex == 0 ? mContent->GetHrefURI() : nsnull; } diff --git a/accessible/src/html/nsHTMLLinkAccessible.h b/accessible/src/html/nsHTMLLinkAccessible.h index 38ea37edf18..e8ba19961f9 100644 --- a/accessible/src/html/nsHTMLLinkAccessible.h +++ b/accessible/src/html/nsHTMLLinkAccessible.h @@ -61,8 +61,8 @@ public: virtual PRUint64 NativeState(); // HyperLinkAccessible - virtual bool IsHyperLink(); - virtual already_AddRefed GetAnchorURI(PRUint32 aAnchorIndex); + virtual bool IsLink(); + virtual already_AddRefed AnchorURIAt(PRUint32 aAnchorIndex); protected: enum { eAction_Jump = 0 }; diff --git a/accessible/src/html/nsHTMLTableAccessible.cpp b/accessible/src/html/nsHTMLTableAccessible.cpp index 6d7c1ad9be5..0a921153f2e 100644 --- a/accessible/src/html/nsHTMLTableAccessible.cpp +++ b/accessible/src/html/nsHTMLTableAccessible.cpp @@ -313,19 +313,19 @@ nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell, nsCOMPtr headerCells = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); + PRUint32 desiredRole = -1; + if (aRowOrColumnHeaderCell == nsAccUtils::eRowHeaderCells) + desiredRole = nsIAccessibleRole::ROLE_ROWHEADER; + else if (aRowOrColumnHeaderCell == nsAccUtils::eColumnHeaderCells) + desiredRole = nsIAccessibleRole::ROLE_COLUMNHEADER; do { nsAccessible* headerCell = GetAccService()->GetAccessibleInWeakShell(headerCellElm, mWeakShell); - if (headerCell && - (aRowOrColumnHeaderCell == nsAccUtils::eRowHeaderCells && - headerCell->Role() == nsIAccessibleRole::ROLE_ROWHEADER || - aRowOrColumnHeaderCell == nsAccUtils::eColumnHeaderCells && - headerCell->Role() == nsIAccessibleRole::ROLE_COLUMNHEADER)) { + if (headerCell && headerCell->Role() == desiredRole) headerCells->AppendElement(static_cast(headerCell), PR_FALSE); - } } while ((headerCellElm = iter.NextElem())); NS_ADDREF(*aHeaderCells = headerCells); @@ -464,10 +464,22 @@ nsresult nsHTMLTableAccessible::GetNameInternal(nsAString& aName) { nsAccessible::GetNameInternal(aName); + if (!aName.IsEmpty()) + return NS_OK; - if (aName.IsEmpty()) - mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::summary, aName); + // Use table caption as a name. + nsAccessible* caption = Caption(); + if (caption) { + nsIContent* captionContent = caption->GetContent(); + if (captionContent) { + nsTextEquivUtils::AppendTextEquivFromContent(this, captionContent, &aName); + if (!aName.IsEmpty()) + return NS_OK; + } + } + // If no caption then use summary as a name. + mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::summary, aName); return NS_OK; } @@ -499,11 +511,8 @@ nsHTMLTableAccessible::GetRelationByType(PRUint32 aRelationType, aRelation); NS_ENSURE_SUCCESS(rv, rv); - if (aRelationType == nsIAccessibleRelation::RELATION_DESCRIBED_BY) { - nsCOMPtr accCaption; - GetCaption(getter_AddRefs(accCaption)); - return nsRelUtils::AddTarget(aRelationType, aRelation, accCaption); - } + if (aRelationType == nsIAccessibleRelation::RELATION_DESCRIBED_BY) + return nsRelUtils::AddTarget(aRelationType, aRelation, Caption()); return NS_OK; } @@ -514,10 +523,9 @@ nsHTMLTableAccessible::GetRelationByType(PRUint32 aRelationType, NS_IMETHODIMP nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption) { - nsAccessible* firstChild = GetChildAt(0); - if (firstChild && firstChild->Role() == nsIAccessibleRole::ROLE_CAPTION) - NS_ADDREF(*aCaption = firstChild); + NS_ENSURE_ARG_POINTER(aCaption); + NS_IF_ADDREF(*aCaption = Caption()); return NS_OK; } @@ -1204,13 +1212,9 @@ nsHTMLTableAccessible::RemoveRowsOrColumnsFromSelection(PRInt32 aIndex, const_cast(presShell->ConstFrameSelection()); PRBool doUnselectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW); - - nsresult rv = NS_OK; PRInt32 count = 0; - if (doUnselectRow) - rv = GetColumnCount(&count); - else - rv = GetRowCount(&count); + nsresult rv = doUnselectRow ? GetColumnCount(&count) : GetRowCount(&count); + NS_ENSURE_SUCCESS(rv, rv); PRInt32 startRowIdx = doUnselectRow ? aIndex : 0; PRInt32 endRowIdx = doUnselectRow ? aIndex : count - 1; @@ -1268,17 +1272,23 @@ nsHTMLTableAccessible::Description(nsString& aDescription) if (!aDescription.IsEmpty()) return; - nsCOMPtr captionAccessible; - GetCaption(getter_AddRefs(captionAccessible)); - nsCOMPtr captionAccessNode = do_QueryInterface(captionAccessible); - if (captionAccessNode) { - nsCOMPtr captionNode; - captionAccessNode->GetDOMNode(getter_AddRefs(captionNode)); - nsCOMPtr captionContent = do_QueryInterface(captionNode); - if (captionContent) + // Use summary as description if it weren't used as a name. + // XXX: get rid code duplication with NameInternal(). + nsAccessible* caption = Caption(); + if (caption) { + nsIContent* captionContent = caption->GetContent(); + if (captionContent) { + nsAutoString captionText; nsTextEquivUtils::AppendTextEquivFromContent(this, captionContent, - &aDescription); + &captionText); + + if (!captionText.IsEmpty()) { // summary isn't used as a name. + mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::summary, + aDescription); + } + } } + #ifdef SHOW_LAYOUT_HEURISTIC if (aDescription.IsEmpty()) { PRBool isProbablyForLayout; diff --git a/accessible/src/html/nsHTMLTableAccessible.h b/accessible/src/html/nsHTMLTableAccessible.h index 94b20121b63..2d5ac13cbe1 100644 --- a/accessible/src/html/nsHTMLTableAccessible.h +++ b/accessible/src/html/nsHTMLTableAccessible.h @@ -141,6 +141,14 @@ public: virtual PRUint64 NativeState(); virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes); + // TableAccessible + inline nsAccessible* Caption() const + { + nsAccessible* child = mChildren.SafeElementAt(0, nsnull); + return child && child->Role() == nsIAccessibleRole::ROLE_CAPTION ? + child : nsnull; + } + // nsHTMLTableAccessible /** diff --git a/accessible/src/html/nsHyperTextAccessible.cpp b/accessible/src/html/nsHyperTextAccessible.cpp index bcafdce71ea..a0b45453cb6 100644 --- a/accessible/src/html/nsHyperTextAccessible.cpp +++ b/accessible/src/html/nsHyperTextAccessible.cpp @@ -1154,7 +1154,7 @@ nsHyperTextAccessible::GetTextAttributes(PRBool aIncludeDefAttrs, return NS_ERROR_INVALID_ARG; } - PRInt32 accAtOffsetIdx = accAtOffset->GetIndexInParent(); + PRInt32 accAtOffsetIdx = accAtOffset->IndexInParent(); PRInt32 startOffset = GetChildOffset(accAtOffsetIdx); PRInt32 endOffset = GetChildOffset(accAtOffsetIdx + 1); PRInt32 offsetInAcc = aOffset - startOffset; @@ -2093,7 +2093,7 @@ nsHyperTextAccessible::InvalidateChildren() PRBool nsHyperTextAccessible::RemoveChild(nsAccessible* aAccessible) { - PRInt32 childIndex = aAccessible->GetIndexInParent(); + PRInt32 childIndex = aAccessible->IndexInParent(); PRInt32 count = mOffsets.Length() - childIndex; if (count > 0) mOffsets.RemoveElementsAt(childIndex, count); diff --git a/accessible/src/msaa/CAccessibleHyperlink.cpp b/accessible/src/msaa/CAccessibleHyperlink.cpp index 89d25787e54..c439efaf61e 100644 --- a/accessible/src/msaa/CAccessibleHyperlink.cpp +++ b/accessible/src/msaa/CAccessibleHyperlink.cpp @@ -56,7 +56,7 @@ CAccessibleHyperlink::QueryInterface(REFIID iid, void** ppv) if (IID_IAccessibleHyperlink == iid) { nsRefPtr thisObj = do_QueryObject(this); - if (!thisObj->IsHyperLink()) + if (!thisObj->IsLink()) return E_NOINTERFACE; *ppv = static_cast(this); @@ -76,13 +76,13 @@ __try { VariantInit(aAnchor); nsRefPtr thisObj = do_QueryObject(this); - if (thisObj->IsDefunct() || !thisObj->IsHyperLink()) + if (thisObj->IsDefunct() || !thisObj->IsLink()) return E_FAIL; if (aIndex < 0 || aIndex >= static_cast(thisObj->AnchorCount())) return E_INVALIDARG; - nsAccessible* anchor = thisObj->GetAnchor(aIndex); + nsAccessible* anchor = thisObj->AnchorAt(aIndex); if (!anchor) return S_FALSE; @@ -111,13 +111,13 @@ __try { VariantInit(aAnchorTarget); nsRefPtr thisObj = do_QueryObject(this); - if (thisObj->IsDefunct() || !thisObj->IsHyperLink()) + if (thisObj->IsDefunct() || !thisObj->IsLink()) return E_FAIL; if (aIndex < 0 || aIndex >= static_cast(thisObj->AnchorCount())) return E_INVALIDARG; - nsCOMPtr uri = thisObj->GetAnchorURI(aIndex); + nsCOMPtr uri = thisObj->AnchorURIAt(aIndex); if (!uri) return S_FALSE; @@ -151,7 +151,7 @@ __try { *aIndex = 0; nsRefPtr thisObj = do_QueryObject(this); - if (thisObj->IsDefunct() || !thisObj->IsHyperLink()) + if (thisObj->IsDefunct() || !thisObj->IsLink()) return E_FAIL; *aIndex = thisObj->StartOffset(); @@ -168,7 +168,7 @@ __try { *aIndex = 0; nsRefPtr thisObj = do_QueryObject(this); - if (thisObj->IsDefunct() || !thisObj->IsHyperLink()) + if (thisObj->IsDefunct() || !thisObj->IsLink()) return E_FAIL; *aIndex = thisObj->EndOffset(); @@ -185,10 +185,10 @@ __try { *aValid = false; nsRefPtr thisObj = do_QueryObject(this); - if (thisObj->IsDefunct() || !thisObj->IsHyperLink()) + if (thisObj->IsDefunct() || !thisObj->IsLink()) return E_FAIL; - *aValid = thisObj->IsValid(); + *aValid = thisObj->IsLinkValid(); return S_OK; } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } diff --git a/accessible/src/msaa/nsAccessibleWrap.cpp b/accessible/src/msaa/nsAccessibleWrap.cpp index 955e9f5967e..d0af2c16fa4 100644 --- a/accessible/src/msaa/nsAccessibleWrap.cpp +++ b/accessible/src/msaa/nsAccessibleWrap.cpp @@ -899,38 +899,20 @@ STDMETHODIMP nsAccessibleWrap::accHitTest( { __try { VariantInit(pvarChild); + if (IsDefunct()) + return E_FAIL; - // convert to window coords - nsCOMPtr xpAccessible; - - xLeft = xLeft; - yTop = yTop; - - if (nsAccUtils::MustPrune(this)) { - xpAccessible = this; - } - else { - GetChildAtPoint(xLeft, yTop, getter_AddRefs(xpAccessible)); - } + nsAccessible* accessible = ChildAtPoint(xLeft, yTop, eDirectChild); // if we got a child - if (xpAccessible) { + if (accessible) { // if the child is us - if (xpAccessible == static_cast(this)) { + if (accessible == this) { pvarChild->vt = VT_I4; pvarChild->lVal = CHILDID_SELF; } else { // its not create an Accessible for it. pvarChild->vt = VT_DISPATCH; - pvarChild->pdispVal = NativeAccessible(xpAccessible); - nsCOMPtr accessNode(do_QueryInterface(xpAccessible)); - NS_ASSERTION(accessNode, "Unable to QI to nsIAccessNode"); - nsCOMPtr domNode; - accessNode->GetDOMNode(getter_AddRefs(domNode)); - if (!domNode) { - // Has already been shut down - pvarChild->vt = VT_EMPTY; - return E_FAIL; - } + pvarChild->pdispVal = NativeAccessible(accessible); } } else { // no child at that point @@ -1382,19 +1364,18 @@ STDMETHODIMP nsAccessibleWrap::get_indexInParent(long *aIndexInParent) { __try { + if (!aIndexInParent) + return E_INVALIDARG; + *aIndexInParent = -1; + if (IsDefunct()) + return E_FAIL; - PRInt32 index = -1; - nsresult rv = GetIndexInParent(&index); - if (NS_FAILED(rv)) - return GetHRESULT(rv); - - if (index == -1) + *aIndexInParent = IndexInParent(); + if (*aIndexInParent == -1) return S_FALSE; - *aIndexInParent = index; return S_OK; - } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } return E_FAIL; } diff --git a/accessible/src/msaa/nsRootAccessibleWrap.cpp b/accessible/src/msaa/nsRootAccessibleWrap.cpp index 5f50c93147b..7aa993ae3ad 100644 --- a/accessible/src/msaa/nsRootAccessibleWrap.cpp +++ b/accessible/src/msaa/nsRootAccessibleWrap.cpp @@ -41,7 +41,7 @@ #include "nsWinUtils.h" #include "nsIDOMEventTarget.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" //////////////////////////////////////////////////////////////////////////////// // Constructor/desctructor diff --git a/accessible/src/xforms/nsXFormsAccessible.cpp b/accessible/src/xforms/nsXFormsAccessible.cpp index 8085a75e556..38d601a784f 100644 --- a/accessible/src/xforms/nsXFormsAccessible.cpp +++ b/accessible/src/xforms/nsXFormsAccessible.cpp @@ -562,8 +562,8 @@ nsXFormsSelectableItemAccessible::DoAction(PRUint8 aIndex) return NS_OK; } -PRBool -nsXFormsSelectableItemAccessible::IsItemSelected() +bool +nsXFormsSelectableItemAccessible::IsSelected() { nsresult rv; diff --git a/accessible/src/xforms/nsXFormsAccessible.h b/accessible/src/xforms/nsXFormsAccessible.h index 85fef238b2c..a88b1cf284d 100644 --- a/accessible/src/xforms/nsXFormsAccessible.h +++ b/accessible/src/xforms/nsXFormsAccessible.h @@ -194,7 +194,7 @@ public: NS_IMETHOD DoAction(PRUint8 aIndex); protected: - PRBool IsItemSelected(); + bool IsSelected(); }; #endif diff --git a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp b/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp index b4816bd5eaf..22ef6b170fa 100644 --- a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp +++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp @@ -502,7 +502,7 @@ nsXFormsItemCheckgroupAccessible::NativeState() { PRUint64 state = nsXFormsSelectableItemAccessible::NativeState(); - if (IsItemSelected()) + if (IsSelected()) state |= states::CHECKED; return state; @@ -514,7 +514,7 @@ nsXFormsItemCheckgroupAccessible::GetActionName(PRUint8 aIndex, nsAString& aName if (aIndex != eAction_Click) return NS_ERROR_INVALID_ARG; - if (IsItemSelected()) + if (IsSelected()) aName.AssignLiteral("uncheck"); else aName.AssignLiteral("check"); @@ -544,7 +544,7 @@ nsXFormsItemRadiogroupAccessible::NativeState() { PRUint64 state = nsXFormsSelectableItemAccessible::NativeState(); - if (IsItemSelected()) + if (IsSelected()) state |= states::CHECKED; return state; @@ -627,7 +627,7 @@ nsXFormsItemComboboxAccessible::NativeState() return state; state |= states::SELECTABLE; - if (IsItemSelected()) + if (IsSelected()) state |= states::SELECTED; return state; diff --git a/accessible/src/xul/nsXULListboxAccessible.cpp b/accessible/src/xul/nsXULListboxAccessible.cpp index 68ee2a060a0..2d5fc72a528 100644 --- a/accessible/src/xul/nsXULListboxAccessible.cpp +++ b/accessible/src/xul/nsXULListboxAccessible.cpp @@ -1025,7 +1025,7 @@ nsXULListCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex) *aColumnIndex = 0; - PRInt32 indexInRow = GetIndexInParent(); + PRInt32 indexInRow = IndexInParent(); for (PRInt32 idx = 0; idx < indexInRow; idx++) { nsAccessible* cell = row->GetChildAt(idx); PRUint32 role = cell->Role(); @@ -1058,7 +1058,7 @@ nsXULListCellAccessible::GetRowIndex(PRInt32 *aRowIndex) *aRowIndex = 0; - PRInt32 indexInTable = row->GetIndexInParent(); + PRInt32 indexInTable = row->IndexInParent(); for (PRInt32 idx = 0; idx < indexInTable; idx++) { row = table->GetChildAt(idx); if (row->Role() == nsIAccessibleRole::ROLE_ROW) diff --git a/accessible/src/xul/nsXULTextAccessible.cpp b/accessible/src/xul/nsXULTextAccessible.cpp index 68c7a6594c3..7b67aa00aa5 100644 --- a/accessible/src/xul/nsXULTextAccessible.cpp +++ b/accessible/src/xul/nsXULTextAccessible.cpp @@ -225,7 +225,7 @@ nsXULLinkAccessible::DoAction(PRUint8 aIndex) // nsXULLinkAccessible: HyperLinkAccessible bool -nsXULLinkAccessible::IsHyperLink() +nsXULLinkAccessible::IsLink() { // Expose HyperLinkAccessible unconditionally. return true; @@ -239,21 +239,21 @@ nsXULLinkAccessible::StartOffset() // a text. // XXX: accessible parent of XUL link accessible should be a hypertext // accessible. - if (nsAccessible::IsHyperLink()) + if (nsAccessible::IsLink()) return nsAccessible::StartOffset(); - return GetIndexInParent(); + return IndexInParent(); } PRUint32 nsXULLinkAccessible::EndOffset() { - if (nsAccessible::IsHyperLink()) + if (nsAccessible::IsLink()) return nsAccessible::EndOffset(); - return GetIndexInParent() + 1; + return IndexInParent() + 1; } already_AddRefed -nsXULLinkAccessible::GetAnchorURI(PRUint32 aAnchorIndex) +nsXULLinkAccessible::AnchorURIAt(PRUint32 aAnchorIndex) { if (aAnchorIndex != 0) return nsnull; diff --git a/accessible/src/xul/nsXULTextAccessible.h b/accessible/src/xul/nsXULTextAccessible.h index 34973fb7ad0..6683db8f75b 100644 --- a/accessible/src/xul/nsXULTextAccessible.h +++ b/accessible/src/xul/nsXULTextAccessible.h @@ -97,10 +97,10 @@ public: virtual PRUint64 NativeState(); // HyperLinkAccessible - virtual bool IsHyperLink(); + virtual bool IsLink(); virtual PRUint32 StartOffset(); virtual PRUint32 EndOffset(); - virtual already_AddRefed GetAnchorURI(PRUint32 aAnchorIndex); + virtual already_AddRefed AnchorURIAt(PRUint32 aAnchorIndex); protected: enum { eAction_Jump = 0 }; diff --git a/accessible/src/xul/nsXULTreeAccessible.cpp b/accessible/src/xul/nsXULTreeAccessible.cpp index 768f600361a..e6d2af7d619 100644 --- a/accessible/src/xul/nsXULTreeAccessible.cpp +++ b/accessible/src/xul/nsXULTreeAccessible.cpp @@ -228,8 +228,8 @@ nsXULTreeAccessible::GetFocusedChild(nsIAccessible **aFocusedChild) // nsXULTreeAccessible: nsAccessible implementation (DON'T put methods here) nsAccessible* -nsXULTreeAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild) +nsXULTreeAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild) { nsIFrame *frame = GetFrame(); if (!frame) @@ -255,7 +255,7 @@ nsXULTreeAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, // If we failed to find tree cell for the given point then it might be // tree columns. if (row == -1 || !column) - return nsAccessibleWrap::GetChildAtPoint(aX, aY, aWhichChild); + return nsAccessibleWrap::ChildAtPoint(aX, aY, aWhichChild); nsAccessible *child = GetTreeItemAccessible(row); if (aWhichChild == eDeepestChild && child) { @@ -986,7 +986,7 @@ nsXULTreeItemAccessibleBase::NativeState() } PRInt32 -nsXULTreeItemAccessibleBase::GetIndexInParent() const +nsXULTreeItemAccessibleBase::IndexInParent() const { return mParent ? mParent->ContentChildCount() + mRow : -1; } @@ -1030,7 +1030,7 @@ nsXULTreeItemAccessibleBase::GetSiblingAtOffset(PRInt32 aOffset, if (aError) *aError = NS_OK; // fail peacefully - return mParent->GetChildAt(GetIndexInParent() + aOffset); + return mParent->GetChildAt(IndexInParent() + aOffset); } //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/src/xul/nsXULTreeAccessible.h b/accessible/src/xul/nsXULTreeAccessible.h index 245fa670240..3081fe75092 100644 --- a/accessible/src/xul/nsXULTreeAccessible.h +++ b/accessible/src/xul/nsXULTreeAccessible.h @@ -66,7 +66,6 @@ class nsXULTreeAccessible : public nsAccessibleWrap public: using nsAccessible::GetChildCount; using nsAccessible::GetChildAt; - using nsAccessible::GetChildAtPoint; nsXULTreeAccessible(nsIContent *aContent, nsIWeakReference *aShell); @@ -86,8 +85,8 @@ public: // nsAccessible virtual PRUint32 NativeRole(); virtual PRUint64 NativeState(); - virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild); + virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild); virtual nsAccessible* GetChildAt(PRUint32 aIndex); virtual PRInt32 GetChildCount(); @@ -209,7 +208,7 @@ public: // nsAccessible virtual PRUint64 NativeState(); - virtual PRInt32 GetIndexInParent() const; + virtual PRInt32 IndexInParent() const; // nsXULTreeItemAccessibleBase NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEITEMBASEACCESSIBLE_IMPL_CID) diff --git a/accessible/src/xul/nsXULTreeGridAccessible.cpp b/accessible/src/xul/nsXULTreeGridAccessible.cpp index d8524ad5e97..8b6f1a47eb3 100644 --- a/accessible/src/xul/nsXULTreeGridAccessible.cpp +++ b/accessible/src/xul/nsXULTreeGridAccessible.cpp @@ -685,8 +685,8 @@ nsXULTreeGridRowAccessible::GetName(nsAString& aName) } nsAccessible* -nsXULTreeGridRowAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild) +nsXULTreeGridRowAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild) { nsIFrame *frame = GetFrame(); if (!frame) @@ -1230,7 +1230,7 @@ nsXULTreeGridCellAccessible::NativeState() } PRInt32 -nsXULTreeGridCellAccessible::GetIndexInParent() const +nsXULTreeGridCellAccessible::IndexInParent() const { return GetColumnIndex(); } diff --git a/accessible/src/xul/nsXULTreeGridAccessible.h b/accessible/src/xul/nsXULTreeGridAccessible.h index 36d791dd4e5..0bbf5a5741f 100644 --- a/accessible/src/xul/nsXULTreeGridAccessible.h +++ b/accessible/src/xul/nsXULTreeGridAccessible.h @@ -77,7 +77,6 @@ class nsXULTreeGridRowAccessible : public nsXULTreeItemAccessibleBase public: using nsAccessible::GetChildCount; using nsAccessible::GetChildAt; - using nsAccessible::GetChildAtPoint; nsXULTreeGridRowAccessible(nsIContent *aContent, nsIWeakReference *aShell, nsAccessible *aParent, nsITreeBoxObject *aTree, @@ -94,8 +93,8 @@ public: // nsAccessible virtual PRUint32 NativeRole(); NS_IMETHOD GetName(nsAString& aName); - virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild); + virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild); virtual nsAccessible* GetChildAt(PRUint32 aIndex); virtual PRInt32 GetChildCount(); @@ -166,7 +165,7 @@ public: virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes); virtual PRUint32 NativeRole(); virtual PRUint64 NativeState(); - virtual PRInt32 GetIndexInParent() const; + virtual PRInt32 IndexInParent() const; // nsXULTreeGridCellAccessible NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID) diff --git a/accessible/tests/mochitest/name/markup.js b/accessible/tests/mochitest/name/markup.js index 7323475fdbd..d9a6604d18c 100644 --- a/accessible/tests/mochitest/name/markup.js +++ b/accessible/tests/mochitest/name/markup.js @@ -7,7 +7,6 @@ var gRuleDoc = null; // Debuggin stuff. var gDumpToConsole = false; -gA11yEventDumpToConsole = gDumpToConsole; /** * Start name tests. Run through markup elements and test names for test @@ -149,7 +148,7 @@ function testNameForRule(aElm, aRuleElm) testNameForAttrRule(aElm, aRuleElm); - } else if (aRuleElm.hasAttribute("elm") && aRuleElm.hasAttribute("elmattr")) { + } else if (aRuleElm.hasAttribute("elm")) { if (gDumpToConsole) { dump("\nProcessing rule { elm: " + aRuleElm.getAttribute("elm") + ", elmattr: " + aRuleElm.getAttribute("elmattr") +" }\n"); @@ -178,7 +177,7 @@ function testNameForAttrRule(aElm, aRule) if (type == "string") { name = attrValue; - } else if (type == "ref") { + } else if (type == "ref" && attrValue) { var ids = attrValue.split(/\s+/); for (var idx = 0; idx < ids.length; idx++) { var labelElm = getNode(ids[idx]); @@ -197,37 +196,53 @@ function testNameForAttrRule(aElm, aRule) } function testNameForElmRule(aElm, aRule) -{ - var elm = aRule.getAttribute("elm"); - var elmattr = aRule.getAttribute("elmattr"); +{ + var labelElm; - var filter = { - acceptNode: function filter_acceptNode(aNode) - { - if (aNode.localName == this.mLocalName && - aNode.getAttribute(this.mAttrName) == this.mAttrValue) - return NodeFilter.FILTER_ACCEPT; + var tagname = aRule.getAttribute("elm"); + var attrname = aRule.getAttribute("elmattr"); + if (attrname) { + var filter = { + acceptNode: function filter_acceptNode(aNode) + { + if (aNode.localName == this.mLocalName && + aNode.getAttribute(this.mAttrName) == this.mAttrValue) + return NodeFilter.FILTER_ACCEPT; - return NodeFilter.FILTER_SKIP; - }, + return NodeFilter.FILTER_SKIP; + }, - mLocalName: elm, - mAttrName: elmattr, - mAttrValue: aElm.getAttribute("id") - }; + mLocalName: tagname, + mAttrName: attrname, + mAttrValue: aElm.getAttribute("id") + }; - var treeWalker = document.createTreeWalker(document.body, - NodeFilter.SHOW_ELEMENT, - filter, false); - var labelElm = treeWalker.nextNode(); - var msg = "Element '" + elm + "' test."; + var treeWalker = document.createTreeWalker(document.body, + NodeFilter.SHOW_ELEMENT, + filter, false); + labelElm = treeWalker.nextNode(); + + } else { + // if attrname is empty then look for the element in subtree. + labelElm = aElm.getElementsByTagName(tagname)[0]; + if (!labelElm) + labelElm = aElm.getElementsByTagName("html:" + tagname)[0]; + } + + if (!labelElm) { + ok(false, msg + " Failed to find '" + tagname + "' element."); + gTestIterator.iterateNext(); + return; + } + + var msg = "Element '" + tagname + "' test."; testName(aElm, labelElm.getAttribute("a11yname"), msg); var parentNode = labelElm.parentNode; if (gDumpToConsole) { dump("\nProcessed elm rule. Wait for reorder event on " + - prettyName(parentNode) + "'\n"); + prettyName(parentNode) + "\n"); } waitForEvent(EVENT_REORDER, parentNode, gTestIterator.iterateNext, gTestIterator); diff --git a/accessible/tests/mochitest/name/markuprules.xml b/accessible/tests/mochitest/name/markuprules.xml index bf1ff0c35a0..4eb63b7bb76 100644 --- a/accessible/tests/mochitest/name/markuprules.xml +++ b/accessible/tests/mochitest/name/markuprules.xml @@ -1,31 +1,50 @@ + + caption_tst6 + cell1 + cell2 + + + diff --git a/accessible/tests/mochitest/name/test_markup.html b/accessible/tests/mochitest/name/test_markup.html index cdfbbd0287c..e18e1636e27 100644 --- a/accessible/tests/mochitest/name/test_markup.html +++ b/accessible/tests/mochitest/name/test_markup.html @@ -21,6 +21,8 @@ + + + + diff --git a/content/canvas/crashtests/crashtests.list b/content/canvas/crashtests/crashtests.list index ecf92e275ab..2fafcf1fa73 100644 --- a/content/canvas/crashtests/crashtests.list +++ b/content/canvas/crashtests/crashtests.list @@ -2,3 +2,4 @@ load 360293-1.html load 421715-1.html load 553938-1.html load 647480.html +load 0px-size-font-667225.html diff --git a/content/canvas/public/nsICanvasRenderingContextInternal.h b/content/canvas/public/nsICanvasRenderingContextInternal.h index b8831bc68ff..dd9823ded8a 100644 --- a/content/canvas/public/nsICanvasRenderingContextInternal.h +++ b/content/canvas/public/nsICanvasRenderingContextInternal.h @@ -42,6 +42,7 @@ #include "nsIInputStream.h" #include "nsIDocShell.h" #include "gfxPattern.h" +#include "mozilla/RefPtr.h" #define NS_ICANVASRENDERINGCONTEXTINTERNAL_IID \ { 0xffb42d3c, 0x8281, 0x44c8, \ @@ -61,6 +62,9 @@ class LayerManager; namespace ipc { class Shmem; } +namespace gfx { +class SourceSurface; +} } class nsICanvasRenderingContextInternal : public nsISupports { @@ -96,6 +100,11 @@ public: // If this canvas context can be represented with a simple Thebes surface, // return the surface. Otherwise returns an error. NS_IMETHOD GetThebesSurface(gfxASurface **surface) = 0; + + // This gets an Azure SourceSurface for the canvas, this will be a snapshot + // of the canvas at the time it was called. This will return null for a + // non-azure canvas. + virtual mozilla::TemporaryRef GetSurfaceSnapshot() = 0; // If this context is opaque, the backing store of the canvas should // be created as opaque; all compositing operators should assume the diff --git a/content/canvas/src/CustomQS_Canvas2D.h b/content/canvas/src/CustomQS_Canvas2D.h index 5f761641ad5..62300524e5b 100644 --- a/content/canvas/src/CustomQS_Canvas2D.h +++ b/content/canvas/src/CustomQS_Canvas2D.h @@ -287,8 +287,8 @@ nsIDOMCanvasRenderingContext2D_CreateImageData(JSContext *cx, uintN argc, jsval int32 wi = JS_DoubleToInt32(width); int32 hi = JS_DoubleToInt32(height); - uint32 w = PR_ABS(wi); - uint32 h = PR_ABS(hi); + uint32 w = NS_ABS(wi); + uint32 h = NS_ABS(hi); return CreateImageData(cx, w, h, NULL, 0, 0, vp); } diff --git a/content/canvas/src/CustomQS_WebGL.h b/content/canvas/src/CustomQS_WebGL.h index 8ca9bd29ca4..e0398734fb8 100644 --- a/content/canvas/src/CustomQS_WebGL.h +++ b/content/canvas/src/CustomQS_WebGL.h @@ -329,6 +329,13 @@ nsIDOMWebGLRenderingContext_TexImage2D(JSContext *cx, uintN argc, jsval *vp) rv = self->TexImage2D_dom(argv0, argv1, argv2, argv3, argv4, elt); + // NS_ERROR_DOM_SECURITY_ERR indicates we tried to load a cross-domain element, so + // bail out immediately, don't try to interprete as ImageData + if (rv == NS_ERROR_DOM_SECURITY_ERR) { + xpc_qsThrowBadArg(cx, rv, vp, 5); + return JS_FALSE; + } + if (NS_FAILED(rv)) { // failed to interprete argv[5] as a DOMElement, now try to interprete it as ImageData JSObject *argv5 = JSVAL_TO_OBJECT(argv[5]); @@ -447,6 +454,13 @@ nsIDOMWebGLRenderingContext_TexSubImage2D(JSContext *cx, uintN argc, jsval *vp) if (NS_FAILED(rv)) return JS_FALSE; rv = self->TexSubImage2D_dom(argv0, argv1, argv2, argv3, argv4, argv5, elt); + + // NS_ERROR_DOM_SECURITY_ERR indicates we tried to load a cross-domain element, so + // bail out immediately, don't try to interprete as ImageData + if (rv == NS_ERROR_DOM_SECURITY_ERR) { + xpc_qsThrowBadArg(cx, rv, vp, 6); + return JS_FALSE; + } if (NS_FAILED(rv)) { // failed to interprete argv[6] as a DOMElement, now try to interprete it as ImageData diff --git a/content/canvas/src/Makefile.in b/content/canvas/src/Makefile.in index f98c7f4699d..c2738b68912 100644 --- a/content/canvas/src/Makefile.in +++ b/content/canvas/src/Makefile.in @@ -55,6 +55,7 @@ CPPSRCS = \ CanvasImageCache.cpp \ CanvasUtils.cpp \ nsCanvasRenderingContext2D.cpp \ + nsCanvasRenderingContext2DAzure.cpp \ DocumentRendererParent.cpp \ DocumentRendererChild.cpp \ $(NULL) diff --git a/content/canvas/src/WebGLContext.cpp b/content/canvas/src/WebGLContext.cpp index bd2e1f14abb..4a522c0c58b 100644 --- a/content/canvas/src/WebGLContext.cpp +++ b/content/canvas/src/WebGLContext.cpp @@ -148,6 +148,22 @@ WebGLContext::WebGLContext() mScissorTestEnabled = 0; mDitherEnabled = 1; mBackbufferClearingStatus = BackbufferClearingStatus::NotClearedSinceLastPresented; + + // initialize some GL values: we're going to get them from the GL and use them as the sizes of arrays, + // so in case glGetIntegerv leaves them uninitialized because of a GL bug, we would have very weird crashes. + mGLMaxVertexAttribs = 0; + mGLMaxTextureUnits = 0; + mGLMaxTextureSize = 0; + mGLMaxCubeMapTextureSize = 0; + mGLMaxTextureImageUnits = 0; + mGLMaxVertexTextureImageUnits = 0; + mGLMaxVaryingVectors = 0; + mGLMaxFragmentUniformVectors = 0; + mGLMaxVertexUniformVectors = 0; + + // See OpenGL ES 2.0.25 spec, 6.2 State Tables, table 6.13 + mPixelStorePackAlignment = 4; + mPixelStoreUnpackAlignment = 4; } WebGLContext::~WebGLContext() diff --git a/content/canvas/src/WebGLContext.h b/content/canvas/src/WebGLContext.h index 84db7299fcc..949bd8bb959 100644 --- a/content/canvas/src/WebGLContext.h +++ b/content/canvas/src/WebGLContext.h @@ -342,6 +342,9 @@ public: const PRUnichar* aEncoderOptions, nsIInputStream **aStream); NS_IMETHOD GetThebesSurface(gfxASurface **surface); + mozilla::TemporaryRef GetSurfaceSnapshot() + { return nsnull; } + NS_IMETHOD SetIsOpaque(PRBool b) { return NS_OK; }; NS_IMETHOD SetContextOptions(nsIPropertyBag *aOptions); diff --git a/content/canvas/src/WebGLContextGL.cpp b/content/canvas/src/WebGLContextGL.cpp index 693d4a52026..e75b9d4784a 100644 --- a/content/canvas/src/WebGLContextGL.cpp +++ b/content/canvas/src/WebGLContextGL.cpp @@ -480,7 +480,7 @@ WebGLContext::BufferData_array(WebGLenum target, js::TypedArray *wa, WebGLenum u } NS_IMETHODIMP -WebGLContext::BufferSubData(PRInt32 dummy) +WebGLContext::BufferSubData(PRInt32) { return NS_ERROR_FAILURE; } @@ -1628,10 +1628,10 @@ WebGLContext::GetActiveAttrib(nsIWebGLProgram *pobj, PRUint32 index, nsIWebGLAct return NS_OK; nsAutoArrayPtr name(new char[len]); - PRInt32 attrsize = 0; - PRUint32 attrtype = 0; + GLint attrsize = 0; + GLuint attrtype = 0; - gl->fGetActiveAttrib(progname, index, len, &len, (GLint*) &attrsize, (WebGLuint*) &attrtype, name); + gl->fGetActiveAttrib(progname, index, len, &len, &attrsize, &attrtype, name); if (attrsize == 0 || attrtype == 0) { *retval = nsnull; return NS_OK; @@ -1687,10 +1687,10 @@ WebGLContext::GetActiveUniform(nsIWebGLProgram *pobj, PRUint32 index, nsIWebGLAc nsAutoArrayPtr name(new char[len + 3]); // +3 because we might have to append "[0]", see below - PRInt32 attrsize = 0; - PRUint32 attrtype = 0; + GLint attrsize = 0; + GLuint attrtype = 0; - gl->fGetActiveUniform(progname, index, len, &len, (GLint*) &attrsize, (WebGLenum*) &attrtype, name); + gl->fGetActiveUniform(progname, index, len, &len, &attrsize, &attrtype, name); if (len == 0 || attrsize == 0 || attrtype == 0) { *retval = nsnull; return NS_OK; @@ -2310,8 +2310,8 @@ WebGLContext::GetProgramInfoLog(nsIWebGLProgram *pobj, nsAString& retval) MakeContextCurrent(); - PRInt32 k = -1; - gl->fGetProgramiv(progname, LOCAL_GL_INFO_LOG_LENGTH, (GLint*) &k); + GLint k = -1; + gl->fGetProgramiv(progname, LOCAL_GL_INFO_LOG_LENGTH, &k); if (k == -1) return NS_ERROR_FAILURE; // XXX GL error? shouldn't happen! @@ -2323,7 +2323,7 @@ WebGLContext::GetProgramInfoLog(nsIWebGLProgram *pobj, nsAString& retval) nsCAutoString log; log.SetCapacity(k); - gl->fGetProgramInfoLog(progname, k, (GLint*) &k, (char*) log.BeginWriting()); + gl->fGetProgramInfoLog(progname, k, &k, (char*) log.BeginWriting()); log.SetLength(k); @@ -2634,8 +2634,8 @@ WebGLContext::GetVertexAttrib(WebGLuint index, WebGLenum pname, nsIVariant **ret case LOCAL_GL_VERTEX_ATTRIB_ARRAY_STRIDE: case LOCAL_GL_VERTEX_ATTRIB_ARRAY_TYPE: { - PRInt32 i = 0; - gl->fGetVertexAttribiv(index, pname, (GLint*) &i); + GLint i = 0; + gl->fGetVertexAttribiv(index, pname, &i); wrval->SetAsInt32(i); } break; @@ -2659,8 +2659,8 @@ WebGLContext::GetVertexAttrib(WebGLuint index, WebGLenum pname, nsIVariant **ret case LOCAL_GL_VERTEX_ATTRIB_ARRAY_ENABLED: case LOCAL_GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: { - PRInt32 i = 0; - gl->fGetVertexAttribiv(index, pname, (GLint*) &i); + GLint i = 0; + gl->fGetVertexAttribiv(index, pname, &i); wrval->SetAsBool(PRBool(i)); } break; @@ -2695,7 +2695,7 @@ WebGLContext::GetVertexAttribOffset(WebGLuint index, WebGLenum pname, WebGLuint } NS_IMETHODIMP -WebGLContext::Hint(WebGLenum target, WebGLenum mode) +WebGLContext::Hint(WebGLenum, WebGLenum) { return ErrorInvalidEnum("hint: invalid hint"); } @@ -2884,7 +2884,7 @@ WebGLContext::PixelStorei(WebGLenum pname, WebGLint param) GL_SAME_METHOD_2(PolygonOffset, PolygonOffset, WebGLfloat, WebGLfloat) NS_IMETHODIMP -WebGLContext::ReadPixels(PRInt32 dummy) +WebGLContext::ReadPixels(PRInt32) { return NS_ERROR_FAILURE; } @@ -3570,7 +3570,7 @@ WebGLContext::DOMElementToImageSurface(nsIDOMElement *imageOrCanvas, #define SIMPLE_ARRAY_METHOD_UNIFORM(name, cnt, arrayType, ptrType) \ NS_IMETHODIMP \ -WebGLContext::name(PRInt32 dummy) { \ +WebGLContext::name(PRInt32) { \ return NS_ERROR_NOT_IMPLEMENTED; \ } \ NS_IMETHODIMP \ @@ -3588,7 +3588,7 @@ WebGLContext::name##_array(nsIWebGLUniformLocation *ploc, js::TypedArray *wa) \ #define SIMPLE_MATRIX_METHOD_UNIFORM(name, dim, arrayType, ptrType) \ NS_IMETHODIMP \ -WebGLContext::name(PRInt32 dummy) { \ +WebGLContext::name(PRInt32) { \ return NS_ERROR_NOT_IMPLEMENTED; \ } \ NS_IMETHODIMP \ @@ -3733,7 +3733,7 @@ WebGLContext::VertexAttrib4f(PRUint32 index, WebGLfloat x0, WebGLfloat x1, #define SIMPLE_ARRAY_METHOD_NO_COUNT(name, cnt, arrayType, ptrType) \ NS_IMETHODIMP \ -WebGLContext::name(PRInt32 dummy) { \ +WebGLContext::name(PRInt32) { \ return NS_ERROR_NOT_IMPLEMENTED; \ } \ NS_IMETHODIMP \ @@ -4002,8 +4002,8 @@ WebGLContext::GetShaderInfoLog(nsIWebGLShader *sobj, nsAString& retval) MakeContextCurrent(); - PRInt32 k = -1; - gl->fGetShaderiv(shadername, LOCAL_GL_INFO_LOG_LENGTH, (GLint*) &k); + GLint k = -1; + gl->fGetShaderiv(shadername, LOCAL_GL_INFO_LOG_LENGTH, &k); if (k == -1) return NS_ERROR_FAILURE; // XXX GL Error? should never happen. @@ -4015,7 +4015,7 @@ WebGLContext::GetShaderInfoLog(nsIWebGLShader *sobj, nsAString& retval) nsCAutoString log; log.SetCapacity(k); - gl->fGetShaderInfoLog(shadername, k, (GLint*) &k, (char*) log.BeginWriting()); + gl->fGetShaderInfoLog(shadername, k, &k, (char*) log.BeginWriting()); log.SetLength(k); @@ -4131,7 +4131,7 @@ WebGLContext::VertexAttribPointer(WebGLuint index, WebGLint size, WebGLenum type } NS_IMETHODIMP -WebGLContext::TexImage2D(PRInt32 dummy) +WebGLContext::TexImage2D(PRInt32) { return NS_ERROR_FAILURE; } @@ -4340,7 +4340,7 @@ WebGLContext::TexImage2D_dom(WebGLenum target, WebGLint level, WebGLenum interna } NS_IMETHODIMP -WebGLContext::TexSubImage2D(PRInt32 dummy) +WebGLContext::TexSubImage2D(PRInt32) { return NS_ERROR_FAILURE; } diff --git a/content/canvas/src/WebGLContextValidate.cpp b/content/canvas/src/WebGLContextValidate.cpp index fa9334da890..93c8d7ee548 100644 --- a/content/canvas/src/WebGLContextValidate.cpp +++ b/content/canvas/src/WebGLContextValidate.cpp @@ -93,12 +93,12 @@ PRBool WebGLContext::ValidateBuffers(PRInt32 *maxAllowedCount, const char *info) { #ifdef DEBUG - GLuint currentProgram = 0; + GLint currentProgram = 0; MakeContextCurrent(); - gl->fGetIntegerv(LOCAL_GL_CURRENT_PROGRAM, (GLint*) ¤tProgram); - NS_ASSERTION(currentProgram == mCurrentProgram->GLName(), + gl->fGetIntegerv(LOCAL_GL_CURRENT_PROGRAM, ¤tProgram); + NS_ASSERTION(GLuint(currentProgram) == mCurrentProgram->GLName(), "WebGL: current program doesn't agree with GL state"); - if (currentProgram != mCurrentProgram->GLName()) + if (GLuint(currentProgram) != mCurrentProgram->GLName()) return PR_FALSE; #endif @@ -471,9 +471,6 @@ WebGLContext::InitAndValidateGL() mMapFramebuffers.Clear(); mMapRenderbuffers.Clear(); - // make sure that the opengl stuff that we need is supported - GLint val = 0; - MakeContextCurrent(); // on desktop OpenGL, we always keep vertex attrib 0 array enabled @@ -481,7 +478,7 @@ WebGLContext::InitAndValidateGL() gl->fEnableVertexAttribArray(0); } - gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_ATTRIBS, (GLint*) &mGLMaxVertexAttribs); + gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_ATTRIBS, &mGLMaxVertexAttribs); if (mGLMaxVertexAttribs < 8) { LogMessage("GL_MAX_VERTEX_ATTRIBS: %d is < 8!", mGLMaxVertexAttribs); return PR_FALSE; @@ -492,7 +489,7 @@ WebGLContext::InitAndValidateGL() // Note: GL_MAX_TEXTURE_UNITS is fixed at 4 for most desktop hardware, // even though the hardware supports much more. The // GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS value is the accurate value. - gl->fGetIntegerv(LOCAL_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, (GLint*) &mGLMaxTextureUnits); + gl->fGetIntegerv(LOCAL_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &mGLMaxTextureUnits); if (mGLMaxTextureUnits < 8) { LogMessage("GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: %d is < 8!", mGLMaxTextureUnits); return PR_FALSE; @@ -501,20 +498,20 @@ WebGLContext::InitAndValidateGL() mBound2DTextures.SetLength(mGLMaxTextureUnits); mBoundCubeMapTextures.SetLength(mGLMaxTextureUnits); - gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, (GLint*) &mGLMaxTextureSize); - gl->fGetIntegerv(LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE, (GLint*) &mGLMaxCubeMapTextureSize); + gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &mGLMaxTextureSize); + gl->fGetIntegerv(LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE, &mGLMaxCubeMapTextureSize); - gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS, (GLint*) &mGLMaxTextureImageUnits); - gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, (GLint*) &mGLMaxVertexTextureImageUnits); + gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS, &mGLMaxTextureImageUnits); + gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &mGLMaxVertexTextureImageUnits); if (gl->HasES2Compatibility()) { - gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS, (GLint*) &mGLMaxFragmentUniformVectors); - gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS, (GLint*) &mGLMaxVertexUniformVectors); - gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_VECTORS, (GLint*) &mGLMaxVaryingVectors); + gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS, &mGLMaxFragmentUniformVectors); + gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS, &mGLMaxVertexUniformVectors); + gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_VECTORS, &mGLMaxVaryingVectors); } else { - gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, (GLint*) &mGLMaxFragmentUniformVectors); + gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &mGLMaxFragmentUniformVectors); mGLMaxFragmentUniformVectors /= 4; - gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS, (GLint*) &mGLMaxVertexUniformVectors); + gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS, &mGLMaxVertexUniformVectors); mGLMaxVertexUniformVectors /= 4; // we are now going to try to read GL_MAX_VERTEX_OUTPUT_COMPONENTS and GL_MAX_FRAGMENT_INPUT_COMPONENTS, @@ -549,23 +546,8 @@ WebGLContext::InitAndValidateGL() } } -#if 0 - // Leaving this code in here, even though it's ifdef'd out, for - // when we support more than 1 color attachment. - gl->fGetIntegerv(LOCAL_GL_MAX_COLOR_ATTACHMENTS, (GLint*) &val); -#else // Always 1 for GLES2 - val = 1; -#endif - mMaxFramebufferColorAttachments = val; - -#if defined(DEBUG_vladimir) && defined(USE_GLES2) - gl->fGetIntegerv(LOCAL_GL_IMPLEMENTATION_COLOR_READ_FORMAT, (GLint*) &val); - fprintf(stderr, "GL_IMPLEMENTATION_COLOR_READ_FORMAT: 0x%04x\n", val); - - gl->fGetIntegerv(LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE, (GLint*) &val); - fprintf(stderr, "GL_IMPLEMENTATION_COLOR_READ_TYPE: 0x%04x\n", val); -#endif + mMaxFramebufferColorAttachments = 1; if (!gl->IsGLES2()) { // gl_PointSize is always available in ES2 GLSL, but has to be @@ -589,9 +571,6 @@ WebGLContext::InitAndValidateGL() } } - gl->fGetIntegerv(LOCAL_GL_PACK_ALIGNMENT, (GLint*) &mPixelStorePackAlignment); - gl->fGetIntegerv(LOCAL_GL_UNPACK_ALIGNMENT, (GLint*) &mPixelStoreUnpackAlignment); - // Check the shader validator pref nsCOMPtr prefService = do_GetService(NS_PREFSERVICE_CONTRACTID); NS_ENSURE_TRUE(prefService != nsnull, NS_ERROR_FAILURE); diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 97abaa73c44..b57aea6d378 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -373,6 +373,9 @@ public: const PRUnichar* aEncoderOptions, nsIInputStream **aStream); NS_IMETHOD GetThebesSurface(gfxASurface **surface); + mozilla::TemporaryRef GetSurfaceSnapshot() + { return nsnull; } + NS_IMETHOD SetIsOpaque(PRBool isOpaque); NS_IMETHOD Reset(); already_AddRefed GetCanvasLayer(nsDisplayListBuilder* aBuilder, @@ -813,7 +816,7 @@ PRUint8 (*nsCanvasRenderingContext2D::sUnpremultiplyTable)[256] = nsnull; PRUint8 (*nsCanvasRenderingContext2D::sPremultiplyTable)[256] = nsnull; nsresult -NS_NewCanvasRenderingContext2D(nsIDOMCanvasRenderingContext2D** aResult) +NS_NewCanvasRenderingContext2DThebes(nsIDOMCanvasRenderingContext2D** aResult) { nsRefPtr ctx = new nsCanvasRenderingContext2D(); if (!ctx) diff --git a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp new file mode 100644 index 00000000000..722e3b5da73 --- /dev/null +++ b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp @@ -0,0 +1,4357 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 "base/basictypes.h" + +#include "nsIDOMXULElement.h" + +#include "prmem.h" +#include "prenv.h" + +#include "nsIServiceManager.h" +#include "nsMathUtils.h" + +#include "nsContentUtils.h" + +#include "nsIDOMDocument.h" +#include "nsIDocument.h" +#include "nsIDOMCanvasRenderingContext2D.h" +#include "nsICanvasRenderingContextInternal.h" +#include "nsHTMLCanvasElement.h" +#include "nsSVGEffects.h" +#include "nsPresContext.h" +#include "nsIPresShell.h" +#include "nsIVariant.h" + +#include "nsIInterfaceRequestorUtils.h" +#include "nsIFrame.h" +#include "nsDOMError.h" +#include "nsIScriptError.h" + +#include "nsCSSParser.h" +#include "mozilla/css/StyleRule.h" +#include "mozilla/css/Declaration.h" +#include "nsComputedDOMStyle.h" +#include "nsStyleSet.h" + +#include "nsPrintfCString.h" + +#include "nsReadableUtils.h" + +#include "nsColor.h" +#include "nsGfxCIID.h" +#include "nsIScriptSecurityManager.h" +#include "nsIDocShell.h" +#include "nsIDOMWindow.h" +#include "nsPIDOMWindow.h" +#include "nsIDocShell.h" +#include "nsIDocShellTreeItem.h" +#include "nsIDocShellTreeNode.h" +#include "nsIXPConnect.h" +#include "jsapi.h" +#include "nsDisplayList.h" + +#include "nsTArray.h" + +#include "imgIEncoder.h" + +#include "gfxContext.h" +#include "gfxASurface.h" +#include "gfxImageSurface.h" +#include "gfxPlatform.h" +#include "gfxFont.h" +#include "gfxTextRunCache.h" +#include "gfxBlur.h" +#include "gfxUtils.h" + +#include "nsFrameManager.h" +#include "nsFrameLoader.h" +#include "nsBidiPresUtils.h" +#include "Layers.h" +#include "CanvasUtils.h" +#include "nsIMemoryReporter.h" +#include "nsStyleUtil.h" +#include "CanvasImageCache.h" + +#include +#include "mozilla/dom/ContentParent.h" +#include "mozilla/ipc/PDocumentRendererParent.h" +#include "mozilla/dom/PBrowserParent.h" +#include "mozilla/ipc/DocumentRendererParent.h" + +#include "mozilla/gfx/2D.h" + +#ifdef XP_WIN +#include "gfxWindowsPlatform.h" +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +// windows.h (included by chromium code) defines this, in its infinite wisdom +#undef DrawText + +using namespace mozilla; +using namespace mozilla::layers; +using namespace mozilla::dom; +using namespace mozilla::gfx; +using namespace mozilla::ipc; +using namespace mozilla::css; + +namespace mgfx = mozilla::gfx; + +static float kDefaultFontSize = 10.0; +static NS_NAMED_LITERAL_STRING(kDefaultFontName, "sans-serif"); +static NS_NAMED_LITERAL_STRING(kDefaultFontStyle, "10px sans-serif"); + +/* Float validation stuff */ +#define VALIDATE(_f) if (!NS_finite(_f)) return PR_FALSE + +static PRBool FloatValidate (double f1) { + VALIDATE(f1); + return PR_TRUE; +} + +static PRBool FloatValidate (double f1, double f2) { + VALIDATE(f1); VALIDATE(f2); + return PR_TRUE; +} + +static PRBool FloatValidate (double f1, double f2, double f3) { + VALIDATE(f1); VALIDATE(f2); VALIDATE(f3); + return PR_TRUE; +} + +static PRBool FloatValidate (double f1, double f2, double f3, double f4) { + VALIDATE(f1); VALIDATE(f2); VALIDATE(f3); VALIDATE(f4); + return PR_TRUE; +} + +static PRBool FloatValidate (double f1, double f2, double f3, double f4, double f5) { + VALIDATE(f1); VALIDATE(f2); VALIDATE(f3); VALIDATE(f4); VALIDATE(f5); + return PR_TRUE; +} + +static PRBool FloatValidate (double f1, double f2, double f3, double f4, double f5, double f6) { + VALIDATE(f1); VALIDATE(f2); VALIDATE(f3); VALIDATE(f4); VALIDATE(f5); VALIDATE(f6); + return PR_TRUE; +} + +#undef VALIDATE + +/* Memory reporter stuff */ +static nsIMemoryReporter *gCanvasAzureMemoryReporter = nsnull; +static PRInt64 gCanvasAzureMemoryUsed = 0; + +static PRInt64 GetCanvasAzureMemoryUsed(void *) { + return gCanvasAzureMemoryUsed; +} + +// This is MR_OTHER because it's not always clear where in memory the pixels of +// a canvas are stored. Furthermore, this memory will be tracked by the +// underlying surface implementations. See bug 655638 for details. +NS_MEMORY_REPORTER_IMPLEMENT(CanvasAzureMemory, + "canvas-2d-pixel-bytes", + MR_OTHER, + "Memory used by 2D canvases. Each canvas requires (width * height * 4) " + "bytes.", + GetCanvasAzureMemoryUsed, + nsnull) + +/** + ** nsCanvasGradientAzure + **/ +#define NS_CANVASGRADIENTAZURE_PRIVATE_IID \ + {0x28425a6a, 0x90e0, 0x4d42, {0x9c, 0x75, 0xff, 0x60, 0x09, 0xb3, 0x10, 0xa8}} +class nsCanvasGradientAzure : public nsIDOMCanvasGradient +{ +public: + NS_DECLARE_STATIC_IID_ACCESSOR(NS_CANVASGRADIENTAZURE_PRIVATE_IID) + + enum Type + { + LINEAR = 0, + RADIAL + }; + + Type GetType() + { + return mType; + } + + + GradientStops *GetGradientStopsForTarget(DrawTarget *aRT) + { + if (mStops && mStops->GetBackendType() == aRT->GetType()) { + return mStops; + } + + mStops = aRT->CreateGradientStops(mRawStops.Elements(), mRawStops.Length()); + + return mStops; + } + + NS_DECL_ISUPPORTS + +protected: + nsCanvasGradientAzure(Type aType) : mType(aType) + {} + + nsTArray mRawStops; + RefPtr mStops; + Type mType; +}; + +class nsCanvasRadialGradientAzure : public nsCanvasGradientAzure +{ +public: + nsCanvasRadialGradientAzure(const Point &aBeginOrigin, Float aBeginRadius, + const Point &aEndOrigin, Float aEndRadius) + : nsCanvasGradientAzure(RADIAL) + , mCenter(aEndOrigin) + , mRadius(aEndRadius) + { + mOffsetStart = aBeginRadius / mRadius; + + mOffsetRatio = 1 - mOffsetStart; + mOrigin = ((mCenter * aBeginRadius) - (aBeginOrigin * mRadius)) / + (aBeginRadius - mRadius); + } + + + /* nsIDOMCanvasGradient */ + NS_IMETHOD AddColorStop (float offset, + const nsAString& colorstr) + { + if (!FloatValidate(offset) || offset < 0.0 || offset > 1.0) { + return NS_ERROR_DOM_INDEX_SIZE_ERR; + } + + nscolor color; + nsCSSParser parser; + nsresult rv = parser.ParseColorString(nsString(colorstr), + nsnull, 0, &color); + if (NS_FAILED(rv)) { + return NS_ERROR_DOM_SYNTAX_ERR; + } + + mStops = nsnull; + + GradientStop newStop; + + newStop.offset = offset * mOffsetRatio + mOffsetStart; + newStop.color = Color::FromABGR(color); + + mRawStops.AppendElement(newStop); + + return NS_OK; + } + + // XXX - Temporary gradient code, this will be fixed soon as per bug 666097 + Point mCenter; + Float mRadius; + Point mOrigin; + + Float mOffsetStart; + Float mOffsetRatio; +}; + +class nsCanvasLinearGradientAzure : public nsCanvasGradientAzure +{ +public: + nsCanvasLinearGradientAzure(const Point &aBegin, const Point &aEnd) + : nsCanvasGradientAzure(LINEAR) + , mBegin(aBegin) + , mEnd(aEnd) + { + } + + /* nsIDOMCanvasGradient */ + NS_IMETHOD AddColorStop (float offset, + const nsAString& colorstr) + { + if (!FloatValidate(offset) || offset < 0.0 || offset > 1.0) { + return NS_ERROR_DOM_INDEX_SIZE_ERR; + } + + nscolor color; + nsCSSParser parser; + nsresult rv = parser.ParseColorString(nsString(colorstr), + nsnull, 0, &color); + if (NS_FAILED(rv)) { + return NS_ERROR_DOM_SYNTAX_ERR; + } + + mStops = nsnull; + + GradientStop newStop; + + newStop.offset = offset; + newStop.color = Color::FromABGR(color); + + mRawStops.AppendElement(newStop); + + return NS_OK; + } + +protected: + friend class nsCanvasRenderingContext2DAzure; + + // Beginning of linear gradient. + Point mBegin; + // End of linear gradient. + Point mEnd; +}; + +NS_DEFINE_STATIC_IID_ACCESSOR(nsCanvasGradientAzure, NS_CANVASGRADIENTAZURE_PRIVATE_IID) + +NS_IMPL_ADDREF(nsCanvasGradientAzure) +NS_IMPL_RELEASE(nsCanvasGradientAzure) + +// XXX +// DOMCI_DATA(CanvasGradient, nsCanvasGradientAzure) + +NS_INTERFACE_MAP_BEGIN(nsCanvasGradientAzure) + NS_INTERFACE_MAP_ENTRY(nsCanvasGradientAzure) + NS_INTERFACE_MAP_ENTRY(nsIDOMCanvasGradient) + NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasGradient) + NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +/** + ** nsCanvasPatternAzure + **/ +#define NS_CANVASPATTERNAZURE_PRIVATE_IID \ + {0xc9bacc25, 0x28da, 0x421e, {0x9a, 0x4b, 0xbb, 0xd6, 0x93, 0x05, 0x12, 0xbc}} +class nsCanvasPatternAzure : public nsIDOMCanvasPattern +{ +public: + NS_DECLARE_STATIC_IID_ACCESSOR(NS_CANVASPATTERNAZURE_PRIVATE_IID) + + enum RepeatMode + { + REPEAT, + REPEATX, + REPEATY, + NOREPEAT + }; + + nsCanvasPatternAzure(SourceSurface* aSurface, + RepeatMode aRepeat, + nsIPrincipal* principalForSecurityCheck, + PRBool forceWriteOnly) + : mSurface(aSurface) + , mRepeat(aRepeat) + , mPrincipal(principalForSecurityCheck) + , mForceWriteOnly(forceWriteOnly) + { + } + + NS_DECL_ISUPPORTS + + RefPtr mSurface; + RepeatMode mRepeat; + nsCOMPtr mPrincipal; + PRPackedBool mForceWriteOnly; +}; + +NS_DEFINE_STATIC_IID_ACCESSOR(nsCanvasPatternAzure, NS_CANVASPATTERNAZURE_PRIVATE_IID) + +NS_IMPL_ADDREF(nsCanvasPatternAzure) +NS_IMPL_RELEASE(nsCanvasPatternAzure) + +// XXX +// DOMCI_DATA(CanvasPattern, nsCanvasPatternAzure) + +NS_INTERFACE_MAP_BEGIN(nsCanvasPatternAzure) + NS_INTERFACE_MAP_ENTRY(nsCanvasPatternAzure) + NS_INTERFACE_MAP_ENTRY(nsIDOMCanvasPattern) + NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasPattern) + NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +/** + ** nsTextMetricsAzure + **/ +#define NS_TEXTMETRICSAZURE_PRIVATE_IID \ + {0x9793f9e7, 0x9dc1, 0x4e9c, {0x81, 0xc8, 0xfc, 0xa7, 0x14, 0xf4, 0x30, 0x79}} +class nsTextMetricsAzure : public nsIDOMTextMetrics +{ +public: + nsTextMetricsAzure(float w) : width(w) { } + + virtual ~nsTextMetricsAzure() { } + + NS_DECLARE_STATIC_IID_ACCESSOR(NS_TEXTMETRICSAZURE_PRIVATE_IID) + + NS_IMETHOD GetWidth(float* w) { + *w = width; + return NS_OK; + } + + NS_DECL_ISUPPORTS + +private: + float width; +}; + +NS_DEFINE_STATIC_IID_ACCESSOR(nsTextMetricsAzure, NS_TEXTMETRICSAZURE_PRIVATE_IID) + +NS_IMPL_ADDREF(nsTextMetricsAzure) +NS_IMPL_RELEASE(nsTextMetricsAzure) + +// XXX +// DOMCI_DATA(TextMetrics, nsTextMetricsAzure) + +NS_INTERFACE_MAP_BEGIN(nsTextMetricsAzure) + NS_INTERFACE_MAP_ENTRY(nsTextMetricsAzure) + NS_INTERFACE_MAP_ENTRY(nsIDOMTextMetrics) + NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(TextMetrics) + NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +struct nsCanvasBidiProcessorAzure; + +// Cap sigma to avoid overly large temp surfaces. +static const Float SIGMA_MAX = 100; + +/** + ** nsCanvasRenderingContext2DAzure + **/ +class nsCanvasRenderingContext2DAzure : + public nsIDOMCanvasRenderingContext2D, + public nsICanvasRenderingContextInternal +{ +public: + nsCanvasRenderingContext2DAzure(); + virtual ~nsCanvasRenderingContext2DAzure(); + + nsresult Redraw(); + + // nsICanvasRenderingContextInternal + NS_IMETHOD SetCanvasElement(nsHTMLCanvasElement* aParentCanvas); + NS_IMETHOD SetDimensions(PRInt32 width, PRInt32 height); + NS_IMETHOD InitializeWithSurface(nsIDocShell *shell, gfxASurface *surface, PRInt32 width, PRInt32 height) + { return NS_ERROR_NOT_IMPLEMENTED; } + + NS_IMETHOD Render(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter); + NS_IMETHOD GetInputStream(const char* aMimeType, + const PRUnichar* aEncoderOptions, + nsIInputStream **aStream); + NS_IMETHOD GetThebesSurface(gfxASurface **surface); + + TemporaryRef GetSurfaceSnapshot() + { return mTarget ? mTarget->Snapshot() : nsnull; } + + NS_IMETHOD SetIsOpaque(PRBool isOpaque); + NS_IMETHOD Reset(); + already_AddRefed GetCanvasLayer(nsDisplayListBuilder* aBuilder, + CanvasLayer *aOldLayer, + LayerManager *aManager); + void MarkContextClean(); + NS_IMETHOD SetIsIPC(PRBool isIPC); + // this rect is in canvas device space + void Redraw(const mgfx::Rect &r); + NS_IMETHOD Redraw(const gfxRect &r) { Redraw(ToRect(r)); return NS_OK; } + + // this rect is in mTarget's current user space + nsresult RedrawUser(const gfxRect &r); + + // nsISupports interface + CC + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + + NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsCanvasRenderingContext2DAzure, nsIDOMCanvasRenderingContext2D) + + // nsIDOMCanvasRenderingContext2D interface + NS_DECL_NSIDOMCANVASRENDERINGCONTEXT2D + + enum Style { + STYLE_STROKE = 0, + STYLE_FILL, + STYLE_MAX + }; + +protected: + nsresult InitializeWithTarget(DrawTarget *surface, PRInt32 width, PRInt32 height); + + /** + * The number of living nsCanvasRenderingContexts. When this goes down to + * 0, we free the premultiply and unpremultiply tables, if they exist. + */ + static PRUint32 sNumLivingContexts; + + /** + * Lookup table used to speed up GetImageData(). + */ + static PRUint8 (*sUnpremultiplyTable)[256]; + + /** + * Lookup table used to speed up PutImageData(). + */ + static PRUint8 (*sPremultiplyTable)[256]; + + // Some helpers. Doesn't modify a color on failure. + nsresult SetStyleFromStringOrInterface(const nsAString& aStr, nsISupports *aInterface, Style aWhichStyle); + nsresult GetStyleAsStringOrInterface(nsAString& aStr, nsISupports **aInterface, PRInt32 *aType, Style aWhichStyle); + + void StyleColorToString(const nscolor& aColor, nsAString& aStr); + + /** + * Creates the unpremultiply lookup table, if it doesn't exist. + */ + void EnsureUnpremultiplyTable(); + + /** + * Creates the premultiply lookup table, if it doesn't exist. + */ + void EnsurePremultiplyTable(); + + /* This function ensures there is a writable pathbuilder available, this + * pathbuilder may be working in user space or in device space or + * device space. + */ + void EnsureWritablePath(); + + // Ensures a path in UserSpace is available. + void EnsureUserSpacePath(); + + void TransformWillUpdate(); + + // Report the fillRule has changed. + void FillRuleChanged(); + + /** + * Returns the surface format this canvas should be allocated using. Takes + * into account mOpaque, platform requirements, etc. + */ + SurfaceFormat GetSurfaceFormat() const; + + nsHTMLCanvasElement *HTMLCanvasElement() { + return static_cast(mCanvasElement.get()); + } + + // Member vars + PRInt32 mWidth, mHeight; + + // This is true when the canvas is valid, false otherwise, this occurs when + // for some reason initialization of the drawtarget fails. If the canvas + // is invalid certain behavior is expected. + PRPackedBool mValid; + // This is true when the canvas is valid, but of zero size, this requires + // specific behavior on some operations. + PRPackedBool mZero; + + PRPackedBool mOpaque; + + // This is true when the next time our layer is retrieved we need to + // recreate it (i.e. our backing surface changed) + PRPackedBool mResetLayer; + // This is needed for drawing in drawAsyncXULElement + PRPackedBool mIPC; + + // the canvas element we're a context of + nsCOMPtr mCanvasElement; + + // If mCanvasElement is not provided, then a docshell is + nsCOMPtr mDocShell; + + // our drawing surfaces, contexts, and layers + RefPtr mTarget; + + /** + * Flag to avoid duplicate calls to InvalidateFrame. Set to true whenever + * Redraw is called, reset to false when Render is called. + */ + PRPackedBool mIsEntireFrameInvalid; + /** + * When this is set, the first call to Redraw(gfxRect) should set + * mIsEntireFrameInvalid since we expect it will be followed by + * many more Redraw calls. + */ + PRPackedBool mPredictManyRedrawCalls; + + /** + * We also have a device space pathbuilder. The reason for this is as + * follows, when a path is being built, but the transform changes, we + * can no longer keep a single path in userspace, considering there's + * several 'user spaces' now. We therefore transform the current path + * into device space, and add all operations to this path in device + * space. + * + * When then finally executing a render, the Azure drawing API expects + * the path to be in userspace. We could then set an identity transform + * on the DrawTarget and do all drawing in device space. This is + * undesirable because it requires transforming patterns, gradients, + * clips, etc. into device space and it would not work for stroking. + * What we do instead is convert the path back to user space when it is + * drawn, and draw it with the current transform. This makes all drawing + * occur correctly. + * + * There's never both a device space path builder and a user space path + * builder present at the same time. There is also never a path and a + * path builder present at the same time. When writing proceeds on an + * existing path the Path is cleared and a new builder is created. + * + * mPath is always in user-space. + */ + RefPtr mPath; + RefPtr mDSPathBuilder; + RefPtr mPathBuilder; + bool mPathTransformWillUpdate; + Matrix mPathToDS; + + /** + * Number of times we've invalidated before calling redraw + */ + PRUint32 mInvalidateCount; + static const PRUint32 kCanvasMaxInvalidateCount = 100; + + /** + * Returns true if a shadow should be drawn along with a + * drawing operation. + */ + PRBool NeedToDrawShadow() + { + const ContextState& state = CurrentState(); + + // The spec says we should not draw shadows if the operator is OVER. + // If it's over and the alpha value is zero, nothing needs to be drawn. + return state.op == OP_OVER && NS_GET_A(state.shadowColor) != 0; + } + + /** + * Gets the pres shell from either the canvas element or the doc shell + */ + nsIPresShell *GetPresShell() { + nsCOMPtr content = + do_QueryInterface(static_cast(mCanvasElement)); + if (content) { + nsIDocument* ownerDoc = content->GetOwnerDoc(); + return ownerDoc ? ownerDoc->GetShell() : nsnull; + } + if (mDocShell) { + nsCOMPtr shell; + mDocShell->GetPresShell(getter_AddRefs(shell)); + return shell.get(); + } + return nsnull; + } + + // text + enum TextAlign { + TEXT_ALIGN_START, + TEXT_ALIGN_END, + TEXT_ALIGN_LEFT, + TEXT_ALIGN_RIGHT, + TEXT_ALIGN_CENTER + }; + + enum TextBaseline { + TEXT_BASELINE_TOP, + TEXT_BASELINE_HANGING, + TEXT_BASELINE_MIDDLE, + TEXT_BASELINE_ALPHABETIC, + TEXT_BASELINE_IDEOGRAPHIC, + TEXT_BASELINE_BOTTOM + }; + + gfxFontGroup *GetCurrentFontStyle(); + + enum TextDrawOperation { + TEXT_DRAW_OPERATION_FILL, + TEXT_DRAW_OPERATION_STROKE, + TEXT_DRAW_OPERATION_MEASURE + }; + + /* + * Implementation of the fillText, strokeText, and measure functions with + * the operation abstracted to a flag. + */ + nsresult DrawOrMeasureText(const nsAString& text, + float x, + float y, + float maxWidth, + TextDrawOperation op, + float* aWidth); + + // state stack handling + class ContextState { + public: + ContextState() : textAlign(TEXT_ALIGN_START), + textBaseline(TEXT_BASELINE_ALPHABETIC), + lineWidth(1.0f), + miterLimit(10.0f), + globalAlpha(1.0f), + shadowBlur(0.0), + op(OP_OVER), + fillRule(FILL_WINDING), + lineCap(CAP_BUTT), + lineJoin(JOIN_MITER_OR_BEVEL), + imageSmoothingEnabled(PR_TRUE) + { } + + ContextState(const ContextState& other) + : fontGroup(other.fontGroup), + font(other.font), + textAlign(other.textAlign), + textBaseline(other.textBaseline), + shadowColor(other.shadowColor), + transform(other.transform), + shadowOffset(other.shadowOffset), + lineWidth(other.lineWidth), + miterLimit(other.miterLimit), + globalAlpha(other.globalAlpha), + shadowBlur(other.shadowBlur), + op(other.op), + fillRule(FILL_WINDING), + lineCap(other.lineCap), + lineJoin(other.lineJoin), + imageSmoothingEnabled(other.imageSmoothingEnabled) + { + for (int i = 0; i < STYLE_MAX; i++) { + colorStyles[i] = other.colorStyles[i]; + gradientStyles[i] = other.gradientStyles[i]; + patternStyles[i] = other.patternStyles[i]; + } + } + + void SetColorStyle(Style whichStyle, nscolor color) { + colorStyles[whichStyle] = color; + gradientStyles[whichStyle] = nsnull; + patternStyles[whichStyle] = nsnull; + } + + void SetPatternStyle(Style whichStyle, nsCanvasPatternAzure* pat) { + gradientStyles[whichStyle] = nsnull; + patternStyles[whichStyle] = pat; + } + + void SetGradientStyle(Style whichStyle, nsCanvasGradientAzure* grad) { + gradientStyles[whichStyle] = grad; + patternStyles[whichStyle] = nsnull; + } + + /** + * returns true iff the given style is a solid color. + */ + PRBool StyleIsColor(Style whichStyle) const + { + return !(patternStyles[whichStyle] || + gradientStyles[whichStyle]); + } + + + std::vector > clipsPushed; + + nsRefPtr fontGroup; + nsRefPtr gradientStyles[STYLE_MAX]; + nsRefPtr patternStyles[STYLE_MAX]; + + nsString font; + TextAlign textAlign; + TextBaseline textBaseline; + + nscolor colorStyles[STYLE_MAX]; + nscolor shadowColor; + + Matrix transform; + Point shadowOffset; + Float lineWidth; + Float miterLimit; + Float globalAlpha; + Float shadowBlur; + + CompositionOp op; + FillRule fillRule; + CapStyle lineCap; + JoinStyle lineJoin; + + PRPackedBool imageSmoothingEnabled; + }; + + class GeneralPattern + { + public: + GeneralPattern() : mPattern(nsnull) {} + ~GeneralPattern() + { + if (mPattern) { + mPattern->~Pattern(); + } + } + + Pattern& ForStyle(nsCanvasRenderingContext2DAzure *aCtx, + Style aStyle, + DrawTarget *aRT) + { + // This should only be called once or the mPattern destructor will + // not be executed. + NS_ASSERTION(!mPattern, "ForStyle() should only be called once on GeneralPattern!"); + + const nsCanvasRenderingContext2DAzure::ContextState &state = aCtx->CurrentState(); + + if (state.StyleIsColor(aStyle)) { + mPattern = new (mColorPattern.addr()) ColorPattern(Color::FromABGR(state.colorStyles[aStyle])); + } else if (state.gradientStyles[aStyle] && + state.gradientStyles[aStyle]->GetType() == nsCanvasGradientAzure::LINEAR) { + nsCanvasLinearGradientAzure *gradient = + static_cast(state.gradientStyles[aStyle].get()); + + mPattern = new (mLinearGradientPattern.addr()) + LinearGradientPattern(gradient->mBegin, gradient->mEnd, + gradient->GetGradientStopsForTarget(aRT)); + } else if (state.gradientStyles[aStyle] && + state.gradientStyles[aStyle]->GetType() == nsCanvasGradientAzure::RADIAL) { + nsCanvasRadialGradientAzure *gradient = + static_cast(state.gradientStyles[aStyle].get()); + + mPattern = new (mRadialGradientPattern.addr()) + RadialGradientPattern(gradient->mCenter, gradient->mOrigin, gradient->mRadius, + gradient->GetGradientStopsForTarget(aRT)); + } else if (state.patternStyles[aStyle]) { + if (aCtx->mCanvasElement) { + CanvasUtils::DoDrawImageSecurityCheck(aCtx->HTMLCanvasElement(), + state.patternStyles[aStyle]->mPrincipal, + state.patternStyles[aStyle]->mForceWriteOnly); + } + + ExtendMode mode; + if (state.patternStyles[aStyle]->mRepeat == nsCanvasPatternAzure::NOREPEAT) { + mode = EXTEND_CLAMP; + } else { + mode = EXTEND_WRAP; + } + mPattern = new (mSurfacePattern.addr()) + SurfacePattern(state.patternStyles[aStyle]->mSurface, mode); + } + + return *mPattern; + } + + union { + AlignedStorage2 mColorPattern; + AlignedStorage2 mLinearGradientPattern; + AlignedStorage2 mRadialGradientPattern; + AlignedStorage2 mSurfacePattern; + }; + Pattern *mPattern; + }; + + /* This is an RAII based class that can be used as a drawtarget for + * operations that need a shadow drawn. It will automatically provide a + * temporary target when needed, and if so blend it back with a shadow. + */ + class AdjustedTarget + { + public: + AdjustedTarget(nsCanvasRenderingContext2DAzure *ctx, + const mgfx::Rect *aBounds = nsnull) + : mCtx(nsnull) + { + if (!ctx->NeedToDrawShadow()) { + mTarget = ctx->mTarget; + return; + } + mCtx = ctx; + + const ContextState &state = mCtx->CurrentState(); + + mSigma = state.shadowBlur / 2.0f; + + if (mSigma > SIGMA_MAX) { + mSigma = SIGMA_MAX; + } + + Matrix transform = mCtx->mTarget->GetTransform(); + if (!aBounds) { + mTempSize = IntSize(ctx->mWidth, ctx->mHeight); + + // We need to enlarge an possibly offset our temporary surface + // so that things outside of the canvas may cast shadows. + if (state.shadowOffset.x > 0) { + mTempSize.width += state.shadowOffset.x; + mSurfOffset.x = -state.shadowOffset.x; + transform._31 += state.shadowOffset.x; + } else { + mTempSize.width -= state.shadowOffset.x; + } + if (state.shadowOffset.y > 0) { + mTempSize.height += state.shadowOffset.y; + mSurfOffset.y = -state.shadowOffset.y; + transform._32 += state.shadowOffset.y; + } else { + mTempSize.height -= state.shadowOffset.y; + } + + if (mSigma > 0) { + float blurRadius = mSigma * 3; + mSurfOffset.x -= blurRadius; + mSurfOffset.y -= blurRadius; + mTempSize.width += blurRadius; + mTempSize.height += blurRadius; + transform._31 += blurRadius; + transform._32 += blurRadius; + } + } // XXX - Implement aBounds path! See bug 666452. + + mTarget = + mCtx->mTarget->CreateSimilarDrawTarget(mTempSize, + FORMAT_B8G8R8A8); + + mTarget->SetTransform(transform); + + if (!mTarget) { + // XXX - Deal with the situation where our temp size is too big to + // fit in a texture. + mTarget = ctx->mTarget; + mCtx = nsnull; + } + } + + ~AdjustedTarget() + { + if (!mCtx) { + return; + } + + RefPtr snapshot = mTarget->Snapshot(); + + mCtx->mTarget->DrawSurfaceWithShadow(snapshot, mSurfOffset, + Color::FromABGR(mCtx->CurrentState().shadowColor), + mCtx->CurrentState().shadowOffset, mSigma); + } + + DrawTarget* operator->() + { + return mTarget; + } + + private: + RefPtr mTarget; + nsCanvasRenderingContext2DAzure *mCtx; + Float mSigma; + IntSize mTempSize; + Point mSurfOffset; + }; + + nsAutoTArray mStyleStack; + + inline ContextState& CurrentState() { + return mStyleStack[mStyleStack.Length() - 1]; + } + + // other helpers + void GetAppUnitsValues(PRUint32 *perDevPixel, PRUint32 *perCSSPixel) { + // If we don't have a canvas element, we just return something generic. + PRUint32 devPixel = 60; + PRUint32 cssPixel = 60; + + nsIPresShell *ps = GetPresShell(); + nsPresContext *pc; + + if (!ps) goto FINISH; + pc = ps->GetPresContext(); + if (!pc) goto FINISH; + devPixel = pc->AppUnitsPerDevPixel(); + cssPixel = pc->AppUnitsPerCSSPixel(); + + FINISH: + if (perDevPixel) + *perDevPixel = devPixel; + if (perCSSPixel) + *perCSSPixel = cssPixel; + } + + friend struct nsCanvasBidiProcessorAzure; +}; + +NS_IMPL_CYCLE_COLLECTING_ADDREF(nsCanvasRenderingContext2DAzure) +NS_IMPL_CYCLE_COLLECTING_RELEASE(nsCanvasRenderingContext2DAzure) + +NS_IMPL_CYCLE_COLLECTION_CLASS(nsCanvasRenderingContext2DAzure) +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsCanvasRenderingContext2DAzure) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCanvasElement) +NS_IMPL_CYCLE_COLLECTION_UNLINK_END +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsCanvasRenderingContext2DAzure) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCanvasElement) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END + +// XXX +// DOMCI_DATA(CanvasRenderingContext2D, nsCanvasRenderingContext2DAzure) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCanvasRenderingContext2DAzure) + NS_INTERFACE_MAP_ENTRY(nsIDOMCanvasRenderingContext2D) + NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCanvasRenderingContext2D) + NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasRenderingContext2D) +NS_INTERFACE_MAP_END + +/** + ** CanvasRenderingContext2D impl + **/ + + +// Initialize our static variables. +PRUint32 nsCanvasRenderingContext2DAzure::sNumLivingContexts = 0; +PRUint8 (*nsCanvasRenderingContext2DAzure::sUnpremultiplyTable)[256] = nsnull; +PRUint8 (*nsCanvasRenderingContext2DAzure::sPremultiplyTable)[256] = nsnull; + +nsresult +NS_NewCanvasRenderingContext2DAzure(nsIDOMCanvasRenderingContext2D** aResult) +{ +#ifndef XP_WIN + return NS_ERROR_NOT_AVAILABLE; +#else + + if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() != + gfxWindowsPlatform::RENDER_DIRECT2D || + !gfxWindowsPlatform::GetPlatform()->DWriteEnabled()) { + return NS_ERROR_NOT_AVAILABLE; + } + + nsRefPtr ctx = new nsCanvasRenderingContext2DAzure(); + if (!ctx) + return NS_ERROR_OUT_OF_MEMORY; + + *aResult = ctx.forget().get(); + return NS_OK; +#endif +} + +nsCanvasRenderingContext2DAzure::nsCanvasRenderingContext2DAzure() + : mValid(PR_FALSE), mZero(PR_FALSE), mOpaque(PR_FALSE), mResetLayer(PR_TRUE) + , mIPC(PR_FALSE) + , mCanvasElement(nsnull) + , mIsEntireFrameInvalid(PR_FALSE) + , mPredictManyRedrawCalls(PR_FALSE), mPathTransformWillUpdate(false) + , mInvalidateCount(0) +{ + sNumLivingContexts++; +} + +nsCanvasRenderingContext2DAzure::~nsCanvasRenderingContext2DAzure() +{ + Reset(); + sNumLivingContexts--; + if (!sNumLivingContexts) { + delete[] sUnpremultiplyTable; + delete[] sPremultiplyTable; + sUnpremultiplyTable = nsnull; + sPremultiplyTable = nsnull; + } +} + +nsresult +nsCanvasRenderingContext2DAzure::Reset() +{ + if (mCanvasElement) { + HTMLCanvasElement()->InvalidateCanvas(); + } + + // only do this for non-docshell created contexts, + // since those are the ones that we created a surface for + if (mValid && !mDocShell) { + gCanvasAzureMemoryUsed -= mWidth * mHeight * 4; + } + + mTarget = nsnull; + mValid = PR_FALSE; + mIsEntireFrameInvalid = PR_FALSE; + mPredictManyRedrawCalls = PR_FALSE; + return NS_OK; +} + +nsresult +nsCanvasRenderingContext2DAzure::SetStyleFromStringOrInterface(const nsAString& aStr, + nsISupports *aInterface, + Style aWhichStyle) +{ + nsresult rv; + nscolor color; + + if (!aStr.IsVoid()) { + nsIDocument* document = mCanvasElement ? + HTMLCanvasElement()->GetOwnerDoc() : nsnull; + + // Pass the CSS Loader object to the parser, to allow parser error + // reports to include the outer window ID. + nsCSSParser parser(document ? document->CSSLoader() : nsnull); + rv = parser.ParseColorString(aStr, nsnull, 0, &color); + if (NS_FAILED(rv)) { + // Error reporting happens inside the CSS parser + return NS_OK; + } + + CurrentState().SetColorStyle(aWhichStyle, color); + return NS_OK; + } + + if (aInterface) { + nsCOMPtr grad(do_QueryInterface(aInterface)); + if (grad) { + CurrentState().SetGradientStyle(aWhichStyle, grad); + return NS_OK; + } + + nsCOMPtr pattern(do_QueryInterface(aInterface)); + if (pattern) { + CurrentState().SetPatternStyle(aWhichStyle, pattern); + return NS_OK; + } + } + + nsContentUtils::ReportToConsole( + nsContentUtils::eDOM_PROPERTIES, + "UnexpectedCanvasVariantStyle", + nsnull, 0, + nsnull, + EmptyString(), 0, 0, + nsIScriptError::warningFlag, + "Canvas", + mCanvasElement ? HTMLCanvasElement()->GetOwnerDoc() : nsnull); + + return NS_OK; +} + +nsresult +nsCanvasRenderingContext2DAzure::GetStyleAsStringOrInterface(nsAString& aStr, + nsISupports **aInterface, + PRInt32 *aType, + Style aWhichStyle) +{ + const ContextState &state = CurrentState(); + + if (state.patternStyles[aWhichStyle]) { + aStr.SetIsVoid(PR_TRUE); + NS_ADDREF(*aInterface = state.patternStyles[aWhichStyle]); + *aType = CMG_STYLE_PATTERN; + } else if (state.gradientStyles[aWhichStyle]) { + aStr.SetIsVoid(PR_TRUE); + NS_ADDREF(*aInterface = state.gradientStyles[aWhichStyle]); + *aType = CMG_STYLE_GRADIENT; + } else { + StyleColorToString(state.colorStyles[aWhichStyle], aStr); + *aInterface = nsnull; + *aType = CMG_STYLE_STRING; + } + + return NS_OK; +} + +void +nsCanvasRenderingContext2DAzure::StyleColorToString(const nscolor& aColor, nsAString& aStr) +{ + // We can't reuse the normal CSS color stringification code, + // because the spec calls for a different algorithm for canvas. + if (NS_GET_A(aColor) == 255) { + CopyUTF8toUTF16(nsPrintfCString(100, "#%02x%02x%02x", + NS_GET_R(aColor), + NS_GET_G(aColor), + NS_GET_B(aColor)), + aStr); + } else { + CopyUTF8toUTF16(nsPrintfCString(100, "rgba(%d, %d, %d, ", + NS_GET_R(aColor), + NS_GET_G(aColor), + NS_GET_B(aColor)), + aStr); + aStr.AppendFloat(nsStyleUtil::ColorComponentToFloat(NS_GET_A(aColor))); + aStr.Append(')'); + } +} + +nsresult +nsCanvasRenderingContext2DAzure::Redraw() +{ + if (mIsEntireFrameInvalid) { + return NS_OK; + } + + mIsEntireFrameInvalid = PR_TRUE; + + if (!mCanvasElement) { + NS_ASSERTION(mDocShell, "Redraw with no canvas element or docshell!"); + return NS_OK; + } + + nsSVGEffects::InvalidateDirectRenderingObservers(HTMLCanvasElement()); + + HTMLCanvasElement()->InvalidateCanvasContent(nsnull); + + return NS_OK; +} + +void +nsCanvasRenderingContext2DAzure::Redraw(const mgfx::Rect &r) +{ + ++mInvalidateCount; + + if (mIsEntireFrameInvalid) { + return; + } + + if (mPredictManyRedrawCalls || + mInvalidateCount > kCanvasMaxInvalidateCount) { + Redraw(); + return; + } + + if (!mCanvasElement) { + NS_ASSERTION(mDocShell, "Redraw with no canvas element or docshell!"); + return; + } + + nsSVGEffects::InvalidateDirectRenderingObservers(HTMLCanvasElement()); + + gfxRect tmpR = GFXRect(r); + HTMLCanvasElement()->InvalidateCanvasContent(&tmpR); + + return; +} + +nsresult +nsCanvasRenderingContext2DAzure::RedrawUser(const gfxRect& r) +{ + if (mIsEntireFrameInvalid) { + ++mInvalidateCount; + return NS_OK; + } + + mgfx::Rect newr = + mTarget->GetTransform().TransformBounds(ToRect(r)); + Redraw(newr); + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetDimensions(PRInt32 width, PRInt32 height) +{ + RefPtr target; + + // Zero sized surfaces cause issues, so just go with 1x1. + if (height == 0 || width == 0) { + mZero = PR_TRUE; + height = 1; + width = 1; + } + + // Check that the dimensions are sane + IntSize size(width, height); + if (size.width <= 0xFFFF && size.height <= 0xFFFF && + size.width >= 0 && size.height >= 0) { + SurfaceFormat format = GetSurfaceFormat(); + nsCOMPtr content = + do_QueryInterface(static_cast(mCanvasElement)); + nsIDocument* ownerDoc = nsnull; + if (content) { + ownerDoc = content->GetOwnerDoc(); + } + + nsRefPtr layerManager = nsnull; + + if (ownerDoc) { + layerManager = + nsContentUtils::PersistentLayerManagerForDocument(ownerDoc); + } + + if (layerManager) { + target = layerManager->CreateDrawTarget(size, format); + } else { + target = Factory::CreateDrawTarget(BACKEND_DIRECT2D, size, format); + } + } + + if (target) { + if (gCanvasAzureMemoryReporter == nsnull) { + gCanvasAzureMemoryReporter = new NS_MEMORY_REPORTER_NAME(CanvasAzureMemory); + NS_RegisterMemoryReporter(gCanvasAzureMemoryReporter); + } + + gCanvasAzureMemoryUsed += width * height * 4; + JS_updateMallocCounter(nsContentUtils::GetCurrentJSContext(), width * height * 4); + } + + return InitializeWithTarget(target, width, height); +} + +nsresult +nsCanvasRenderingContext2DAzure::InitializeWithTarget(DrawTarget *target, PRInt32 width, PRInt32 height) +{ + Reset(); + + NS_ASSERTION(mCanvasElement, "Must have a canvas element!"); + mDocShell = nsnull; + + mWidth = width; + mHeight = height; + + mTarget = target; + + mResetLayer = PR_TRUE; + + /* Create dummy surfaces here - target can be null when a canvas was created + * that is too large to support. + */ + if (!target) + { + mTarget = Factory::CreateDrawTarget(BACKEND_DIRECT2D, IntSize(1, 1), FORMAT_B8G8R8A8); + } else { + mValid = PR_TRUE; + } + + // set up the initial canvas defaults + mStyleStack.Clear(); + mPathBuilder = nsnull; + mPath = nsnull; + mDSPathBuilder = nsnull; + + ContextState *state = mStyleStack.AppendElement(); + state->globalAlpha = 1.0; + + state->colorStyles[STYLE_FILL] = NS_RGB(0,0,0); + state->colorStyles[STYLE_STROKE] = NS_RGB(0,0,0); + state->shadowColor = NS_RGBA(0,0,0,0); + + mTarget->ClearRect(mgfx::Rect(Point(0, 0), Size(mWidth, mHeight))); + + // always force a redraw, because if the surface dimensions were reset + // then the surface became cleared, and we need to redraw everything. + Redraw(); + + return mValid ? NS_OK : NS_ERROR_OUT_OF_MEMORY; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetIsOpaque(PRBool isOpaque) +{ + if (isOpaque == mOpaque) + return NS_OK; + + mOpaque = isOpaque; + + if (mValid) { + /* If we've already been created, let SetDimensions take care of + * recreating our surface + */ + return SetDimensions(mWidth, mHeight); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetIsIPC(PRBool isIPC) +{ + if (isIPC == mIPC) + return NS_OK; + + mIPC = isIPC; + + if (mValid) { + /* If we've already been created, let SetDimensions take care of + * recreating our surface + */ + return SetDimensions(mWidth, mHeight); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::Render(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter) +{ + nsresult rv = NS_OK; + + if (!mValid || !mTarget) { + return NS_ERROR_FAILURE; + } + + nsRefPtr surface; + + if (NS_FAILED(GetThebesSurface(getter_AddRefs(surface)))) { + return NS_ERROR_FAILURE; + } + + nsRefPtr pat = new gfxPattern(surface); + + pat->SetFilter(aFilter); + pat->SetExtend(gfxPattern::EXTEND_PAD); + + gfxContext::GraphicsOperator op = ctx->CurrentOperator(); + if (mOpaque) + ctx->SetOperator(gfxContext::OPERATOR_SOURCE); + + // XXX I don't want to use PixelSnapped here, but layout doesn't guarantee + // pixel alignment for this stuff! + ctx->NewPath(); + ctx->PixelSnappedRectangleAndSetPattern(gfxRect(0, 0, mWidth, mHeight), pat); + ctx->Fill(); + + if (mOpaque) + ctx->SetOperator(op); + + return rv; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetInputStream(const char *aMimeType, + const PRUnichar *aEncoderOptions, + nsIInputStream **aStream) +{ + if (!mValid || !mTarget) { + return NS_ERROR_FAILURE; + } + + nsRefPtr surface; + + if (NS_FAILED(GetThebesSurface(getter_AddRefs(surface)))) { + return NS_ERROR_FAILURE; + } + + nsresult rv; + const char encoderPrefix[] = "@mozilla.org/image/encoder;2?type="; + nsAutoArrayPtr conid(new (std::nothrow) char[strlen(encoderPrefix) + strlen(aMimeType) + 1]); + + if (!conid) { + return NS_ERROR_OUT_OF_MEMORY; + } + + strcpy(conid, encoderPrefix); + strcat(conid, aMimeType); + + nsCOMPtr encoder = do_CreateInstance(conid); + if (!encoder) { + return NS_ERROR_FAILURE; + } + + nsAutoArrayPtr imageBuffer(new (std::nothrow) PRUint8[mWidth * mHeight * 4]); + if (!imageBuffer) { + return NS_ERROR_OUT_OF_MEMORY; + } + + nsRefPtr imgsurf = + new gfxImageSurface(imageBuffer.get(), + gfxIntSize(mWidth, mHeight), + mWidth * 4, + gfxASurface::ImageFormatARGB32); + + if (!imgsurf || imgsurf->CairoStatus()) { + return NS_ERROR_FAILURE; + } + + nsRefPtr ctx = new gfxContext(imgsurf); + + if (!ctx || ctx->HasError()) { + return NS_ERROR_FAILURE; + } + + ctx->SetOperator(gfxContext::OPERATOR_SOURCE); + ctx->SetSource(surface, gfxPoint(0, 0)); + ctx->Paint(); + + rv = encoder->InitFromData(imageBuffer.get(), + mWidth * mHeight * 4, mWidth, mHeight, mWidth * 4, + imgIEncoder::INPUT_FORMAT_HOSTARGB, + nsDependentString(aEncoderOptions)); + NS_ENSURE_SUCCESS(rv, rv); + + return CallQueryInterface(encoder, aStream); +} + +SurfaceFormat +nsCanvasRenderingContext2DAzure::GetSurfaceFormat() const +{ + return mOpaque ? FORMAT_B8G8R8X8 : FORMAT_B8G8R8A8; +} + +// +// nsCanvasRenderingContext2DAzure impl +// + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetCanvasElement(nsHTMLCanvasElement* aCanvasElement) +{ + mCanvasElement = aCanvasElement; + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetCanvas(nsIDOMHTMLCanvasElement **canvas) +{ + NS_IF_ADDREF(*canvas = mCanvasElement); + + return NS_OK; +} + +// +// state +// + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::Save() +{ + mStyleStack[mStyleStack.Length() - 1].transform = mTarget->GetTransform(); + mStyleStack.SetCapacity(mStyleStack.Length() + 1); + mStyleStack.AppendElement(CurrentState()); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::Restore() +{ + if (mStyleStack.Length() - 1 == 0) + return NS_OK; + + for (PRUint32 i = 0; i < CurrentState().clipsPushed.size(); i++) { + mTarget->PopClip(); + } + + mStyleStack.RemoveElementAt(mStyleStack.Length() - 1); + + TransformWillUpdate(); + + mTarget->SetTransform(CurrentState().transform); + + return NS_OK; +} + +// +// transformations +// + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::Scale(float x, float y) +{ + if (!FloatValidate(x,y)) + return NS_OK; + + TransformWillUpdate(); + + Matrix newMatrix = mTarget->GetTransform(); + mTarget->SetTransform(newMatrix.Scale(x, y)); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::Rotate(float angle) +{ + if (!FloatValidate(angle)) + return NS_OK; + + TransformWillUpdate(); + + Matrix rotation = Matrix::Rotation(angle); + mTarget->SetTransform(rotation * mTarget->GetTransform()); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::Translate(float x, float y) +{ + if (!FloatValidate(x,y)) { + return NS_OK; + } + + TransformWillUpdate(); + + Matrix newMatrix = mTarget->GetTransform(); + mTarget->SetTransform(newMatrix.Translate(x, y)); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::Transform(float m11, float m12, float m21, float m22, float dx, float dy) +{ + if (!FloatValidate(m11,m12,m21,m22,dx,dy)) { + return NS_OK; + } + + TransformWillUpdate(); + + Matrix matrix(m11, m12, m21, m22, dx, dy); + mTarget->SetTransform(matrix * mTarget->GetTransform()); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetTransform(float m11, float m12, float m21, float m22, float dx, float dy) +{ + if (!FloatValidate(m11,m12,m21,m22,dx,dy)) { + return NS_OK; + } + + TransformWillUpdate(); + + Matrix matrix(m11, m12, m21, m22, dx, dy); + mTarget->SetTransform(matrix); + + return NS_OK; +} + +// +// colors +// + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetGlobalAlpha(float aGlobalAlpha) +{ + if (!FloatValidate(aGlobalAlpha) || aGlobalAlpha < 0.0 || aGlobalAlpha > 1.0) { + return NS_OK; + } + + CurrentState().globalAlpha = aGlobalAlpha; + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetGlobalAlpha(float *aGlobalAlpha) +{ + *aGlobalAlpha = CurrentState().globalAlpha; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetStrokeStyle(nsIVariant *aValue) +{ + if (!aValue) + return NS_ERROR_FAILURE; + + nsString str; + + nsresult rv; + PRUint16 vtype; + rv = aValue->GetDataType(&vtype); + NS_ENSURE_SUCCESS(rv, rv); + + if (vtype == nsIDataType::VTYPE_INTERFACE || + vtype == nsIDataType::VTYPE_INTERFACE_IS) + { + nsIID *iid; + nsCOMPtr sup; + rv = aValue->GetAsInterface(&iid, getter_AddRefs(sup)); + NS_ENSURE_SUCCESS(rv, rv); + if (iid) { + NS_Free(iid); + } + + str.SetIsVoid(PR_TRUE); + return SetStrokeStyle_multi(str, sup); + } + + rv = aValue->GetAsAString(str); + NS_ENSURE_SUCCESS(rv, rv); + + return SetStrokeStyle_multi(str, nsnull); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetStrokeStyle(nsIVariant **aResult) +{ + nsCOMPtr wv = do_CreateInstance(NS_VARIANT_CONTRACTID); + + nsCOMPtr sup; + nsString str; + PRInt32 t; + nsresult rv = GetStrokeStyle_multi(str, getter_AddRefs(sup), &t); + NS_ENSURE_SUCCESS(rv, rv); + + if (t == CMG_STYLE_STRING) { + rv = wv->SetAsAString(str); + } else if (t == CMG_STYLE_PATTERN) { + rv = wv->SetAsInterface(NS_GET_IID(nsIDOMCanvasPattern), + sup); + } else if (t == CMG_STYLE_GRADIENT) { + rv = wv->SetAsInterface(NS_GET_IID(nsIDOMCanvasGradient), + sup); + } else { + NS_ERROR("Unknown type from GetStroke/FillStyle_multi!"); + return NS_ERROR_FAILURE; + } + NS_ENSURE_SUCCESS(rv, rv); + + NS_IF_ADDREF(*aResult = wv.get()); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetFillStyle(nsIVariant *aValue) +{ + if (!aValue) { + return NS_ERROR_FAILURE; + } + + nsString str; + nsresult rv; + PRUint16 vtype; + rv = aValue->GetDataType(&vtype); + NS_ENSURE_SUCCESS(rv, rv); + + if (vtype == nsIDataType::VTYPE_INTERFACE || + vtype == nsIDataType::VTYPE_INTERFACE_IS) + { + nsIID *iid; + nsCOMPtr sup; + rv = aValue->GetAsInterface(&iid, getter_AddRefs(sup)); + NS_ENSURE_SUCCESS(rv, rv); + + str.SetIsVoid(PR_TRUE); + return SetFillStyle_multi(str, sup); + } + + rv = aValue->GetAsAString(str); + NS_ENSURE_SUCCESS(rv, rv); + + return SetFillStyle_multi(str, nsnull); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetFillStyle(nsIVariant **aResult) +{ + nsCOMPtr wv = do_CreateInstance(NS_VARIANT_CONTRACTID); + + nsCOMPtr sup; + nsString str; + PRInt32 t; + nsresult rv = GetFillStyle_multi(str, getter_AddRefs(sup), &t); + NS_ENSURE_SUCCESS(rv, rv); + + if (t == CMG_STYLE_STRING) { + rv = wv->SetAsAString(str); + } else if (t == CMG_STYLE_PATTERN) { + rv = wv->SetAsInterface(NS_GET_IID(nsIDOMCanvasPattern), + sup); + } else if (t == CMG_STYLE_GRADIENT) { + rv = wv->SetAsInterface(NS_GET_IID(nsIDOMCanvasGradient), + sup); + } else { + NS_ERROR("Unknown type from GetStroke/FillStyle_multi!"); + return NS_ERROR_FAILURE; + } + NS_ENSURE_SUCCESS(rv, rv); + + NS_IF_ADDREF(*aResult = wv.get()); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetMozFillRule(const nsAString& aString) +{ + FillRule rule; + + if (aString.EqualsLiteral("evenodd")) + rule = FILL_EVEN_ODD; + else if (aString.EqualsLiteral("nonzero")) + rule = FILL_WINDING; + else + return NS_OK; + + CurrentState().fillRule = rule; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetMozFillRule(nsAString& aString) +{ + switch (CurrentState().fillRule) { + case FILL_WINDING: + aString.AssignLiteral("nonzero"); break; + case FILL_EVEN_ODD: + aString.AssignLiteral("evenodd"); break; + default: + return NS_ERROR_FAILURE; + } + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetStrokeStyle_multi(const nsAString& aStr, nsISupports *aInterface) +{ + return SetStyleFromStringOrInterface(aStr, aInterface, STYLE_STROKE); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetStrokeStyle_multi(nsAString& aStr, nsISupports **aInterface, PRInt32 *aType) +{ + return GetStyleAsStringOrInterface(aStr, aInterface, aType, STYLE_STROKE); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetFillStyle_multi(const nsAString& aStr, nsISupports *aInterface) +{ + return SetStyleFromStringOrInterface(aStr, aInterface, STYLE_FILL); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetFillStyle_multi(nsAString& aStr, nsISupports **aInterface, PRInt32 *aType) +{ + return GetStyleAsStringOrInterface(aStr, aInterface, aType, STYLE_FILL); +} + +// +// gradients and patterns +// +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::CreateLinearGradient(float x0, float y0, float x1, float y1, + nsIDOMCanvasGradient **_retval) +{ + if (!FloatValidate(x0,y0,x1,y1)) { + return NS_ERROR_DOM_NOT_SUPPORTED_ERR; + } + + nsRefPtr grad = + new nsCanvasLinearGradientAzure(Point(x0, y0), Point(x1, y1)); + + *_retval = grad.forget().get(); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::CreateRadialGradient(float x0, float y0, float r0, + float x1, float y1, float r1, + nsIDOMCanvasGradient **_retval) +{ + if (!FloatValidate(x0,y0,r0,x1,y1,r1)) { + return NS_ERROR_DOM_NOT_SUPPORTED_ERR; + } + + if (r0 < 0.0 || r1 < 0.0) { + return NS_ERROR_DOM_INDEX_SIZE_ERR; + } + + nsRefPtr grad = + new nsCanvasRadialGradientAzure(Point(x0, y0), r0, Point(x1, y1), r1); + + *_retval = grad.forget().get(); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::CreatePattern(nsIDOMHTMLElement *image, + const nsAString& repeat, + nsIDOMCanvasPattern **_retval) +{ + if (!image) { + return NS_ERROR_DOM_TYPE_MISMATCH_ERR; + } + + nsCanvasPatternAzure::RepeatMode repeatMode = + nsCanvasPatternAzure::NOREPEAT; + + if (repeat.IsEmpty() || repeat.EqualsLiteral("repeat")) { + repeatMode = nsCanvasPatternAzure::REPEAT; + } else if (repeat.EqualsLiteral("repeat-x")) { + repeatMode = nsCanvasPatternAzure::REPEATX; + } else if (repeat.EqualsLiteral("repeat-y")) { + repeatMode = nsCanvasPatternAzure::REPEATY; + } else if (repeat.EqualsLiteral("no-repeat")) { + repeatMode = nsCanvasPatternAzure::NOREPEAT; + } else { + return NS_ERROR_DOM_SYNTAX_ERR; + } + + nsCOMPtr content = do_QueryInterface(image); + nsHTMLCanvasElement* canvas = nsHTMLCanvasElement::FromContent(content); + + if (canvas) { + nsIntSize size = canvas->GetSize(); + if (size.width == 0 || size.height == 0) { + return NS_ERROR_DOM_INVALID_STATE_ERR; + } + } + + // Special case for Canvas, which could be an Azure canvas! + nsCOMPtr node = do_QueryInterface(image); + if (canvas && node) { + if (canvas->CountContexts() == 1) { + nsICanvasRenderingContextInternal *srcCanvas = canvas->GetContextAtIndex(0); + + // This might not be an Azure canvas! + if (srcCanvas) { + RefPtr srcSurf = srcCanvas->GetSurfaceSnapshot(); + + nsRefPtr pat = + new nsCanvasPatternAzure(srcSurf, repeatMode, node->NodePrincipal(), canvas->IsWriteOnly()); + + *_retval = pat.forget().get(); + return NS_OK; + } + } + } + + // The canvas spec says that createPattern should use the first frame + // of animated images + nsLayoutUtils::SurfaceFromElementResult res = + nsLayoutUtils::SurfaceFromElement(image, nsLayoutUtils::SFE_WANT_FIRST_FRAME | + nsLayoutUtils::SFE_WANT_NEW_SURFACE); + + if (!res.mSurface) { + return NS_ERROR_NOT_AVAILABLE; + } + + // Ignore nsnull cairo surfaces! See bug 666312. + if (!res.mSurface->CairoSurface()) { + return NS_OK; + } + + RefPtr srcSurf = + gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mTarget, res.mSurface); + + nsRefPtr pat = + new nsCanvasPatternAzure(srcSurf, repeatMode, res.mPrincipal, res.mIsWriteOnly); + + *_retval = pat.forget().get(); + return NS_OK; +} + +// +// shadows +// +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetShadowOffsetX(float x) +{ + if (!FloatValidate(x)) { + return NS_OK; + } + + CurrentState().shadowOffset.x = x; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetShadowOffsetX(float *x) +{ + *x = static_cast(CurrentState().shadowOffset.x); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetShadowOffsetY(float y) +{ + if (!FloatValidate(y)) { + return NS_OK; + } + + CurrentState().shadowOffset.y = y; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetShadowOffsetY(float *y) +{ + *y = static_cast(CurrentState().shadowOffset.y); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetShadowBlur(float blur) +{ + if (!FloatValidate(blur) || blur < 0.0) { + return NS_OK; + } + + CurrentState().shadowBlur = blur; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetShadowBlur(float *blur) +{ + *blur = CurrentState().shadowBlur; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetShadowColor(const nsAString& colorstr) +{ + nsIDocument* document = mCanvasElement ? + HTMLCanvasElement()->GetOwnerDoc() : nsnull; + + // Pass the CSS Loader object to the parser, to allow parser error reports + // to include the outer window ID. + nsCSSParser parser(document ? document->CSSLoader() : nsnull); + nscolor color; + nsresult rv = parser.ParseColorString(colorstr, nsnull, 0, &color); + if (NS_FAILED(rv)) { + // Error reporting happens inside the CSS parser + return NS_OK; + } + CurrentState().shadowColor = color; + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetShadowColor(nsAString& color) +{ + StyleColorToString(CurrentState().shadowColor, color); + + return NS_OK; +} + +// +// rects +// + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::ClearRect(float x, float y, float w, float h) +{ + if (!FloatValidate(x,y,w,h)) { + return NS_OK; + } + + mTarget->ClearRect(mgfx::Rect(x, y, w, h)); + + return RedrawUser(gfxRect(x, y, w, h)); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::FillRect(float x, float y, float w, float h) +{ + if (!FloatValidate(x,y,w,h)) { + return NS_OK; + } + + bool doDrawShadow = NeedToDrawShadow(); + + const ContextState &state = CurrentState(); + + if (state.patternStyles[STYLE_FILL]) { + nsCanvasPatternAzure::RepeatMode repeat = + state.patternStyles[STYLE_FILL]->mRepeat; + // In the FillRect case repeat modes are easy to deal with. + bool limitx = repeat == nsCanvasPatternAzure::NOREPEAT || repeat == nsCanvasPatternAzure::REPEATY; + bool limity = repeat == nsCanvasPatternAzure::NOREPEAT || repeat == nsCanvasPatternAzure::REPEATX; + + IntSize patternSize = + state.patternStyles[STYLE_FILL]->mSurface->GetSize(); + + // We always need to execute painting for non-over operators, even if + // we end up with w/h = 0. + if (limitx) { + if (x < 0) { + w += x; + if (w < 0) { + w = 0; + } + + x = 0; + } + if (x + w > patternSize.width) { + w = patternSize.width - x; + if (w < 0) { + w = 0; + } + } + } + if (limity) { + if (y < 0) { + h += y; + if (h < 0) { + h = 0; + } + + y = 0; + } + if (y + h > patternSize.height) { + h = patternSize.height - y; + if (h < 0) { + h = 0; + } + } + } + } + + AdjustedTarget(this)->FillRect(mgfx::Rect(x, y, w, h), + GeneralPattern().ForStyle(this, STYLE_FILL, mTarget), + DrawOptions(state.globalAlpha, state.op)); + + return RedrawUser(gfxRect(x, y, w, h)); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::StrokeRect(float x, float y, float w, float h) +{ + if (!FloatValidate(x,y,w,h)) { + return NS_OK; + } + + const ContextState &state = CurrentState(); + + if (!w && !h) { + return NS_OK; + } else if (!h) { + CapStyle cap = CAP_BUTT; + if (state.lineJoin == JOIN_ROUND) { + cap = CAP_ROUND; + } + AdjustedTarget(this)-> + StrokeLine(Point(x, y), Point(x + w, y), + GeneralPattern().ForStyle(this, STYLE_STROKE, mTarget), + StrokeOptions(state.lineWidth, state.lineJoin, + cap, state.miterLimit), + DrawOptions(state.globalAlpha, state.op)); + return NS_OK; + } else if (!w) { + CapStyle cap = CAP_BUTT; + if (state.lineJoin == JOIN_ROUND) { + cap = CAP_ROUND; + } + AdjustedTarget(this)-> + StrokeLine(Point(x, y), Point(x, y + h), + GeneralPattern().ForStyle(this, STYLE_STROKE, mTarget), + StrokeOptions(state.lineWidth, state.lineJoin, + cap, state.miterLimit), + DrawOptions(state.globalAlpha, state.op)); + return NS_OK; + } + + AdjustedTarget(this)-> + StrokeRect(mgfx::Rect(x, y, w, h), + GeneralPattern().ForStyle(this, STYLE_STROKE, mTarget), + StrokeOptions(state.lineWidth, state.lineJoin, + state.lineCap, state.miterLimit), + DrawOptions(state.globalAlpha, state.op)); + + return Redraw(); +} + +// +// path bits +// + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::BeginPath() +{ + mPath = nsnull; + mPathBuilder = nsnull; + mDSPathBuilder = nsnull; + mPathTransformWillUpdate = false; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::ClosePath() +{ + EnsureWritablePath(); + + if (mPathBuilder) { + mPathBuilder->Close(); + } else { + mDSPathBuilder->Close(); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::Fill() +{ + EnsureUserSpacePath(); + + if (!mPath) { + return NS_OK; + } + + AdjustedTarget(this)-> + Fill(mPath, GeneralPattern().ForStyle(this, STYLE_FILL, mTarget), + DrawOptions(CurrentState().globalAlpha, CurrentState().op)); + + return Redraw(); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::Stroke() +{ + EnsureUserSpacePath(); + + if (!mPath) { + return NS_OK; + } + + const ContextState &state = CurrentState(); + + AdjustedTarget(this)-> + Stroke(mPath, GeneralPattern().ForStyle(this, STYLE_STROKE, mTarget), + StrokeOptions(state.lineWidth, state.lineJoin, + state.lineCap, state.miterLimit), + DrawOptions(state.globalAlpha, state.op)); + + return Redraw(); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::Clip() +{ + EnsureUserSpacePath(); + + if (!mPath) { + return NS_OK; + } + + mTarget->PushClip(mPath); + CurrentState().clipsPushed.push_back(mPath); + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::MoveTo(float x, float y) +{ + if (!FloatValidate(x,y)) + return NS_OK; + + EnsureWritablePath(); + + if (mPathBuilder) { + mPathBuilder->MoveTo(Point(x, y)); + } else { + mDSPathBuilder->MoveTo(mTarget->GetTransform() * Point(x, y)); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::LineTo(float x, float y) +{ + if (!FloatValidate(x,y)) + return NS_OK; + + EnsureWritablePath(); + + if (mPathBuilder) { + mPathBuilder->LineTo(Point(x, y)); + } else { + mDSPathBuilder->LineTo(mTarget->GetTransform() * Point(x, y)); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::QuadraticCurveTo(float cpx, float cpy, float x, float y) +{ + if (!FloatValidate(cpx, cpy, x, y)) { + return NS_OK; + } + + EnsureWritablePath(); + + if (mPathBuilder) { + mPathBuilder->QuadraticBezierTo(Point(cpx, cpy), Point(x, y)); + } else { + Matrix transform = mTarget->GetTransform(); + mDSPathBuilder->QuadraticBezierTo(transform * Point(cpx, cpy), transform * Point(cpx, cpy)); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::BezierCurveTo(float cp1x, float cp1y, + float cp2x, float cp2y, + float x, float y) +{ + if (!FloatValidate(cp1x, cp1y, cp2x, cp2y, x, y)) { + return NS_OK; + } + + EnsureWritablePath(); + + if (mPathBuilder) { + mPathBuilder->BezierTo(Point(cp1x, cp1y), Point(cp2x, cp2y), Point(x, y)); + } else { + Matrix transform = mTarget->GetTransform(); + mDSPathBuilder->BezierTo(transform * Point(cp1x, cp1y), + transform * Point(cp2x, cp2y), + transform * Point(x, y)); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::ArcTo(float x1, float y1, float x2, float y2, float radius) +{ + if (!FloatValidate(x1, y1, x2, y2, radius)) { + return NS_OK; + } + + if (radius < 0) { + return NS_ERROR_DOM_INDEX_SIZE_ERR; + } + + EnsureWritablePath(); + + // Current point in user space! + Point p0; + if (mPathBuilder) { + p0 = mPathBuilder->CurrentPoint(); + } else { + Matrix invTransform = mTarget->GetTransform(); + if (!invTransform.Invert()) { + return NS_OK; + } + + p0 = invTransform * mDSPathBuilder->CurrentPoint(); + } + + Point p1(x1, y1); + Point p2(x2, y2); + + // Execute these calculations in double precision to avoid cumulative + // rounding errors. + double dir, a2, b2, c2, cosx, sinx, d, anx, any, + bnx, bny, x3, y3, x4, y4, cx, cy, angle0, angle1; + bool anticlockwise; + + if (p0 == p1 || p1 == p2 || radius == 0) { + LineTo(p1.x, p1.y); + return NS_OK; + } + + // Check for colinearity + dir = (p2.x - p1.x) * (p0.y - p1.y) + (p2.y - p1.y) * (p1.x - p0.x); + if (dir == 0) { + LineTo(p1.x, p1.y); + return NS_OK; + } + + + // XXX - Math for this code was already available from the non-azure code + // and would be well tested. Perhaps converting to bezier directly might + // be more efficient longer run. + a2 = (p0.x-x1)*(p0.x-x1) + (p0.y-y1)*(p0.y-y1); + b2 = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2); + c2 = (p0.x-x2)*(p0.x-x2) + (p0.y-y2)*(p0.y-y2); + cosx = (a2+b2-c2)/(2*sqrt(a2*b2)); + + sinx = sqrt(1 - cosx*cosx); + d = radius / ((1 - cosx) / sinx); + + anx = (x1-p0.x) / sqrt(a2); + any = (y1-p0.y) / sqrt(a2); + bnx = (x1-x2) / sqrt(b2); + bny = (y1-y2) / sqrt(b2); + x3 = x1 - anx*d; + y3 = y1 - any*d; + x4 = x1 - bnx*d; + y4 = y1 - bny*d; + anticlockwise = (dir < 0); + cx = x3 + any*radius*(anticlockwise ? 1 : -1); + cy = y3 - anx*radius*(anticlockwise ? 1 : -1); + angle0 = atan2((y3-cy), (x3-cx)); + angle1 = atan2((y4-cy), (x4-cx)); + + + LineTo(x3, y3); + + Arc(cx, cy, radius, angle0, angle1, anticlockwise); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::Arc(float x, float y, + float r, + float startAngle, float endAngle, + PRBool ccw) +{ + if (!FloatValidate(x, y, r, startAngle, endAngle)) { + return NS_OK; + } + + if (r < 0.0) + return NS_ERROR_DOM_INDEX_SIZE_ERR; + + EnsureWritablePath(); + + // We convert to Bezier curve here, since we need to be able to write in + // device space, but a transformed arc is no longer representable by an arc. + + Point startPoint(x + cos(startAngle) * r, y + sin(startAngle) * r); + + if (mPathBuilder) { + mPathBuilder->LineTo(startPoint); + } else { + mDSPathBuilder->LineTo(mTarget->GetTransform() * startPoint); + } + + // Clockwise we always sweep from the smaller to the larger angle, ccw + // it's vice versa. + if (!ccw && (endAngle < startAngle)) { + Float correction = ceil((startAngle - endAngle) / (2.0f * M_PI)); + endAngle += correction * 2.0f * M_PI; + } else if (ccw && (startAngle < endAngle)) { + Float correction = ceil((endAngle - startAngle) / (2.0f * M_PI)); + startAngle += correction * 2.0f * M_PI; + } + + // Sweeping more than 2 * pi is a full circle. + if (!ccw && (endAngle - startAngle > 2 * M_PI)) { + endAngle = startAngle + 2.0f * M_PI; + } else if (ccw && (startAngle - endAngle > 2.0f * M_PI)) { + endAngle = startAngle - 2.0f * M_PI; + } + + // Calculate the total arc we're going to sweep. + Float arcSweepLeft = abs(endAngle - startAngle); + // Calculate the amount of curves needed, 1 per quarter circle. + Float curves = ceil(arcSweepLeft / (M_PI / 2.0f)); + + Float sweepDirection = ccw ? -1.0f : 1.0f; + + Float currentStartAngle = startAngle; + + while (arcSweepLeft > 0) { + // We guarantee here the current point is the start point of the next + // curve segment. + Float currentEndAngle; + + if (arcSweepLeft > M_PI / 2.0f) { + currentEndAngle = currentStartAngle + M_PI / 2.0f * sweepDirection; + } else { + currentEndAngle = currentStartAngle + arcSweepLeft * sweepDirection; + } + + Point currentStartPoint(x + cos(currentStartAngle) * r, + y + sin(currentStartAngle) * r); + Point currentEndPoint(x + cos(currentEndAngle) * r, + y + sin(currentEndAngle) * r); + + // Calculate kappa constant for partial curve. The sign of angle in the + // tangent will actually ensure this is negative for a counter clockwise + // sweep, so changing signs later isn't needed. + Float kappa = (4.0f / 3.0f) * tan((currentEndAngle - currentStartAngle) / 4.0f) * r; + + Point tangentStart(-sin(currentStartAngle), cos(currentStartAngle)); + Point cp1 = currentStartPoint; + cp1 += tangentStart * kappa; + + Point revTangentEnd(sin(currentEndAngle), -cos(currentEndAngle)); + Point cp2 = currentEndPoint; + cp2 += revTangentEnd * kappa; + + if (mPathBuilder) { + mPathBuilder->BezierTo(cp1, cp2, currentEndPoint); + } else { + mDSPathBuilder->BezierTo(mTarget->GetTransform() * cp1, + mTarget->GetTransform() * cp2, + mTarget->GetTransform() * currentEndPoint); + } + + arcSweepLeft -= M_PI / 2.0f; + currentStartAngle = currentEndAngle; + } + + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::Rect(float x, float y, float w, float h) +{ + if (!FloatValidate(x, y, w, h)) { + return NS_OK; + } + + EnsureWritablePath(); + + if (mPathBuilder) { + mPathBuilder->MoveTo(Point(x, y)); + mPathBuilder->LineTo(Point(x + w, y)); + mPathBuilder->LineTo(Point(x + w, y + h)); + mPathBuilder->LineTo(Point(x, y + h)); + mPathBuilder->Close(); + } else { + mDSPathBuilder->MoveTo(mTarget->GetTransform() * Point(x, y)); + mDSPathBuilder->LineTo(mTarget->GetTransform() * Point(x + w, y)); + mDSPathBuilder->LineTo(mTarget->GetTransform() * Point(x + w, y + h)); + mDSPathBuilder->LineTo(mTarget->GetTransform() * Point(x, y + h)); + mDSPathBuilder->Close(); + } + + return NS_OK; +} + +void +nsCanvasRenderingContext2DAzure::EnsureWritablePath() +{ + if (mDSPathBuilder) { + return; + } + + FillRule fillRule = CurrentState().fillRule; + + if (mPathBuilder) { + if (mPathTransformWillUpdate) { + mPath = mPathBuilder->Finish(); + mDSPathBuilder = + mPath->TransformedCopyToBuilder(mPathToDS, fillRule); + mPath = nsnull; + mPathBuilder = nsnull; + } + return; + } + + if (!mPath) { + mPathBuilder = mTarget->CreatePathBuilder(fillRule); + } else if (!mPathTransformWillUpdate) { + mPathBuilder = mPath->CopyToBuilder(fillRule); + } else { + mDSPathBuilder = + mPath->TransformedCopyToBuilder(mPathToDS, fillRule); + } +} + +void +nsCanvasRenderingContext2DAzure::EnsureUserSpacePath() +{ + FillRule fillRule = CurrentState().fillRule; + + if (!mPath && !mPathBuilder && !mDSPathBuilder) { + mPathBuilder = mTarget->CreatePathBuilder(fillRule); + } + + if (mPathBuilder) { + mPath = mPathBuilder->Finish(); + mPathBuilder = nsnull; + } + + if (mPath && mPathTransformWillUpdate) { + mDSPathBuilder = + mPath->TransformedCopyToBuilder(mPathToDS, fillRule); + mPath = nsnull; + mPathTransformWillUpdate = false; + } + + if (mDSPathBuilder) { + RefPtr dsPath; + dsPath = mDSPathBuilder->Finish(); + mDSPathBuilder = nsnull; + + Matrix inverse = mTarget->GetTransform(); + if (!inverse.Invert()) { + return; + } + + mPathBuilder = + dsPath->TransformedCopyToBuilder(inverse, fillRule); + mPath = mPathBuilder->Finish(); + mPathBuilder = nsnull; + } + + if (mPath && mPath->GetFillRule() != fillRule) { + mPathBuilder = mPath->CopyToBuilder(fillRule); + mPath = mPathBuilder->Finish(); + } +} + +void +nsCanvasRenderingContext2DAzure::TransformWillUpdate() +{ + // Store the matrix that would transform the current path to device + // space. + if (mPath || mPathBuilder) { + if (!mPathTransformWillUpdate) { + // If the transform has already been updated, but a device space builder + // has not been created yet mPathToDS contains the right transform to + // transform the current mPath into device space. + // We should leave it alone. + mPathToDS = mTarget->GetTransform(); + } + mPathTransformWillUpdate = true; + } +} + +// +// text +// + +/** + * Helper function for SetFont that creates a style rule for the given font. + * @param aFont The CSS font string + * @param aNode The canvas element + * @param aResult Pointer in which to place the new style rule. + * @remark Assumes all pointer arguments are non-null. + */ +static nsresult +CreateFontStyleRule(const nsAString& aFont, + nsINode* aNode, + StyleRule** aResult) +{ + nsRefPtr rule; + PRBool changed; + + nsIPrincipal* principal = aNode->NodePrincipal(); + nsIDocument* document = aNode->GetOwnerDoc(); + + nsIURI* docURL = document->GetDocumentURI(); + nsIURI* baseURL = document->GetDocBaseURI(); + + // Pass the CSS Loader object to the parser, to allow parser error reports + // to include the outer window ID. + nsCSSParser parser(document->CSSLoader()); + + nsresult rv = parser.ParseStyleAttribute(EmptyString(), docURL, baseURL, + principal, getter_AddRefs(rule)); + if (NS_FAILED(rv)) { + return rv; + } + + rv = parser.ParseProperty(eCSSProperty_font, aFont, docURL, baseURL, + principal, rule->GetDeclaration(), &changed, + PR_FALSE); + if (NS_FAILED(rv)) + return rv; + + rv = parser.ParseProperty(eCSSProperty_line_height, + NS_LITERAL_STRING("normal"), docURL, baseURL, + principal, rule->GetDeclaration(), &changed, + PR_FALSE); + if (NS_FAILED(rv)) { + return rv; + } + + rule->RuleMatched(); + + rule.forget(aResult); + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetFont(const nsAString& font) +{ + nsresult rv; + + /* + * If font is defined with relative units (e.g. ems) and the parent + * style context changes in between calls, setting the font to the + * same value as previous could result in a different computed value, + * so we cannot have the optimization where we check if the new font + * string is equal to the old one. + */ + + nsCOMPtr content = do_QueryInterface(mCanvasElement); + if (!content && !mDocShell) { + NS_WARNING("Canvas element must be an nsIContent and non-null or a docshell must be provided"); + return NS_ERROR_FAILURE; + } + + nsIPresShell* presShell = GetPresShell(); + if (!presShell) { + return NS_ERROR_FAILURE; + } + nsIDocument* document = presShell->GetDocument(); + + nsCOMArray rules; + + nsRefPtr rule; + rv = CreateFontStyleRule(font, document, getter_AddRefs(rule)); + + if (NS_FAILED(rv)) { + return rv; + } + + css::Declaration *declaration = rule->GetDeclaration(); + // The easiest way to see whether we got a syntax error or whether + // we got 'inherit' or 'initial' is to look at font-size-adjust, + // which the shorthand resets to either 'none' or + // '-moz-system-font'. + // We know the declaration is not !important, so we can use + // GetNormalBlock(). + const nsCSSValue *fsaVal = + declaration->GetNormalBlock()->ValueFor(eCSSProperty_font_size_adjust); + if (!fsaVal || (fsaVal->GetUnit() != eCSSUnit_None && + fsaVal->GetUnit() != eCSSUnit_System_Font)) { + // We got an all-property value or a syntax error. The spec says + // this value must be ignored. + return NS_OK; + } + + rules.AppendObject(rule); + + nsStyleSet* styleSet = presShell->StyleSet(); + + // have to get a parent style context for inherit-like relative + // values (2em, bolder, etc.) + nsRefPtr parentContext; + + if (content && content->IsInDoc()) { + // inherit from the canvas element + parentContext = nsComputedDOMStyle::GetStyleContextForElement( + content->AsElement(), + nsnull, + presShell); + } else { + // otherwise inherit from default (10px sans-serif) + nsRefPtr parentRule; + rv = CreateFontStyleRule(NS_LITERAL_STRING("10px sans-serif"), + document, + getter_AddRefs(parentRule)); + + if (NS_FAILED(rv)) { + return rv; + } + + nsCOMArray parentRules; + parentRules.AppendObject(parentRule); + parentContext = styleSet->ResolveStyleForRules(nsnull, parentRules); + } + + if (!parentContext) { + return NS_ERROR_FAILURE; + } + + nsRefPtr sc = + styleSet->ResolveStyleForRules(parentContext, rules); + if (!sc) { + return NS_ERROR_FAILURE; + } + + const nsStyleFont* fontStyle = sc->GetStyleFont(); + + NS_ASSERTION(fontStyle, "Could not obtain font style"); + + nsIAtom* language = sc->GetStyleVisibility()->mLanguage; + if (!language) { + language = presShell->GetPresContext()->GetLanguageFromCharset(); + } + + // use CSS pixels instead of dev pixels to avoid being affected by page zoom + const PRUint32 aupcp = nsPresContext::AppUnitsPerCSSPixel(); + // un-zoom the font size to avoid being affected by text-only zoom + const nscoord fontSize = nsStyleFont::UnZoomText(parentContext->PresContext(), fontStyle->mFont.size); + + PRBool printerFont = (presShell->GetPresContext()->Type() == nsPresContext::eContext_PrintPreview || + presShell->GetPresContext()->Type() == nsPresContext::eContext_Print); + + gfxFontStyle style(fontStyle->mFont.style, + fontStyle->mFont.weight, + fontStyle->mFont.stretch, + NSAppUnitsToFloatPixels(fontSize, float(aupcp)), + language, + fontStyle->mFont.sizeAdjust, + fontStyle->mFont.systemFont, + printerFont, + fontStyle->mFont.featureSettings, + fontStyle->mFont.languageOverride); + + CurrentState().fontGroup = + gfxPlatform::GetPlatform()->CreateFontGroup(fontStyle->mFont.name, + &style, + presShell->GetPresContext()->GetUserFontSet()); + NS_ASSERTION(CurrentState().fontGroup, "Could not get font group"); + + // The font getter is required to be reserialized based on what we + // parsed (including having line-height removed). (Older drafts of + // the spec required font sizes be converted to pixels, but that no + // longer seems to be required.) + declaration->GetValue(eCSSProperty_font, CurrentState().font); + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetFont(nsAString& font) +{ + /* will initilize the value if not set, else does nothing */ + GetCurrentFontStyle(); + + font = CurrentState().font; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetTextAlign(const nsAString& ta) +{ + if (ta.EqualsLiteral("start")) + CurrentState().textAlign = TEXT_ALIGN_START; + else if (ta.EqualsLiteral("end")) + CurrentState().textAlign = TEXT_ALIGN_END; + else if (ta.EqualsLiteral("left")) + CurrentState().textAlign = TEXT_ALIGN_LEFT; + else if (ta.EqualsLiteral("right")) + CurrentState().textAlign = TEXT_ALIGN_RIGHT; + else if (ta.EqualsLiteral("center")) + CurrentState().textAlign = TEXT_ALIGN_CENTER; + // spec says to not throw error for invalid arg, but do it anyway + else + return NS_ERROR_INVALID_ARG; + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetTextAlign(nsAString& ta) +{ + switch (CurrentState().textAlign) + { + case TEXT_ALIGN_START: + ta.AssignLiteral("start"); + break; + case TEXT_ALIGN_END: + ta.AssignLiteral("end"); + break; + case TEXT_ALIGN_LEFT: + ta.AssignLiteral("left"); + break; + case TEXT_ALIGN_RIGHT: + ta.AssignLiteral("right"); + break; + case TEXT_ALIGN_CENTER: + ta.AssignLiteral("center"); + break; + default: + NS_ERROR("textAlign holds invalid value"); + return NS_ERROR_FAILURE; + } + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetTextBaseline(const nsAString& tb) +{ + if (tb.EqualsLiteral("top")) + CurrentState().textBaseline = TEXT_BASELINE_TOP; + else if (tb.EqualsLiteral("hanging")) + CurrentState().textBaseline = TEXT_BASELINE_HANGING; + else if (tb.EqualsLiteral("middle")) + CurrentState().textBaseline = TEXT_BASELINE_MIDDLE; + else if (tb.EqualsLiteral("alphabetic")) + CurrentState().textBaseline = TEXT_BASELINE_ALPHABETIC; + else if (tb.EqualsLiteral("ideographic")) + CurrentState().textBaseline = TEXT_BASELINE_IDEOGRAPHIC; + else if (tb.EqualsLiteral("bottom")) + CurrentState().textBaseline = TEXT_BASELINE_BOTTOM; + // spec says to not throw error for invalid arg, but do it anyway + else + return NS_ERROR_INVALID_ARG; + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetTextBaseline(nsAString& tb) +{ + switch (CurrentState().textBaseline) + { + case TEXT_BASELINE_TOP: + tb.AssignLiteral("top"); + break; + case TEXT_BASELINE_HANGING: + tb.AssignLiteral("hanging"); + break; + case TEXT_BASELINE_MIDDLE: + tb.AssignLiteral("middle"); + break; + case TEXT_BASELINE_ALPHABETIC: + tb.AssignLiteral("alphabetic"); + break; + case TEXT_BASELINE_IDEOGRAPHIC: + tb.AssignLiteral("ideographic"); + break; + case TEXT_BASELINE_BOTTOM: + tb.AssignLiteral("bottom"); + break; + default: + NS_ERROR("textBaseline holds invalid value"); + return NS_ERROR_FAILURE; + } + + return NS_OK; +} + +/* + * Helper function that replaces the whitespace characters in a string + * with U+0020 SPACE. The whitespace characters are defined as U+0020 SPACE, + * U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), U+000B LINE + * TABULATION, U+000C FORM FEED (FF), and U+000D CARRIAGE RETURN (CR). + * @param str The string whose whitespace characters to replace. + */ +static inline void +TextReplaceWhitespaceCharacters(nsAutoString& str) +{ + str.ReplaceChar("\x09\x0A\x0B\x0C\x0D", PRUnichar(' ')); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::FillText(const nsAString& text, float x, float y, float maxWidth) +{ + return DrawOrMeasureText(text, x, y, maxWidth, TEXT_DRAW_OPERATION_FILL, nsnull); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::StrokeText(const nsAString& text, float x, float y, float maxWidth) +{ + return DrawOrMeasureText(text, x, y, maxWidth, TEXT_DRAW_OPERATION_STROKE, nsnull); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::MeasureText(const nsAString& rawText, + nsIDOMTextMetrics** _retval) +{ + float width; + + nsresult rv = DrawOrMeasureText(rawText, 0, 0, 0, TEXT_DRAW_OPERATION_MEASURE, &width); + + if (NS_FAILED(rv)) { + return rv; + } + + nsRefPtr textMetrics = new nsTextMetricsAzure(width); + if (!textMetrics.get()) { + return NS_ERROR_OUT_OF_MEMORY; + } + + *_retval = textMetrics.forget().get(); + + return NS_OK; +} + +/** + * Used for nsBidiPresUtils::ProcessText + */ +struct NS_STACK_CLASS nsCanvasBidiProcessorAzure : public nsBidiPresUtils::BidiProcessor +{ + virtual void SetText(const PRUnichar* text, PRInt32 length, nsBidiDirection direction) + { + mTextRun = gfxTextRunCache::MakeTextRun(text, + length, + mFontgrp, + mThebes, + mAppUnitsPerDevPixel, + direction==NSBIDI_RTL ? gfxTextRunFactory::TEXT_IS_RTL : 0); + } + + virtual nscoord GetWidth() + { + gfxTextRun::Metrics textRunMetrics = mTextRun->MeasureText(0, + mTextRun->GetLength(), + mDoMeasureBoundingBox ? + gfxFont::TIGHT_INK_EXTENTS : + gfxFont::LOOSE_INK_EXTENTS, + mThebes, + nsnull); + + // this only measures the height; the total width is gotten from the + // the return value of ProcessText. + if (mDoMeasureBoundingBox) { + textRunMetrics.mBoundingBox.Scale(1.0 / mAppUnitsPerDevPixel); + mBoundingBox = mBoundingBox.Union(textRunMetrics.mBoundingBox); + } + + return static_cast(textRunMetrics.mAdvanceWidth/gfxFloat(mAppUnitsPerDevPixel)); + } + + virtual void DrawText(nscoord xOffset, nscoord width) + { + gfxPoint point = mPt; + point.x += xOffset * mAppUnitsPerDevPixel; + + // offset is given in terms of left side of string + if (mTextRun->IsRightToLeft()) { + // Bug 581092 - don't use rounded pixel width to advance to + // right-hand end of run, because this will cause different + // glyph positioning for LTR vs RTL drawing of the same + // glyph string on OS X and DWrite where textrun widths may + // involve fractional pixels. + gfxTextRun::Metrics textRunMetrics = + mTextRun->MeasureText(0, + mTextRun->GetLength(), + mDoMeasureBoundingBox ? + gfxFont::TIGHT_INK_EXTENTS : + gfxFont::LOOSE_INK_EXTENTS, + mThebes, + nsnull); + point.x += textRunMetrics.mAdvanceWidth; + // old code was: + // point.x += width * mAppUnitsPerDevPixel; + // TODO: restore this if/when we move to fractional coords + // throughout the text layout process + } + + PRUint32 numRuns; + const gfxTextRun::GlyphRun *runs = mTextRun->GetGlyphRuns(&numRuns); + const PRUint32 appUnitsPerDevUnit = mAppUnitsPerDevPixel; + const double devUnitsPerAppUnit = 1.0/double(appUnitsPerDevUnit); + Point baselineOrigin = + Point(point.x * devUnitsPerAppUnit, point.y * devUnitsPerAppUnit); + + for (int c = 0; c < numRuns; c++) { + gfxFont *font = runs[c].mFont; + PRUint32 endRun = 0; + if (c + 1 < numRuns) { + endRun = runs[c + 1].mCharacterOffset; + } else { + endRun = mTextRun->GetLength(); + } + + const gfxTextRun::CompressedGlyph *glyphs = mTextRun->GetCharacterGlyphs(); + + RefPtr scaledFont = + gfxPlatform::GetPlatform()->GetScaledFontForFont(font); + + GlyphBuffer buffer; + + std::vector glyphBuf; + + float advanceSum = 0; + + for (int i = runs[c].mCharacterOffset; i < endRun; i++) { + Glyph newGlyph; + if (glyphs[i].IsSimpleGlyph()) { + newGlyph.mIndex = glyphs[i].GetSimpleGlyph(); + if (mTextRun->IsRightToLeft()) { + newGlyph.mPosition.x = baselineOrigin.x - advanceSum - + glyphs[i].GetSimpleAdvance() * devUnitsPerAppUnit; + } else { + newGlyph.mPosition.x = baselineOrigin.x + advanceSum; + } + newGlyph.mPosition.y = baselineOrigin.y; + advanceSum += glyphs[i].GetSimpleAdvance() * devUnitsPerAppUnit; + glyphBuf.push_back(newGlyph); + continue; + } + + if (!glyphs[i].GetGlyphCount()) { + continue; + } + + gfxTextRun::DetailedGlyph *detailedGlyphs = + mTextRun->GetDetailedGlyphs(i); + + for (int c = 0; c < glyphs[i].GetGlyphCount(); c++) { + newGlyph.mIndex = detailedGlyphs[c].mGlyphID; + if (mTextRun->IsRightToLeft()) { + newGlyph.mPosition.x = baselineOrigin.x + detailedGlyphs[c].mXOffset * devUnitsPerAppUnit - + advanceSum - detailedGlyphs[c].mAdvance * devUnitsPerAppUnit; + } else { + newGlyph.mPosition.x = baselineOrigin.x + detailedGlyphs[c].mXOffset * devUnitsPerAppUnit + advanceSum; + } + newGlyph.mPosition.y = baselineOrigin.y + detailedGlyphs[c].mYOffset * devUnitsPerAppUnit; + glyphBuf.push_back(newGlyph); + advanceSum += detailedGlyphs[c].mAdvance * devUnitsPerAppUnit; + } + } + + if (!glyphBuf.size()) { + // This may happen for glyph runs for a 0 size font. + continue; + } + + buffer.mGlyphs = &glyphBuf.front(); + buffer.mNumGlyphs = glyphBuf.size(); + + if (mOp == nsCanvasRenderingContext2DAzure::TEXT_DRAW_OPERATION_FILL) { + nsCanvasRenderingContext2DAzure::AdjustedTarget(mCtx)-> + FillGlyphs(scaledFont, buffer, + nsCanvasRenderingContext2DAzure::GeneralPattern(). + ForStyle(mCtx, nsCanvasRenderingContext2DAzure::STYLE_FILL, mCtx->mTarget), + DrawOptions(mState->globalAlpha, mState->op)); + } else if (mOp == nsCanvasRenderingContext2DAzure::TEXT_DRAW_OPERATION_STROKE) { + RefPtr path = scaledFont->GetPathForGlyphs(buffer, mCtx->mTarget); + + Matrix oldTransform = mCtx->mTarget->GetTransform(); + + nsCanvasRenderingContext2DAzure::AdjustedTarget(mCtx)-> + Stroke(path, nsCanvasRenderingContext2DAzure::GeneralPattern(). + ForStyle(mCtx, nsCanvasRenderingContext2DAzure::STYLE_STROKE, mCtx->mTarget), + StrokeOptions(mCtx->CurrentState().lineWidth, mCtx->CurrentState().lineJoin, + mCtx->CurrentState().lineCap, mCtx->CurrentState().miterLimit), + DrawOptions(mState->globalAlpha, mState->op)); + + } + } + } + + // current text run + gfxTextRunCache::AutoTextRun mTextRun; + + // pointer to a screen reference context used to measure text and such + nsRefPtr mThebes; + + // Pointer to the draw target we should fill our text to + nsCanvasRenderingContext2DAzure *mCtx; + + // position of the left side of the string, alphabetic baseline + gfxPoint mPt; + + // current font + gfxFontGroup* mFontgrp; + + // dev pixel conversion factor + PRUint32 mAppUnitsPerDevPixel; + + // operation (fill or stroke) + nsCanvasRenderingContext2DAzure::TextDrawOperation mOp; + + // context state + nsCanvasRenderingContext2DAzure::ContextState *mState; + + // union of bounding boxes of all runs, needed for shadows + gfxRect mBoundingBox; + + // true iff the bounding box should be measured + PRBool mDoMeasureBoundingBox; +}; + +nsresult +nsCanvasRenderingContext2DAzure::DrawOrMeasureText(const nsAString& aRawText, + float aX, + float aY, + float aMaxWidth, + TextDrawOperation aOp, + float* aWidth) +{ + nsresult rv; + + if (!FloatValidate(aX, aY, aMaxWidth)) + return NS_ERROR_DOM_SYNTAX_ERR; + + // spec isn't clear on what should happen if aMaxWidth <= 0, so + // treat it as an invalid argument + // technically, 0 should be an invalid value as well, but 0 is the default + // arg, and there is no way to tell if the default was used + if (aMaxWidth < 0) + return NS_ERROR_INVALID_ARG; + + nsCOMPtr content = do_QueryInterface(mCanvasElement); + if (!content && !mDocShell) { + NS_WARNING("Canvas element must be an nsIContent and non-null or a docshell must be provided"); + return NS_ERROR_FAILURE; + } + + nsIPresShell* presShell = GetPresShell(); + if (!presShell) + return NS_ERROR_FAILURE; + + nsIDocument* document = presShell->GetDocument(); + + nsBidiPresUtils* bidiUtils = presShell->GetPresContext()->GetBidiUtils(); + if (!bidiUtils) { + return NS_ERROR_FAILURE; + } + + // replace all the whitespace characters with U+0020 SPACE + nsAutoString textToDraw(aRawText); + TextReplaceWhitespaceCharacters(textToDraw); + + // for now, default to ltr if not in doc + PRBool isRTL = PR_FALSE; + + if (content && content->IsInDoc()) { + // try to find the closest context + nsRefPtr canvasStyle = + nsComputedDOMStyle::GetStyleContextForElement(content->AsElement(), + nsnull, + presShell); + if (!canvasStyle) { + return NS_ERROR_FAILURE; + } + + isRTL = canvasStyle->GetStyleVisibility()->mDirection == + NS_STYLE_DIRECTION_RTL; + } else { + isRTL = GET_BIDI_OPTION_DIRECTION(document->GetBidiOptions()) == IBMBIDI_TEXTDIRECTION_RTL; + } + + const ContextState &state = CurrentState(); + + // This is only needed to know if we can know the drawing bounding box easily. + PRBool doDrawShadow = aOp == TEXT_DRAW_OPERATION_FILL && NeedToDrawShadow(); + + nsCanvasBidiProcessorAzure processor; + + GetAppUnitsValues(&processor.mAppUnitsPerDevPixel, nsnull); + processor.mPt = gfxPoint(aX, aY); + processor.mThebes = + new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface()); + Matrix matrix = mTarget->GetTransform(); + processor.mThebes->SetMatrix(gfxMatrix(matrix._11, matrix._12, matrix._21, matrix._22, matrix._31, matrix._32)); + processor.mCtx = this; + processor.mOp = aOp; + processor.mBoundingBox = gfxRect(0, 0, 0, 0); + processor.mDoMeasureBoundingBox = doDrawShadow || !mIsEntireFrameInvalid; + processor.mState = &CurrentState(); + + + processor.mFontgrp = GetCurrentFontStyle(); + NS_ASSERTION(processor.mFontgrp, "font group is null"); + + nscoord totalWidth; + + // calls bidi algo twice since it needs the full text width and the + // bounding boxes before rendering anything + rv = bidiUtils->ProcessText(textToDraw.get(), + textToDraw.Length(), + isRTL ? NSBIDI_RTL : NSBIDI_LTR, + presShell->GetPresContext(), + processor, + nsBidiPresUtils::MODE_MEASURE, + nsnull, + 0, + &totalWidth); + if (NS_FAILED(rv)) { + return rv; + } + + if (aWidth) { + *aWidth = static_cast(totalWidth); + } + + // if only measuring, don't need to do any more work + if (aOp==TEXT_DRAW_OPERATION_MEASURE) { + return NS_OK; + } + + // offset pt.x based on text align + gfxFloat anchorX; + + if (state.textAlign == TEXT_ALIGN_CENTER) { + anchorX = .5; + } else if (state.textAlign == TEXT_ALIGN_LEFT || + (!isRTL && state.textAlign == TEXT_ALIGN_START) || + (isRTL && state.textAlign == TEXT_ALIGN_END)) { + anchorX = 0; + } else { + anchorX = 1; + } + + processor.mPt.x -= anchorX * totalWidth; + + // offset pt.y based on text baseline + NS_ASSERTION(processor.mFontgrp->FontListLength()>0, "font group contains no fonts"); + const gfxFont::Metrics& fontMetrics = processor.mFontgrp->GetFontAt(0)->GetMetrics(); + + gfxFloat anchorY; + + switch (state.textBaseline) + { + case TEXT_BASELINE_HANGING: + // fall through; best we can do with the information available + case TEXT_BASELINE_TOP: + anchorY = fontMetrics.emAscent; + break; + break; + case TEXT_BASELINE_MIDDLE: + anchorY = (fontMetrics.emAscent - fontMetrics.emDescent) * .5f; + break; + case TEXT_BASELINE_IDEOGRAPHIC: + // fall through; best we can do with the information available + case TEXT_BASELINE_ALPHABETIC: + anchorY = 0; + break; + case TEXT_BASELINE_BOTTOM: + anchorY = -fontMetrics.emDescent; + break; + default: + NS_ERROR("mTextBaseline holds invalid value"); + return NS_ERROR_FAILURE; + } + + processor.mPt.y += anchorY; + + // correct bounding box to get it to be the correct size/position + processor.mBoundingBox.width = totalWidth; + processor.mBoundingBox.MoveBy(processor.mPt); + + processor.mPt.x *= processor.mAppUnitsPerDevPixel; + processor.mPt.y *= processor.mAppUnitsPerDevPixel; + + Matrix oldTransform = mTarget->GetTransform(); + // if text is over aMaxWidth, then scale the text horizontally such that its + // width is precisely aMaxWidth + if (aMaxWidth > 0 && totalWidth > aMaxWidth) { + Matrix newTransform = oldTransform; + + // Translate so that the anchor point is at 0,0, then scale and then + // translate back. + newTransform.Translate(aX, 0); + newTransform.Scale(aMaxWidth / totalWidth, 1); + newTransform.Translate(-aX, 0); + /* we do this to avoid an ICE in the android compiler */ + Matrix androidCompilerBug = newTransform; + mTarget->SetTransform(androidCompilerBug); + } + + // save the previous bounding box + gfxRect boundingBox = processor.mBoundingBox; + + // don't ever need to measure the bounding box twice + processor.mDoMeasureBoundingBox = PR_FALSE; + + rv = bidiUtils->ProcessText(textToDraw.get(), + textToDraw.Length(), + isRTL ? NSBIDI_RTL : NSBIDI_LTR, + presShell->GetPresContext(), + processor, + nsBidiPresUtils::MODE_DRAW, + nsnull, + 0, + nsnull); + + + mTarget->SetTransform(oldTransform); + + if (aOp == nsCanvasRenderingContext2DAzure::TEXT_DRAW_OPERATION_FILL && !doDrawShadow) + return RedrawUser(boundingBox); + + return Redraw(); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetMozTextStyle(const nsAString& textStyle) +{ + // font and mozTextStyle are the same value + return SetFont(textStyle); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetMozTextStyle(nsAString& textStyle) +{ + // font and mozTextStyle are the same value + return GetFont(textStyle); +} + +gfxFontGroup *nsCanvasRenderingContext2DAzure::GetCurrentFontStyle() +{ + // use lazy initilization for the font group since it's rather expensive + if (!CurrentState().fontGroup) { + nsresult rv = SetFont(kDefaultFontStyle); + if (NS_FAILED(rv)) { + gfxFontStyle style; + style.size = kDefaultFontSize; + CurrentState().fontGroup = + gfxPlatform::GetPlatform()->CreateFontGroup(kDefaultFontName, + &style, + nsnull); + if (CurrentState().fontGroup) { + CurrentState().font = kDefaultFontStyle; + rv = NS_OK; + } else { + rv = NS_ERROR_OUT_OF_MEMORY; + } + } + + NS_ASSERTION(NS_SUCCEEDED(rv), "Default canvas font is invalid"); + } + + return CurrentState().fontGroup; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::MozDrawText(const nsAString& textToDraw) +{ + return NS_ERROR_DOM_NOT_SUPPORTED_ERR; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::MozMeasureText(const nsAString& textToMeasure, float *retVal) +{ + return NS_ERROR_DOM_NOT_SUPPORTED_ERR; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::MozPathText(const nsAString& textToPath) +{ + return NS_ERROR_DOM_NOT_SUPPORTED_ERR; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::MozTextAlongPath(const nsAString& textToDraw, PRBool stroke) +{ + return NS_ERROR_DOM_NOT_SUPPORTED_ERR; +} + +// +// line caps/joins +// +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetLineWidth(float width) +{ + if (!FloatValidate(width) || width <= 0.0) { + return NS_OK; + } + + CurrentState().lineWidth = width; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetLineWidth(float *width) +{ + *width = CurrentState().lineWidth; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetLineCap(const nsAString& capstyle) +{ + CapStyle cap; + + if (capstyle.EqualsLiteral("butt")) { + cap = CAP_BUTT; + } else if (capstyle.EqualsLiteral("round")) { + cap = CAP_ROUND; + } else if (capstyle.EqualsLiteral("square")) { + cap = CAP_SQUARE; + } else { + // XXX ERRMSG we need to report an error to developers here! (bug 329026) + return NS_OK; + } + + CurrentState().lineCap = cap; + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetLineCap(nsAString& capstyle) +{ + switch (CurrentState().lineCap) { + case CAP_BUTT: + capstyle.AssignLiteral("butt"); + break; + case CAP_ROUND: + capstyle.AssignLiteral("round"); + break; + case CAP_SQUARE: + capstyle.AssignLiteral("square"); + break; + default: + return NS_ERROR_FAILURE; + } + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetLineJoin(const nsAString& joinstyle) +{ + JoinStyle j; + + if (joinstyle.EqualsLiteral("round")) { + j = JOIN_ROUND; + } else if (joinstyle.EqualsLiteral("bevel")) { + j = JOIN_BEVEL; + } else if (joinstyle.EqualsLiteral("miter")) { + j = JOIN_MITER_OR_BEVEL; + } else { + // XXX ERRMSG we need to report an error to developers here! (bug 329026) + return NS_OK; + } + + CurrentState().lineJoin = j; + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetLineJoin(nsAString& joinstyle) +{ + switch (CurrentState().lineJoin) { + case JOIN_ROUND: + joinstyle.AssignLiteral("round"); + break; + case JOIN_BEVEL: + joinstyle.AssignLiteral("bevel"); + break; + case JOIN_MITER_OR_BEVEL: + joinstyle.AssignLiteral("miter"); + break; + default: + return NS_ERROR_FAILURE; + } + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetMiterLimit(float miter) +{ + if (!FloatValidate(miter) || miter <= 0.0) + return NS_OK; + + CurrentState().miterLimit = miter; + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetMiterLimit(float *miter) +{ + *miter = CurrentState().miterLimit; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::IsPointInPath(float x, float y, PRBool *retVal) +{ + if (!FloatValidate(x,y)) { + *retVal = PR_FALSE; + return NS_OK; + } + + EnsureUserSpacePath(); + + *retVal = PR_FALSE; + + if (mPath) { + *retVal = mPath->ContainsPoint(Point(x, y), mTarget->GetTransform()); + } + + return NS_OK; +} + +// +// image +// + +// drawImage(in HTMLImageElement image, in float dx, in float dy); +// -- render image from 0,0 at dx,dy top-left coords +// drawImage(in HTMLImageElement image, in float dx, in float dy, in float sw, in float sh); +// -- render image from 0,0 at dx,dy top-left coords clipping it to sw,sh +// drawImage(in HTMLImageElement image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh); +// -- render the region defined by (sx,sy,sw,wh) in image-local space into the region (dx,dy,dw,dh) on the canvas + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::DrawImage(nsIDOMElement *imgElt, float a1, + float a2, float a3, float a4, float a5, + float a6, float a7, float a8, + PRUint8 optional_argc) +{ + if (!imgElt) { + return NS_ERROR_DOM_TYPE_MISMATCH_ERR; + } + + if (optional_argc == 0) { + if (!FloatValidate(a1, a2)) { + return NS_OK; + } + } else if (optional_argc == 2) { + if (!FloatValidate(a1, a2, a3, a4)) { + return NS_OK; + } + } else if (optional_argc == 6) { + if (!FloatValidate(a1, a2, a3, a4, a5, a6) || !FloatValidate(a7, a8)) { + return NS_OK; + } + } + + double sx,sy,sw,sh; + double dx,dy,dw,dh; + + nsCOMPtr content = do_QueryInterface(imgElt); + nsHTMLCanvasElement* canvas = nsHTMLCanvasElement::FromContent(content); + if (canvas) { + nsIntSize size = canvas->GetSize(); + if (size.width == 0 || size.height == 0) { + return NS_ERROR_DOM_INVALID_STATE_ERR; + } + } + + RefPtr srcSurf; + + gfxIntSize imgSize; + nsRefPtr imgsurf = + CanvasImageCache::Lookup(imgElt, HTMLCanvasElement(), &imgSize); + + if (imgsurf) { + srcSurf = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mTarget, imgsurf); + } + + // We know an Azure canvas always has an HTMLCanvasElement! + if (canvas == HTMLCanvasElement()) { + // Self-copy. + srcSurf = mTarget->Snapshot(); + imgSize = gfxIntSize(mWidth, mHeight); + } + + if (!srcSurf) { + // The canvas spec says that drawImage should draw the first frame + // of animated images + PRUint32 sfeFlags = nsLayoutUtils::SFE_WANT_FIRST_FRAME; + nsLayoutUtils::SurfaceFromElementResult res = + nsLayoutUtils::SurfaceFromElement(imgElt, sfeFlags); + + if (!res.mSurface) { + // Spec says to silently do nothing if the element is still loading. + return res.mIsStillLoading ? NS_OK : NS_ERROR_NOT_AVAILABLE; + } + + // Ignore nsnull cairo surfaces! See bug 666312. + if (!res.mSurface->CairoSurface()) { + return NS_OK; + } + + imgsurf = res.mSurface.forget(); + imgSize = res.mSize; + + if (mCanvasElement) { + CanvasUtils::DoDrawImageSecurityCheck(HTMLCanvasElement(), + res.mPrincipal, res.mIsWriteOnly); + } + + if (res.mImageRequest) { + CanvasImageCache::NotifyDrawImage(imgElt, HTMLCanvasElement(), + res.mImageRequest, imgsurf, imgSize); + } + + srcSurf = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mTarget, imgsurf); + } + + if (optional_argc == 0) { + dx = a1; + dy = a2; + sx = sy = 0.0; + dw = sw = (double) imgSize.width; + dh = sh = (double) imgSize.height; + } else if (optional_argc == 2) { + dx = a1; + dy = a2; + dw = a3; + dh = a4; + sx = sy = 0.0; + sw = (double) imgSize.width; + sh = (double) imgSize.height; + } else if (optional_argc == 6) { + sx = a1; + sy = a2; + sw = a3; + sh = a4; + dx = a5; + dy = a6; + dw = a7; + dh = a8; + } else { + // XXX ERRMSG we need to report an error to developers here! (bug 329026) + return NS_ERROR_INVALID_ARG; + } + + if (sw == 0.0 || sh == 0.0) { + // zero-sized source -- failure !? + return NS_ERROR_DOM_INDEX_SIZE_ERR; + } + + if (dw == 0.0 || dh == 0.0) { + // not really failure, but nothing to do -- + // and noone likes a divide-by-zero + return NS_OK; + } + + // Handle negative sw, sh, dw and dh by flipping the rectangle over in the + // relevant direction. + if (sw < 0.0) { + sx += sw; + sw = -sw; + } + if (sh < 0.0) { + sy += sh; + sh = -sh; + } + if (dw < 0.0) { + dx += dw; + dw = -dw; + } + if (dh < 0.0) { + dy += dh; + dh = -dh; + } + + // Checking source image boundaries. + if (sx < 0 || sx + sw > (double) imgSize.width || + sy < 0 || sy + sh > (double) imgSize.height) { + return NS_ERROR_DOM_INDEX_SIZE_ERR; + } + + Filter filter; + + if (CurrentState().imageSmoothingEnabled) + filter = mgfx::FILTER_LINEAR; + else + filter = mgfx::FILTER_POINT; + + AdjustedTarget(this)-> + DrawSurface(srcSurf, + mgfx::Rect(dx, dy, dw, dh), + mgfx::Rect(sx, sy, sw, sh), + DrawSurfaceOptions(filter), + DrawOptions(CurrentState().globalAlpha, CurrentState().op)); + + return RedrawUser(gfxRect(dx, dy, dw, dh)); +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetGlobalCompositeOperation(const nsAString& op) +{ + CompositionOp comp_op; + +#define CANVAS_OP_TO_GFX_OP(cvsop, op2d) \ + if (op.EqualsLiteral(cvsop)) \ + comp_op = OP_##op2d; + + CANVAS_OP_TO_GFX_OP("copy", SOURCE) + else CANVAS_OP_TO_GFX_OP("source-atop", ATOP) + else CANVAS_OP_TO_GFX_OP("source-in", IN) + else CANVAS_OP_TO_GFX_OP("source-out", OUT) + else CANVAS_OP_TO_GFX_OP("source-over", OVER) + else CANVAS_OP_TO_GFX_OP("destination-in", DEST_IN) + else CANVAS_OP_TO_GFX_OP("destination-out", DEST_OUT) + else CANVAS_OP_TO_GFX_OP("destination-over", DEST_OVER) + else CANVAS_OP_TO_GFX_OP("destination-atop", DEST_ATOP) + else CANVAS_OP_TO_GFX_OP("lighter", ADD) + else CANVAS_OP_TO_GFX_OP("xor", XOR) + // XXX ERRMSG we need to report an error to developers here! (bug 329026) + else return NS_OK; + +#undef CANVAS_OP_TO_GFX_OP + CurrentState().op = comp_op; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetGlobalCompositeOperation(nsAString& op) +{ + CompositionOp comp_op = CurrentState().op; + +#define CANVAS_OP_TO_GFX_OP(cvsop, op2d) \ + if (comp_op == OP_##op2d) \ + op.AssignLiteral(cvsop); + + CANVAS_OP_TO_GFX_OP("copy", SOURCE) + else CANVAS_OP_TO_GFX_OP("destination-atop", DEST_ATOP) + else CANVAS_OP_TO_GFX_OP("destination-in", DEST_IN) + else CANVAS_OP_TO_GFX_OP("destination-out", DEST_OUT) + else CANVAS_OP_TO_GFX_OP("destination-over", DEST_OVER) + else CANVAS_OP_TO_GFX_OP("lighter", ADD) + else CANVAS_OP_TO_GFX_OP("source-atop", ATOP) + else CANVAS_OP_TO_GFX_OP("source-in", IN) + else CANVAS_OP_TO_GFX_OP("source-out", OUT) + else CANVAS_OP_TO_GFX_OP("source-over", OVER) + else CANVAS_OP_TO_GFX_OP("xor", XOR) + else return NS_ERROR_FAILURE; + +#undef CANVAS_OP_TO_GFX_OP + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::DrawWindow(nsIDOMWindow* aWindow, float aX, float aY, + float aW, float aH, + const nsAString& aBGColor, + PRUint32 flags) +{ + NS_ENSURE_ARG(aWindow != nsnull); + + // protect against too-large surfaces that will cause allocation + // or overflow issues + if (!gfxASurface::CheckSurfaceSize(gfxIntSize(PRInt32(aW), PRInt32(aH)), + 0xffff)) + return NS_ERROR_FAILURE; + + nsRefPtr drawSurf; + GetThebesSurface(getter_AddRefs(drawSurf)); + + nsRefPtr thebes = new gfxContext(drawSurf); + + Matrix matrix = mTarget->GetTransform(); + thebes->SetMatrix(gfxMatrix(matrix._11, matrix._12, matrix._21, + matrix._22, matrix._31, matrix._32)); + + // We can't allow web apps to call this until we fix at least the + // following potential security issues: + // -- rendering cross-domain IFRAMEs and then extracting the results + // -- rendering the user's theme and then extracting the results + // -- rendering native anonymous content (e.g., file input paths; + // scrollbars should be allowed) + if (!nsContentUtils::IsCallerTrustedForRead()) { + // not permitted to use DrawWindow + // XXX ERRMSG we need to report an error to developers here! (bug 329026) + return NS_ERROR_DOM_SECURITY_ERR; + } + + // Flush layout updates + if (!(flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DO_NOT_FLUSH)) + nsContentUtils::FlushLayoutForTree(aWindow); + + nsRefPtr presContext; + nsCOMPtr win = do_QueryInterface(aWindow); + if (win) { + nsIDocShell* docshell = win->GetDocShell(); + if (docshell) { + docshell->GetPresContext(getter_AddRefs(presContext)); + } + } + if (!presContext) + return NS_ERROR_FAILURE; + + nscolor bgColor; + + nsIDocument* elementDoc = mCanvasElement ? + HTMLCanvasElement()->GetOwnerDoc() : nsnull; + + // Pass the CSS Loader object to the parser, to allow parser error reports + // to include the outer window ID. + nsCSSParser parser(elementDoc ? elementDoc->CSSLoader() : nsnull); + nsresult rv = parser.ParseColorString(PromiseFlatString(aBGColor), + nsnull, 0, &bgColor); + NS_ENSURE_SUCCESS(rv, rv); + + nsIPresShell* presShell = presContext->PresShell(); + NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); + + nsRect r(nsPresContext::CSSPixelsToAppUnits(aX), + nsPresContext::CSSPixelsToAppUnits(aY), + nsPresContext::CSSPixelsToAppUnits(aW), + nsPresContext::CSSPixelsToAppUnits(aH)); + PRUint32 renderDocFlags = (nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING | + nsIPresShell::RENDER_DOCUMENT_RELATIVE); + if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DRAW_CARET) { + renderDocFlags |= nsIPresShell::RENDER_CARET; + } + if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DRAW_VIEW) { + renderDocFlags &= ~(nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING | + nsIPresShell::RENDER_DOCUMENT_RELATIVE); + } + if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_USE_WIDGET_LAYERS) { + renderDocFlags |= nsIPresShell::RENDER_USE_WIDGET_LAYERS; + } + if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_ASYNC_DECODE_IMAGES) { + renderDocFlags |= nsIPresShell::RENDER_ASYNC_DECODE_IMAGES; + } + + rv = presShell->RenderDocument(r, renderDocFlags, bgColor, thebes); + + // note that aX and aY are coordinates in the document that + // we're drawing; aX and aY are drawn to 0,0 in current user + // space. + RedrawUser(gfxRect(0, 0, aW, aH)); + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::AsyncDrawXULElement(nsIDOMXULElement* aElem, float aX, float aY, + float aW, float aH, + const nsAString& aBGColor, + PRUint32 flags) +{ +#if 0 + NS_ENSURE_ARG(aElem != nsnull); + + // We can't allow web apps to call this until we fix at least the + // following potential security issues: + // -- rendering cross-domain IFRAMEs and then extracting the results + // -- rendering the user's theme and then extracting the results + // -- rendering native anonymous content (e.g., file input paths; + // scrollbars should be allowed) + if (!nsContentUtils::IsCallerTrustedForRead()) { + // not permitted to use DrawWindow + // XXX ERRMSG we need to report an error to developers here! (bug 329026) + return NS_ERROR_DOM_SECURITY_ERR; + } + + nsCOMPtr loaderOwner = do_QueryInterface(aElem); + if (!loaderOwner) + return NS_ERROR_FAILURE; + + nsRefPtr frameloader = loaderOwner->GetFrameLoader(); + if (!frameloader) + return NS_ERROR_FAILURE; + + PBrowserParent *child = frameloader->GetRemoteBrowser(); + if (!child) { + nsCOMPtr window = + do_GetInterface(frameloader->GetExistingDocShell()); + if (!window) + return NS_ERROR_FAILURE; + + return DrawWindow(window, aX, aY, aW, aH, aBGColor, flags); + } + + // protect against too-large surfaces that will cause allocation + // or overflow issues + if (!gfxASurface::CheckSurfaceSize(gfxIntSize(aW, aH), 0xffff)) + return NS_ERROR_FAILURE; + + PRBool flush = + (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DO_NOT_FLUSH) == 0; + + PRUint32 renderDocFlags = nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING; + if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DRAW_CARET) { + renderDocFlags |= nsIPresShell::RENDER_CARET; + } + if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DRAW_VIEW) { + renderDocFlags &= ~nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING; + } + + nsRect rect(nsPresContext::CSSPixelsToAppUnits(aX), + nsPresContext::CSSPixelsToAppUnits(aY), + nsPresContext::CSSPixelsToAppUnits(aW), + nsPresContext::CSSPixelsToAppUnits(aH)); + if (mIPC) { + PDocumentRendererParent *pdocrender = + child->SendPDocumentRendererConstructor(rect, + mThebes->CurrentMatrix(), + nsString(aBGColor), + renderDocFlags, flush, + nsIntSize(mWidth, mHeight)); + if (!pdocrender) + return NS_ERROR_FAILURE; + + DocumentRendererParent *docrender = + static_cast(pdocrender); + + docrender->SetCanvasContext(this, mThebes); + } +#endif + return NS_OK; +} + +// +// device pixel getting/setting +// + +void +nsCanvasRenderingContext2DAzure::EnsureUnpremultiplyTable() { + if (sUnpremultiplyTable) + return; + + // Infallably alloc the unpremultiply table. + sUnpremultiplyTable = new PRUint8[256][256]; + + // It's important that the array be indexed first by alpha and then by rgb + // value. When we unpremultiply a pixel, we're guaranteed to do three + // lookups with the same alpha; indexing by alpha first makes it likely that + // those three lookups will be close to one another in memory, thus + // increasing the chance of a cache hit. + + // a == 0 case + for (PRUint32 c = 0; c <= 255; c++) { + sUnpremultiplyTable[0][c] = c; + } + + for (int a = 1; a <= 255; a++) { + for (int c = 0; c <= 255; c++) { + sUnpremultiplyTable[a][c] = (PRUint8)((c * 255) / a); + } + } +} + + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetImageData() +{ + /* Should never be called -- GetImageData_explicit is the QS entry point */ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetImageData_explicit(PRInt32 x, PRInt32 y, PRUint32 w, PRUint32 h, + PRUint8 *aData, PRUint32 aDataLen) +{ + if (!mValid) + return NS_ERROR_FAILURE; + + if (!mCanvasElement && !mDocShell) { + NS_ERROR("No canvas element and no docshell in GetImageData!!!"); + return NS_ERROR_DOM_SECURITY_ERR; + } + + // Check only if we have a canvas element; if we were created with a docshell, + // then it's special internal use. + if (mCanvasElement && + HTMLCanvasElement()->IsWriteOnly() && + !nsContentUtils::IsCallerTrustedForRead()) + { + // XXX ERRMSG we need to report an error to developers here! (bug 329026) + return NS_ERROR_DOM_SECURITY_ERR; + } + + if (w == 0 || h == 0 || aDataLen != w * h * 4) + return NS_ERROR_DOM_SYNTAX_ERR; + + CheckedInt32 rightMost = CheckedInt32(x) + w; + CheckedInt32 bottomMost = CheckedInt32(y) + h; + + if (!rightMost.valid() || !bottomMost.valid()) + return NS_ERROR_DOM_SYNTAX_ERR; + + if (mZero) { + return NS_OK; + } + + IntRect srcRect(0, 0, mWidth, mHeight); + IntRect destRect(x, y, w, h); + + if (!srcRect.Contains(destRect)) { + // Some data is outside the canvas surface, clear the destination. + memset(aData, 0, aDataLen); + } + + bool finishedPainting = false; + + IntRect srcReadRect = srcRect.Intersect(destRect); + IntRect dstWriteRect = srcReadRect; + dstWriteRect.MoveBy(-x, -y); + + PRUint8 *src = aData; + PRUint32 srcStride = w * 4; + + if (!srcReadRect.IsEmpty()) { + RefPtr snapshot = mTarget->Snapshot(); + + RefPtr readback = snapshot->GetDataSurface(); + + srcStride = readback->Stride(); + src = readback->GetData() + srcReadRect.y * srcStride + srcReadRect.x * 4; + } + + // make sure sUnpremultiplyTable has been created + EnsureUnpremultiplyTable(); + + // NOTE! dst is the same as src, and this relies on reading + // from src and advancing that ptr before writing to dst. + PRUint8 *dst = aData + dstWriteRect.y * (w * 4) + dstWriteRect.x * 4; + + for (PRUint32 j = 0; j < dstWriteRect.height; j++) { + for (PRUint32 i = 0; i < dstWriteRect.width; i++) { + // XXX Is there some useful swizzle MMX we can use here? +#ifdef IS_LITTLE_ENDIAN + PRUint8 b = *src++; + PRUint8 g = *src++; + PRUint8 r = *src++; + PRUint8 a = *src++; +#else + PRUint8 a = *src++; + PRUint8 r = *src++; + PRUint8 g = *src++; + PRUint8 b = *src++; +#endif + // Convert to non-premultiplied color + *dst++ = sUnpremultiplyTable[a][r]; + *dst++ = sUnpremultiplyTable[a][g]; + *dst++ = sUnpremultiplyTable[a][b]; + *dst++ = a; + } + src += srcStride - (dstWriteRect.width * 4); + dst += (w * 4) - (dstWriteRect.width * 4); + } + return NS_OK; +} + +void +nsCanvasRenderingContext2DAzure::EnsurePremultiplyTable() { + if (sPremultiplyTable) + return; + + // Infallably alloc the premultiply table. + sPremultiplyTable = new PRUint8[256][256]; + + // Like the unpremultiply table, it's important that we index the premultiply + // table with the alpha value as the first index to ensure good cache + // performance. + + for (int a = 0; a <= 255; a++) { + for (int c = 0; c <= 255; c++) { + sPremultiplyTable[a][c] = (a * c + 254) / 255; + } + } +} + +void +nsCanvasRenderingContext2DAzure::FillRuleChanged() +{ + if (mPath) { + mPathBuilder = mPath->CopyToBuilder(CurrentState().fillRule); + mPath = nsnull; + } +} + +// void putImageData (in ImageData d, in float x, in float y); +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::PutImageData() +{ + /* Should never be called -- PutImageData_explicit is the QS entry point */ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::PutImageData_explicit(PRInt32 x, PRInt32 y, PRUint32 w, PRUint32 h, + unsigned char *aData, PRUint32 aDataLen, + PRBool hasDirtyRect, PRInt32 dirtyX, PRInt32 dirtyY, + PRInt32 dirtyWidth, PRInt32 dirtyHeight) +{ + if (!mValid) { + return NS_ERROR_FAILURE; + } + + if (w == 0 || h == 0) { + return NS_ERROR_DOM_SYNTAX_ERR; + } + + IntRect dirtyRect; + IntRect imageDataRect(0, 0, w, h); + + if (hasDirtyRect) { + // fix up negative dimensions + if (dirtyWidth < 0) { + NS_ENSURE_TRUE(dirtyWidth != INT_MIN, NS_ERROR_DOM_INDEX_SIZE_ERR); + + CheckedInt32 checkedDirtyX = CheckedInt32(dirtyX) + dirtyWidth; + + if (!checkedDirtyX.valid()) + return NS_ERROR_DOM_INDEX_SIZE_ERR; + + dirtyX = checkedDirtyX.value(); + dirtyWidth = -(int32)dirtyWidth; + } + + if (dirtyHeight < 0) { + NS_ENSURE_TRUE(dirtyHeight != INT_MIN, NS_ERROR_DOM_INDEX_SIZE_ERR); + + CheckedInt32 checkedDirtyY = CheckedInt32(dirtyY) + dirtyHeight; + + if (!checkedDirtyY.valid()) + return NS_ERROR_DOM_INDEX_SIZE_ERR; + + dirtyY = checkedDirtyY.value(); + dirtyHeight = -(int32)dirtyHeight; + } + + // bound the dirty rect within the imageData rectangle + dirtyRect = imageDataRect.Intersect(IntRect(dirtyX, dirtyY, dirtyWidth, dirtyHeight)); + + if (dirtyRect.Width() <= 0 || dirtyRect.Height() <= 0) + return NS_OK; + } else { + dirtyRect = imageDataRect; + } + + dirtyRect.MoveBy(IntPoint(x, y)); + dirtyRect = IntRect(0, 0, mWidth, mHeight).Intersect(dirtyRect); + + if (dirtyRect.Width() <= 0 || dirtyRect.Height() <= 0) { + return NS_OK; + } + + PRUint32 len = w * h * 4; + if (aDataLen != len) { + return NS_ERROR_DOM_SYNTAX_ERR; + } + + nsRefPtr imgsurf = new gfxImageSurface(gfxIntSize(w, h), + gfxASurface::ImageFormatARGB32); + if (!imgsurf || imgsurf->CairoStatus()) { + return NS_ERROR_FAILURE; + } + + // ensure premultiply table has been created + EnsurePremultiplyTable(); + + PRUint8 *src = aData; + PRUint8 *dst = imgsurf->Data(); + + for (PRUint32 j = 0; j < h; j++) { + for (PRUint32 i = 0; i < w; i++) { + PRUint8 r = *src++; + PRUint8 g = *src++; + PRUint8 b = *src++; + PRUint8 a = *src++; + + // Convert to premultiplied color (losslessly if the input came from getImageData) +#ifdef IS_LITTLE_ENDIAN + *dst++ = sPremultiplyTable[a][b]; + *dst++ = sPremultiplyTable[a][g]; + *dst++ = sPremultiplyTable[a][r]; + *dst++ = a; +#else + *dst++ = a; + *dst++ = sPremultiplyTable[a][r]; + *dst++ = sPremultiplyTable[a][g]; + *dst++ = sPremultiplyTable[a][b]; +#endif + } + } + + RefPtr sourceSurface = + mTarget->CreateSourceSurfaceFromData(imgsurf->Data(), IntSize(w, h), imgsurf->Stride(), FORMAT_B8G8R8A8); + + + mTarget->CopySurface(sourceSurface, + IntRect(dirtyRect.x - x, dirtyRect.y - y, + dirtyRect.width, dirtyRect.height), + IntPoint(dirtyRect.x, dirtyRect.y)); + + Redraw(mgfx::Rect(dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height)); + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetThebesSurface(gfxASurface **surface) +{ + if (!mTarget) { + nsRefPtr tmpSurf = + gfxPlatform::GetPlatform()->CreateOffscreenSurface(gfxIntSize(1, 1), gfxASurface::CONTENT_COLOR_ALPHA); + *surface = tmpSurf.forget().get(); + return NS_OK; + } + + nsRefPtr newSurf = + gfxPlatform::GetPlatform()->GetThebesSurfaceForDrawTarget(mTarget); + + *surface = newSurf.forget().get(); + + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::CreateImageData() +{ + /* Should never be called; handled entirely in the quickstub */ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::GetMozImageSmoothingEnabled(PRBool *retVal) +{ + *retVal = CurrentState().imageSmoothingEnabled; + return NS_OK; +} + +NS_IMETHODIMP +nsCanvasRenderingContext2DAzure::SetMozImageSmoothingEnabled(PRBool val) +{ + if (val != CurrentState().imageSmoothingEnabled) { + CurrentState().imageSmoothingEnabled = val; + } + + return NS_OK; +} + +static PRUint8 g2DContextLayerUserData; + +class CanvasRenderingContext2DUserData : public LayerUserData { +public: + CanvasRenderingContext2DUserData(nsHTMLCanvasElement *aContent) + : mContent(aContent) {} + static void DidTransactionCallback(void* aData) + { + static_cast(aData)->mContent->MarkContextClean(); + } + +private: + nsRefPtr mContent; +}; + +already_AddRefed +nsCanvasRenderingContext2DAzure::GetCanvasLayer(nsDisplayListBuilder* aBuilder, + CanvasLayer *aOldLayer, + LayerManager *aManager) +{ + if (!mValid) { + return nsnull; + } + + if (mTarget) { + mTarget->Flush(); + } + + if (!mResetLayer && aOldLayer && + aOldLayer->HasUserData(&g2DContextLayerUserData)) { + NS_ADDREF(aOldLayer); + return aOldLayer; + } + + nsRefPtr canvasLayer = aManager->CreateCanvasLayer(); + if (!canvasLayer) { + NS_WARNING("CreateCanvasLayer returned null!"); + return nsnull; + } + CanvasRenderingContext2DUserData *userData = nsnull; + if (aBuilder->IsPaintingToWindow()) { + // Make the layer tell us whenever a transaction finishes (including + // the current transaction), so we can clear our invalidation state and + // start invalidating again. We need to do this for the layer that is + // being painted to a window (there shouldn't be more than one at a time, + // and if there is, flushing the invalidation state more often than + // necessary is harmless). + + // The layer will be destroyed when we tear down the presentation + // (at the latest), at which time this userData will be destroyed, + // releasing the reference to the element. + // The userData will receive DidTransactionCallbacks, which flush the + // the invalidation state to indicate that the canvas is up to date. + userData = new CanvasRenderingContext2DUserData(HTMLCanvasElement()); + canvasLayer->SetDidTransactionCallback( + CanvasRenderingContext2DUserData::DidTransactionCallback, userData); + } + canvasLayer->SetUserData(&g2DContextLayerUserData, userData); + + CanvasLayer::Data data; + + data.mDrawTarget = mTarget; + data.mSize = nsIntSize(mWidth, mHeight); + + canvasLayer->Initialize(data); + PRUint32 flags = mOpaque ? Layer::CONTENT_OPAQUE : 0; + canvasLayer->SetContentFlags(flags); + canvasLayer->Updated(); + + mResetLayer = PR_FALSE; + + return canvasLayer.forget(); +} + +void +nsCanvasRenderingContext2DAzure::MarkContextClean() +{ + if (mInvalidateCount > 0) { + mPredictManyRedrawCalls = mInvalidateCount > kCanvasMaxInvalidateCount; + } + mIsEntireFrameInvalid = PR_FALSE; + mInvalidateCount = 0; +} + diff --git a/content/canvas/test/test_2d.gradient.radial.cone.top.html b/content/canvas/test/test_2d.gradient.radial.cone.top.html index 424df7fa826..48525c458b9 100644 --- a/content/canvas/test/test_2d.gradient.radial.cone.top.html +++ b/content/canvas/test/test_2d.gradient.radial.cone.top.html @@ -6,6 +6,18 @@

FAIL (fallback content)

@@ -245,7 +256,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -1018,8 +1029,8 @@ function todo_isPixel(ctx, x,y, r,g,b,a, d) { todo(r-d <= pr && pr <= r+d && g-d <= pg && pg <= g+d && b-d <= pb && pb <= b+d && - a-d <= pa && pa <= a+d, - "pixel "+pos+" is "+pr+","+pg+","+pb+","+pa+"; expected "+colour+" +/- "+d); + a-d <= pa && pa <= a+d, + "pixel "+pos+" of "+ctx.canvas.id+" is "+pr+","+pg+","+pb+","+pa+" (marked todo); expected "+colour+" +/- " + d); } function test_2d_composite_globalAlpha_canvaspattern() { @@ -1467,7 +1478,7 @@ ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor' } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -1573,7 +1584,7 @@ ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor' } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -1600,7 +1611,7 @@ ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor' } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -1646,7 +1657,7 @@ ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor' } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -3141,6 +3152,7 @@ var canvas = document.getElementById('c119'); var ctx = canvas.getContext('2d'); var _thrown_outer = false; + try { ctx.fillStyle = '#0f0'; @@ -3843,7 +3855,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -6072,9 +6084,15 @@ g.addColorStop(0.75, '#0f0'); g.addColorStop(1, '#f00'); ctx.fillStyle = g; ctx.fillRect(0, 0, 100, 50); -ctx.translate(-50, 0); -ctx.fillRect(50, 0, 100, 50); -todo_isPixel(ctx, 25,25, 0,255,0,255, 0); +ctx.translate(-50, 0); +ctx.fillRect(50, 0, 100, 50); + +if (IsAzureEnabled()) { + isPixel(ctx, 25,25, 0,255,0,255, 0); +} else { + todo_isPixel(ctx, 25,25, 0,255,0,255, 0); +} + isPixel(ctx, 50,25, 0,255,0,255, 0); isPixel(ctx, 75,25, 0,255,0,255, 0); @@ -6379,18 +6397,30 @@ var g = ctx.createRadialGradient(210, 25, 100, 230, 25, 100); g.addColorStop(0, '#0f0'); g.addColorStop(1, '#f00'); ctx.fillStyle = g; -ctx.fillRect(0, 0, 100, 50); - -isPixel(ctx, 1,1, 0,255,0,255, 0); -isPixel(ctx, 50,1, 0,255,0,255, 0); -isPixel(ctx, 98,1, 0,255,0,255, 0); -isPixel(ctx, 1,25, 0,255,0,255, 0); -isPixel(ctx, 50,25, 0,255,0,255, 0); -isPixel(ctx, 98,25, 0,255,0,255, 0); -isPixel(ctx, 1,48, 0,255,0,255, 0); -isPixel(ctx, 50,48, 0,255,0,255, 0); -isPixel(ctx, 98,48, 0,255,0,255, 0); - +ctx.fillRect(0, 0, 100, 50); + +if (IsAzureEnabled()) { + // XXX - See Bug 666097. + todo_isPixel(ctx, 1, 1, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 50, 1, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 98, 1, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 1, 25, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 50, 25, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 98, 25, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 1, 48, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 50, 48, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 98, 48, 0, 255, 0, 255, 0); +} else { + isPixel(ctx, 1, 1, 0, 255, 0, 255, 0); + isPixel(ctx, 50, 1, 0, 255, 0, 255, 0); + isPixel(ctx, 98, 1, 0, 255, 0, 255, 0); + isPixel(ctx, 1, 25, 0, 255, 0, 255, 0); + isPixel(ctx, 50, 25, 0, 255, 0, 255, 0); + isPixel(ctx, 98, 25, 0, 255, 0, 255, 0); + isPixel(ctx, 1, 48, 0, 255, 0, 255, 0); + isPixel(ctx, 50, 48, 0, 255, 0, 255, 0); + isPixel(ctx, 98, 48, 0, 255, 0, 255, 0); +} } @@ -6538,18 +6568,31 @@ var g = ctx.createRadialGradient(230, 25, 100, 100, 25, 101); g.addColorStop(0, '#f00'); g.addColorStop(1, '#0f0'); ctx.fillStyle = g; -ctx.fillRect(0, 0, 100, 50); - -isPixel(ctx, 1,1, 0,255,0,255, 0); -isPixel(ctx, 50,1, 0,255,0,255, 0); -isPixel(ctx, 98,1, 0,255,0,255, 0); -isPixel(ctx, 1,25, 0,255,0,255, 0); -isPixel(ctx, 50,25, 0,255,0,255, 0); -isPixel(ctx, 98,25, 0,255,0,255, 0); -isPixel(ctx, 1,48, 0,255,0,255, 0); -isPixel(ctx, 50,48, 0,255,0,255, 0); -isPixel(ctx, 98,48, 0,255,0,255, 0); - +ctx.fillRect(0, 0, 100, 50); + + +if (IsAzureEnabled()) { + // XXX - See Bug 666097. + todo_isPixel(ctx, 1, 1, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 50, 1, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 98, 1, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 1, 25, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 50, 25, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 98, 25, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 1, 48, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 50, 48, 0, 255, 0, 255, 0); + todo_isPixel(ctx, 98, 48, 0, 255, 0, 255, 0); +} else { + isPixel(ctx, 1, 1, 0, 255, 0, 255, 0); + isPixel(ctx, 50, 1, 0, 255, 0, 255, 0); + isPixel(ctx, 98, 1, 0, 255, 0, 255, 0); + isPixel(ctx, 1, 25, 0, 255, 0, 255, 0); + isPixel(ctx, 50, 25, 0, 255, 0, 255, 0); + isPixel(ctx, 98, 25, 0, 255, 0, 255, 0); + isPixel(ctx, 1, 48, 0, 255, 0, 255, 0); + isPixel(ctx, 50, 48, 0, 255, 0, 255, 0); + isPixel(ctx, 98, 48, 0, 255, 0, 255, 0); +} } @@ -7267,10 +7310,16 @@ ctx.fillRect(0, 0, 100, 50); ctx.translate(50, 25); ctx.scale(10, 10); ctx.fillRect(-5, -2.5, 10, 5); -todo_isPixel(ctx, 25,25, 0,255,0,255, 0); -todo_isPixel(ctx, 50,25, 0,255,0,255, 0); -todo_isPixel(ctx, 75,25, 0,255,0,255, 0); +if (IsAzureEnabled()) { + isPixel(ctx, 25,25, 0,255,0,255, 0); + isPixel(ctx, 50,25, 0,255,0,255, 0); + isPixel(ctx, 75,25, 0,255,0,255, 0); +} else { + todo_isPixel(ctx, 25,25, 0,255,0,255, 0); + todo_isPixel(ctx, 50,25, 0,255,0,255, 0); + todo_isPixel(ctx, 75,25, 0,255,0,255, 0); +} } @@ -7420,7 +7469,7 @@ ok(imgdata3.data.length == imgdata4.data.length, "imgdata3.data.length == imgdat } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -7536,7 +7585,7 @@ ok(isTransparentBlack, "isTransparentBlack"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -7568,7 +7617,7 @@ ok(imgdata.data.thisImplementsCanvasPixelArray, "imgdata.data.thisImplementsCanv } catch (e) { _thrown_outer = true; } -todo(!_thrown_outer, 'should not throw exception'); +todo(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -7600,7 +7649,7 @@ todo(imgdata.data.thisImplementsCanvasPixelArray, "imgdata.data.thisImplementsCa } catch (e) { _thrown_outer = true; } -todo(!_thrown_outer, 'should not throw exception'); +todo(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -8039,7 +8088,7 @@ ok(imgdata2.data[3] === 0, "imgdata2.data[\""+(3)+"\"] === 0"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -8124,7 +8173,7 @@ ok(imgdata7.data[20*4+3] === 0, "imgdata7.data[20*4+3] === 0"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -8174,7 +8223,7 @@ ok(imgdata.height == 1, "imgdata.height == 1"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -8206,7 +8255,7 @@ ok(imgdata.data.thisImplementsCanvasPixelArray, "imgdata.data.thisImplementsCanv } catch (e) { _thrown_outer = true; } -todo(!_thrown_outer, 'should not throw exception'); +todo(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -8699,7 +8748,7 @@ isPixel(ctx, 50,45, 0,255,0,255, 2); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -8745,7 +8794,7 @@ isPixel(ctx, 1,45, 0,255,0,255, 2); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -8789,7 +8838,7 @@ isPixel(ctx, 50,45, 0,255,0,255, 2); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -8833,7 +8882,7 @@ isPixel(ctx, 50,45, 0,255,0,255, 2); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -9433,7 +9482,7 @@ ok(ctx.lineCap === 'butt', "ctx.lineCap === 'butt'"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -9807,7 +9856,7 @@ ok(ctx.lineJoin === 'bevel', "ctx.lineJoin === 'bevel'"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -10138,7 +10187,7 @@ ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -10428,7 +10477,7 @@ ok(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -11100,7 +11149,7 @@ isPixel(ctx, 90,45, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -11582,7 +11631,12 @@ ctx.beginPath(); ctx.moveTo(0, 25); ctx.arc(200, 25, 0, 0, Math.PI, true); ctx.stroke(); -todo_isPixel(ctx, 50,25, 0,255,0,255, 0); + +if (IsAzureEnabled()) { + isPixel(ctx, 50,25, 0,255,0,255, 0); +} else { + todo_isPixel(ctx, 50,25, 0,255,0,255, 0); +} } @@ -11880,7 +11934,7 @@ isPixel(ctx, 90,45, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -12170,7 +12224,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -12213,7 +12267,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -12393,7 +12447,7 @@ isPixel(ctx, 90,45, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -13140,22 +13194,22 @@ ok(ctx.isPointInPath(70, 30) === false, "ctx.isPointInPath(70, 30) === false"); function test_2d_path_isPointInPath_edge() { var canvas = document.getElementById('c404'); -var ctx = canvas.getContext('2d'); - -ctx.rect(0, 0, 20, 20); -ok(ctx.isPointInPath(0, 0) === true, "ctx.isPointInPath(0, 0) === true"); -ok(ctx.isPointInPath(10, 0) === true, "ctx.isPointInPath(10, 0) === true"); -ok(ctx.isPointInPath(20, 0) === true, "ctx.isPointInPath(20, 0) === true"); -ok(ctx.isPointInPath(20, 10) === true, "ctx.isPointInPath(20, 10) === true"); -ok(ctx.isPointInPath(20, 20) === true, "ctx.isPointInPath(20, 20) === true"); -ok(ctx.isPointInPath(10, 20) === true, "ctx.isPointInPath(10, 20) === true"); -ok(ctx.isPointInPath(0, 20) === true, "ctx.isPointInPath(0, 20) === true"); -ok(ctx.isPointInPath(0, 10) === true, "ctx.isPointInPath(0, 10) === true"); -ok(ctx.isPointInPath(10, -0.01) === false, "ctx.isPointInPath(10, -0.01) === false"); -ok(ctx.isPointInPath(10, 20.01) === false, "ctx.isPointInPath(10, 20.01) === false"); -ok(ctx.isPointInPath(-0.01, 10) === false, "ctx.isPointInPath(-0.01, 10) === false"); -ok(ctx.isPointInPath(20.01, 10) === false, "ctx.isPointInPath(20.01, 10) === false"); - +var ctx = canvas.getContext('2d'); + +ctx.rect(0, 0, 20, 20); + +ok(ctx.isPointInPath(0, 0) === true, "ctx.isPointInPath(0, 0) === true"); +ok(ctx.isPointInPath(10, 0) === true, "ctx.isPointInPath(10, 0) === true"); +ok(ctx.isPointInPath(20, 0) === true, "ctx.isPointInPath(20, 0) === true"); +ok(ctx.isPointInPath(20, 10) === true, "ctx.isPointInPath(20, 10) === true"); +ok(ctx.isPointInPath(20, 20) === true, "ctx.isPointInPath(20, 20) === true"); +ok(ctx.isPointInPath(10, 20) === true, "ctx.isPointInPath(10, 20) === true"); +ok(ctx.isPointInPath(0, 20) === true, "ctx.isPointInPath(0, 20) === true"); +ok(ctx.isPointInPath(0, 10) === true, "ctx.isPointInPath(0, 10) === true"); +ok(ctx.isPointInPath(10, -0.01) === false, "ctx.isPointInPath(10, -0.01) === false"); +ok(ctx.isPointInPath(10, 20.01) === false, "ctx.isPointInPath(10, 20.01) === false"); +ok(ctx.isPointInPath(-0.01, 10) === false, "ctx.isPointInPath(-0.01, 10) === false"); +ok(ctx.isPointInPath(20.01, 10) === false, "ctx.isPointInPath(20.01, 10) === false"); } @@ -13205,7 +13259,7 @@ ok(ctx.isPointInPath(NaN, NaN) === false, "ctx.isPointInPath(NaN, NaN) === false } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -13506,7 +13560,7 @@ isPixel(ctx, 90,45, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -13621,7 +13675,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -13727,7 +13781,7 @@ isPixel(ctx, 90,45, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -13991,7 +14045,7 @@ isPixel(ctx, 90,45, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -14943,30 +14997,41 @@ ok(pattern.thisImplementsCanvasPattern, "pattern.thisImplementsCanvasPattern"); function test_2d_pattern_basic_zerocanvas() { -var canvas = document.getElementById('c463'); -var ctx = canvas.getContext('2d'); +var _thrown_outer = false; -var canvas2 = document.createElement('canvas'); -canvas2.width = 0; -canvas2.height = 0; -ok(canvas2.width === 0, "canvas2.width === 0"); -ok(canvas2.height === 0, "canvas2.height === 0"); -var ctx2 = canvas2.getContext('2d'); -ctx2.fillStyle = '#f00'; -ctx2.fillRect(0, 0, 100, 50); -var pattern = ctx.createPattern(canvas2, 'repeat'); +try { + var canvas = document.getElementById('c463'); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillStyle = pattern; -ctx.fillRect(0, 0, 100, 50); + var canvas2 = document.createElement('canvas'); + canvas2.width = 0; + canvas2.height = 0; + ok(canvas2.width === 0, "canvas2.width === 0"); + ok(canvas2.height === 0, "canvas2.height === 0"); + var ctx2 = canvas2.getContext('2d'); + ctx2.fillStyle = '#f00'; + ctx2.fillRect(0, 0, 100, 50); + var pattern = ctx.createPattern(canvas2, 'repeat'); -isPixel(ctx, 1,1, 0,255,0,255, 0); -isPixel(ctx, 98,1, 0,255,0,255, 0); -isPixel(ctx, 1,48, 0,255,0,255, 0); -isPixel(ctx, 98,48, 0,255,0,255, 0); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + isPixel(ctx, 1,1, 0,255,0,255, 0); + isPixel(ctx, 98,1, 0,255,0,255, 0); + isPixel(ctx, 1,48, 0,255,0,255, 0); + isPixel(ctx, 98,48, 0,255,0,255, 0); +} catch(e) { + _thrown_outer = true; +} + +if (IsAzureEnabled()) { + ok(_thrown_outer); +} else { + todo(_thrown_outer, ctx.canvas.is + ' should throw exception INVALID_STATE_ERR'); +} } @@ -15594,11 +15659,17 @@ ctx.fillRect(0, 0, 100, 50); ctx.translate(-128, -78); ctx.fillRect(128, 78, 100, 50); -todo_isPixel(ctx, 1,1, 0,255,0,255, 0); -todo_isPixel(ctx, 98,1, 0,255,0,255, 0); -todo_isPixel(ctx, 1,48, 0,255,0,255, 0); -todo_isPixel(ctx, 98,48, 0,255,0,255, 0); - +if (IsAzureEnabled()) { + isPixel(ctx, 1,1, 0,255,0,255, 0); + isPixel(ctx, 98,1, 0,255,0,255, 0); + isPixel(ctx, 1,48, 0,255,0,255, 0); + isPixel(ctx, 98,48, 0,255,0,255, 0); +} else { + todo_isPixel(ctx, 1,1, 0,255,0,255, 0); + todo_isPixel(ctx, 98,1, 0,255,0,255, 0); + todo_isPixel(ctx, 1,48, 0,255,0,255, 0); + todo_isPixel(ctx, 98,48, 0,255,0,255, 0); +} } @@ -15692,12 +15763,20 @@ ctx.fillRect(0, -16, 100, 50); ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 16); -todo_isPixel(ctx, 1,1, 0,255,0,255, 0); -todo_isPixel(ctx, 98,1, 0,255,0,255, 0); +if (IsAzureEnabled()) { + isPixel(ctx, 1,1, 0,255,0,255, 0); + isPixel(ctx, 98,1, 0,255,0,255, 0); + isPixel(ctx, 1,48, 0,255,0,255, 0); + isPixel(ctx, 98,48, 0,255,0,255, 0); +} else { + todo_isPixel(ctx, 1,1, 0,255,0,255, 0); + todo_isPixel(ctx, 98,1, 0,255,0,255, 0); + todo_isPixel(ctx, 1,48, 0,255,0,255, 0); + todo_isPixel(ctx, 98,48, 0,255,0,255, 0); +} + isPixel(ctx, 1,25, 0,255,0,255, 0); isPixel(ctx, 98,25, 0,255,0,255, 0); -todo_isPixel(ctx, 1,48, 0,255,0,255, 0); -todo_isPixel(ctx, 98,48, 0,255,0,255, 0); } @@ -15730,8 +15809,14 @@ ctx.fillRect(0, 0, 100, 16); isPixel(ctx, 1,1, 0,255,0,255, 0); isPixel(ctx, 98,1, 0,255,0,255, 0); -todo_isPixel(ctx, 1,48, 0,255,0,255, 0); -todo_isPixel(ctx, 98,48, 0,255,0,255, 0); + +if (IsAzureEnabled()) { + isPixel(ctx, 1,48, 0,255,0,255, 0); + isPixel(ctx, 98,48, 0,255,0,255, 0); +} else { + todo_isPixel(ctx, 1,48, 0,255,0,255, 0); + todo_isPixel(ctx, 98,48, 0,255,0,255, 0); +} } @@ -15795,12 +15880,20 @@ ctx.fillRect(-48, 0, 100, 50); ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 16, 50); -todo_isPixel(ctx, 1,1, 0,255,0,255, 0); isPixel(ctx, 50,1, 0,255,0,255, 0); -todo_isPixel(ctx, 98,1, 0,255,0,255, 0); -todo_isPixel(ctx, 1,48, 0,255,0,255, 0); isPixel(ctx, 50,48, 0,255,0,255, 0); -todo_isPixel(ctx, 98,48, 0,255,0,255, 0); + +if (IsAzureEnabled()) { + isPixel(ctx, 1,1, 0,255,0,255, 0); + isPixel(ctx, 98,1, 0,255,0,255, 0); + isPixel(ctx, 1,48, 0,255,0,255, 0); + isPixel(ctx, 98,48, 0,255,0,255, 0); +} else { + todo_isPixel(ctx, 1,1, 0,255,0,255, 0); + todo_isPixel(ctx, 98,1, 0,255,0,255, 0); + todo_isPixel(ctx, 1,48, 0,255,0,255, 0); + todo_isPixel(ctx, 98,48, 0,255,0,255, 0); +} } @@ -15832,10 +15925,15 @@ ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 16, 50); isPixel(ctx, 1,1, 0,255,0,255, 0); -todo_isPixel(ctx, 98,1, 0,255,0,255, 0); isPixel(ctx, 1,48, 0,255,0,255, 0); -todo_isPixel(ctx, 98,48, 0,255,0,255, 0); +if (IsAzureEnabled()) { + isPixel(ctx, 98,1, 0,255,0,255, 0); + isPixel(ctx, 98,48, 0,255,0,255, 0); +} else { + todo_isPixel(ctx, 98,1, 0,255,0,255, 0); + todo_isPixel(ctx, 98,48, 0,255,0,255, 0); +} } @@ -16642,10 +16740,9 @@ ctx.globalCompositeOperation = 'xor'; ctx.shadowColor = '#f00'; ctx.shadowOffsetX = 100; ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, 0, 200, 50); - -isPixel(ctx, 50,25, 0,255,0,255, 2); - +ctx.fillRect(-100, 0, 200, 50); + +isPixel(ctx, 50, 25, 255, 255, 0, 255, 2); } @@ -16669,10 +16766,9 @@ ctx.globalCompositeOperation = 'xor'; ctx.shadowColor = '#f00'; ctx.shadowBlur = 1; ctx.fillStyle = '#0f0'; -ctx.fillRect(-10, -10, 120, 70); - -isPixel(ctx, 50,25, 0,255,0,255, 2); - +ctx.fillRect(-10, -10, 120, 70); + +isPixel(ctx, 50, 25, 255, 255, 0, 255, 2); } @@ -18263,7 +18359,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -18566,7 +18662,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -18825,7 +18921,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -18995,7 +19091,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -19202,7 +19298,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -19316,7 +19412,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -19613,7 +19709,7 @@ ok(canvas.getContext('2D') === null, "canvas.getContext('2D') === null"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -19639,7 +19735,7 @@ ok(canvas.getContext("") === null, "canvas.getContext(\"\") === null"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -19665,7 +19761,7 @@ ok(canvas.getContext('This is not an implemented context in any real browser') = } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -19691,7 +19787,7 @@ ok(canvas.getContext("2d#") === null, "canvas.getContext(\"2d#\") === null"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -19717,7 +19813,7 @@ ok(canvas.getContext("2d\0") === null, "canvas.getContext(\"2d\\0\") === null"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -19743,7 +19839,7 @@ ok(canvas.getContext("2\uFF44") === null, "canvas.getContext(\"2\\uFF44\") === n } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -20763,7 +20859,7 @@ ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -20790,7 +20886,7 @@ ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -20818,7 +20914,7 @@ ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -20904,7 +21000,7 @@ ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -21012,7 +21108,7 @@ ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/"); } catch (e) { _thrown_outer = true; } -ok(!_thrown_outer, 'should not throw exception'); +ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception'); } @@ -21407,14 +21503,10 @@ function runTests() { //test_2d_path_rect_zero_6(); // This test is bogus according to the spec; see bug 407107 - // These tests are bogus according to the spec: shadows should not be - // drawn if shadowBlur, shadowOffsetX, and shadowOffsetY are all zero, whic - // they are in these tests + // The following tests are disabled due to pending changes in the spec: + // //test_2d_shadow_composite_3(); //test_2d_shadow_composite_4(); - // Shadows should not be drawn if the operator is not source-over (the spec doesn't - // say this yet, but it should be changed). These tests assume shadows will - // be drawn with operators other than source-over: //test_2d_shadow_composite_1(); //test_2d_shadow_composite_2(); try { diff --git a/content/events/public/Makefile.in b/content/events/public/Makefile.in index 59ca27a9abb..1329dbd728b 100644 --- a/content/events/public/Makefile.in +++ b/content/events/public/Makefile.in @@ -47,13 +47,11 @@ XPIDL_MODULE = content_events EXPORTS = \ nsMutationEvent.h \ - nsIEventListenerManager.h \ nsIPrivateDOMEvent.h \ nsIPrivateTextEvent.h \ nsIPrivateTextRange.h \ nsPLDOMEvent.h \ nsEventDispatcher.h \ - nsPIDOMEventTarget.h \ nsEventStates.h \ $(NULL) diff --git a/content/events/public/nsEventDispatcher.h b/content/events/public/nsEventDispatcher.h index 2a185383b91..f41c71855ba 100644 --- a/content/events/public/nsEventDispatcher.h +++ b/content/events/public/nsEventDispatcher.h @@ -46,8 +46,8 @@ class nsIContent; class nsIDocument; class nsPresContext; class nsIDOMEvent; -class nsPIDOMEventTarget; class nsIScriptGlobalObject; +class nsIDOMEventTarget; class nsEventTargetChainItem; template class nsCOMArray; @@ -178,7 +178,7 @@ public: PRPackedBool mOriginalTargetIsInAnon; /** - * Whether or not nsPIDOMEventTarget::WillHandleEvent will be + * Whether or not nsIDOMEventTarget::WillHandleEvent will be * called. Default is PR_FALSE; */ PRPackedBool mWantsWillHandleEvent; @@ -192,13 +192,13 @@ public: /** * Parent item in the event target chain. */ - nsPIDOMEventTarget* mParentTarget; + nsIDOMEventTarget* mParentTarget; /** * If the event needs to be retargeted, this is the event target, * which should be used when the event is handled at mParentTarget. */ - nsPIDOMEventTarget* mEventTargetAtParent; + nsIDOMEventTarget* mEventTargetAtParent; }; class nsEventChainPostVisitor : public nsEventChainVisitor { @@ -228,7 +228,7 @@ class nsEventDispatcher { public: /** - * aTarget should QI to nsPIDOMEventTarget. + * aTarget should QI to nsIDOMEventTarget. * If the target of aEvent is set before calling this method, the target of * aEvent is used as the target (unless there is event * retargeting) and the originalTarget of the DOM Event. @@ -249,7 +249,7 @@ public: nsIDOMEvent* aDOMEvent = nsnull, nsEventStatus* aEventStatus = nsnull, nsDispatchingCallback* aCallback = nsnull, - nsCOMArray* aTargets = nsnull); + nsCOMArray* aTargets = nsnull); /** * Dispatches an event. diff --git a/content/events/public/nsIEventListenerManager.h b/content/events/public/nsIEventListenerManager.h deleted file mode 100644 index fbf367b44a4..00000000000 --- a/content/events/public/nsIEventListenerManager.h +++ /dev/null @@ -1,237 +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 nsIEventListenerManager_h__ -#define nsIEventListenerManager_h__ - -#include "nsEvent.h" -#include "nsISupports.h" - -class nsPresContext; -class nsIDOMEventListener; -class nsIScriptContext; -class nsIDOMEventTarget; -class nsIDOMEventGroup; -class nsIAtom; -class nsPIDOMEventTarget; -class nsIEventListenerInfo; -template class nsCOMArray; -class nsCxPusher; - -/* - * Event listener manager interface. - */ -#define NS_IEVENTLISTENERMANAGER_IID \ -{ 0x8e8667ed, 0x10d3, 0x41e8, \ - { 0x93, 0xfa, 0xa4, 0xc4, 0xea, 0x16, 0x85, 0xd5 } } - -class nsIEventListenerManager : public nsISupports { - -public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEVENTLISTENERMANAGER_IID) - - nsIEventListenerManager() : mMayHavePaintEventListener(PR_FALSE), - mMayHaveMutationListeners(PR_FALSE), - mMayHaveCapturingListeners(PR_FALSE), - mMayHaveSystemGroupListeners(PR_FALSE), - mMayHaveAudioAvailableEventListener(PR_FALSE), - mMayHaveTouchEventListener(PR_FALSE), - mNoListenerForEvent(0) - {} - - /** - * Sets events listeners of all types. - * @param an event listener - */ - NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID, PRInt32 flags) = 0; - - /** - * Removes events listeners of all types. - * @param an event listener - */ - NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID, PRInt32 flags) = 0; - - /** - * Sets events listeners of all types. - * @param an event listener - */ - NS_IMETHOD AddEventListenerByType(nsIDOMEventListener *aListener, - const nsAString& type, - PRInt32 flags, - nsIDOMEventGroup* aEvtGrp) = 0; - - /** - * Removes events listeners of all types. - * @param an event listener - */ - NS_IMETHOD RemoveEventListenerByType(nsIDOMEventListener *aListener, - const nsAString& type, - PRInt32 flags, - nsIDOMEventGroup* aEvtGrp) = 0; - - /** - * Creates a script event listener for the given script object with - * name aName and function body aFunc. - * @param an event listener - */ - NS_IMETHOD AddScriptEventListener(nsISupports *aObject, - nsIAtom *aName, - const nsAString& aFunc, - PRUint32 aLanguage, - PRBool aDeferCompilation, - PRBool aPermitUntrustedEvents) = 0; - - - NS_IMETHOD RemoveScriptEventListener(nsIAtom *aName) = 0; - - /** - * Registers an event listener that already exists on the given - * script object with the event listener manager. If the event - * listener is registerd from chrome code, the event listener will - * only ever receive trusted events. - * @param the name of an event listener - */ - NS_IMETHOD RegisterScriptEventListener(nsIScriptContext *aContext, - void *aScopeObject, - nsISupports *aObject, - nsIAtom* aName) = 0; - - /** - * Compiles any event listeners that already exists on the given - * script object for a given event type. - * @param an event listener */ - NS_IMETHOD CompileScriptEventListener(nsIScriptContext *aContext, - void *aScopeObject, - nsISupports *aObject, - nsIAtom* aName, - PRBool *aDidCompile) = 0; - - /** - * Tells the event listener manager that its target (which owns it) is - * no longer using it (and could go away). - * - * It also clears the weak pointer set by the call to - * |SetListenerTarget|. - */ - NS_IMETHOD Disconnect() = 0; - - /** - * Tells the event listener manager what its target is. This must be - * followed by a call to |Disconnect| before the target is destroyed. - */ - NS_IMETHOD SetListenerTarget(nsISupports* aTarget) = 0; - - /** - * Allows us to quickly determine if we have mutation listeners registered. - */ - NS_IMETHOD HasMutationListeners(PRBool* aListener) = 0; - - /** - * Gets the EventGroup registered for use by system event listeners. - * This is a special EventGroup which is used in the secondary DOM Event - * Loop pass for evaluation of system event listeners. - */ - NS_IMETHOD GetSystemEventGroupLM(nsIDOMEventGroup** aGroup) = 0; - - /** - * Allows us to quickly determine whether we have unload or beforeunload - * listeners registered. - */ - virtual PRBool HasUnloadListeners() = 0; - - /** - * Returns the mutation bits depending on which mutation listeners are - * registered to this listener manager. - * @note If a listener is an nsIDOMMutationListener, all possible mutation - * event bits are returned. All bits are also returned if one of the - * event listeners is registered to handle DOMSubtreeModified events. - */ - virtual PRUint32 MutationListenerBits() = 0; - - /** - * Sets aList to the list of nsIEventListenerInfo objects representing the - * listeners managed by this listener manager. - */ - virtual nsresult GetListenerInfo(nsCOMArray* aList) = 0; - - /** - * Returns PR_TRUE if there is at least one event listener for aEventName. - */ - virtual PRBool HasListenersFor(const nsAString& aEventName) = 0; - - /** - * Returns PR_TRUE if there is at least one event listener. - */ - virtual PRBool HasListeners() = 0; - - - /** - * Returns PR_TRUE if there may be a paint event listener registered, - * PR_FALSE if there definitely isn't. - */ - PRBool MayHavePaintEventListener() { return mMayHavePaintEventListener; } - - /** - * Returns PR_TRUE if there may be a MozAudioAvailable event listener registered, - * PR_FALSE if there definitely isn't. - */ - PRBool MayHaveAudioAvailableEventListener() { return mMayHaveAudioAvailableEventListener; } - - /** - * Returns PR_TRUE if there may be a touch event listener registered, - * PR_FALSE if there definitely isn't. - */ - PRBool MayHaveTouchEventListener() { return mMayHaveTouchEventListener; } -protected: - PRUint32 mMayHavePaintEventListener : 1; - PRUint32 mMayHaveMutationListeners : 1; - PRUint32 mMayHaveCapturingListeners : 1; - PRUint32 mMayHaveSystemGroupListeners : 1; - PRUint32 mMayHaveAudioAvailableEventListener : 1; - PRUint32 mMayHaveTouchEventListener : 1; - PRUint32 mNoListenerForEvent : 26; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIEventListenerManager, - NS_IEVENTLISTENERMANAGER_IID) - -nsresult -NS_NewEventListenerManager(nsIEventListenerManager** aInstancePtrResult); - -#endif // nsIEventListenerManager_h__ diff --git a/content/events/public/nsIEventListenerService.idl b/content/events/public/nsIEventListenerService.idl index 43be66017b9..fb1dadd6057 100644 --- a/content/events/public/nsIEventListenerService.idl +++ b/content/events/public/nsIEventListenerService.idl @@ -67,7 +67,7 @@ interface nsIEventListenerInfo : nsISupports nsISupports getDebugObject(); }; -[scriptable, uuid(7be78bb6-33f7-4f31-b3f3-97eefaff2762)] +[scriptable, uuid(0cf94aa6-ea9a-44cb-a063-be834afa679d)] interface nsIEventListenerService : nsISupports { /** @@ -86,15 +86,32 @@ interface nsIEventListenerService : nsISupports * dispatching an event to aEventTarget * @note Some events, especially 'load', may actually have a shorter * event target chain than what this methods returns. - */ + */ void getEventTargetChainFor(in nsIDOMEventTarget aEventTarget, [optional] out unsigned long aCount, [retval, array, size_is(aCount)] out nsIDOMEventTarget aOutArray); /** - * Returns system event group. + * Returns true if a event target has any listener for the given type. */ - readonly attribute nsIDOMEventGroup systemEventGroup; + boolean hasListenersFor(in nsIDOMEventTarget aEventTarget, + in DOMString aType); + + /** + * Add a system-group eventlistener to a event target. + */ + void addSystemEventListener(in nsIDOMEventTarget target, + in DOMString type, + in nsIDOMEventListener listener, + in boolean useCapture); + + /** + * Remove a system-group eventlistener from a event target. + */ + void removeSystemEventListener(in nsIDOMEventTarget target, + in DOMString type, + in nsIDOMEventListener listener, + in boolean useCapture); }; diff --git a/content/events/public/nsIPrivateDOMEvent.h b/content/events/public/nsIPrivateDOMEvent.h index 2ccca93bde9..48127c9bf40 100644 --- a/content/events/public/nsIPrivateDOMEvent.h +++ b/content/events/public/nsIPrivateDOMEvent.h @@ -134,10 +134,8 @@ nsresult NS_NewDOMScrollAreaEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsScrollAreaEvent* aEvent); nsresult NS_NewDOMTransitionEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsTransitionEvent* aEvent); -#ifdef MOZ_CSS_ANIMATIONS nsresult NS_NewDOMAnimationEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsAnimationEvent* aEvent); -#endif nsresult NS_NewDOMCloseEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsEvent* aEvent); nsresult diff --git a/content/events/public/nsPIDOMEventTarget.h b/content/events/public/nsPIDOMEventTarget.h deleted file mode 100644 index dfacc7649f9..00000000000 --- a/content/events/public/nsPIDOMEventTarget.h +++ /dev/null @@ -1,178 +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 Mozilla.org. - * Portions created by the Initial Developer are Copyright (C) 2006 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Olli Pettay (Original Author) - * - * 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 ***** */ - -#ifndef nsPIDOMEventTarget_h_ -#define nsPIDOMEventTarget_h_ - -#include "nsISupports.h" -#include "nsEvent.h" - -class nsIDOMEvent; -class nsPresContext; -class nsEventChainPreVisitor; -class nsEventChainPostVisitor; -class nsIEventListenerManager; -class nsIDOMEventListener; -class nsIDOMEventGroup; -class nsIScriptContext; -struct JSContext; - -// 89292f3a-535d-4ba0-882a-10cff9e21bcc -#define NS_PIDOMEVENTTARGET_IID \ - { 0x89292f3a, 0x535d, 0x4ba0, \ - { 0x88, 0x2a, 0x10, 0xcf, 0xf9, 0xe2, 0x1b, 0xcc } } - -class nsPIDOMEventTarget : public nsISupports -{ -public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_PIDOMEVENTTARGET_IID) - - /** - * Returns the nsPIDOMEventTarget object which should be used as the target - * of DOMEvents. - * Usually |this| is returned, but for example global object returns - * the outer object. - */ - virtual nsPIDOMEventTarget* GetTargetForDOMEvent() { return this; } - - /** - * Returns the nsPIDOMEventTarget object which should be used as the target - * of the event and when constructing event target chain. - * Usually |this| is returned, but for example global object returns - * the inner object. - */ - virtual nsPIDOMEventTarget* GetTargetForEventTargetChain() { return this; } - - /** - * Called before the capture phase of the event flow. - * This is used to create the event target chain and implementations - * should set the necessary members of nsEventChainPreVisitor. - * At least aVisitor.mCanHandle must be set, - * usually also aVisitor.mParentTarget if mCanHandle is PR_TRUE. - * First one tells that this object can handle the aVisitor.mEvent event and - * the latter one is the possible parent object for the event target chain. - * @see nsEventDispatcher.h for more documentation about aVisitor. - * - * @param aVisitor the visitor object which is used to create the - * event target chain for event dispatching. - * - * @note Only nsEventDispatcher should call this method. - */ - virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) = 0; - - /** - * If nsEventChainPreVisitor.mWantsWillHandleEvent is set PR_TRUE, - * called just before possible event handlers on this object will be called. - */ - virtual nsresult WillHandleEvent(nsEventChainPostVisitor& aVisitor) - { - return NS_OK; - } - - /** - * Called after the bubble phase of the system event group. - * The default handling of the event should happen here. - * @param aVisitor the visitor object which is used during post handling. - * - * @see nsEventDispatcher.h for documentation about aVisitor. - * @note Only nsEventDispatcher should call this method. - */ - virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) = 0; - - /** - * Dispatch an event. - * @param aEvent the event that is being dispatched. - * @param aDOMEvent the event that is being dispatched, use if you want to - * dispatch nsIDOMEvent, not only nsEvent. - * @param aPresContext the current presentation context, can be nsnull. - * @param aEventStatus the status returned from the function, can be nsnull. - * - * @note If both aEvent and aDOMEvent are used, aEvent must be the internal - * event of the aDOMEvent. - * - * If aDOMEvent is not nsnull (in which case aEvent can be nsnull) it is used - * for dispatching, otherwise aEvent is used. - * - * @deprecated This method is here just until all the callers outside Gecko - * have been converted to use nsIDOMEventTarget::dispatchEvent. - */ - virtual nsresult DispatchDOMEvent(nsEvent* aEvent, - nsIDOMEvent* aDOMEvent, - nsPresContext* aPresContext, - nsEventStatus* aEventStatus) = 0; - - /** - * Get the event listener manager, the guy you talk to to register for events - * on this node. - * @param aMayCreate If PR_FALSE, returns a listener manager only if - * one already exists. - */ - virtual nsIEventListenerManager* GetListenerManager(PRBool aMayCreate) = 0; - - /** - * Add an event listener for nsIID. - */ - virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID) = 0; - /** - * Remove event listener for nsIID. - */ - virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID) = 0; - - /** - * Get the system event group. - */ - virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup) = 0; - - /** - * Get the script context in which the event handlers should be run. - * May return null. - * @note Caller *must* check the value of aRv. - */ - virtual nsIScriptContext* GetContextForEventHandlers(nsresult* aRv) = 0; - - /** - * If the method above returns null, but a success code, this method - * is called. - */ - virtual JSContext* GetJSContextForEventHandlers() { return nsnull; } -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMEventTarget, NS_PIDOMEVENTTARGET_IID) - -#endif // !defined(nsPIDOMEventTarget_h_) diff --git a/content/events/src/Makefile.in b/content/events/src/Makefile.in index c649cefb80f..d547548d442 100644 --- a/content/events/src/Makefile.in +++ b/content/events/src/Makefile.in @@ -48,6 +48,7 @@ LIBXUL_LIBRARY = 1 EXPORTS = \ nsEventStateManager.h \ + nsEventListenerManager.h \ $(NULL) CPPSRCS = \ @@ -72,7 +73,6 @@ CPPSRCS = \ nsDOMMessageEvent.cpp \ nsPaintRequest.cpp \ nsPrivateTextRange.cpp \ - nsDOMEventGroup.cpp \ nsXMLEventsManager.cpp \ nsXMLEventsElement.cpp \ nsPLDOMEvent.cpp \ @@ -89,6 +89,7 @@ CPPSRCS = \ nsDOMEventTargetHelper.cpp \ nsDOMScrollAreaEvent.cpp \ nsDOMTransitionEvent.cpp \ + nsDOMAnimationEvent.cpp \ nsDOMPopStateEvent.cpp \ nsDOMHashChangeEvent.cpp \ nsDOMCloseEvent.cpp \ @@ -96,10 +97,6 @@ CPPSRCS = \ nsDOMCustomEvent.cpp \ $(NULL) -ifdef MOZ_CSS_ANIMATIONS -CPPSRCS += nsDOMAnimationEvent.cpp -endif - # we don't want the shared lib, but we want to force the creation of a static lib. FORCE_STATIC_LIB = 1 diff --git a/content/events/src/nsDOMDataTransfer.cpp b/content/events/src/nsDOMDataTransfer.cpp index 4b9259ae131..59f90aa1620 100644 --- a/content/events/src/nsDOMDataTransfer.cpp +++ b/content/events/src/nsDOMDataTransfer.cpp @@ -448,8 +448,11 @@ nsDOMDataTransfer::MozGetDataAt(const nsAString& aFormat, // data from the same principal. nsIPrincipal* principal = nsnull; if (mEventType != NS_DRAGDROP_DROP && mEventType != NS_DRAGDROP_DRAGDROP && - !nsContentUtils::IsCallerTrustedForCapability("UniversalBrowserRead")) - principal = GetCurrentPrincipal(); + !nsContentUtils::IsCallerTrustedForCapability("UniversalBrowserRead")) { + nsresult rv = NS_OK; + principal = GetCurrentPrincipal(&rv); + NS_ENSURE_SUCCESS(rv, rv); + } PRUint32 count = item.Length(); for (PRUint32 i = 0; i < count; i++) { @@ -466,7 +469,7 @@ nsDOMDataTransfer::MozGetDataAt(const nsAString& aFormat, nsCOMPtr data; formatitem.mData->GetAsISupports(getter_AddRefs(data)); // Make sure the code that is calling us is same-origin with the data. - nsCOMPtr pt = do_QueryInterface(data); + nsCOMPtr pt = do_QueryInterface(data); if (pt) { nsresult rv = NS_OK; nsIScriptContext* c = pt->GetContextForEventHandlers(&rv); @@ -475,8 +478,9 @@ nsDOMDataTransfer::MozGetDataAt(const nsAString& aFormat, NS_ENSURE_TRUE(sp, NS_ERROR_DOM_SECURITY_ERR); nsIPrincipal* dataPrincipal = sp->GetPrincipal(); NS_ENSURE_TRUE(dataPrincipal, NS_ERROR_DOM_SECURITY_ERR); - NS_ENSURE_TRUE(principal || (principal = GetCurrentPrincipal()), + NS_ENSURE_TRUE(principal || (principal = GetCurrentPrincipal(&rv)), NS_ERROR_DOM_SECURITY_ERR); + NS_ENSURE_SUCCESS(rv, rv); PRBool equals = PR_FALSE; NS_ENSURE_TRUE(NS_SUCCEEDED(principal->Equals(dataPrincipal, &equals)) && equals, NS_ERROR_DOM_SECURITY_ERR); @@ -517,7 +521,10 @@ nsDOMDataTransfer::MozSetDataAt(const nsAString& aFormat, return NS_ERROR_DOM_SECURITY_ERR; } - return SetDataWithPrincipal(aFormat, aData, aIndex, GetCurrentPrincipal()); + nsresult rv = NS_OK; + nsIPrincipal* principal = GetCurrentPrincipal(&rv); + NS_ENSURE_SUCCESS(rv, rv); + return SetDataWithPrincipal(aFormat, aData, aIndex, principal); } NS_IMETHODIMP @@ -532,7 +539,9 @@ nsDOMDataTransfer::MozClearDataAt(const nsAString& aFormat, PRUint32 aIndex) nsAutoString format; GetRealFormat(aFormat, format); - nsIPrincipal* principal = GetCurrentPrincipal(); + nsresult rv = NS_OK; + nsIPrincipal* principal = GetCurrentPrincipal(&rv); + NS_ENSURE_SUCCESS(rv, rv); // if the format is empty, clear all formats PRBool clearall = format.IsEmpty(); @@ -798,12 +807,14 @@ nsDOMDataTransfer::SetDataWithPrincipal(const nsAString& aFormat, } nsIPrincipal* -nsDOMDataTransfer::GetCurrentPrincipal() +nsDOMDataTransfer::GetCurrentPrincipal(nsresult* rv) { nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); nsCOMPtr currentPrincipal; - ssm->GetSubjectPrincipal(getter_AddRefs(currentPrincipal)); + *rv = ssm->GetSubjectPrincipal(getter_AddRefs(currentPrincipal)); + NS_ENSURE_SUCCESS(*rv, nsnull); + if (!currentPrincipal) ssm->GetSystemPrincipal(getter_AddRefs(currentPrincipal)); diff --git a/content/events/src/nsDOMDataTransfer.h b/content/events/src/nsDOMDataTransfer.h index dc4a1bbed5b..4596bad6b51 100644 --- a/content/events/src/nsDOMDataTransfer.h +++ b/content/events/src/nsDOMDataTransfer.h @@ -152,7 +152,7 @@ protected: } // returns a weak reference to the current principal - nsIPrincipal* GetCurrentPrincipal(); + nsIPrincipal* GetCurrentPrincipal(nsresult* rv); // converts some formats used for compatibility in aInFormat into aOutFormat. // Text and text/unicode become text/plain, and URL becomes text/uri-list diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index 1fa9cee9a5e..230e363deff 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -46,7 +46,6 @@ #include "nsIContent.h" #include "nsIPresShell.h" #include "nsIDocument.h" -#include "nsIDOMEventTarget.h" #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" #include "prmem.h" @@ -106,13 +105,10 @@ static const char* const sEventNames[] = { "MozTouchMove", "MozTouchUp", "MozScrolledAreaChanged", - "transitionend" -#ifdef MOZ_CSS_ANIMATIONS - , + "transitionend", "animationstart", "animationend", "animationiteration" -#endif }; static char *sPopupAllowedEvents; @@ -283,16 +279,14 @@ NS_METHOD nsDOMEvent::GetType(nsAString& aType) } static nsresult -GetDOMEventTarget(nsPIDOMEventTarget* aTarget, +GetDOMEventTarget(nsIDOMEventTarget* aTarget, nsIDOMEventTarget** aDOMTarget) { - nsPIDOMEventTarget* realTarget = + nsIDOMEventTarget* realTarget = aTarget ? aTarget->GetTargetForDOMEvent() : aTarget; - if (realTarget) { - return CallQueryInterface(realTarget, aDOMTarget); - } - *aDOMTarget = nsnull; + NS_IF_ADDREF(*aDOMTarget = realTarget); + return NS_OK; } @@ -820,7 +814,6 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData() NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY); break; } -#ifdef MOZ_CSS_ANIMATIONS case NS_ANIMATION_EVENT: { nsAnimationEvent* oldAnimationEvent = @@ -831,7 +824,6 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData() NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY); break; } -#endif case NS_MOZTOUCH_EVENT: { newEvent = new nsMozTouchEvent(PR_FALSE, msg, nsnull, @@ -1363,14 +1355,12 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType) return sEventNames[eDOMEvents_MozScrolledAreaChanged]; case NS_TRANSITION_END: return sEventNames[eDOMEvents_transitionend]; -#ifdef MOZ_CSS_ANIMATIONS case NS_ANIMATION_START: return sEventNames[eDOMEvents_animationstart]; case NS_ANIMATION_END: return sEventNames[eDOMEvents_animationend]; case NS_ANIMATION_ITERATION: return sEventNames[eDOMEvents_animationiteration]; -#endif default: break; } diff --git a/content/events/src/nsDOMEvent.h b/content/events/src/nsDOMEvent.h index 92fd8a75fcd..3e7bab7f259 100644 --- a/content/events/src/nsDOMEvent.h +++ b/content/events/src/nsDOMEvent.h @@ -189,13 +189,10 @@ public: eDOMEvents_MozTouchMove, eDOMEvents_MozTouchUp, eDOMEvents_MozScrolledAreaChanged, - eDOMEvents_transitionend -#ifdef MOZ_CSS_ANIMATIONS - , + eDOMEvents_transitionend, eDOMEvents_animationstart, eDOMEvents_animationend, eDOMEvents_animationiteration -#endif }; nsDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent); diff --git a/content/events/src/nsDOMEventGroup.cpp b/content/events/src/nsDOMEventGroup.cpp deleted file mode 100644 index 3f07c43a4c9..00000000000 --- a/content/events/src/nsDOMEventGroup.cpp +++ /dev/null @@ -1,73 +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): - * Steve Clark (buster@netscape.com) - * - * 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 ***** */ - -#include "nsDOMEventGroup.h" - -NS_IMPL_ISUPPORTS1(nsDOMEventGroup, nsIDOMEventGroup) - -nsDOMEventGroup::nsDOMEventGroup() -{ - /* member initializers and constructor code */ -} - -nsDOMEventGroup::~nsDOMEventGroup() -{ - /* destructor code */ -} - -/* boolean isSameEventGroup (in nsIDOMEventGroup other); */ -NS_IMETHODIMP nsDOMEventGroup::IsSameEventGroup(nsIDOMEventGroup *other, PRBool *retval) -{ - *retval = PR_FALSE; - if (other == this) { - *retval = PR_TRUE; - } - return NS_OK; -} - -nsresult NS_NewDOMEventGroup(nsIDOMEventGroup** aResult); - -nsresult -NS_NewDOMEventGroup(nsIDOMEventGroup** aInstancePtrResult) -{ - *aInstancePtrResult = new nsDOMEventGroup; - if (!*aInstancePtrResult) - return NS_ERROR_OUT_OF_MEMORY; - NS_ADDREF(*aInstancePtrResult); - return NS_OK; -} diff --git a/content/events/src/nsDOMEventGroup.h b/content/events/src/nsDOMEventGroup.h deleted file mode 100644 index 2dff7889847..00000000000 --- a/content/events/src/nsDOMEventGroup.h +++ /dev/null @@ -1,54 +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 nsIDOMEventGroup_h__ -#define nsIDOMEventGroup_h__ - -#include "nsIDOMEventGroup.h" -#include "nsISupports.h" - -class nsDOMEventGroup : public nsIDOMEventGroup -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIDOMEVENTGROUP - - nsDOMEventGroup(); - virtual ~nsDOMEventGroup(); -}; - -#endif // nsIDOMEventGroup_h__ diff --git a/content/events/src/nsDOMEventTargetHelper.cpp b/content/events/src/nsDOMEventTargetHelper.cpp index c3ba88ec8ff..588a5c6db24 100644 --- a/content/events/src/nsDOMEventTargetHelper.cpp +++ b/content/events/src/nsDOMEventTargetHelper.cpp @@ -68,7 +68,8 @@ nsDOMEventListenerWrapper::HandleEvent(nsIDOMEvent* aEvent) NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMEventTargetHelper) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEventTargetHelper) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mListenerManager) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mListenerManager, + nsEventListenerManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptContext) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOwner) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END @@ -80,33 +81,23 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEventTargetHelper) NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMEventTargetHelper) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsPIDOMEventTarget) - NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget) + NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget) - NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget) NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMEventTargetHelper) NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMEventTargetHelper) - -NS_IMETHODIMP -nsDOMEventTargetHelper::AddEventListener(const nsAString& aType, - nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - return AddEventListener(aType, aListener, aUseCapture, PR_FALSE, 1); -} +NS_IMPL_DOMTARGET_DEFAULTS(nsDOMEventTargetHelper); NS_IMETHODIMP nsDOMEventTargetHelper::RemoveEventListener(const nsAString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { - nsIEventListenerManager* elm = GetListenerManager(PR_FALSE); + nsEventListenerManager* elm = GetListenerManager(PR_FALSE); if (elm) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - elm->RemoveEventListenerByType(aListener, aType, flags, nsnull); + elm->RemoveEventListener(aType, aListener, aUseCapture); } return NS_OK; @@ -117,18 +108,14 @@ nsDOMEventTargetHelper::AddEventListener(const nsAString& aType, nsIDOMEventListener *aListener, PRBool aUseCapture, PRBool aWantsUntrusted, - PRUint8 optional_argc) + PRUint8 aOptionalArgc) { - NS_ASSERTION(!aWantsUntrusted || optional_argc > 1, + NS_ASSERTION(!aWantsUntrusted || aOptionalArgc > 1, "Won't check if this is chrome, you want to set " "aWantsUntrusted to PR_FALSE or make the aWantsUntrusted " - "explicit by making optional_argc non-zero."); + "explicit by making aOptionalArgc non-zero."); - nsIEventListenerManager* elm = GetListenerManager(PR_TRUE); - NS_ENSURE_STATE(elm); - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - if (optional_argc < 2) { + if (aOptionalArgc < 2) { nsresult rv; nsIScriptContext* context = GetContextForEventHandlers(&rv); NS_ENSURE_SUCCESS(rv, rv); @@ -137,25 +124,9 @@ nsDOMEventTargetHelper::AddEventListener(const nsAString& aType, aWantsUntrusted = doc && !nsContentUtils::IsChromeDoc(doc); } - if (aWantsUntrusted) { - flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED; - } - - return elm->AddEventListenerByType(aListener, aType, flags, nsnull); -} - -NS_IMETHODIMP -nsDOMEventTargetHelper::GetScriptTypeID(PRUint32 *aLang) -{ - *aLang = mLang; - return NS_OK; -} - -NS_IMETHODIMP -nsDOMEventTargetHelper::SetScriptTypeID(PRUint32 aLang) -{ - mLang = aLang; - return NS_OK; + nsEventListenerManager* elm = GetListenerManager(PR_TRUE); + NS_ENSURE_STATE(elm); + return elm->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted); } NS_IMETHODIMP @@ -163,8 +134,7 @@ nsDOMEventTargetHelper::DispatchEvent(nsIDOMEvent* aEvent, PRBool* aRetVal) { nsEventStatus status = nsEventStatus_eIgnore; nsresult rv = - nsEventDispatcher::DispatchDOMEvent(static_cast(this), - nsnull, aEvent, nsnull, &status); + nsEventDispatcher::DispatchDOMEvent(this, nsnull, aEvent, nsnull, &status); *aRetVal = (status != nsEventStatus_eConsumeNoDefault); return rv; @@ -182,7 +152,7 @@ nsDOMEventTargetHelper::RemoveAddEventListener(const nsAString& aType, if (aNew) { aCurrent = new nsDOMEventListenerWrapper(aNew); NS_ENSURE_TRUE(aCurrent, NS_ERROR_OUT_OF_MEMORY); - AddEventListener(aType, aCurrent, PR_FALSE); + nsIDOMEventTarget::AddEventListener(aType, aCurrent, PR_FALSE); } return NS_OK; } @@ -222,21 +192,15 @@ nsDOMEventTargetHelper::DispatchDOMEvent(nsEvent* aEvent, nsEventStatus* aEventStatus) { return - nsEventDispatcher::DispatchDOMEvent(static_cast(this), - aEvent, aDOMEvent, aPresContext, + nsEventDispatcher::DispatchDOMEvent(this, aEvent, aDOMEvent, aPresContext, aEventStatus); } -nsIEventListenerManager* +nsEventListenerManager* nsDOMEventTargetHelper::GetListenerManager(PRBool aCreateIfNotFound) { - if (!mListenerManager) { - if (!aCreateIfNotFound) { - return nsnull; - } - nsresult rv = NS_NewEventListenerManager(getter_AddRefs(mListenerManager)); - NS_ENSURE_SUCCESS(rv, nsnull); - mListenerManager->SetListenerTarget(static_cast(this)); + if (!mListenerManager && aCreateIfNotFound) { + mListenerManager = new nsEventListenerManager(this); } return mListenerManager; @@ -246,7 +210,7 @@ nsresult nsDOMEventTargetHelper::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) { - nsIEventListenerManager* elm = GetListenerManager(PR_TRUE); + nsEventListenerManager* elm = GetListenerManager(PR_TRUE); NS_ENSURE_STATE(elm); return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); } @@ -255,18 +219,11 @@ nsresult nsDOMEventTargetHelper::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) { - nsIEventListenerManager* elm = GetListenerManager(PR_FALSE); - return elm ? - elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE) : - NS_OK; -} - -nsresult -nsDOMEventTargetHelper::GetSystemEventGroup(nsIDOMEventGroup** aGroup) -{ - nsIEventListenerManager* elm = GetListenerManager(PR_TRUE); - NS_ENSURE_STATE(elm); - return elm->GetSystemEventGroupLM(aGroup); + nsEventListenerManager* elm = GetListenerManager(PR_FALSE); + if (elm) { + elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); + } + return NS_OK; } nsIScriptContext* diff --git a/content/events/src/nsDOMEventTargetHelper.h b/content/events/src/nsDOMEventTargetHelper.h index b35f644f736..7e39cf93bfa 100644 --- a/content/events/src/nsDOMEventTargetHelper.h +++ b/content/events/src/nsDOMEventTargetHelper.h @@ -41,14 +41,12 @@ #include "nsCOMPtr.h" #include "nsAutoPtr.h" -#include "nsPIDOMEventTarget.h" -#include "nsIDOMEventListener.h" -#include "nsIDOMNSEventTarget.h" #include "nsIDOMEventTarget.h" +#include "nsIDOMEventListener.h" #include "nsCycleCollectionParticipant.h" #include "nsPIDOMWindow.h" #include "nsIScriptGlobalObject.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsIScriptContext.h" class nsDOMEventListenerWrapper : public nsIDOMEventListener @@ -67,32 +65,15 @@ protected: nsCOMPtr mListener; }; -class nsDOMEventTargetHelper : public nsPIDOMEventTarget, - public nsIDOMEventTarget, - public nsIDOMNSEventTarget +class nsDOMEventTargetHelper : public nsIDOMEventTarget { public: - nsDOMEventTargetHelper() : mLang(nsIProgrammingLanguage::JAVASCRIPT) {} + nsDOMEventTargetHelper() {} virtual ~nsDOMEventTargetHelper() {} NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMEventTargetHelper, - nsPIDOMEventTarget) + NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMEventTargetHelper) - NS_DECL_NSIDOMNSEVENTTARGET NS_DECL_NSIDOMEVENTTARGET - // nsPIDOMEventTarget - virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor); - virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor); - virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent, - nsPresContext* aPresContext, - nsEventStatus* aEventStatus); - virtual nsIEventListenerManager* GetListenerManager(PRBool aCreateIfNotFound); - virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID); - virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID); - virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup); - virtual nsIScriptContext* GetContextForEventHandlers(nsresult* aRv); PRBool HasListenersFor(const nsAString& aType) { @@ -117,8 +98,7 @@ public: return NS_OK; } protected: - nsCOMPtr mListenerManager; - PRUint32 mLang; + nsRefPtr mListenerManager; // These may be null (native callers or xpcshell). nsCOMPtr mScriptContext; nsCOMPtr mOwner; // Inner window. diff --git a/content/events/src/nsEventDispatcher.cpp b/content/events/src/nsEventDispatcher.cpp index 3472d325836..4d1158dd773 100644 --- a/content/events/src/nsEventDispatcher.cpp +++ b/content/events/src/nsEventDispatcher.cpp @@ -37,7 +37,7 @@ #include "nsEventDispatcher.h" #include "nsDOMEvent.h" -#include "nsPIDOMEventTarget.h" +#include "nsIDOMEventTarget.h" #include "nsPresContext.h" #include "nsIPrivateDOMEvent.h" #include "nsEventListenerManager.h" @@ -64,12 +64,12 @@ static nsEventTargetChainItem* gCachedETCI = nsnull; class nsEventTargetChainItem { private: - nsEventTargetChainItem(nsPIDOMEventTarget* aTarget, + nsEventTargetChainItem(nsIDOMEventTarget* aTarget, nsEventTargetChainItem* aChild = nsnull); public: static nsEventTargetChainItem* Create(nsFixedSizeAllocator* aAllocator, - nsPIDOMEventTarget* aTarget, + nsIDOMEventTarget* aTarget, nsEventTargetChainItem* aChild = nsnull) { void* place = nsnull; @@ -109,12 +109,12 @@ public: return !!(mTarget); } - nsPIDOMEventTarget* GetNewTarget() + nsIDOMEventTarget* GetNewTarget() { return mNewTarget; } - void SetNewTarget(nsPIDOMEventTarget* aNewTarget) + void SetNewTarget(nsIDOMEventTarget* aNewTarget) { mNewTarget = aNewTarget; } @@ -161,7 +161,7 @@ public: return !!(mFlags & NS_TARGET_CHAIN_MAY_HAVE_MANAGER); } - nsPIDOMEventTarget* CurrentTarget() + nsIDOMEventTarget* CurrentTarget() { return mTarget; } @@ -186,7 +186,7 @@ public: /** * If the current item in the event target chain has an event listener - * manager, this method calls nsIEventListenerManager::HandleEvent(). + * manager, this method calls nsEventListenerManager::HandleEvent(). */ nsresult HandleEvent(nsEventChainPostVisitor& aVisitor, PRUint32 aFlags, PRBool aMayHaveNewListenerManagers, @@ -232,7 +232,7 @@ public: sMaxEtciCount = 0; } - nsCOMPtr mTarget; + nsCOMPtr mTarget; nsEventTargetChainItem* mChild; union { nsEventTargetChainItem* mParent; @@ -243,7 +243,7 @@ public: PRUint16 mItemFlags; nsCOMPtr mItemData; // Event retargeting must happen whenever mNewTarget is non-null. - nsCOMPtr mNewTarget; + nsCOMPtr mNewTarget; // Cache mTarget's event listener manager. nsRefPtr mManager; @@ -254,7 +254,7 @@ public: PRUint32 nsEventTargetChainItem::sMaxEtciCount = 0; PRUint32 nsEventTargetChainItem::sCurrentEtciCount = 0; -nsEventTargetChainItem::nsEventTargetChainItem(nsPIDOMEventTarget* aTarget, +nsEventTargetChainItem::nsEventTargetChainItem(nsIDOMEventTarget* aTarget, nsEventTargetChainItem* aChild) : mChild(aChild), mParent(nsnull), mFlags(0), mItemFlags(0) { @@ -298,7 +298,7 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor { PRUint32 createdELMs = nsEventListenerManager::sCreatedCount; // Save the target so that it can be restored later. - nsCOMPtr firstTarget = aVisitor.mEvent->target; + nsCOMPtr firstTarget = aVisitor.mEvent->target; // Capture nsEventTargetChainItem* item = this; @@ -318,7 +318,7 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor // item is at anonymous boundary. Need to retarget for the child items. nsEventTargetChainItem* nextTarget = item->mChild; while (nextTarget) { - nsPIDOMEventTarget* newTarget = nextTarget->GetNewTarget(); + nsIDOMEventTarget* newTarget = nextTarget->GetNewTarget(); if (newTarget) { aVisitor.mEvent->target = newTarget; break; @@ -351,7 +351,7 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor aVisitor.mEvent->flags &= ~NS_EVENT_FLAG_CAPTURE; item = item->mParent; while (item) { - nsPIDOMEventTarget* newTarget = item->GetNewTarget(); + nsIDOMEventTarget* newTarget = item->GetNewTarget(); if (newTarget) { // Item is at anonymous boundary. Need to retarget for the current item // and for parent items. @@ -468,7 +468,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget, nsIDOMEvent* aDOMEvent, nsEventStatus* aEventStatus, nsDispatchingCallback* aCallback, - nsCOMArray* aTargets) + nsCOMArray* aTargets) { NS_ASSERTION(aEvent, "Trying to dispatch without nsEvent!"); NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(aEvent), @@ -487,7 +487,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget, timer_event_name ? timer_event_name : ""); #endif - nsCOMPtr target = do_QueryInterface(aTarget); + nsCOMPtr target = do_QueryInterface(aTarget); PRBool retargeted = PR_FALSE; @@ -518,14 +518,14 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget, if (!nsContentUtils::IsChromeDoc(doc)) { nsPIDOMWindow* win = doc ? doc->GetInnerWindow() : nsnull; // If we can't dispatch the event to chrome, do nothing. - nsPIDOMEventTarget* piTarget = win ? win->GetChromeEventHandler() : nsnull; + nsIDOMEventTarget* piTarget = win ? win->GetChromeEventHandler() : nsnull; NS_ENSURE_TRUE(piTarget, NS_OK); nsCOMPtr flo = do_QueryInterface(piTarget); if (flo) { nsRefPtr fl = flo->GetFrameLoader(); if (fl) { - nsPIDOMEventTarget* t = fl->GetTabChildGlobalAsEventTarget(); + nsIDOMEventTarget* t = fl->GetTabChildGlobalAsEventTarget(); piTarget = t ? t : piTarget; } } @@ -619,7 +619,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget, if (preVisitor.mCanHandle) { // At least the original target can handle the event. // Setting the retarget to the |target| simplifies retargeting code. - nsCOMPtr t = do_QueryInterface(aEvent->target); + nsCOMPtr t = aEvent->target; targetEtci->SetNewTarget(t); nsEventTargetChainItem* topEtci = targetEtci; while (preVisitor.mParentTarget) { @@ -802,11 +802,9 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext, case NS_TRANSITION_EVENT: return NS_NewDOMTransitionEvent(aDOMEvent, aPresContext, static_cast(aEvent)); -#ifdef MOZ_CSS_ANIMATIONS case NS_ANIMATION_EVENT: return NS_NewDOMAnimationEvent(aDOMEvent, aPresContext, static_cast(aEvent)); -#endif } // For all other types of events, create a vanilla event object. @@ -886,10 +884,8 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext, // is probably wrong! if (aEventType.LowerCaseEqualsLiteral("transitionevent")) return NS_NewDOMTransitionEvent(aDOMEvent, aPresContext, nsnull); -#ifdef MOZ_CSS_ANIMATIONS if (aEventType.LowerCaseEqualsLiteral("animationevent")) return NS_NewDOMAnimationEvent(aDOMEvent, aPresContext, nsnull); -#endif if (aEventType.LowerCaseEqualsLiteral("popstateevent")) return NS_NewDOMPopStateEvent(aDOMEvent, aPresContext, nsnull); if (aEventType.LowerCaseEqualsLiteral("mozaudioavailableevent")) diff --git a/content/events/src/nsEventListenerManager.cpp b/content/events/src/nsEventListenerManager.cpp index 9fb8f1bac86..c3253f286e0 100644 --- a/content/events/src/nsEventListenerManager.cpp +++ b/content/events/src/nsEventListenerManager.cpp @@ -82,7 +82,6 @@ #include "nsIDOMElement.h" #include "nsContentUtils.h" #include "nsJSUtils.h" -#include "nsIDOMEventGroup.h" #include "nsContentCID.h" #include "nsEventDispatcher.h" #include "nsDOMJSUtils.h" @@ -105,7 +104,6 @@ using namespace mozilla::dom; static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID); -static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID); static const PRUint32 kAllMutationBits = NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED | @@ -271,17 +269,13 @@ static const EventTypeData sEventTypes[] = { IMPL_EVENTTYPEDATA(UI) }; -// Strong references to event groups -nsIDOMEventGroup* gSystemEventGroup = nsnull; -nsIDOMEventGroup* gDOM2EventGroup = nsnull; - -PRUint32 nsEventListenerManager::mInstanceCount = 0; PRUint32 nsEventListenerManager::sCreatedCount = 0; -nsEventListenerManager::nsEventListenerManager() : - mTarget(nsnull) +nsEventListenerManager::nsEventListenerManager(nsISupports* aTarget) : + mTarget(aTarget) { - ++mInstanceCount; + NS_ASSERTION(aTarget, "unexpected null pointer"); + ++sCreatedCount; } @@ -299,49 +293,27 @@ nsEventListenerManager::~nsEventListenerManager() NS_ASSERTION(!mTarget, "didn't call Disconnect"); RemoveAllListeners(); - --mInstanceCount; - if(mInstanceCount == 0) { - NS_IF_RELEASE(gDOM2EventGroup); - } } -nsresult +void nsEventListenerManager::RemoveAllListeners() { mListeners.Clear(); - return NS_OK; } void nsEventListenerManager::Shutdown() { - NS_IF_RELEASE(gSystemEventGroup); sAddListenerID = JSID_VOID; nsDOMEvent::Shutdown(); } -nsIDOMEventGroup* -nsEventListenerManager::GetSystemEventGroup() -{ - if (!gSystemEventGroup) { - CallCreateInstance(kDOMEventGroupCID, &gSystemEventGroup); - } - return gSystemEventGroup; -} - NS_IMPL_CYCLE_COLLECTION_CLASS(nsEventListenerManager) -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsEventListenerManager) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIEventListenerManager) - NS_INTERFACE_MAP_ENTRY(nsIEventListenerManager) - NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget) - NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsEventListenerManager, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsEventListenerManager, Release) -NS_IMPL_CYCLE_COLLECTING_ADDREF(nsEventListenerManager) -NS_IMPL_CYCLE_COLLECTING_RELEASE(nsEventListenerManager) - -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsEventListenerManager) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(nsEventListenerManager) PRUint32 count = tmp->mListeners.Length(); for (PRUint32 i = 0; i < count; i++) { NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mListeners[i] mListener"); @@ -349,7 +321,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsEventListenerManager) } NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsEventListenerManager) +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsEventListenerManager) tmp->Disconnect(); NS_IMPL_CYCLE_COLLECTION_UNLINK_END @@ -407,26 +379,13 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener, PRUint32 aType, nsIAtom* aTypeAtom, const EventTypeData* aTypeData, - PRInt32 aFlags, - nsIDOMEventGroup* aEvtGrp) + PRInt32 aFlags) { NS_ENSURE_TRUE(aListener, NS_ERROR_FAILURE); NS_ENSURE_TRUE(aType || aTypeData, NS_ERROR_FAILURE); nsRefPtr kungFuDeathGrip = aListener; - PRBool isSame = PR_FALSE; - PRUint16 group = 0; - nsCOMPtr sysGroup; - GetSystemEventGroupLM(getter_AddRefs(sysGroup)); - if (sysGroup) { - sysGroup->IsSameEventGroup(aEvtGrp, &isSame); - if (isSame) { - group = NS_EVENT_FLAG_SYSTEM_EVENT; - mMayHaveSystemGroupListeners = PR_TRUE; - } - } - if (!aTypeData) { // If we don't have type data, we can try to QI listener to the right // interface and set mTypeData only if QI succeeds. This way we can save @@ -449,7 +408,6 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener, for (PRUint32 i = 0; i < count; i++) { ls = &mListeners.ElementAt(i); if (ls->mListener == aListener && ls->mFlags == aFlags && - ls->mGroupFlags == group && (EVENT_TYPE_EQUALS(ls, aType, aTypeAtom) || EVENT_TYPE_DATA_EQUALS(aTypeData, ls->mTypeData))) { return NS_OK; @@ -460,15 +418,16 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener, mNoListenerForEventAtom = nsnull; ls = mListeners.AppendElement(); - NS_ENSURE_TRUE(ls, NS_ERROR_OUT_OF_MEMORY); - ls->mListener = aListener; ls->mEventType = aType; ls->mTypeAtom = aTypeAtom; ls->mFlags = aFlags; - ls->mGroupFlags = group; ls->mHandlerIsString = PR_FALSE; ls->mTypeData = aTypeData; + + if (aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) { + mMayHaveSystemGroupListeners = PR_TRUE; + } if (aFlags & NS_EVENT_FLAG_CAPTURE) { mMayHaveCapturingListeners = PR_TRUE; } @@ -521,27 +480,15 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener, return NS_OK; } -nsresult +void nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener, PRUint32 aType, nsIAtom* aUserType, const EventTypeData* aTypeData, - PRInt32 aFlags, - nsIDOMEventGroup* aEvtGrp) + PRInt32 aFlags) { if (!aListener || !(aType || aTypeData)) { - return NS_OK; - } - - PRBool isSame = PR_FALSE; - PRUint16 group = 0; - nsCOMPtr sysGroup; - GetSystemEventGroupLM(getter_AddRefs(sysGroup)); - if (sysGroup) { - sysGroup->IsSameEventGroup(aEvtGrp, &isSame); - if (isSame) { - group = NS_EVENT_FLAG_SYSTEM_EVENT; - } + return; } nsListenerStruct* ls; @@ -551,7 +498,6 @@ nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener, for (PRUint32 i = 0; i < count; ++i) { ls = &mListeners.ElementAt(i); if (ls->mListener == aListener && - ls->mGroupFlags == group && ((ls->mFlags & ~NS_PRIV_EVENT_UNTRUSTED_PERMITTED) == aFlags) && (EVENT_TYPE_EQUALS(ls, aType, aUserType) || (!(ls->mEventType) && @@ -563,8 +509,6 @@ nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener, break; } } - - return NS_OK; } nsresult @@ -572,19 +516,17 @@ nsEventListenerManager::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags) { - AddEventListener(aListener, NS_EVENT_TYPE_NULL, nsnull, - GetTypeDataForIID(aIID), aFlags, nsnull); - return NS_OK; + return AddEventListener(aListener, NS_EVENT_TYPE_NULL, nsnull, + GetTypeDataForIID(aIID), aFlags); } -NS_IMETHODIMP +void nsEventListenerManager::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags) { RemoveEventListener(aListener, NS_EVENT_TYPE_NULL, nsnull, - GetTypeDataForIID(aIID), aFlags, nsnull); - return NS_OK; + GetTypeDataForIID(aIID), aFlags); } PRBool @@ -598,28 +540,24 @@ nsEventListenerManager::ListenerCanHandle(nsListenerStruct* aLs, return (aLs->mEventType == aEvent->message); } -NS_IMETHODIMP +nsresult nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aListener, const nsAString& aType, - PRInt32 aFlags, - nsIDOMEventGroup* aEvtGrp) + PRInt32 aFlags) { nsCOMPtr atom = do_GetAtom(NS_LITERAL_STRING("on") + aType); PRUint32 type = nsContentUtils::GetEventId(atom); - AddEventListener(aListener, type, atom, nsnull, aFlags, aEvtGrp); - return NS_OK; + return AddEventListener(aListener, type, atom, nsnull, aFlags); } -NS_IMETHODIMP +void nsEventListenerManager::RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsAString& aType, - PRInt32 aFlags, - nsIDOMEventGroup* aEvtGrp) + PRInt32 aFlags) { nsCOMPtr atom = do_GetAtom(NS_LITERAL_STRING("on") + aType); PRUint32 type = nsContentUtils::GetEventId(atom); - RemoveEventListener(aListener, type, atom, nsnull, aFlags, aEvtGrp); - return NS_OK; + RemoveEventListener(aListener, type, atom, nsnull, aFlags); } nsListenerStruct* @@ -660,7 +598,7 @@ nsEventListenerManager::SetJSEventListener(nsIScriptContext *aContext, getter_AddRefs(scriptListener)); if (NS_SUCCEEDED(rv)) { AddEventListener(scriptListener, eventType, aName, nsnull, - NS_EVENT_FLAG_BUBBLE | NS_PRIV_EVENT_FLAG_SCRIPT, nsnull); + NS_EVENT_FLAG_BUBBLE | NS_PRIV_EVENT_FLAG_SCRIPT); ls = FindJSEventListener(eventType, aName); } @@ -678,7 +616,7 @@ nsEventListenerManager::SetJSEventListener(nsIScriptContext *aContext, return rv; } -NS_IMETHODIMP +nsresult nsEventListenerManager::AddScriptEventListener(nsISupports *aObject, nsIAtom *aName, const nsAString& aBody, @@ -863,7 +801,7 @@ nsEventListenerManager::AddScriptEventListener(nsISupports *aObject, aPermitUntrustedEvents); } -nsresult +void nsEventListenerManager::RemoveScriptEventListener(nsIAtom* aName) { PRUint32 eventType = nsContentUtils::GetEventId(aName); @@ -874,14 +812,12 @@ nsEventListenerManager::RemoveScriptEventListener(nsIAtom* aName) mNoListenerForEvent = NS_EVENT_TYPE_NULL; mNoListenerForEventAtom = nsnull; } - - return NS_OK; } jsid nsEventListenerManager::sAddListenerID = JSID_VOID; -NS_IMETHODIMP +nsresult nsEventListenerManager::RegisterScriptEventListener(nsIScriptContext *aContext, void *aScope, nsISupports *aObject, @@ -1092,7 +1028,7 @@ nsresult nsEventListenerManager::HandleEventSubType(nsListenerStruct* aListenerStruct, nsIDOMEventListener* aListener, nsIDOMEvent* aDOMEvent, - nsPIDOMEventTarget* aCurrentTarget, + nsIDOMEventTarget* aCurrentTarget, PRUint32 aPhaseFlags, nsCxPusher* aPusher) { @@ -1149,11 +1085,11 @@ static const EventDispatchData* sLatestEventDispData = nsnull; * @param an event listener */ -nsresult +void nsEventListenerManager::HandleEventInternal(nsPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, - nsPIDOMEventTarget* aCurrentTarget, + nsIDOMEventTarget* aCurrentTarget, PRUint32 aFlags, nsEventStatus* aEventStatus, nsCxPusher* aPusher) @@ -1162,7 +1098,6 @@ nsEventListenerManager::HandleEventInternal(nsPresContext* aPresContext, if (*aEventStatus == nsEventStatus_eConsumeNoDefault) { aEvent->flags |= NS_EVENT_FLAG_NO_DEFAULT; } - PRUint16 currentGroup = aFlags & NS_EVENT_FLAG_SYSTEM_EVENT; const EventTypeData* typeData = nsnull; const EventDispatchData* dispData = nsnull; @@ -1207,8 +1142,11 @@ found: if (useTypeInterface || useGenericInterface) { if (ls->mListener) { hasListener = PR_TRUE; - if (ls->mFlags & aFlags && - ls->mGroupFlags == currentGroup && + // XXX The (mFlags & aFlags) test here seems fragile. Shouldn't we + // specifically only test the capture/bubble flags. + if ((ls->mFlags & aFlags & ~NS_EVENT_FLAG_SYSTEM_EVENT) && + (ls->mFlags & NS_EVENT_FLAG_SYSTEM_EVENT) == + (aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) && (NS_IS_TRUSTED_EVENT(aEvent) || ls->mFlags & NS_PRIV_EVENT_UNTRUSTED_PERMITTED)) { if (!*aDOMEvent) { @@ -1251,164 +1189,56 @@ found: if (aEvent->flags & NS_EVENT_FLAG_NO_DEFAULT) { *aEventStatus = nsEventStatus_eConsumeNoDefault; } - - return NS_OK; } -NS_IMETHODIMP +void nsEventListenerManager::Disconnect() { mTarget = nsnull; - return RemoveAllListeners(); -} - -NS_IMETHODIMP -nsEventListenerManager::SetListenerTarget(nsISupports* aTarget) -{ - NS_PRECONDITION(aTarget, "unexpected null pointer"); - - //WEAK reference, must be set back to nsnull when done by calling Disconnect - mTarget = aTarget; - return NS_OK; -} - -NS_IMETHODIMP -nsEventListenerManager::GetSystemEventGroupLM(nsIDOMEventGroup **aGroup) -{ - *aGroup = GetSystemEventGroup(); - NS_ENSURE_TRUE(*aGroup, NS_ERROR_OUT_OF_MEMORY); - NS_ADDREF(*aGroup); - return NS_OK; -} - -nsresult -nsEventListenerManager::GetDOM2EventGroup(nsIDOMEventGroup **aGroup) -{ - if (!gDOM2EventGroup) { - nsresult result; - nsCOMPtr group(do_CreateInstance(kDOMEventGroupCID,&result)); - if (NS_FAILED(result)) - return result; - - gDOM2EventGroup = group; - NS_ADDREF(gDOM2EventGroup); - } - - *aGroup = gDOM2EventGroup; - NS_ADDREF(*aGroup); - return NS_OK; + RemoveAllListeners(); } // nsIDOMEventTarget interface -NS_IMETHODIMP -nsEventListenerManager::AddEventListener(const nsAString& aType, - nsIDOMEventListener* aListener, - PRBool aUseCapture) +nsresult +nsEventListenerManager::AddEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture, + PRBool aWantsUntrusted) { PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - nsresult rv = AddEventListenerByType(aListener, aType, flags, nsnull); - NS_ASSERTION(NS_FAILED(rv) || HasListenersFor(aType), - "Adding event listener didn't work!"); - return rv; + if (aWantsUntrusted) { + flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED; + } + + return AddEventListenerByType(aListener, aType, flags); } -NS_IMETHODIMP +void nsEventListenerManager::RemoveEventListener(const nsAString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - return RemoveEventListenerByType(aListener, aType, flags, nsnull); + RemoveEventListenerByType(aListener, aType, flags); } -NS_IMETHODIMP -nsEventListenerManager::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval) +PRBool +nsEventListenerManager::HasMutationListeners() { - nsCOMPtr targetNode(do_QueryInterface(mTarget)); - if (!targetNode) { - // nothing to dispatch on -- bad! - return NS_ERROR_FAILURE; - } - - // XXX sXBL/XBL2 issue -- do we really want the owner here? What - // if that's the XBL document? Would we want its presshell? Or what? - nsCOMPtr document = targetNode->GetOwnerDoc(); - - // Do nothing if the element does not belong to a document - if (!document) { - *_retval = PR_TRUE; - return NS_OK; - } - - // Obtain a presentation shell - nsIPresShell *shell = document->GetShell(); - nsRefPtr context; - if (shell) { - context = shell->GetPresContext(); - } - - nsEventStatus status = nsEventStatus_eIgnore; - nsresult rv = - nsEventDispatcher::DispatchDOMEvent(targetNode, nsnull, aEvent, - context, &status); - *_retval = (status != nsEventStatus_eConsumeNoDefault); - return rv; -} - -// nsIDOM3EventTarget interface -NS_IMETHODIMP -nsEventListenerManager::AddGroupedEventListener(const nsAString& aType, - nsIDOMEventListener* aListener, - PRBool aUseCapture, - nsIDOMEventGroup* aEvtGrp) -{ - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - return AddEventListenerByType(aListener, aType, flags, aEvtGrp); -} - -NS_IMETHODIMP -nsEventListenerManager::RemoveGroupedEventListener(const nsAString& aType, - nsIDOMEventListener* aListener, - PRBool aUseCapture, - nsIDOMEventGroup* aEvtGrp) -{ - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - return RemoveEventListenerByType(aListener, aType, flags, aEvtGrp); -} - -NS_IMETHODIMP -nsEventListenerManager::CanTrigger(const nsAString & type, PRBool *_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsEventListenerManager::IsRegisteredHere(const nsAString & type, PRBool *_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsEventListenerManager::HasMutationListeners(PRBool* aListener) -{ - *aListener = PR_FALSE; if (mMayHaveMutationListeners) { PRUint32 count = mListeners.Length(); for (PRUint32 i = 0; i < count; ++i) { nsListenerStruct* ls = &mListeners.ElementAt(i); if (ls->mEventType >= NS_MUTATION_START && ls->mEventType <= NS_MUTATION_END) { - *aListener = PR_TRUE; - break; + return PR_TRUE; } } } - return NS_OK; + return PR_FALSE; } PRUint32 @@ -1474,14 +1304,14 @@ nsEventListenerManager::HasListeners() nsresult nsEventListenerManager::GetListenerInfo(nsCOMArray* aList) { - nsCOMPtr target = do_QueryInterface(mTarget); + nsCOMPtr target = do_QueryInterface(mTarget); NS_ENSURE_STATE(target); aList->Clear(); PRUint32 count = mListeners.Length(); for (PRUint32 i = 0; i < count; ++i) { const nsListenerStruct& ls = mListeners.ElementAt(i); PRBool capturing = !!(ls.mFlags & NS_EVENT_FLAG_CAPTURE); - PRBool systemGroup = !!(ls.mGroupFlags & NS_EVENT_FLAG_SYSTEM_EVENT); + PRBool systemGroup = !!(ls.mFlags & NS_EVENT_FLAG_SYSTEM_EVENT); PRBool allowsUntrusted = !!(ls.mFlags & NS_PRIV_EVENT_UNTRUSTED_PERMITTED); // If this is a script handler and we haven't yet // compiled the event handler itself @@ -1553,15 +1383,3 @@ nsEventListenerManager::HasUnloadListeners() } return PR_FALSE; } - -nsresult -NS_NewEventListenerManager(nsIEventListenerManager** aInstancePtrResult) -{ - nsIEventListenerManager* l = new nsEventListenerManager(); - - if (!l) { - return NS_ERROR_OUT_OF_MEMORY; - } - - return CallQueryInterface(l, aInstancePtrResult); -} diff --git a/content/events/src/nsEventListenerManager.h b/content/events/src/nsEventListenerManager.h index 61ba60df3ba..62630e2d9ff 100644 --- a/content/events/src/nsEventListenerManager.h +++ b/content/events/src/nsEventListenerManager.h @@ -38,11 +38,13 @@ #ifndef nsEventListenerManager_h__ #define nsEventListenerManager_h__ -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "jsapi.h" #include "nsCOMPtr.h" #include "nsIDOMEventTarget.h" -#include "nsIDOM3EventTarget.h" +#include "nsIDOMEventListener.h" +#include "nsAutoPtr.h" +#include "nsCOMArray.h" #include "nsHashtable.h" #include "nsIScriptContext.h" #include "nsCycleCollectionParticipant.h" @@ -56,13 +58,14 @@ struct nsPoint; struct EventTypeData; class nsEventTargetChainItem; class nsPIDOMWindow; +class nsCxPusher; +class nsIEventListenerInfo; typedef struct { nsRefPtr mListener; PRUint32 mEventType; nsCOMPtr mTypeAtom; PRUint16 mFlags; - PRUint16 mGroupFlags; PRBool mHandlerIsString; const EventTypeData* mTypeData; } nsListenerStruct; @@ -71,127 +74,136 @@ typedef struct { * Event listener manager */ -class nsEventListenerManager : public nsIEventListenerManager, - public nsIDOMEventTarget, - public nsIDOM3EventTarget +class nsEventListenerManager { public: - nsEventListenerManager(); + nsEventListenerManager(nsISupports* aTarget); virtual ~nsEventListenerManager(); - NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_INLINE_DECL_REFCOUNTING(nsEventListenerManager) + + NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsEventListenerManager) + + nsresult AddEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture, + PRBool aWantsUntrusted); + void RemoveEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture); /** * Sets events listeners of all types. * @param an event listener */ - NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID, PRInt32 aFlags); - NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID, PRInt32 aFlags); - NS_IMETHOD AddEventListenerByType(nsIDOMEventListener *aListener, - const nsAString& type, - PRInt32 aFlags, - nsIDOMEventGroup* aEvtGroup); - NS_IMETHOD RemoveEventListenerByType(nsIDOMEventListener *aListener, - const nsAString& type, - PRInt32 aFlags, - nsIDOMEventGroup* aEvtGroup); - NS_IMETHOD AddScriptEventListener(nsISupports *aObject, - nsIAtom *aName, - const nsAString& aFunc, - PRUint32 aLanguage, - PRBool aDeferCompilation, - PRBool aPermitUntrustedEvents); - NS_IMETHOD RegisterScriptEventListener(nsIScriptContext *aContext, - void *aScopeObject, - nsISupports *aObject, - nsIAtom* aName); - NS_IMETHOD RemoveScriptEventListener(nsIAtom *aName); - NS_IMETHOD CompileScriptEventListener(nsIScriptContext *aContext, - void *aScopeObject, - nsISupports *aObject, - nsIAtom* aName, PRBool *aDidCompile); + nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, + const nsIID& aIID, PRInt32 aFlags); + void RemoveEventListenerByIID(nsIDOMEventListener *aListener, + const nsIID& aIID, PRInt32 aFlags); + nsresult AddEventListenerByType(nsIDOMEventListener *aListener, + const nsAString& type, + PRInt32 aFlags); + void RemoveEventListenerByType(nsIDOMEventListener *aListener, + const nsAString& type, + PRInt32 aFlags); + nsresult AddScriptEventListener(nsISupports *aObject, + nsIAtom *aName, + const nsAString& aFunc, + PRUint32 aLanguage, + PRBool aDeferCompilation, + PRBool aPermitUntrustedEvents); + nsresult RegisterScriptEventListener(nsIScriptContext *aContext, + void *aScopeObject, + nsISupports *aObject, + nsIAtom* aName); + void RemoveScriptEventListener(nsIAtom *aName); + nsresult CompileScriptEventListener(nsIScriptContext *aContext, + void *aScopeObject, + nsISupports *aObject, + nsIAtom* aName, PRBool *aDidCompile); - nsresult HandleEvent(nsPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - nsPIDOMEventTarget* aCurrentTarget, - PRUint32 aFlags, - nsEventStatus* aEventStatus, - nsCxPusher* aPusher) + void HandleEvent(nsPresContext* aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + nsIDOMEventTarget* aCurrentTarget, + PRUint32 aFlags, + nsEventStatus* aEventStatus, + nsCxPusher* aPusher) { if (mListeners.IsEmpty() || aEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH) { - return NS_OK; + return; } if (!mMayHaveCapturingListeners && !(aEvent->flags & NS_EVENT_FLAG_BUBBLE)) { - return NS_OK; + return; } if (!mMayHaveSystemGroupListeners && aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) { - return NS_OK; + return; } // Check if we already know that there is no event listener for the event. if (mNoListenerForEvent == aEvent->message && (mNoListenerForEvent != NS_USER_DEFINED_EVENT || mNoListenerForEventAtom == aEvent->userType)) { - return NS_OK; + return; } - return HandleEventInternal(aPresContext, aEvent, aDOMEvent, aCurrentTarget, - aFlags, aEventStatus, aPusher); + HandleEventInternal(aPresContext, aEvent, aDOMEvent, aCurrentTarget, + aFlags, aEventStatus, aPusher); } - nsresult HandleEventInternal(nsPresContext* aPresContext, - nsEvent* aEvent, - nsIDOMEvent** aDOMEvent, - nsPIDOMEventTarget* aCurrentTarget, - PRUint32 aFlags, - nsEventStatus* aEventStatus, - nsCxPusher* aPusher); + void HandleEventInternal(nsPresContext* aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + nsIDOMEventTarget* aCurrentTarget, + PRUint32 aFlags, + nsEventStatus* aEventStatus, + nsCxPusher* aPusher); - NS_IMETHOD Disconnect(); + void Disconnect(); - NS_IMETHOD SetListenerTarget(nsISupports* aTarget); + PRBool HasMutationListeners(); - NS_IMETHOD HasMutationListeners(PRBool* aListener); + PRBool HasUnloadListeners(); - NS_IMETHOD GetSystemEventGroupLM(nsIDOMEventGroup** aGroup); + PRUint32 MutationListenerBits(); - virtual PRBool HasUnloadListeners(); + PRBool HasListenersFor(const nsAString& aEventName); - virtual PRUint32 MutationListenerBits(); + PRBool HasListeners(); - virtual PRBool HasListenersFor(const nsAString& aEventName); + nsresult GetListenerInfo(nsCOMArray* aList); - virtual PRBool HasListeners(); - - virtual nsresult GetListenerInfo(nsCOMArray* aList); - - static PRUint32 GetIdentifierForEvent(nsIAtom* aEvent); - - // nsIDOMEventTarget - NS_DECL_NSIDOMEVENTTARGET - - // nsIDOM3EventTarget - NS_DECL_NSIDOM3EVENTTARGET + PRUint32 GetIdentifierForEvent(nsIAtom* aEvent); static void Shutdown(); - static nsIDOMEventGroup* GetSystemEventGroup(); + /** + * Returns PR_TRUE if there may be a paint event listener registered, + * PR_FALSE if there definitely isn't. + */ + PRBool MayHavePaintEventListener() { return mMayHavePaintEventListener; } - NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsEventListenerManager, - nsIEventListenerManager) + /** + * Returns PR_TRUE if there may be a MozAudioAvailable event listener registered, + * PR_FALSE if there definitely isn't. + */ + PRBool MayHaveAudioAvailableEventListener() { return mMayHaveAudioAvailableEventListener; } + + /** + * Returns PR_TRUE if there may be a touch event listener registered, + * PR_FALSE if there definitely isn't. + */ + PRBool MayHaveTouchEventListener() { return mMayHaveTouchEventListener; } protected: nsresult HandleEventSubType(nsListenerStruct* aListenerStruct, nsIDOMEventListener* aListener, nsIDOMEvent* aDOMEvent, - nsPIDOMEventTarget* aCurrentTarget, + nsIDOMEventTarget* aCurrentTarget, PRUint32 aPhaseFlags, nsCxPusher* aPusher); nsresult CompileEventHandlerInternal(nsIScriptContext *aContext, @@ -211,21 +223,26 @@ protected: PRUint32 aType, nsIAtom* aTypeAtom, const EventTypeData* aTypeData, - PRInt32 aFlags, - nsIDOMEventGroup* aEvtGrp); - nsresult RemoveEventListener(nsIDOMEventListener *aListener, - PRUint32 aType, - nsIAtom* aUserType, - const EventTypeData* aTypeData, - PRInt32 aFlags, - nsIDOMEventGroup* aEvtGrp); - nsresult RemoveAllListeners(); + PRInt32 aFlags); + void RemoveEventListener(nsIDOMEventListener *aListener, + PRUint32 aType, + nsIAtom* aUserType, + const EventTypeData* aTypeData, + PRInt32 aFlags); + void RemoveAllListeners(); const EventTypeData* GetTypeDataForIID(const nsIID& aIID); const EventTypeData* GetTypeDataForEventName(nsIAtom* aName); - nsresult GetDOM2EventGroup(nsIDOMEventGroup** aGroup); PRBool ListenerCanHandle(nsListenerStruct* aLs, nsEvent* aEvent); nsPIDOMWindow* GetInnerWindowForTarget(); + PRUint32 mMayHavePaintEventListener : 1; + PRUint32 mMayHaveMutationListeners : 1; + PRUint32 mMayHaveCapturingListeners : 1; + PRUint32 mMayHaveSystemGroupListeners : 1; + PRUint32 mMayHaveAudioAvailableEventListener : 1; + PRUint32 mMayHaveTouchEventListener : 1; + PRUint32 mNoListenerForEvent : 26; + nsAutoTObserverArray mListeners; nsISupports* mTarget; //WEAK nsCOMPtr mNoListenerForEventAtom; diff --git a/content/events/src/nsEventListenerService.cpp b/content/events/src/nsEventListenerService.cpp index d305b78af49..6ed73f56ce8 100644 --- a/content/events/src/nsEventListenerService.cpp +++ b/content/events/src/nsEventListenerService.cpp @@ -37,7 +37,6 @@ #include "nsEventListenerService.h" #include "nsCOMArray.h" #include "nsEventListenerManager.h" -#include "nsPIDOMEventTarget.h" #include "nsIVariant.h" #include "nsIServiceManager.h" #include "nsMemory.h" @@ -51,7 +50,6 @@ #include "nsGUIEvent.h" #include "nsEventDispatcher.h" #include "nsIJSEventListener.h" -#include "nsIDOMEventGroup.h" #ifdef MOZ_JSDEBUGGER #include "jsdIDebuggerService.h" #endif @@ -202,13 +200,10 @@ nsEventListenerService::GetListenerInfoFor(nsIDOMEventTarget* aEventTarget, *aCount = 0; *aOutArray = nsnull; nsCOMArray listenerInfos; - nsCOMPtr target = do_QueryInterface(aEventTarget); - if (target) { - nsCOMPtr elm = - target->GetListenerManager(PR_FALSE); - if (elm) { - elm->GetListenerInfo(&listenerInfos); - } + nsEventListenerManager* elm = + aEventTarget->GetListenerManager(PR_FALSE); + if (elm) { + elm->GetListenerInfo(&listenerInfos); } PRInt32 count = listenerInfos.Count(); @@ -235,11 +230,10 @@ nsEventListenerService::GetEventTargetChainFor(nsIDOMEventTarget* aEventTarget, { *aCount = 0; *aOutArray = nsnull; - nsCOMPtr target = do_QueryInterface(aEventTarget); - NS_ENSURE_ARG(target); + NS_ENSURE_ARG(aEventTarget); nsEvent event(PR_TRUE, NS_EVENT_TYPE_NULL); - nsCOMArray targets; - nsresult rv = nsEventDispatcher::Dispatch(target, nsnull, &event, + nsCOMArray targets; + nsresult rv = nsEventDispatcher::Dispatch(aEventTarget, nsnull, &event, nsnull, nsnull, nsnull, &targets); NS_ENSURE_SUCCESS(rv, rv); PRInt32 count = targets.Count(); @@ -249,12 +243,11 @@ nsEventListenerService::GetEventTargetChainFor(nsIDOMEventTarget* aEventTarget, *aOutArray = static_cast( - nsMemory::Alloc(sizeof(nsPIDOMEventTarget*) * count)); + nsMemory::Alloc(sizeof(nsIDOMEventTarget*) * count)); NS_ENSURE_TRUE(*aOutArray, NS_ERROR_OUT_OF_MEMORY); for (PRInt32 i = 0; i < count; ++i) { - nsCOMPtr target = do_QueryInterface(targets[i]); - (*aOutArray)[i] = target.forget().get(); + NS_ADDREF((*aOutArray)[i] = targets[i]); } *aCount = count; @@ -262,12 +255,52 @@ nsEventListenerService::GetEventTargetChainFor(nsIDOMEventTarget* aEventTarget, } NS_IMETHODIMP -nsEventListenerService::GetSystemEventGroup(nsIDOMEventGroup** aSystemGroup) +nsEventListenerService::HasListenersFor(nsIDOMEventTarget* aEventTarget, + const nsAString& aType, + PRBool* aRetVal) { - NS_ENSURE_ARG_POINTER(aSystemGroup); - *aSystemGroup = nsEventListenerManager::GetSystemEventGroup(); - NS_ENSURE_TRUE(*aSystemGroup, NS_ERROR_OUT_OF_MEMORY); - NS_ADDREF(*aSystemGroup); + nsEventListenerManager* elm = aEventTarget->GetListenerManager(PR_FALSE); + *aRetVal = elm && elm->HasListenersFor(aType); + return NS_OK; +} + +NS_IMETHODIMP +nsEventListenerService::AddSystemEventListener(nsIDOMEventTarget *aTarget, + const nsAString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) +{ + NS_PRECONDITION(aTarget, "Missing target"); + NS_PRECONDITION(aListener, "Missing listener"); + + nsEventListenerManager* manager = aTarget->GetListenerManager(PR_TRUE); + NS_ENSURE_STATE(manager); + + PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE | + NS_EVENT_FLAG_SYSTEM_EVENT : + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT; + return manager->AddEventListenerByType(aListener, aType, flags); +} + +NS_IMETHODIMP +nsEventListenerService::RemoveSystemEventListener(nsIDOMEventTarget *aTarget, + const nsAString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) +{ + NS_PRECONDITION(aTarget, "Missing target"); + NS_PRECONDITION(aListener, "Missing listener"); + + nsEventListenerManager* manager = aTarget->GetListenerManager(PR_FALSE); + if (manager) { + PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE | + NS_EVENT_FLAG_SYSTEM_EVENT : + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT; + manager->RemoveEventListenerByType(aListener, aType, flags); + } + return NS_OK; } diff --git a/content/events/src/nsEventListenerService.h b/content/events/src/nsEventListenerService.h index 0bdf04560e1..d0378ddc7ff 100644 --- a/content/events/src/nsEventListenerService.h +++ b/content/events/src/nsEventListenerService.h @@ -42,7 +42,6 @@ #include "nsIDOMEventListener.h" #include "nsIDOMEventTarget.h" #include "nsString.h" -#include "nsPIDOMEventTarget.h" #include "nsCycleCollectionParticipant.h" #include "jsapi.h" diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 6beaff86136..4447aa8d889 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -88,7 +88,6 @@ #include "nsIDOMWindowInternal.h" #include "nsPIDOMWindow.h" #include "nsPIWindowRoot.h" -#include "nsIDOMEventTarget.h" #include "nsIEnumerator.h" #include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeNode.h" diff --git a/content/html/content/public/nsHTMLCanvasElement.h b/content/html/content/public/nsHTMLCanvasElement.h index 1f624154ae3..84eb1ee90c9 100644 --- a/content/html/content/public/nsHTMLCanvasElement.h +++ b/content/html/content/public/nsHTMLCanvasElement.h @@ -91,8 +91,8 @@ public: NS_DECL_NSIDOMHTMLCANVASELEMENT // CC - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLCanvasElement, - nsGenericHTMLElement) + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLCanvasElement, + nsGenericHTMLElement) /** * Ask the canvas Element to return the primary frame, if any diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/nsHTMLMediaElement.h index 09846c6fe53..1b2694ac9af 100644 --- a/content/html/content/public/nsHTMLMediaElement.h +++ b/content/html/content/public/nsHTMLMediaElement.h @@ -188,6 +188,7 @@ public: gfxASurface* GetPrintSurface() { return mPrintSurface; } // Dispatch events + using nsGenericHTMLElement::DispatchEvent; nsresult DispatchEvent(const nsAString& aName); nsresult DispatchAsyncEvent(const nsAString& aName); nsresult DispatchAudioAvailableEvent(float* aFrameBuffer, diff --git a/content/html/content/src/Makefile.in b/content/html/content/src/Makefile.in index 26bc9023399..3ab42a0b52c 100644 --- a/content/html/content/src/Makefile.in +++ b/content/html/content/src/Makefile.in @@ -143,6 +143,7 @@ INCLUDES += \ -I$(srcdir)/../../../../editor/libeditor/base \ -I$(srcdir)/../../../../editor/libeditor/text \ -I$(srcdir) \ + -I$(topsrcdir)/xpcom/ds \ $(NULL) DEFINES += -D_IMPL_NS_LAYOUT diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 3b3306d701d..88eee264ba2 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -53,7 +53,7 @@ #include "nsIDOMElementCSSInlineStyle.h" #include "nsIDOMWindow.h" #include "nsIDOMDocument.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsMappedAttributes.h" #include "nsHTMLStyleSheet.h" #include "nsIHTMLDocument.h" @@ -1124,7 +1124,7 @@ nsGenericHTMLElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName, } nsresult -nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIEventListenerManager** aManager, +nsGenericHTMLElement::GetEventListenerManagerForAttr(nsEventListenerManager** aManager, nsISupports** aTarget, PRBool* aDefer) { @@ -1147,7 +1147,7 @@ nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIEventListenerManager** a // bail if it does. if (document && (win = document->GetInnerWindow()) && win->IsInnerWindow()) { - nsCOMPtr piTarget(do_QueryInterface(win)); + nsCOMPtr piTarget(do_QueryInterface(win)); NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE); *aManager = piTarget->GetListenerManager(PR_TRUE); @@ -1236,7 +1236,7 @@ nsGenericHTMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, } else if (nsContentUtils::IsEventAttributeName(aAttribute, EventNameType_HTML)) { - nsIEventListenerManager* manager = GetListenerManager(PR_FALSE); + nsEventListenerManager* manager = GetListenerManager(PR_FALSE); if (manager) { manager->RemoveScriptEventListener(aAttribute); } diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index 3a759b57df6..5a6603c523c 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -580,7 +580,7 @@ protected: const nsAString* aValue, PRBool aNotify); virtual nsresult - GetEventListenerManagerForAttr(nsIEventListenerManager** aManager, + GetEventListenerManagerForAttr(nsEventListenerManager** aManager, nsISupports** aTarget, PRBool* aDefer); diff --git a/content/html/content/src/nsHTMLCanvasElement.cpp b/content/html/content/src/nsHTMLCanvasElement.cpp index f7eb93ba1ee..e50a96a182f 100644 --- a/content/html/content/src/nsHTMLCanvasElement.cpp +++ b/content/html/content/src/nsHTMLCanvasElement.cpp @@ -48,6 +48,7 @@ #include "jsapi.h" #include "nsJSUtils.h" #include "nsMathUtils.h" +#include "mozilla/Preferences.h" #include "nsFrameManager.h" #include "nsDisplayList.h" @@ -86,6 +87,11 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLCanvasElement, NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCurrentContext) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLCanvasElement, + nsGenericHTMLElement) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCurrentContext) +NS_IMPL_CYCLE_COLLECTION_UNLINK_END + NS_IMPL_ADDREF_INHERITED(nsHTMLCanvasElement, nsGenericElement) NS_IMPL_RELEASE_INHERITED(nsHTMLCanvasElement, nsGenericElement) @@ -616,7 +622,7 @@ nsHTMLCanvasElement::InvalidateCanvasContent(const gfxRect* damageRect) if (!frame) return; - frame->MarkLayersActive(); + frame->MarkLayersActive(nsChangeHint(0)); nsRect invalRect; nsRect contentArea = frame->GetContentRect(); @@ -717,3 +723,23 @@ nsHTMLCanvasElement::RenderContextsExternal(gfxContext *aContext, gfxPattern::Gr return mCurrentContext->Render(aContext, aFilter); } + +nsresult NS_NewCanvasRenderingContext2DThebes(nsIDOMCanvasRenderingContext2D** aResult); +nsresult NS_NewCanvasRenderingContext2DAzure(nsIDOMCanvasRenderingContext2D** aResult); + +nsresult +NS_NewCanvasRenderingContext2D(nsIDOMCanvasRenderingContext2D** aResult) +{ + PRBool azure = PR_FALSE; + nsresult rv = Preferences::GetBool("gfx.canvas.azure.enabled", &azure); + + if (azure) { + nsresult rv = NS_NewCanvasRenderingContext2DAzure(aResult); + // If Azure fails, fall back to a classic canvas. + if (NS_SUCCEEDED(rv)) { + return rv; + } + } + + return NS_NewCanvasRenderingContext2DThebes(aResult); +} diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index acae0234422..41e1a03709c 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -49,7 +49,6 @@ #include "nsContentCID.h" #include "nsIComponentManager.h" #include "nsIDOMHTMLFormElement.h" -#include "nsIDOMEventTarget.h" #include "nsGkAtoms.h" #include "nsStyleConsts.h" #include "nsPresContext.h" @@ -90,7 +89,7 @@ #include "nsIDOMMutationEvent.h" #include "nsIDOMEventTarget.h" #include "nsMutationEvent.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsRuleData.h" @@ -683,8 +682,18 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLInputElement, if (tmp->IsSingleLineTextControl(PR_FALSE)) { NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mInputData.mState, nsTextEditorState) } + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mFiles) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFileList) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLInputElement, + nsGenericHTMLFormElement) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mControllers) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mFiles) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFileList); + //XXX should unlink more? +NS_IMPL_CYCLE_COLLECTION_UNLINK_END + NS_IMPL_ADDREF_INHERITED(nsHTMLInputElement, nsGenericElement) NS_IMPL_RELEASE_INHERITED(nsHTMLInputElement, nsGenericElement) @@ -988,37 +997,42 @@ nsHTMLInputElement::GetValue(nsAString& aValue) nsresult nsHTMLInputElement::GetValueInternal(nsAString& aValue) const { - nsTextEditorState* state = GetEditorState(); - if (state) { - state->GetValue(aValue, PR_TRUE); - return NS_OK; - } - - if (mType == NS_FORM_INPUT_FILE) { - if (nsContentUtils::IsCallerTrustedForCapability("UniversalFileRead")) { - if (mFiles.Count()) { - return mFiles[0]->GetMozFullPath(aValue); - } - else { - aValue.Truncate(); - } - } else { - // Just return the leaf name - if (mFiles.Count() == 0 || NS_FAILED(mFiles[0]->GetName(aValue))) { - aValue.Truncate(); - } - } - - return NS_OK; - } - - // Treat value == defaultValue for other input elements - if (!GetAttr(kNameSpaceID_None, nsGkAtoms::value, aValue) && - (mType == NS_FORM_INPUT_RADIO || mType == NS_FORM_INPUT_CHECKBOX)) { - // The default value of a radio or checkbox input is "on". - aValue.AssignLiteral("on"); + switch (GetValueMode()) { + case VALUE_MODE_VALUE: + mInputData.mState->GetValue(aValue, PR_TRUE); + return NS_OK; + + case VALUE_MODE_FILENAME: + if (nsContentUtils::IsCallerTrustedForCapability("UniversalFileRead")) { + if (mFiles.Count()) { + return mFiles[0]->GetMozFullPath(aValue); + } + else { + aValue.Truncate(); + } + } else { + // Just return the leaf name + if (mFiles.Count() == 0 || NS_FAILED(mFiles[0]->GetName(aValue))) { + aValue.Truncate(); + } + } + + return NS_OK; + + case VALUE_MODE_DEFAULT: + // Treat defaultValue as value. + GetAttr(kNameSpaceID_None, nsGkAtoms::value, aValue); + return NS_OK; + + case VALUE_MODE_DEFAULT_ON: + // Treat default value as value and returns "on" if no value. + if (!GetAttr(kNameSpaceID_None, nsGkAtoms::value, aValue)) { + aValue.AssignLiteral("on"); + } + return NS_OK; } + // This return statement is required for some compilers. return NS_OK; } @@ -1383,48 +1397,61 @@ nsHTMLInputElement::SetValueInternal(const nsAString& aValue, PRBool aUserInput, PRBool aSetValueChanged) { - NS_PRECONDITION(mType != NS_FORM_INPUT_FILE, + NS_PRECONDITION(GetValueMode() != VALUE_MODE_FILENAME, "Don't call SetValueInternal for file inputs"); - if (mType == NS_FORM_INPUT_FILE) { - return NS_ERROR_UNEXPECTED; - } + switch (GetValueMode()) { + case VALUE_MODE_VALUE: + { + // At the moment, only single line text control have to sanitize their value + // Because we have to create a new string for that, we should prevent doing + // it if it's useless. + nsAutoString value(aValue); - if (IsSingleLineTextControl(PR_FALSE)) { - // At the moment, only single line text control have to sanitize their value - // Because we have to create a new string for that, we should prevent doing - // it if it's useless. - nsAutoString value(aValue); - if (!GET_BOOLBIT(mBitField, BF_PARSER_CREATING)) { - SanitizeValue(value); + if (!GET_BOOLBIT(mBitField, BF_PARSER_CREATING)) { + SanitizeValue(value); + } + + if (aSetValueChanged) { + SetValueChanged(PR_TRUE); + } + + mInputData.mState->SetValue(value, aUserInput); + + // This call might be useless in some situations because if the element is + // a single line text control, nsTextEditorState::SetValue will call + // nsHTMLInputElement::OnValueChanged which is going to call UpdateState() + // if the element is focused. This bug 665547. + if (PlaceholderApplies() && + HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) { + UpdateState(true); + } + + return NS_OK; } - if (aSetValueChanged) { - SetValueChanged(PR_TRUE); - } - mInputData.mState->SetValue(value, aUserInput); + case VALUE_MODE_DEFAULT: + case VALUE_MODE_DEFAULT_ON: + // If the value of a hidden input was changed, we mark it changed so that we + // will know we need to save / restore the value. Yes, we are overloading + // the meaning of ValueChanged just a teensy bit to save a measly byte of + // storage space in nsHTMLInputElement. Yes, you are free to make a new flag, + // NEED_TO_SAVE_VALUE, at such time as mBitField becomes a 16-bit value. + if (mType == NS_FORM_INPUT_HIDDEN) { + SetValueChanged(PR_TRUE); + } - if (PlaceholderApplies() && - HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) { - UpdateState(true); - } + // Treat value == defaultValue for other input elements. + return nsGenericHTMLFormElement::SetAttr(kNameSpaceID_None, + nsGkAtoms::value, aValue, + PR_TRUE); - return NS_OK; + case VALUE_MODE_FILENAME: + return NS_ERROR_UNEXPECTED; } - // If the value of a hidden input was changed, we mark it changed so that we - // will know we need to save / restore the value. Yes, we are overloading - // the meaning of ValueChanged just a teensy bit to save a measly byte of - // storage space in nsHTMLInputElement. Yes, you are free to make a new flag, - // NEED_TO_SAVE_VALUE, at such time as mBitField becomes a 16-bit value. - if (mType == NS_FORM_INPUT_HIDDEN) { - SetValueChanged(PR_TRUE); - } - - // Treat value == defaultValue for other input elements. - return nsGenericHTMLFormElement::SetAttr(kNameSpaceID_None, - nsGkAtoms::value, aValue, - PR_TRUE); + // This return statement is required for some compilers. + return NS_OK; } NS_IMETHODIMP @@ -1434,12 +1461,6 @@ nsHTMLInputElement::SetValueChanged(PRBool aValueChanged) SET_BOOLBIT(mBitField, BF_VALUE_CHANGED, aValueChanged); - if (!aValueChanged) { - if (!IsSingleLineTextControl(PR_FALSE)) { - FreeData(); - } - } - if (valueChangedBefore != aValueChanged) { UpdateState(true); } diff --git a/content/html/content/src/nsHTMLInputElement.h b/content/html/content/src/nsHTMLInputElement.h index 19236db01b7..60b64d31eb1 100644 --- a/content/html/content/src/nsHTMLInputElement.h +++ b/content/html/content/src/nsHTMLInputElement.h @@ -245,8 +245,8 @@ public: return UpdateEditableFormControlState(aNotify); } - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLInputElement, - nsGenericHTMLFormElement) + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLInputElement, + nsGenericHTMLFormElement) static UploadLastDir* gUploadLastDir; // create and destroy the static UploadLastDir object for remembering diff --git a/content/html/content/src/nsHTMLLinkElement.cpp b/content/html/content/src/nsHTMLLinkElement.cpp index 8944fb92663..e12bd3dc717 100644 --- a/content/html/content/src/nsHTMLLinkElement.cpp +++ b/content/html/content/src/nsHTMLLinkElement.cpp @@ -36,7 +36,6 @@ * ***** END LICENSE BLOCK ***** */ #include "nsIDOMHTMLLinkElement.h" #include "nsIDOMLinkStyle.h" -#include "nsIDOMEventTarget.h" #include "nsGenericHTMLElement.h" #include "nsILink.h" #include "nsGkAtoms.h" diff --git a/content/html/content/src/nsHTMLProgressElement.cpp b/content/html/content/src/nsHTMLProgressElement.cpp index 59d83d4e826..becd8edd37f 100644 --- a/content/html/content/src/nsHTMLProgressElement.cpp +++ b/content/html/content/src/nsHTMLProgressElement.cpp @@ -186,7 +186,7 @@ nsHTMLProgressElement::GetValue(double* aValue) double max; GetMax(&max); - *aValue = PR_MIN(*aValue, max); + *aValue = NS_MIN(*aValue, max); return NS_OK; } diff --git a/content/html/content/src/nsTextEditorState.cpp b/content/html/content/src/nsTextEditorState.cpp index 27590200889..c4468d7d03d 100644 --- a/content/html/content/src/nsTextEditorState.cpp +++ b/content/html/content/src/nsTextEditorState.cpp @@ -54,16 +54,16 @@ #include "nsIControllerContext.h" #include "nsAttrValue.h" #include "nsGenericHTMLElement.h" -#include "nsIDOMKeyListener.h" +#include "nsIDOMEventListener.h" #include "nsIEditorObserver.h" #include "nsINativeKeyBindings.h" #include "nsIDocumentEncoder.h" #include "nsISelectionPrivate.h" #include "nsPIDOMWindow.h" #include "nsServiceManagerUtils.h" -#include "nsIDOMEventGroup.h" #include "nsIEditor.h" #include "nsTextEditRules.h" +#include "nsEventListenerManager.h" #include "nsTextEditorState.h" @@ -609,7 +609,7 @@ nsTextInputSelectionImpl::CheckVisibility(nsIDOMNode *node, PRInt16 startOffset, } class nsTextInputListener : public nsISelectionListener, - public nsIDOMKeyListener, + public nsIDOMEventListener, public nsIEditorObserver, public nsSupportsWeakReference { @@ -632,12 +632,7 @@ public: NS_DECL_NSISELECTIONLISTENER - NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); - - // nsIDOMKeyListener - NS_IMETHOD KeyDown(nsIDOMEvent *aKeyEvent); - NS_IMETHOD KeyPress(nsIDOMEvent *aKeyEvent); - NS_IMETHOD KeyUp(nsIDOMEvent *aKeyEvent); + NS_DECL_NSIDOMEVENTLISTENER NS_DECL_NSIEDITOROBSERVER @@ -690,17 +685,11 @@ nsTextInputListener::~nsTextInputListener() { } -NS_IMPL_ADDREF(nsTextInputListener) -NS_IMPL_RELEASE(nsTextInputListener) - -NS_INTERFACE_MAP_BEGIN(nsTextInputListener) - NS_INTERFACE_MAP_ENTRY(nsISelectionListener) - NS_INTERFACE_MAP_ENTRY(nsIEditorObserver) - NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) - NS_INTERFACE_MAP_ENTRY(nsIDOMKeyListener) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMKeyListener) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMKeyListener) -NS_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS4(nsTextInputListener, + nsISelectionListener, + nsIEditorObserver, + nsISupportsWeakReference, + nsIDOMEventListener) // BEGIN nsIDOMSelectionListener @@ -763,14 +752,6 @@ nsTextInputListener::NotifySelectionChanged(nsIDOMDocument* aDoc, nsISelection* // END nsIDOMSelectionListener -// BEGIN nsIDOMKeyListener - -NS_IMETHODIMP -nsTextInputListener::HandleEvent(nsIDOMEvent* aEvent) -{ - return NS_OK; -} - static void DoCommandCallback(const char *aCommand, void *aData) { @@ -802,62 +783,41 @@ DoCommandCallback(const char *aCommand, void *aData) } } - NS_IMETHODIMP -nsTextInputListener::KeyDown(nsIDOMEvent *aDOMEvent) +nsTextInputListener::HandleEvent(nsIDOMEvent* aEvent) { - nsCOMPtr keyEvent(do_QueryInterface(aDOMEvent)); + nsCOMPtr keyEvent(do_QueryInterface(aEvent)); NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG); + nsAutoString eventType; + aEvent->GetType(eventType); + nsNativeKeyEvent nativeEvent; nsINativeKeyBindings *bindings = GetKeyBindings(); if (bindings && nsContentUtils::DOMEventToNativeKeyEvent(keyEvent, &nativeEvent, PR_FALSE)) { - if (bindings->KeyDown(nativeEvent, DoCommandCallback, mFrame)) { - aDOMEvent->PreventDefault(); + + PRBool handled = PR_FALSE; + if (eventType.EqualsLiteral("keydown")) { + handled = bindings->KeyDown(nativeEvent, DoCommandCallback, mFrame); + } + else if (eventType.EqualsLiteral("keyup")) { + handled = bindings->KeyUp(nativeEvent, DoCommandCallback, mFrame); + } + else if (eventType.EqualsLiteral("keypress")) { + handled = bindings->KeyPress(nativeEvent, DoCommandCallback, mFrame); + } + else { + NS_ABORT(); + } + if (handled) { + aEvent->PreventDefault(); } } return NS_OK; } -NS_IMETHODIMP -nsTextInputListener::KeyPress(nsIDOMEvent *aDOMEvent) -{ - nsCOMPtr keyEvent(do_QueryInterface(aDOMEvent)); - NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG); - - nsNativeKeyEvent nativeEvent; - nsINativeKeyBindings *bindings = GetKeyBindings(); - if (bindings && - nsContentUtils::DOMEventToNativeKeyEvent(keyEvent, &nativeEvent, PR_TRUE)) { - if (bindings->KeyPress(nativeEvent, DoCommandCallback, mFrame)) { - aDOMEvent->PreventDefault(); - } - } - - return NS_OK; -} - -NS_IMETHODIMP -nsTextInputListener::KeyUp(nsIDOMEvent *aDOMEvent) -{ - nsCOMPtr keyEvent(do_QueryInterface(aDOMEvent)); - NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG); - - nsNativeKeyEvent nativeEvent; - nsINativeKeyBindings *bindings = GetKeyBindings(); - if (bindings && - nsContentUtils::DOMEventToNativeKeyEvent(keyEvent, &nativeEvent, PR_FALSE)) { - if (bindings->KeyUp(nativeEvent, DoCommandCallback, mFrame)) { - aDOMEvent->PreventDefault(); - } - } - - return NS_OK; -} -// END nsIDOMKeyListener - // BEGIN nsIEditorObserver NS_IMETHODIMP @@ -1008,6 +968,10 @@ NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsTextEditorState, AddRef) NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsTextEditorState, Release) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsTextEditorState) tmp->Clear(); + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mSelCon) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mEditor) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mRootNode) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mPlaceholderDiv) NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(nsTextEditorState) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mSelCon, nsISelectionController) @@ -1509,21 +1473,22 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame) { mTextListener->SetFrame(nsnull); - nsCOMPtr systemGroup; - nsCOMPtr content = do_QueryInterface(mTextCtrlElement); - content->GetSystemEventGroup(getter_AddRefs(systemGroup)); - nsCOMPtr dom3Targ = do_QueryInterface(mTextCtrlElement); - if (dom3Targ) { - // cast because of ambiguous base - nsIDOMEventListener *listener = static_cast - (mTextListener); - - dom3Targ->RemoveGroupedEventListener(NS_LITERAL_STRING("keydown"), - listener, PR_FALSE, systemGroup); - dom3Targ->RemoveGroupedEventListener(NS_LITERAL_STRING("keypress"), - listener, PR_FALSE, systemGroup); - dom3Targ->RemoveGroupedEventListener(NS_LITERAL_STRING("keyup"), - listener, PR_FALSE, systemGroup); + nsCOMPtr target = do_QueryInterface(mTextCtrlElement); + nsEventListenerManager* manager = + target->GetListenerManager(PR_FALSE); + if (manager) { + manager->RemoveEventListenerByType(mTextListener, + NS_LITERAL_STRING("keydown"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); + manager->RemoveEventListenerByType(mTextListener, + NS_LITERAL_STRING("keypress"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); + manager->RemoveEventListenerByType(mTextListener, + NS_LITERAL_STRING("keyup"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); } NS_RELEASE(mTextListener); @@ -1933,23 +1898,22 @@ nsTextEditorState::SetValue(const nsAString& aValue, PRBool aUserInput) void nsTextEditorState::InitializeKeyboardEventListeners() { - nsCOMPtr content = do_QueryInterface(mTextCtrlElement); - //register key listeners - nsCOMPtr systemGroup; - content->GetSystemEventGroup(getter_AddRefs(systemGroup)); - nsCOMPtr dom3Targ = do_QueryInterface(content); - if (dom3Targ) { - // cast because of ambiguous base - nsIDOMEventListener *listener = static_cast - (mTextListener); - - dom3Targ->AddGroupedEventListener(NS_LITERAL_STRING("keydown"), - listener, PR_FALSE, systemGroup); - dom3Targ->AddGroupedEventListener(NS_LITERAL_STRING("keypress"), - listener, PR_FALSE, systemGroup); - dom3Targ->AddGroupedEventListener(NS_LITERAL_STRING("keyup"), - listener, PR_FALSE, systemGroup); + nsCOMPtr target = do_QueryInterface(mTextCtrlElement); + nsEventListenerManager* manager = target->GetListenerManager(PR_TRUE); + if (manager) { + manager->AddEventListenerByType(mTextListener, + NS_LITERAL_STRING("keydown"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); + manager->AddEventListenerByType(mTextListener, + NS_LITERAL_STRING("keypress"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); + manager->AddEventListenerByType(mTextListener, + NS_LITERAL_STRING("keyup"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); } mSelCon->SetScrollableFrame(do_QueryFrame(mBoundFrame->GetFirstChild(nsnull))); diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index 9659efcd279..f3183c33f76 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -80,6 +80,7 @@ _TEST_FILES = \ test_bug109445.html \ test_bug109445.xhtml \ test_bug143220.html \ + test_bug182279.html \ test_bug237071.html \ bug242709_iframe.html \ bug242709_load.html \ @@ -181,15 +182,12 @@ _TEST_FILES = \ test_bug458037.xhtml \ test_bug556645.html \ test_bug551670.html \ - test_bug346485.html \ test_bug555567.html \ test_bug557620.html \ - test_bug565538.html \ test_bug456229.html \ test_bug546995.html \ test_bug377624.html \ test_bug551846.html \ - test_bug562932.html \ test_bug564001.html \ test_bug566046.html \ test_bug567938-1.html \ @@ -203,12 +201,7 @@ _TEST_FILES = \ test_bug345624-1.html \ test_bug345624-2.html \ test_bug561640.html \ - test_bug345822.html \ - test_bug555559.html \ - test_bug344615.html \ - test_bug345512.html \ test_bug566064.html \ - test_bug566160.html \ test_bug582412-1.html \ test_bug582412-2.html \ test_bug558788-1.html \ @@ -223,12 +216,10 @@ _TEST_FILES = \ test_bug593689.html \ test_bug555840.html \ test_bug561636.html \ - test_bug556013.html \ test_bug590363.html \ test_bug557628-1.html \ test_bug557628-2.html \ test_bug592802.html \ - test_bug589696.html \ test_bug595429.html \ test_bug595447.html \ test_bug595449.html \ diff --git a/content/html/content/test/forms/Makefile.in b/content/html/content/test/forms/Makefile.in index 974bb366df7..cb788e80ce3 100644 --- a/content/html/content/test/forms/Makefile.in +++ b/content/html/content/test/forms/Makefile.in @@ -46,6 +46,16 @@ include $(topsrcdir)/config/rules.mk _TEST_FILES = \ save_restore_radio_groups.sjs \ test_save_restore_radio_groups.html \ + test_mozistextfield.html \ + test_input_email.html \ + test_input_url.html \ + test_pattern_attribute.html \ + test_required_attribute.html \ + test_novalidate_attribute.html \ + test_formaction_attribute.html \ + test_formnovalidate_attribute.html \ + test_label_control_attribute.html \ + test_output_element.html \ $(NULL) libs:: $(_TEST_FILES) diff --git a/content/html/content/test/test_bug566160.html b/content/html/content/test/forms/test_formaction_attribute.html similarity index 100% rename from content/html/content/test/test_bug566160.html rename to content/html/content/test/forms/test_formaction_attribute.html diff --git a/content/html/content/test/test_bug589696.html b/content/html/content/test/forms/test_formnovalidate_attribute.html similarity index 100% rename from content/html/content/test/test_bug589696.html rename to content/html/content/test/forms/test_formnovalidate_attribute.html diff --git a/content/html/content/test/test_bug555559.html b/content/html/content/test/forms/test_input_email.html similarity index 100% rename from content/html/content/test/test_bug555559.html rename to content/html/content/test/forms/test_input_email.html diff --git a/content/html/content/test/test_bug344615.html b/content/html/content/test/forms/test_input_url.html similarity index 100% rename from content/html/content/test/test_bug344615.html rename to content/html/content/test/forms/test_input_url.html diff --git a/content/html/content/test/test_bug562932.html b/content/html/content/test/forms/test_label_control_attribute.html similarity index 100% rename from content/html/content/test/test_bug562932.html rename to content/html/content/test/forms/test_label_control_attribute.html diff --git a/content/html/content/test/test_bug565538.html b/content/html/content/test/forms/test_mozistextfield.html similarity index 100% rename from content/html/content/test/test_bug565538.html rename to content/html/content/test/forms/test_mozistextfield.html diff --git a/content/html/content/test/test_bug556013.html b/content/html/content/test/forms/test_novalidate_attribute.html similarity index 100% rename from content/html/content/test/test_bug556013.html rename to content/html/content/test/forms/test_novalidate_attribute.html diff --git a/content/html/content/test/test_bug346485.html b/content/html/content/test/forms/test_output_element.html similarity index 98% rename from content/html/content/test/test_bug346485.html rename to content/html/content/test/forms/test_output_element.html index 0214a202f9e..83a7b4c608d 100644 --- a/content/html/content/test/test_bug346485.html +++ b/content/html/content/test/forms/test_output_element.html @@ -147,7 +147,7 @@ function checkFormSubmission() */ is(frames['submit_frame'].location.href, - 'http://mochi.test:8888/tests/content/html/content/test/foo?a=afield&b=bfield', + 'http://mochi.test:8888/tests/content/html/content/test/forms/foo?a=afield&b=bfield', "The output element value should not be submitted"); SimpleTest.finish(); } diff --git a/content/html/content/test/test_bug345512.html b/content/html/content/test/forms/test_pattern_attribute.html similarity index 100% rename from content/html/content/test/test_bug345512.html rename to content/html/content/test/forms/test_pattern_attribute.html diff --git a/content/html/content/test/test_bug345822.html b/content/html/content/test/forms/test_required_attribute.html similarity index 100% rename from content/html/content/test/test_bug345822.html rename to content/html/content/test/forms/test_required_attribute.html diff --git a/content/html/content/test/test_bug182279.html b/content/html/content/test/test_bug182279.html new file mode 100644 index 00000000000..58a1c9c8f89 --- /dev/null +++ b/content/html/content/test/test_bug182279.html @@ -0,0 +1,36 @@ + + + + + Test for Bug 182279 + + + + + +Moozilla Bug 182279 +

+ +
+
+
+ + diff --git a/content/html/content/test/test_bug389797.html b/content/html/content/test/test_bug389797.html index 27404c4e596..182f3b19739 100644 --- a/content/html/content/test/test_bug389797.html +++ b/content/html/content/test/test_bug389797.html @@ -34,7 +34,6 @@ function HTML_TAG(aTagName, aImplClass) { interfaces[aTagName] = [ "nsIDOMNSElement", "nsIDOMEventTarget", - "nsIDOMNSEventTarget", "nsIDOMNSHTMLElement", "nsIDOMElementCSSInlineStyle", "nsIDOMNodeSelector" ]; @@ -44,7 +43,6 @@ function HTML_TAG(aTagName, aImplClass) { interfacesNonClassinfo[aTagName] = [ "nsIDOMNode", "nsIDOMElement", - "nsIDOM3EventTarget", "nsISupportsWeakReference" ]; var interfaceName = "nsIDOM" + getClassName(aTagName); diff --git a/content/html/content/test/test_bug561634.html b/content/html/content/test/test_bug561634.html index fe6bed8d9fe..036d62cc2b8 100644 --- a/content/html/content/test/test_bug561634.html +++ b/content/html/content/test/test_bug561634.html @@ -12,8 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=561634 Mozilla Bug 561634

- -
+ @@ -72,12 +71,6 @@ function checkInvalid() ok(!f.checkValidity(), "A form with at least one invalid element is invalid"); - // Check event is fired - i.addEventListener("invalid", function (e) { - ok(true, "invalid event should have been fired on invalid elements"); - SimpleTest.finish(); - }, false); - f.removeChild(i2); f.removeChild(i); } @@ -107,22 +100,26 @@ function checkInvalidEvent() f.checkValidity(); - SimpleTest.executeSoon(function () { + setTimeout(function() { ok(invalidEventForInvalidElement, "invalid event should be fired on invalid elements"); ok(!invalidEventForValidElement, "invalid event should not be fired on valid elements"); - }); - f.removeChild(i2); - f.removeChild(i); + f.removeChild(i2); + f.removeChild(i); + + SimpleTest.finish(); + }, 0); } +SimpleTest.waitForExplicitFinish(); + checkEmptyForm(); checkBarredFromConstraintValidation(); checkValid(); checkInvalid(); -checkInvalidEvent(); +checkInvalidEvent(); // will call finish(). diff --git a/content/html/document/src/Makefile.in b/content/html/document/src/Makefile.in index 1e3c6592934..6db67e2bd3f 100644 --- a/content/html/document/src/Makefile.in +++ b/content/html/document/src/Makefile.in @@ -77,6 +77,7 @@ INCLUDES += \ -I$(topsrcdir)/dom/base \ -I$(topsrcdir)/xpcom/io \ -I$(topsrcdir)/caps/include \ + -I$(topsrcdir)/xpcom/ds \ $(NULL) DEFINES += -D_IMPL_NS_LAYOUT diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 2ff2b98ef63..d47790d71a0 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -101,7 +101,7 @@ #include "mozilla/css/Loader.h" #include "nsIHttpChannel.h" #include "nsIFile.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsFrameSelection.h" #include "nsISelectionPrivate.h"//for toStringwithformat code diff --git a/content/html/document/test/bug448564-echo.sjs b/content/html/document/test/bug448564-echo.sjs index 0b6eea9d9dd..1eee116fd7c 100644 --- a/content/html/document/test/bug448564-echo.sjs +++ b/content/html/document/test/bug448564-echo.sjs @@ -1,8 +1,6 @@ function handleRequest(request, response) { response.setHeader("Cache-Control", "no-cache", false); response.setStatusLine(request.httpVersion, 200, "OK"); - - response.write(""); + + response.write(request.queryString); } diff --git a/content/html/document/test/test_bug448564.html b/content/html/document/test/test_bug448564.html index 1567fe71b30..cdf915e95b1 100644 --- a/content/html/document/test/test_bug448564.html +++ b/content/html/document/test/test_bug448564.html @@ -8,25 +8,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=448564 - - Mozilla Bug 448564 @@ -36,27 +17,37 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=448564

 
 
diff --git a/content/mathml/content/src/nsMathMLElement.cpp b/content/mathml/content/src/nsMathMLElement.cpp index 30b130391fe..261fa83b22a 100644 --- a/content/mathml/content/src/nsMathMLElement.cpp +++ b/content/mathml/content/src/nsMathMLElement.cpp @@ -62,6 +62,8 @@ NS_INTERFACE_TABLE_HEAD(nsMathMLElement) NS_NODE_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsMathMLElement) NS_INTERFACE_TABLE_ENTRY(nsMathMLElement, nsIDOMNode) NS_INTERFACE_TABLE_ENTRY(nsMathMLElement, nsIDOMElement) + NS_INTERFACE_TABLE_ENTRY(nsMathMLElement, nsILink) + NS_INTERFACE_TABLE_ENTRY(nsMathMLElement, Link) NS_OFFSET_AND_INTERFACE_TABLE_END NS_ELEMENT_INTERFACE_TABLE_TO_MAP_SEGUE NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MathMLElement) @@ -77,6 +79,8 @@ nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, { static const char kMathMLStyleSheetURI[] = "resource://gre-resources/mathml.css"; + Link::ResetLinkState(false); + nsresult rv = nsMathMLElementBase::BindToTree(aDocument, aParent, aBindingParent, aCompileEventHandlers); @@ -101,6 +105,16 @@ nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, return rv; } +void +nsMathMLElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent) +{ + // If this link is ever reinserted into a document, it might + // be under a different xml:base, so forget the cached state now. + Link::ResetLinkState(false); + + nsMathMLElementBase::UnbindFromTree(aDeep, aNullParent); +} + PRBool nsMathMLElement::ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute, @@ -438,12 +452,27 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes, } } +nsresult +nsMathMLElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) +{ + nsresult rv = nsGenericElement::PreHandleEvent(aVisitor); + NS_ENSURE_SUCCESS(rv, rv); + + return PreHandleEventForLinks(aVisitor); +} + +nsresult +nsMathMLElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) +{ + return PostHandleEventForLinks(aVisitor); +} + NS_IMPL_ELEMENT_CLONE(nsMathMLElement) nsEventStates nsMathMLElement::IntrinsicState() const { - return nsMathMLElementBase::IntrinsicState() | + return Link::LinkState() | nsMathMLElementBase::IntrinsicState() | (mIncrementScriptLevel ? NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL : nsEventStates()); } @@ -465,3 +494,185 @@ nsMathMLElement::SetIncrementScriptLevel(PRBool aIncrementScriptLevel, UpdateState(true); } + +PRBool +nsMathMLElement::IsFocusable(PRInt32 *aTabIndex, PRBool aWithMouse) +{ + nsCOMPtr uri; + if (IsLink(getter_AddRefs(uri))) { + if (aTabIndex) { + *aTabIndex = ((sTabFocusModel & eTabFocus_linksMask) == 0 ? -1 : 0); + } + return PR_TRUE; + } + + if (aTabIndex) { + *aTabIndex = -1; + } + + return PR_FALSE; +} + +PRBool +nsMathMLElement::IsLink(nsIURI** aURI) const +{ + // http://www.w3.org/TR/2010/REC-MathML3-20101021/chapter6.html#interf.link + // The REC says that the following elements should not be linking elements: + nsIAtom* tag = Tag(); + if (tag == nsGkAtoms::mprescripts_ || + tag == nsGkAtoms::none || + tag == nsGkAtoms::malignmark_ || + tag == nsGkAtoms::maligngroup_) { + *aURI = nsnull; + return PR_FALSE; + } + + PRBool hasHref = PR_FALSE; + const nsAttrValue* href = mAttrsAndChildren.GetAttr(nsGkAtoms::href, + kNameSpaceID_None); + if (href) { + // MathML href + // The REC says: "When user agents encounter MathML elements with both href + // and xlink:href attributes, the href attribute should take precedence." + hasHref = PR_TRUE; + } else { + // To be a clickable XLink for styling and interaction purposes, we require: + // + // xlink:href - must be set + // xlink:type - must be unset or set to "" or set to "simple" + // xlink:show - must be unset or set to "", "new" or "replace" + // xlink:actuate - must be unset or set to "" or "onRequest" + // + // For any other values, we're either not a *clickable* XLink, or the end + // result is poorly specified. Either way, we return PR_FALSE. + + static nsIContent::AttrValuesArray sTypeVals[] = + { &nsGkAtoms::_empty, &nsGkAtoms::simple, nsnull }; + + static nsIContent::AttrValuesArray sShowVals[] = + { &nsGkAtoms::_empty, &nsGkAtoms::_new, &nsGkAtoms::replace, nsnull }; + + static nsIContent::AttrValuesArray sActuateVals[] = + { &nsGkAtoms::_empty, &nsGkAtoms::onRequest, nsnull }; + + // Optimization: check for href first for early return + href = mAttrsAndChildren.GetAttr(nsGkAtoms::href, + kNameSpaceID_XLink); + if (href && + FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::type, + sTypeVals, eCaseMatters) != + nsIContent::ATTR_VALUE_NO_MATCH && + FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show, + sShowVals, eCaseMatters) != + nsIContent::ATTR_VALUE_NO_MATCH && + FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::actuate, + sActuateVals, eCaseMatters) != + nsIContent::ATTR_VALUE_NO_MATCH) { + hasHref = PR_TRUE; + } + } + + if (hasHref) { + nsCOMPtr baseURI = GetBaseURI(); + // Get absolute URI + nsAutoString hrefStr; + href->ToString(hrefStr); + nsContentUtils::NewURIWithDocumentCharset(aURI, hrefStr, + GetOwnerDoc(), baseURI); + // must promise out param is non-null if we return true + return !!*aURI; + } + + *aURI = nsnull; + return PR_FALSE; +} + +void +nsMathMLElement::GetLinkTarget(nsAString& aTarget) +{ + const nsAttrValue* target = mAttrsAndChildren.GetAttr(nsGkAtoms::target, + kNameSpaceID_XLink); + if (target) { + target->ToString(aTarget); + } + + if (aTarget.IsEmpty()) { + + static nsIContent::AttrValuesArray sShowVals[] = + { &nsGkAtoms::_new, &nsGkAtoms::replace, nsnull }; + + switch (FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show, + sShowVals, eCaseMatters)) { + case 0: + aTarget.AssignLiteral("_blank"); + return; + case 1: + return; + } + nsIDocument* ownerDoc = GetOwnerDoc(); + if (ownerDoc) { + ownerDoc->GetBaseTarget(aTarget); + } + } +} + +nsLinkState +nsMathMLElement::GetLinkState() const +{ + return Link::GetLinkState(); +} + +void +nsMathMLElement::RequestLinkStateUpdate() +{ + UpdateLinkState(Link::LinkState()); +} + +already_AddRefed +nsMathMLElement::GetHrefURI() const +{ + nsCOMPtr hrefURI; + return IsLink(getter_AddRefs(hrefURI)) ? hrefURI.forget() : nsnull; +} + +nsresult +nsMathMLElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom* aPrefix, const nsAString& aValue, + PRBool aNotify) +{ + nsresult rv = nsMathMLElementBase::SetAttr(aNameSpaceID, aName, aPrefix, + aValue, aNotify); + + // The ordering of the parent class's SetAttr call and Link::ResetLinkState + // is important here! The attribute is not set until SetAttr returns, and + // we will need the updated attribute value because notifying the document + // that content states have changed will call IntrinsicState, which will try + // to get updated information about the visitedness from Link. + if (aName == nsGkAtoms::href && + (aNameSpaceID == kNameSpaceID_None || + aNameSpaceID == kNameSpaceID_XLink)) { + Link::ResetLinkState(!!aNotify); + } + + return rv; +} + +nsresult +nsMathMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttr, + PRBool aNotify) +{ + nsresult rv = nsMathMLElementBase::UnsetAttr(aNameSpaceID, aAttr, aNotify); + + // The ordering of the parent class's UnsetAttr call and Link::ResetLinkState + // is important here! The attribute is not unset until UnsetAttr returns, and + // we will need the updated attribute value because notifying the document + // that content states have changed will call IntrinsicState, which will try + // to get updated information about the visitedness from Link. + if (aAttr == nsGkAtoms::href && + (aNameSpaceID == kNameSpaceID_None || + aNameSpaceID == kNameSpaceID_XLink)) { + Link::ResetLinkState(!!aNotify); + } + + return rv; +} diff --git a/content/mathml/content/src/nsMathMLElement.h b/content/mathml/content/src/nsMathMLElement.h index 92058f4da12..3e6dd56ba72 100644 --- a/content/mathml/content/src/nsMathMLElement.h +++ b/content/mathml/content/src/nsMathMLElement.h @@ -42,6 +42,8 @@ #include "nsMappedAttributeElement.h" #include "nsIDOMElement.h" +#include "nsILink.h" +#include "Link.h" class nsCSSValue; @@ -50,12 +52,15 @@ typedef nsMappedAttributeElement nsMathMLElementBase; /* * The base class for MathML elements. */ -class nsMathMLElement : public nsMathMLElementBase - , public nsIDOMElement +class nsMathMLElement : public nsMathMLElementBase, + public nsIDOMElement, + public nsILink, + public mozilla::dom::Link { public: nsMathMLElement(already_AddRefed aNodeInfo) - : nsMathMLElementBase(aNodeInfo), mIncrementScriptLevel(PR_FALSE) + : nsMathMLElementBase(aNodeInfo), Link(this), + mIncrementScriptLevel(PR_FALSE) {} // Implementation of nsISupports is inherited from nsMathMLElementBase @@ -69,6 +74,8 @@ public: nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsIContent* aBindingParent, PRBool aCompileEventHandlers); + virtual void UnbindFromTree(PRBool aDeep = PR_TRUE, + PRBool aNullParent = PR_TRUE); virtual PRBool ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute, @@ -89,6 +96,8 @@ public: static void MapMathMLAttributesInto(const nsMappedAttributes* aAttributes, nsRuleData* aRuleData); + virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor); + virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor); nsresult Clone(nsINodeInfo*, nsINode**) const; virtual nsEventStates IntrinsicState() const; virtual PRBool IsNodeOfType(PRUint32 aFlags) const; @@ -100,6 +109,26 @@ public: return mIncrementScriptLevel; } + NS_IMETHOD LinkAdded() { return NS_OK; } + NS_IMETHOD LinkRemoved() { return NS_OK; } + virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull, + PRBool aWithMouse = PR_FALSE); + virtual PRBool IsLink(nsIURI** aURI) const; + virtual void GetLinkTarget(nsAString& aTarget); + virtual nsLinkState GetLinkState() const; + virtual void RequestLinkStateUpdate(); + virtual already_AddRefed GetHrefURI() const; + nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify) + { + return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify); + } + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom* aPrefix, const nsAString& aValue, + PRBool aNotify); + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); + virtual nsXPCClassInfo* GetClassInfo(); private: PRPackedBool mIncrementScriptLevel; diff --git a/content/media/VideoUtils.cpp b/content/media/VideoUtils.cpp index 76b8166eceb..92f0137d913 100644 --- a/content/media/VideoUtils.cpp +++ b/content/media/VideoUtils.cpp @@ -36,6 +36,7 @@ * ***** END LICENSE BLOCK ***** */ #include "VideoUtils.h" +#include "nsMathUtils.h" #include "prtypes.h" // Adds two 32bit unsigned numbers, retuns PR_TRUE if addition succeeded, @@ -196,3 +197,22 @@ PRBool UsecsToSamples(PRInt64 aUsecs, PRUint32 aRate, PRInt64& aOutSamples) aOutSamples = x / USECS_PER_S; return PR_TRUE; } + +static PRInt32 ConditionDimension(float aValue) +{ + // This will exclude NaNs and too-big values. + if (aValue > 1.0 && aValue <= PR_INT32_MAX) + return PRInt32(NS_round(aValue)); + return 0; +} + +void ScaleDisplayByAspectRatio(nsIntSize& aDisplay, float aAspectRatio) +{ + if (aAspectRatio > 1.0) { + // Increase the intrinsic width + aDisplay.width = ConditionDimension(aAspectRatio * aDisplay.width); + } else { + // Increase the intrinsic height + aDisplay.height = ConditionDimension(aDisplay.height / aAspectRatio); + } +} diff --git a/content/media/VideoUtils.h b/content/media/VideoUtils.h index 865a45c93fb..c5fa4bbe878 100644 --- a/content/media/VideoUtils.h +++ b/content/media/VideoUtils.h @@ -41,6 +41,8 @@ #include "mozilla/ReentrantMonitor.h" +#include "nsRect.h" + // This file contains stuff we'd rather put elsewhere, but which is // dependent on other changes which we don't want to wait for. We plan to // remove this file in the near future. @@ -143,4 +145,16 @@ PRBool UsecsToSamples(PRInt64 aUsecs, PRUint32 aRate, PRInt64& aOutSamples); // Number of microseconds per millisecond. #define USECS_PER_MS 1000 +// The maximum height and width of the video. Used for +// sanitizing the memory allocation of the RGB buffer. +// The maximum resolution we anticipate encountering in the +// wild is 2160p - 3840x2160 pixels. +#define MAX_VIDEO_WIDTH 4000 +#define MAX_VIDEO_HEIGHT 3000 + +// Scales the display rect aDisplay by aspect ratio aAspectRatio. +// Note that aDisplay must be validated by nsVideoInfo::ValidateVideoRegion() +// before being used! +void ScaleDisplayByAspectRatio(nsIntSize& aDisplay, float aAspectRatio); + #endif diff --git a/content/media/nsAudioStream.cpp b/content/media/nsAudioStream.cpp index 551d3520ba4..2e6fee6e6a7 100644 --- a/content/media/nsAudioStream.cpp +++ b/content/media/nsAudioStream.cpp @@ -329,7 +329,7 @@ static int VolumeScaleChanged(const char* aPref, void *aClosure) { gVolumeScale = 1.0; } else { NS_ConvertUTF16toUTF8 utf8(value); - gVolumeScale = PR_MAX(0, PR_strtod(utf8.get(), nsnull)); + gVolumeScale = NS_MAX(0, PR_strtod(utf8.get(), nsnull)); } return 0; } diff --git a/content/media/nsBuiltinDecoderReader.cpp b/content/media/nsBuiltinDecoderReader.cpp index eb89f4fbb72..2a2d908b7d2 100644 --- a/content/media/nsBuiltinDecoderReader.cpp +++ b/content/media/nsBuiltinDecoderReader.cpp @@ -50,13 +50,6 @@ using namespace mozilla; using mozilla::layers::ImageContainer; using mozilla::layers::PlanarYCbCrImage; -// The maximum height and width of the video. Used for -// sanitizing the memory allocation of the RGB buffer. -// The maximum resolution we anticipate encountering in the -// wild is 2160p - 3840x2160 pixels. -#define MAX_VIDEO_WIDTH 4000 -#define MAX_VIDEO_HEIGHT 3000 - using mozilla::layers::PlanarYCbCrImage; // Verify these values are sane. Once we've checked the frame sizes, we then @@ -121,7 +114,8 @@ VideoData* VideoData::Create(nsVideoInfo& aInfo, PRInt64 aEndTime, const YCbCrBuffer& aBuffer, PRBool aKeyframe, - PRInt64 aTimecode) + PRInt64 aTimecode, + nsIntRect aPicture) { if (!aContainer) { return nsnull; @@ -136,7 +130,7 @@ VideoData* VideoData::Create(nsVideoInfo& aInfo, } // The following situations could be triggered by invalid input - if (aInfo.mPicture.width <= 0 || aInfo.mPicture.height <= 0) { + if (aPicture.width <= 0 || aPicture.height <= 0) { NS_WARNING("Empty picture rect"); return nsnull; } @@ -146,30 +140,14 @@ VideoData* VideoData::Create(nsVideoInfo& aInfo, return nsnull; } - PRUint32 picX = aInfo.mPicture.x; - PRUint32 picY = aInfo.mPicture.y; - gfxIntSize picSize = gfxIntSize(aInfo.mPicture.width, aInfo.mPicture.height); - - if (aInfo.mFrame.width != aBuffer.mPlanes[0].mWidth || - aInfo.mFrame.height != aBuffer.mPlanes[0].mHeight) - { - // Frame size is different from what the container reports. This is legal - // in WebM, and we will preserve the ratio of the crop rectangle as it - // was reported relative to the picture size reported by the container. - picX = (aInfo.mPicture.x * aBuffer.mPlanes[0].mWidth) / aInfo.mFrame.width; - picY = (aInfo.mPicture.y * aBuffer.mPlanes[0].mHeight) / aInfo.mFrame.height; - picSize = gfxIntSize((aBuffer.mPlanes[0].mWidth * aInfo.mPicture.width) / aInfo.mFrame.width, - (aBuffer.mPlanes[0].mHeight * aInfo.mPicture.height) / aInfo.mFrame.height); - } - // Ensure the picture size specified in the headers can be extracted out of // the frame we've been supplied without indexing out of bounds. - PRUint32 picXLimit; - PRUint32 picYLimit; - if (!AddOverflow32(picX, picSize.width, picXLimit) || - picXLimit > aBuffer.mPlanes[0].mStride || - !AddOverflow32(picY, picSize.height, picYLimit) || - picYLimit > aBuffer.mPlanes[0].mHeight) + PRUint32 xLimit; + PRUint32 yLimit; + if (!AddOverflow32(aPicture.x, aPicture.width, xLimit) || + xLimit > aBuffer.mPlanes[0].mStride || + !AddOverflow32(aPicture.y, aPicture.height, yLimit) || + yLimit > aBuffer.mPlanes[0].mHeight) { // The specified picture dimensions can't be contained inside the video // frame, we'll stomp memory if we try to copy it. Fail. @@ -177,7 +155,12 @@ VideoData* VideoData::Create(nsVideoInfo& aInfo, return nsnull; } - nsAutoPtr v(new VideoData(aOffset, aTime, aEndTime, aKeyframe, aTimecode)); + nsAutoPtr v(new VideoData(aOffset, + aTime, + aEndTime, + aKeyframe, + aTimecode, + aInfo.mDisplay)); // Currently our decoder only knows how to output to PLANAR_YCBCR // format. Image::Format format = Image::PLANAR_YCBCR; @@ -197,9 +180,9 @@ VideoData* VideoData::Create(nsVideoInfo& aInfo, data.mCrChannel = aBuffer.mPlanes[2].mData; data.mCbCrSize = gfxIntSize(aBuffer.mPlanes[1].mWidth, aBuffer.mPlanes[1].mHeight); data.mCbCrStride = aBuffer.mPlanes[1].mStride; - data.mPicX = picX; - data.mPicY = picY; - data.mPicSize = picSize; + data.mPicX = aPicture.x; + data.mPicY = aPicture.y; + data.mPicSize = gfxIntSize(aPicture.width, aPicture.height); data.mStereoMode = aInfo.mStereoMode; videoImage->SetData(data); // Copies buffer diff --git a/content/media/nsBuiltinDecoderReader.h b/content/media/nsBuiltinDecoderReader.h index 1427e21c336..a1ed8a7e0df 100644 --- a/content/media/nsBuiltinDecoderReader.h +++ b/content/media/nsBuiltinDecoderReader.h @@ -54,10 +54,8 @@ class nsBuiltinDecoderStateMachine; class nsVideoInfo { public: nsVideoInfo() - : mPixelAspectRatio(1.0), - mAudioRate(0), + : mAudioRate(0), mAudioChannels(0), - mFrame(0,0), mDisplay(0,0), mStereoMode(mozilla::layers::STEREO_MODE_MONO), mHasAudio(PR_FALSE), @@ -67,29 +65,19 @@ public: // Returns PR_TRUE if it's safe to use aPicture as the picture to be // extracted inside a frame of size aFrame, and scaled up to and displayed // at a size of aDisplay. You should validate the frame, picture, and - // display regions before setting them into the mFrame, mPicture and - // mDisplay fields of nsVideoInfo. + // display regions before using them to display video frames. static PRBool ValidateVideoRegion(const nsIntSize& aFrame, const nsIntRect& aPicture, const nsIntSize& aDisplay); - // Pixel aspect ratio, as stored in the metadata. - float mPixelAspectRatio; - // Samples per second. PRUint32 mAudioRate; // Number of audio channels. PRUint32 mAudioChannels; - // Dimensions of the video frame. - nsIntSize mFrame; - - // The picture region inside the video frame to be displayed. - nsIntRect mPicture; - - // Display size of the video frame. The picture region will be scaled - // to and displayed at this size. + // Size in pixels at which the video is rendered. This is after it has + // been scaled by its aspect ratio. nsIntSize mDisplay; // Indicates the frame layout for single track stereo videos. @@ -216,7 +204,8 @@ public: PRInt64 aEndTime, const YCbCrBuffer &aBuffer, PRBool aKeyframe, - PRInt64 aTimecode); + PRInt64 aTimecode, + nsIntRect aPicture); // Constructs a duplicate VideoData object. This intrinsically tells the // player that it does not need to update the displayed frame when this @@ -234,13 +223,18 @@ public: MOZ_COUNT_DTOR(VideoData); } + // Dimensions at which to display the video frame. The picture region + // will be scaled to this size. This is should be the picture region's + // dimensions scaled with respect to its aspect ratio. + nsIntSize mDisplay; + // Approximate byte offset of the end of the frame in the media. PRInt64 mOffset; // Start time of frame in microseconds. PRInt64 mTime; - // End time of frame in microseconds; + // End time of frame in microseconds. PRInt64 mEndTime; // Codec specific internal time code. For Ogg based codecs this is the @@ -272,13 +266,15 @@ public: PRInt64 aTime, PRInt64 aEndTime, PRBool aKeyframe, - PRInt64 aTimecode) + PRInt64 aTimecode, + nsIntSize aDisplay) : mOffset(aOffset), mTime(aTime), mEndTime(aEndTime), mTimecode(aTimecode), mDuplicate(PR_FALSE), - mKeyframe(aKeyframe) + mKeyframe(aKeyframe), + mDisplay(aDisplay) { MOZ_COUNT_CTOR(VideoData); NS_ASSERTION(aEndTime >= aTime, "Frame must start before it ends."); diff --git a/content/media/nsBuiltinDecoderStateMachine.cpp b/content/media/nsBuiltinDecoderStateMachine.cpp index 20bf0815594..6646a1353f8 100644 --- a/content/media/nsBuiltinDecoderStateMachine.cpp +++ b/content/media/nsBuiltinDecoderStateMachine.cpp @@ -1077,12 +1077,8 @@ nsresult nsBuiltinDecoderStateMachine::Run() VideoData* videoData = FindStartTime(); if (videoData) { - nsIntSize display = mInfo.mDisplay; - float aspect = mInfo.mPixelAspectRatio; - { - ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor()); - RenderVideoFrame(videoData, TimeStamp::Now(), display, aspect); - } + ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor()); + RenderVideoFrame(videoData, TimeStamp::Now()); } // Start the decode threads, so that we can pre buffer the streams. @@ -1205,11 +1201,9 @@ nsresult nsBuiltinDecoderStateMachine::Run() if (video) { NS_ASSERTION(video->mTime <= seekTime && seekTime <= video->mEndTime, "Seek target should lie inside the first frame after seek"); - nsIntSize display = mInfo.mDisplay; - float aspect = mInfo.mPixelAspectRatio; { ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor()); - RenderVideoFrame(video, TimeStamp::Now(), display, aspect); + RenderVideoFrame(video, TimeStamp::Now()); } mReader->mVideoQueue.PopFront(); nsCOMPtr event = @@ -1366,9 +1360,7 @@ nsresult nsBuiltinDecoderStateMachine::Run() } void nsBuiltinDecoderStateMachine::RenderVideoFrame(VideoData* aData, - TimeStamp aTarget, - nsIntSize aDisplaySize, - float aAspectRatio) + TimeStamp aTarget) { NS_ASSERTION(IsCurrentThread(mDecoder->mStateMachineThread), "Should be on state machine thread."); mDecoder->GetReentrantMonitor().AssertNotCurrentThreadIn(); @@ -1379,8 +1371,7 @@ void nsBuiltinDecoderStateMachine::RenderVideoFrame(VideoData* aData, nsRefPtr image = aData->mImage; if (image) { - mDecoder->SetVideoData(gfxIntSize(aDisplaySize.width, aDisplaySize.height), - aAspectRatio, image, aTarget); + mDecoder->SetVideoData(aData->mDisplay, image, aTarget); } } @@ -1490,14 +1481,10 @@ void nsBuiltinDecoderStateMachine::AdvanceFrame() UsecsToDuration(currentFrame->mTime - mStartTime); NS_ASSERTION(currentFrame->mTime >= mStartTime, "Should have positive frame time"); { - nsIntSize display = mInfo.mDisplay; - float aspect = mInfo.mPixelAspectRatio; - { - ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor()); - // If we have video, we want to increment the clock in steps of the frame - // duration. - RenderVideoFrame(currentFrame, presTime, display, aspect); - } + ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor()); + // If we have video, we want to increment the clock in steps of the frame + // duration. + RenderVideoFrame(currentFrame, presTime); } mDecoder->GetFrameStatistics().NotifyPresentedFrame(); PRInt64 now = DurationToUsecs(TimeStamp::Now() - mPlayStartTime) + mPlayDuration; @@ -1548,7 +1535,7 @@ void nsBuiltinDecoderStateMachine::AdvanceFrame() void nsBuiltinDecoderStateMachine::Wait(PRInt64 aUsecs) { mDecoder->GetReentrantMonitor().AssertCurrentThreadIn(); - TimeStamp end = TimeStamp::Now() + UsecsToDuration(PR_MAX(USECS_PER_MS, aUsecs)); + TimeStamp end = TimeStamp::Now() + UsecsToDuration(NS_MAX(USECS_PER_MS, aUsecs)); TimeStamp now; while ((now = TimeStamp::Now()) < end && mState != DECODER_STATE_SHUTDOWN && diff --git a/content/media/nsBuiltinDecoderStateMachine.h b/content/media/nsBuiltinDecoderStateMachine.h index eeb1267e310..e78c79f1bee 100644 --- a/content/media/nsBuiltinDecoderStateMachine.h +++ b/content/media/nsBuiltinDecoderStateMachine.h @@ -319,8 +319,7 @@ protected: // Performs YCbCr to RGB conversion, and pushes the image down the // rendering pipeline. Called on the state machine thread. The decoder // monitor must not be held when calling this. - void RenderVideoFrame(VideoData* aData, TimeStamp aTarget, - nsIntSize aDisplaySize, float aAspectRatio); + void RenderVideoFrame(VideoData* aData, TimeStamp aTarget); // If we have video, display a video frame if it's time for display has // arrived, otherwise sleep until it's time for the next sample. Update diff --git a/content/media/nsMediaCache.cpp b/content/media/nsMediaCache.cpp index 60699b74328..187ad983871 100644 --- a/content/media/nsMediaCache.cpp +++ b/content/media/nsMediaCache.cpp @@ -741,8 +741,8 @@ static PRInt32 GetMaxBlocks() // Cache size is in KB PRInt32 cacheSize = Preferences::GetInt("media.cache_size", 500*1024); PRInt64 maxBlocks = static_cast(cacheSize)*1024/nsMediaCache::BLOCK_SIZE; - maxBlocks = PR_MAX(maxBlocks, 1); - return PRInt32(PR_MIN(maxBlocks, PR_INT32_MAX)); + maxBlocks = NS_MAX(maxBlocks, 1); + return PRInt32(NS_MIN(maxBlocks, PR_INT32_MAX)); } PRInt32 diff --git a/content/media/nsMediaDecoder.cpp b/content/media/nsMediaDecoder.cpp index e1b0b3b6a58..0d79ef280b8 100644 --- a/content/media/nsMediaDecoder.cpp +++ b/content/media/nsMediaDecoder.cpp @@ -74,7 +74,6 @@ nsMediaDecoder::nsMediaDecoder() : mRGBWidth(-1), mRGBHeight(-1), mVideoUpdateLock("nsMediaDecoder.mVideoUpdateLock"), - mPixelAspectRatio(1.0), mFrameBufferLength(0), mPinnedForSeek(PR_FALSE), mSizeChanged(PR_FALSE), @@ -116,15 +115,6 @@ nsresult nsMediaDecoder::RequestFrameBufferLength(PRUint32 aLength) return NS_OK; } - -static PRInt32 ConditionDimension(float aValue, PRInt32 aDefault) -{ - // This will exclude NaNs and infinities - if (aValue >= 1.0 && aValue <= 10000.0) - return PRInt32(NS_round(aValue)); - return aDefault; -} - void nsMediaDecoder::Invalidate() { if (!mElement) @@ -141,21 +131,9 @@ void nsMediaDecoder::Invalidate() mImageContainerSizeChanged = PR_FALSE; if (mSizeChanged) { - nsIntSize scaledSize(mRGBWidth, mRGBHeight); - // Apply the aspect ratio to produce the intrinsic size we report - // to the element. - if (mPixelAspectRatio > 1.0) { - // Increase the intrinsic width - scaledSize.width = - ConditionDimension(mPixelAspectRatio*scaledSize.width, scaledSize.width); - } else { - // Increase the intrinsic height - scaledSize.height = - ConditionDimension(scaledSize.height/mPixelAspectRatio, scaledSize.height); - } - mElement->UpdateMediaSize(scaledSize); - + mElement->UpdateMediaSize(nsIntSize(mRGBWidth, mRGBHeight)); mSizeChanged = PR_FALSE; + if (frame) { nsPresContext* presContext = frame->PresContext(); nsIPresShell *presShell = presContext->PresShell(); @@ -244,17 +222,14 @@ void nsMediaDecoder::FireTimeUpdate() } void nsMediaDecoder::SetVideoData(const gfxIntSize& aSize, - float aPixelAspectRatio, Image* aImage, TimeStamp aTarget) { MutexAutoLock lock(mVideoUpdateLock); - if (mRGBWidth != aSize.width || mRGBHeight != aSize.height || - mPixelAspectRatio != aPixelAspectRatio) { + if (mRGBWidth != aSize.width || mRGBHeight != aSize.height) { mRGBWidth = aSize.width; mRGBHeight = aSize.height; - mPixelAspectRatio = aPixelAspectRatio; mSizeChanged = PR_TRUE; } if (mImageContainer && aImage) { diff --git a/content/media/nsMediaDecoder.h b/content/media/nsMediaDecoder.h index dd2afaa25eb..23d18b8f0a1 100644 --- a/content/media/nsMediaDecoder.h +++ b/content/media/nsMediaDecoder.h @@ -372,7 +372,6 @@ public: // target paint time of the next video frame to be displayed. // Ownership of the image is transferred to the layers subsystem. void SetVideoData(const gfxIntSize& aSize, - float aPixelAspectRatio, Image* aImage, TimeStamp aTarget); @@ -445,9 +444,6 @@ protected: // in the midst of being changed. Mutex mVideoUpdateLock; - // Pixel aspect ratio (ratio of the pixel width to pixel height) - float mPixelAspectRatio; - // The framebuffer size to use for audioavailable events. PRUint32 mFrameBufferLength; diff --git a/content/media/nsMediaStream.cpp b/content/media/nsMediaStream.cpp index d0eda60a05c..7dda157a503 100644 --- a/content/media/nsMediaStream.cpp +++ b/content/media/nsMediaStream.cpp @@ -57,6 +57,7 @@ #include "nsICachingChannel.h" #include "nsURILoader.h" #include "nsIAsyncVerifyRedirectCallback.h" +#include "mozilla/Util.h" // for DebugOnly #define HTTP_OK_CODE 200 #define HTTP_PARTIAL_RESPONSE_CODE 206 @@ -331,7 +332,7 @@ nsMediaChannelStream::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) mLoadInBackground = PR_FALSE; nsLoadFlags loadFlags; - nsresult rv = mChannel->GetLoadFlags(&loadFlags); + DebugOnly rv = mChannel->GetLoadFlags(&loadFlags); NS_ASSERTION(NS_SUCCEEDED(rv), "GetLoadFlags() failed!"); loadFlags &= ~nsIRequest::LOAD_BACKGROUND; diff --git a/content/media/ogg/nsOggReader.cpp b/content/media/ogg/nsOggReader.cpp index a5d9b808308..3eabeddb60a 100644 --- a/content/media/ogg/nsOggReader.cpp +++ b/content/media/ogg/nsOggReader.cpp @@ -118,6 +118,7 @@ nsOggReader::nsOggReader(nsBuiltinDecoder* aDecoder) mPageOffset(0) { MOZ_COUNT_CTOR(nsOggReader); + memset(&mTheoraInfo, 0, sizeof(mTheoraInfo)); } nsOggReader::~nsOggReader() @@ -258,27 +259,34 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo) } if (mTheoraState && ReadHeaders(mTheoraState)) { - mInfo.mHasVideo = PR_TRUE; - mInfo.mPixelAspectRatio = mTheoraState->mPixelAspectRatio; - mInfo.mPicture = nsIntRect(mTheoraState->mInfo.pic_x, - mTheoraState->mInfo.pic_y, - mTheoraState->mInfo.pic_width, - mTheoraState->mInfo.pic_height); - mInfo.mFrame = nsIntSize(mTheoraState->mInfo.frame_width, - mTheoraState->mInfo.frame_height); - mInfo.mDisplay = nsIntSize(mInfo.mPicture.width, - mInfo.mPicture.height); - gfxIntSize sz(mTheoraState->mInfo.pic_width, - mTheoraState->mInfo.pic_height); - mDecoder->SetVideoData(sz, - mTheoraState->mPixelAspectRatio, - nsnull, - TimeStamp::Now()); - // Copy Theora info data for time computations on other threads. - memcpy(&mTheoraInfo, &mTheoraState->mInfo, sizeof(mTheoraInfo)); - mTheoraSerial = mTheoraState->mSerial; - } else { - memset(&mTheoraInfo, 0, sizeof(mTheoraInfo)); + nsIntRect picture = nsIntRect(mTheoraState->mInfo.pic_x, + mTheoraState->mInfo.pic_y, + mTheoraState->mInfo.pic_width, + mTheoraState->mInfo.pic_height); + + nsIntSize displaySize = nsIntSize(mTheoraState->mInfo.pic_width, + mTheoraState->mInfo.pic_height); + + // Apply the aspect ratio to produce the intrinsic display size we report + // to the element. + ScaleDisplayByAspectRatio(displaySize, mTheoraState->mPixelAspectRatio); + + nsIntSize frameSize(mTheoraState->mInfo.frame_width, + mTheoraState->mInfo.frame_height); + if (nsVideoInfo::ValidateVideoRegion(frameSize, picture, displaySize)) { + // Video track's frame sizes will not overflow. Activate the video track. + mInfo.mHasVideo = PR_TRUE; + mInfo.mDisplay = displaySize; + mPicture = picture; + + mDecoder->SetVideoData(gfxIntSize(displaySize.width, displaySize.height), + nsnull, + TimeStamp::Now()); + + // Copy Theora info data for time computations on other threads. + memcpy(&mTheoraInfo, &mTheoraState->mInfo, sizeof(mTheoraInfo)); + mTheoraSerial = mTheoraState->mSerial; + } } if (mVorbisState && ReadHeaders(mVorbisState)) { @@ -482,7 +490,8 @@ nsresult nsOggReader::DecodeTheora(ogg_packet* aPacket, PRInt64 aTimeThreshold) endTime, b, isKeyframe, - aPacket->granulepos); + aPacket->granulepos, + mPicture); if (!v) { // There may be other reasons for this error, but for // simplicity just assume the worst case: out of memory. diff --git a/content/media/ogg/nsOggReader.h b/content/media/ogg/nsOggReader.h index 33e06e39cb9..84c0d2cbe49 100644 --- a/content/media/ogg/nsOggReader.h +++ b/content/media/ogg/nsOggReader.h @@ -286,6 +286,10 @@ private: // The offset of the end of the last page we've read, or the start of // the page we're about to read. PRInt64 mPageOffset; + + // The picture region inside Theora frame to be displayed, if we have + // a Theora video track. + nsIntRect mPicture; }; #endif diff --git a/content/media/raw/nsRawReader.cpp b/content/media/raw/nsRawReader.cpp index d2f62e7b7f5..a0cee2d0390 100644 --- a/content/media/raw/nsRawReader.cpp +++ b/content/media/raw/nsRawReader.cpp @@ -92,19 +92,26 @@ nsresult nsRawReader::ReadMetadata(nsVideoInfo* aInfo) if (!MulOverflow32(mMetadata.frameWidth, mMetadata.frameHeight, dummy)) return NS_ERROR_FAILURE; - mInfo.mHasVideo = PR_TRUE; - mInfo.mPicture.x = 0; - mInfo.mPicture.y = 0; - mInfo.mPicture.width = mMetadata.frameWidth; - mInfo.mPicture.height = mMetadata.frameHeight; - mInfo.mFrame.width = mMetadata.frameWidth; - mInfo.mFrame.height = mMetadata.frameHeight; + if (mMetadata.aspectDenominator == 0 || mMetadata.framerateDenominator == 0) return NS_ERROR_FAILURE; // Invalid data - mInfo.mPixelAspectRatio = static_cast(mMetadata.aspectNumerator) / + + // Determine and verify frame display size. + float pixelAspectRatio = static_cast(mMetadata.aspectNumerator) / mMetadata.aspectDenominator; + nsIntSize display(mMetadata.frameWidth, mMetadata.frameHeight); + ScaleDisplayByAspectRatio(display, pixelAspectRatio); + mPicture = nsIntRect(0, 0, mMetadata.frameWidth, mMetadata.frameHeight); + nsIntSize frameSize(mMetadata.frameWidth, mMetadata.frameHeight); + if (!nsVideoInfo::ValidateVideoRegion(frameSize, mPicture, display)) { + // Video track's frame sizes will overflow. Fail. + return NS_ERROR_FAILURE; + } + + mInfo.mHasVideo = PR_TRUE; mInfo.mHasAudio = PR_FALSE; + mInfo.mDisplay = display; mFrameRate = static_cast(mMetadata.framerateNumerator) / mMetadata.framerateDenominator; @@ -112,7 +119,7 @@ nsresult nsRawReader::ReadMetadata(nsVideoInfo* aInfo) // Make some sanity checks if (mFrameRate > 45 || mFrameRate == 0 || - mInfo.mPixelAspectRatio == 0 || + pixelAspectRatio == 0 || mMetadata.frameWidth > 2000 || mMetadata.frameHeight > 2000 || mMetadata.chromaChannelBpp != 4 || @@ -239,7 +246,8 @@ PRBool nsRawReader::DecodeVideoFrame(PRBool &aKeyframeSkip, currentFrameTime + (USECS_PER_S / mFrameRate), b, 1, // In raw video every frame is a keyframe - -1); + -1, + mPicture); if (!v) return PR_FALSE; diff --git a/content/media/raw/nsRawReader.h b/content/media/raw/nsRawReader.h index f683f7805d0..7d1145b8057 100644 --- a/content/media/raw/nsRawReader.h +++ b/content/media/raw/nsRawReader.h @@ -122,6 +122,7 @@ private: PRUint32 mCurrentFrame; double mFrameRate; PRUint32 mFrameSize; + nsIntRect mPicture; }; #endif diff --git a/content/media/wave/nsWaveReader.cpp b/content/media/wave/nsWaveReader.cpp index 7eeb4191c3e..d983abe73b4 100644 --- a/content/media/wave/nsWaveReader.cpp +++ b/content/media/wave/nsWaveReader.cpp @@ -381,7 +381,7 @@ nsWaveReader::ScanForwardUntil(PRUint32 aWantedChunk, PRUint32* aChunkSize) PR_STATIC_ASSERT(MAX_CHUNK_SIZE < UINT_MAX / sizeof(char)); nsAutoArrayPtr chunk(new char[MAX_CHUNK_SIZE]); while (chunkSize > 0) { - PRUint32 size = PR_MIN(chunkSize, MAX_CHUNK_SIZE); + PRUint32 size = NS_MIN(chunkSize, MAX_CHUNK_SIZE); if (!ReadAll(chunk.get(), size)) { return PR_FALSE; } @@ -545,8 +545,8 @@ nsWaveReader::GetDataLength() // the content length rather than the expected PCM data length. PRInt64 streamLength = mDecoder->GetCurrentStream()->GetLength(); if (streamLength >= 0) { - PRInt64 dataLength = PR_MAX(0, streamLength - mWavePCMOffset); - length = PR_MIN(dataLength, length); + PRInt64 dataLength = NS_MAX(0, streamLength - mWavePCMOffset); + length = NS_MIN(dataLength, length); } return length; } diff --git a/content/media/webm/nsWebMReader.cpp b/content/media/webm/nsWebMReader.cpp index 58bfed47480..12db20616a1 100644 --- a/content/media/webm/nsWebMReader.cpp +++ b/content/media/webm/nsWebMReader.cpp @@ -258,9 +258,9 @@ nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo) // Picture region, taking into account cropping, before scaling // to the display size. nsIntRect pictureRect(params.crop_left, - params.crop_top, - params.width - (params.crop_right + params.crop_left), - params.height - (params.crop_bottom + params.crop_top)); + params.crop_top, + params.width - (params.crop_right + params.crop_left), + params.height - (params.crop_bottom + params.crop_top)); // If the cropping data appears invalid then use the frame data if (pictureRect.width <= 0 || @@ -282,15 +282,14 @@ nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo) // Video track's frame sizes will overflow. Ignore the video track. continue; } - + mVideoTrack = track; mHasVideo = PR_TRUE; mInfo.mHasVideo = PR_TRUE; - mInfo.mPicture = pictureRect; + mInfo.mDisplay = displaySize; - mInfo.mFrame = frameSize; - mInfo.mPixelAspectRatio = (static_cast(params.display_width) / mInfo.mPicture.width) / - (static_cast(params.display_height) / mInfo.mPicture.height); + mPicture = pictureRect; + mInitialFrame = frameSize; switch (params.stereo_mode) { case NESTEGG_VIDEO_MONO: @@ -724,6 +723,17 @@ PRBool nsWebMReader::DecodeVideoFrame(PRBool &aKeyframeSkip, b.mPlanes[2].mHeight = img->d_h >> img->y_chroma_shift; b.mPlanes[2].mWidth = img->d_w >> img->x_chroma_shift; + nsIntRect picture = mPicture; + if (img->d_w != mInitialFrame.width || img->d_h != mInitialFrame.height) { + // Frame size is different from what the container reports. This is legal + // in WebM, and we will preserve the ratio of the crop rectangle as it + // was reported relative to the picture size reported by the container. + picture.x = (mPicture.x * img->d_w) / mInitialFrame.width; + picture.y = (mPicture.y * img->d_h) / mInitialFrame.height; + picture.width = (img->d_w * mPicture.width) / mInitialFrame.width; + picture.height = (img->d_h * mPicture.height) / mInitialFrame.height; + } + VideoData *v = VideoData::Create(mInfo, mDecoder->GetImageContainer(), holder->mOffset, @@ -731,7 +741,8 @@ PRBool nsWebMReader::DecodeVideoFrame(PRBool &aKeyframeSkip, next_tstamp / NS_PER_USEC, b, si.is_kf, - -1); + -1, + picture); if (!v) { return PR_FALSE; } diff --git a/content/media/webm/nsWebMReader.h b/content/media/webm/nsWebMReader.h index ab4ab23e008..f64811e0317 100644 --- a/content/media/webm/nsWebMReader.h +++ b/content/media/webm/nsWebMReader.h @@ -231,6 +231,13 @@ private: // readers when decoder has been cloned. Main thread only. nsRefPtr mBufferedState; + // Size of the frame initially present in the stream. The picture region + // is defined as a ratio relative to this. + nsIntSize mInitialFrame; + + // Picture region, as relative to the initial frame size. + nsIntRect mPicture; + // Booleans to indicate if we have audio and/or video data PRPackedBool mHasVideo; PRPackedBool mHasAudio; diff --git a/content/smil/nsSMILInstanceTime.cpp b/content/smil/nsSMILInstanceTime.cpp index c9f870b9438..656a0396c63 100644 --- a/content/smil/nsSMILInstanceTime.cpp +++ b/content/smil/nsSMILInstanceTime.cpp @@ -228,6 +228,22 @@ nsSMILInstanceTime::IsDependentOn(const nsSMILInstanceTime& aOther) const return myBaseTime->IsDependentOn(aOther); } +const nsSMILInstanceTime* +nsSMILInstanceTime::GetBaseTime() const +{ + if (!mBaseInterval) { + return nsnull; + } + + NS_ABORT_IF_FALSE(mCreator, "Base interval is set but there is no creator."); + if (!mCreator) { + return nsnull; + } + + return mCreator->DependsOnBegin() ? mBaseInterval->Begin() : + mBaseInterval->End(); +} + void nsSMILInstanceTime::SetBaseInterval(nsSMILInterval* aBaseInterval) { @@ -246,19 +262,3 @@ nsSMILInstanceTime::SetBaseInterval(nsSMILInterval* aBaseInterval) mBaseInterval = aBaseInterval; } - -const nsSMILInstanceTime* -nsSMILInstanceTime::GetBaseTime() const -{ - if (!mBaseInterval) { - return nsnull; - } - - NS_ABORT_IF_FALSE(mCreator, "Base interval is set but there is no creator."); - if (!mCreator) { - return nsnull; - } - - return mCreator->DependsOnBegin() ? mBaseInterval->Begin() : - mBaseInterval->End(); -} diff --git a/content/smil/nsSMILInstanceTime.h b/content/smil/nsSMILInstanceTime.h index 531cb4d6636..3f21bfeba8e 100644 --- a/content/smil/nsSMILInstanceTime.h +++ b/content/smil/nsSMILInstanceTime.h @@ -117,6 +117,7 @@ public: PRBool IsDependent() const { return !!mBaseInterval; } PRBool IsDependentOn(const nsSMILInstanceTime& aOther) const; const nsSMILInterval* GetBaseInterval() const { return mBaseInterval; } + const nsSMILInstanceTime* GetBaseTime() const; PRBool SameTimeAndBase(const nsSMILInstanceTime& aOther) const { @@ -132,7 +133,6 @@ public: protected: void SetBaseInterval(nsSMILInterval* aBaseInterval); - const nsSMILInstanceTime* GetBaseTime() const; nsSMILTimeValue mTime; diff --git a/content/smil/nsSMILInterval.cpp b/content/smil/nsSMILInterval.cpp index 8a2c7b10448..bc92760125a 100644 --- a/content/smil/nsSMILInterval.cpp +++ b/content/smil/nsSMILInterval.cpp @@ -114,6 +114,11 @@ nsSMILInterval::SetBegin(nsSMILInstanceTime& aBegin) "Attempting to set unresolved begin time on interval"); NS_ABORT_IF_FALSE(!mBeginFixed, "Attempting to set begin time but the begin point is fixed"); + // Check that we're not making an instance time dependent on itself. Such an + // arrangement does not make intuitive sense and should be detected when + // creating or updating intervals. + NS_ABORT_IF_FALSE(!mBegin || aBegin.GetBaseTime() != mBegin, + "Attempting to make self-dependent instance time"); mBegin = &aBegin; } @@ -123,6 +128,10 @@ nsSMILInterval::SetEnd(nsSMILInstanceTime& aEnd) { NS_ABORT_IF_FALSE(!mEndFixed, "Attempting to set end time but the end point is fixed"); + // As with SetBegin, check we're not making an instance time dependent on + // itself. + NS_ABORT_IF_FALSE(!mEnd || aEnd.GetBaseTime() != mEnd, + "Attempting to make self-dependent instance time"); mEnd = &aEnd; } diff --git a/content/smil/nsSMILTimeValueSpec.cpp b/content/smil/nsSMILTimeValueSpec.cpp index 4614ab34070..3fccf5e22ba 100644 --- a/content/smil/nsSMILTimeValueSpec.cpp +++ b/content/smil/nsSMILTimeValueSpec.cpp @@ -44,8 +44,7 @@ #include "nsSMILParserUtils.h" #include "nsISMILAnimationElement.h" #include "nsContentUtils.h" -#include "nsIEventListenerManager.h" -#include "nsIDOMEventGroup.h" +#include "nsEventListenerManager.h" #include "nsGUIEvent.h" #include "nsIDOMTimeEvent.h" #include "nsString.h" @@ -337,17 +336,15 @@ nsSMILTimeValueSpec::RegisterEventListener(Element* aTarget) mEventListener = new EventListener(this); } - nsCOMPtr sysGroup; - nsIEventListenerManager* elm = - GetEventListenerManager(aTarget, getter_AddRefs(sysGroup)); + nsEventListenerManager* elm = GetEventListenerManager(aTarget); if (!elm) return; elm->AddEventListenerByType(mEventListener, nsDependentAtomString(mParams.mEventSymbol), NS_EVENT_FLAG_BUBBLE | - NS_PRIV_EVENT_UNTRUSTED_PERMITTED, - sysGroup); + NS_PRIV_EVENT_UNTRUSTED_PERMITTED | + NS_EVENT_FLAG_SYSTEM_EVENT); } void @@ -356,28 +353,23 @@ nsSMILTimeValueSpec::UnregisterEventListener(Element* aTarget) if (!aTarget || !mEventListener) return; - nsCOMPtr sysGroup; - nsIEventListenerManager* elm = - GetEventListenerManager(aTarget, getter_AddRefs(sysGroup)); + nsEventListenerManager* elm = GetEventListenerManager(aTarget); if (!elm) return; elm->RemoveEventListenerByType(mEventListener, nsDependentAtomString(mParams.mEventSymbol), NS_EVENT_FLAG_BUBBLE | - NS_PRIV_EVENT_UNTRUSTED_PERMITTED, - sysGroup); + NS_PRIV_EVENT_UNTRUSTED_PERMITTED | + NS_EVENT_FLAG_SYSTEM_EVENT); } -nsIEventListenerManager* -nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget, - nsIDOMEventGroup** aSystemGroup) +nsEventListenerManager* +nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget) { NS_ABORT_IF_FALSE(aTarget, "null target; can't get EventListenerManager"); - NS_ABORT_IF_FALSE(aSystemGroup && !*aSystemGroup, - "Bad out param for system group"); - nsCOMPtr piTarget; + nsCOMPtr target; if (mParams.mType == nsSMILTimeValueSpecParams::ACCESSKEY) { nsIDocument* doc = aTarget->GetCurrentDoc(); @@ -386,22 +378,14 @@ nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget, nsPIDOMWindow* win = doc->GetWindow(); if (!win) return nsnull; - piTarget = do_QueryInterface(win); + target = do_QueryInterface(win); } else { - piTarget = aTarget; + target = aTarget; } - if (!piTarget) + if (!target) return nsnull; - nsIEventListenerManager* elm = piTarget->GetListenerManager(PR_TRUE); - if (!elm) - return nsnull; - - aTarget->GetSystemEventGroup(aSystemGroup); - if (!*aSystemGroup) - return nsnull; - - return elm; + return target->GetListenerManager(PR_TRUE); } void diff --git a/content/smil/nsSMILTimeValueSpec.h b/content/smil/nsSMILTimeValueSpec.h index bdd6177d50f..53e0a9c4434 100644 --- a/content/smil/nsSMILTimeValueSpec.h +++ b/content/smil/nsSMILTimeValueSpec.h @@ -95,8 +95,7 @@ protected: nsSMILTimedElement* GetTimedElement(Element* aElement); void RegisterEventListener(Element* aElement); void UnregisterEventListener(Element* aElement); - nsIEventListenerManager* GetEventListenerManager(Element* aElement, - nsIDOMEventGroup** aSystemGroup); + nsEventListenerManager* GetEventListenerManager(Element* aElement); void HandleEvent(nsIDOMEvent* aEvent); PRBool CheckEventDetail(nsIDOMEvent* aEvent); PRBool CheckRepeatEventDetail(nsIDOMEvent* aEvent); diff --git a/content/smil/nsSMILTimedElement.cpp b/content/smil/nsSMILTimedElement.cpp index c8cb3921281..58acb8f882c 100644 --- a/content/smil/nsSMILTimedElement.cpp +++ b/content/smil/nsSMILTimedElement.cpp @@ -511,7 +511,7 @@ nsSMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, PRBool aEndOnly) case STATE_STARTUP: { nsSMILInterval firstInterval; - mElementState = GetNextInterval(nsnull, nsnull, firstInterval) + mElementState = GetNextInterval(nsnull, nsnull, nsnull, firstInterval) ? STATE_WAITING : STATE_POSTACTIVE; stateChanged = PR_TRUE; @@ -558,7 +558,8 @@ nsSMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, PRBool aEndOnly) if (mCurrentInterval->End()->Time() <= sampleTime) { nsSMILInterval newInterval; - mElementState = GetNextInterval(mCurrentInterval, nsnull, newInterval) + mElementState = + GetNextInterval(mCurrentInterval, nsnull, nsnull, newInterval) ? STATE_WAITING : STATE_POSTACTIVE; if (mClient) { @@ -1497,6 +1498,7 @@ nsSMILTimedElement::FilterInstanceTimes(InstanceTimeList& aList) // PRBool nsSMILTimedElement::GetNextInterval(const nsSMILInterval* aPrevInterval, + const nsSMILInterval* aReplacedInterval, const nsSMILInstanceTime* aFixedBeginTime, nsSMILInterval& aResult) const { @@ -1539,19 +1541,35 @@ nsSMILTimedElement::GetNextInterval(const nsSMILInterval* aPrevInterval, tempBegin = new nsSMILInstanceTime(nsSMILTimeValue(0)); } else { PRInt32 beginPos = 0; - tempBegin = GetNextGreaterOrEqual(mBeginInstances, beginAfter, beginPos); - if (!tempBegin || !tempBegin->Time().IsResolved()) { - return PR_FALSE; - } + // If we're updating the current interval then skip any begin time that is + // dependent on the current interval's begin time. e.g. + // Time().IsResolved()) { + return PR_FALSE; + } + } while (aReplacedInterval && + tempBegin->GetBaseTime() == aReplacedInterval->Begin()); } - NS_ABORT_IF_FALSE(tempBegin && tempBegin->Time().IsResolved() && + NS_ABORT_IF_FALSE(tempBegin && tempBegin->Time().IsResolved() && tempBegin->Time() >= beginAfter, "Got a bad begin time while fetching next interval"); // Calculate end time { PRInt32 endPos = 0; - tempEnd = GetNextGreaterOrEqual(mEndInstances, tempBegin->Time(), endPos); + // As above with begin times, avoid creating self-referential loops + // between instance times by checking that the newly found end instance + // time is not already dependent on the end of the current interval. + do { + tempEnd = + GetNextGreaterOrEqual(mEndInstances, tempBegin->Time(), endPos); + } while (tempEnd && aReplacedInterval && + tempEnd->GetBaseTime() == aReplacedInterval->End()); // If the last interval ended at the same point and was zero-duration and // this one is too, look for another end to use instead @@ -1817,7 +1835,8 @@ nsSMILTimedElement::UpdateCurrentInterval(PRBool aForceChangeNotice) ? mCurrentInterval->Begin() : nsnull; nsSMILInterval updatedInterval; - if (GetNextInterval(GetPreviousInterval(), beginTime, updatedInterval)) { + if (GetNextInterval(GetPreviousInterval(), mCurrentInterval, + beginTime, updatedInterval)) { if (mElementState == STATE_POSTACTIVE) { diff --git a/content/smil/nsSMILTimedElement.h b/content/smil/nsSMILTimedElement.h index 25774e3d3e9..d14273a621b 100644 --- a/content/smil/nsSMILTimedElement.h +++ b/content/smil/nsSMILTimedElement.h @@ -472,6 +472,9 @@ protected: * @param aPrevInterval The previous interval used. If supplied, the first * interval that begins after aPrevInterval will be * returned. May be nsnull. + * @param aReplacedInterval The interval that is being updated (if any). This + * used to ensure we don't return interval endpoints + * that are dependent on themselves. May be nsnull. * @param aFixedBeginTime The time to use for the start of the interval. This * is used when only the endpoint of the interval * should be updated such as when the animation is in @@ -482,6 +485,7 @@ protected: * @return PR_TRUE if a suitable interval was found, PR_FALSE otherwise. */ PRBool GetNextInterval(const nsSMILInterval* aPrevInterval, + const nsSMILInterval* aReplacedInterval, const nsSMILInstanceTime* aFixedBeginTime, nsSMILInterval& aResult) const; nsSMILInstanceTime* GetNextGreater(const InstanceTimeList& aList, diff --git a/content/svg/content/src/nsSVGElement.cpp b/content/svg/content/src/nsSVGElement.cpp index a748250425c..3f694f55396 100644 --- a/content/svg/content/src/nsSVGElement.cpp +++ b/content/svg/content/src/nsSVGElement.cpp @@ -62,7 +62,7 @@ #include "nsGenericHTMLElement.h" #include "nsNodeInfoManager.h" #include "nsIScriptGlobalObject.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsSVGUtils.h" #include "nsSVGLength2.h" #include "nsSVGNumber2.h" @@ -598,7 +598,7 @@ nsSVGElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName, mContentStyleRule = nsnull; if (IsEventName(aName)) { - nsIEventListenerManager* manager = GetListenerManager(PR_FALSE); + nsEventListenerManager* manager = GetListenerManager(PR_FALSE); if (manager) { nsIAtom* eventName = GetEventNameForAttr(aName); manager->RemoveScriptEventListener(eventName); @@ -1444,6 +1444,20 @@ void nsSVGElement::LengthAttributesInfo::Reset(PRUint8 aAttrEnum) mLengthInfo[aAttrEnum].mDefaultUnitType); } +void +nsSVGElement::SetLength(nsIAtom* aName, const nsSVGLength2 &aLength) +{ + LengthAttributesInfo lengthInfo = GetLengthInfo(); + + for (PRUint32 i = 0; i < lengthInfo.mLengthCount; i++) { + if (aName == *lengthInfo.mLengthInfo[i].mName) { + lengthInfo.mLengths[i] = aLength; + return; + } + } + NS_ABORT_IF_FALSE(false, "no length found to set"); +} + void nsSVGElement::DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr) { diff --git a/content/svg/content/src/nsSVGElement.h b/content/svg/content/src/nsSVGElement.h index 1933f215a5d..bb118044ebf 100644 --- a/content/svg/content/src/nsSVGElement.h +++ b/content/svg/content/src/nsSVGElement.h @@ -171,6 +171,7 @@ public: PRBool NumberAttrAllowsPercentage(PRUint8 aAttrEnum) { return GetNumberInfo().mNumberInfo[aAttrEnum].mPercentagesAllowed; } + void SetLength(nsIAtom* aName, const nsSVGLength2 &aLength); virtual void DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr); virtual void DidChangeNumber(PRUint8 aAttrEnum, PRBool aDoSetAttr); virtual void DidChangeInteger(PRUint8 aAttrEnum, PRBool aDoSetAttr); diff --git a/content/svg/content/src/nsSVGLength2.cpp b/content/svg/content/src/nsSVGLength2.cpp index 64ee31dfc17..a2b1867625c 100644 --- a/content/svg/content/src/nsSVGLength2.cpp +++ b/content/svg/content/src/nsSVGLength2.cpp @@ -426,9 +426,7 @@ nsSVGLength2::SetBaseValueString(const nsAString &aValueAsString, } #endif - // We don't need to call DidChange* here - we're only called by - // nsSVGElement::ParseAttribute under nsGenericElement::SetAttr, - // which takes care of notifying. + aSVGElement->DidChangeLength(mAttrEnum, aDoSetAttr); return NS_OK; } diff --git a/content/svg/content/src/nsSVGLength2.h b/content/svg/content/src/nsSVGLength2.h index a266949aa2e..062e2e57b31 100644 --- a/content/svg/content/src/nsSVGLength2.h +++ b/content/svg/content/src/nsSVGLength2.h @@ -67,6 +67,15 @@ public: mIsBaseSet = PR_FALSE; } + nsSVGLength2& operator=(const nsSVGLength2& aLength) { + mBaseVal = aLength.mBaseVal; + mAnimVal = aLength.mAnimVal; + mSpecifiedUnitType = aLength.mSpecifiedUnitType; + mIsAnimated = aLength.mIsAnimated; + mIsBaseSet = aLength.mIsBaseSet; + return *this; + } + nsresult SetBaseValueString(const nsAString& aValue, nsSVGElement *aSVGElement, PRBool aDoSetAttr); diff --git a/content/svg/content/src/nsSVGUseElement.cpp b/content/svg/content/src/nsSVGUseElement.cpp index 17b850a255a..6cc4d345037 100644 --- a/content/svg/content/src/nsSVGUseElement.cpp +++ b/content/svg/content/src/nsSVGUseElement.cpp @@ -254,12 +254,6 @@ nsSVGUseElement::NodeWillBeDestroyed(const nsINode *aNode) nsIContent* nsSVGUseElement::CreateAnonymousContent() { -#ifdef DEBUG_tor - nsAutoString href; - mStringAttributes[HREF].GetAnimValue(href, this); - fprintf(stderr, " reclone of \"%s\"\n", ToNewCString(href)); -#endif - mClone = nsnull; if (mSource.get()) { @@ -289,6 +283,10 @@ nsSVGUseElement::CreateAnonymousContent() tag != nsGkAtoms::use) return nsnull; + // Make sure the use attributes are valid + if (!HasValidDimensions()) + return nsnull; + // circular loop detection // check 1 - check if we're a document descendent of the target @@ -352,12 +350,6 @@ nsSVGUseElement::CreateAnonymousContent() if (!svgNode) return nsnull; - if (newcontent->HasAttr(kNameSpaceID_None, nsGkAtoms::viewBox)) { - nsAutoString viewbox; - newcontent->GetAttr(kNameSpaceID_None, nsGkAtoms::viewBox, viewbox); - svgNode->SetAttr(kNameSpaceID_None, nsGkAtoms::viewBox, viewbox, PR_FALSE); - } - // copy attributes const nsAttrName* name; PRUint32 i; @@ -382,17 +374,12 @@ nsSVGUseElement::CreateAnonymousContent() } if (symbol || svg) { - if (HasAttr(kNameSpaceID_None, nsGkAtoms::width)) { - nsAutoString width; - GetAttr(kNameSpaceID_None, nsGkAtoms::width, width); - newcontent->SetAttr(kNameSpaceID_None, nsGkAtoms::width, width, PR_FALSE); - } + nsSVGElement *newElement = static_cast(newcontent.get()); - if (HasAttr(kNameSpaceID_None, nsGkAtoms::height)) { - nsAutoString height; - GetAttr(kNameSpaceID_None, nsGkAtoms::height, height); - newcontent->SetAttr(kNameSpaceID_None, nsGkAtoms::height, height, PR_FALSE); - } + if (mLengthAttributes[WIDTH].IsExplicitlySet()) + newElement->SetLength(nsGkAtoms::width, mLengthAttributes[WIDTH]); + if (mLengthAttributes[HEIGHT].IsExplicitlySet()) + newElement->SetLength(nsGkAtoms::height, mLengthAttributes[HEIGHT]); } // Set up its base URI correctly @@ -418,22 +405,40 @@ nsSVGUseElement::DestroyAnonymousContent() //---------------------------------------------------------------------- // implementation helpers +PRBool nsSVGUseElement::HasValidDimensions() +{ + nsSVGSVGElement *ctx = GetCtx(); + + return (!mLengthAttributes[WIDTH].IsExplicitlySet() || + mLengthAttributes[WIDTH].GetAnimValue(ctx) > 0) && + (!mLengthAttributes[HEIGHT].IsExplicitlySet() || + mLengthAttributes[HEIGHT].GetAnimValue(ctx) > 0); +} + void nsSVGUseElement::SyncWidthHeight(PRUint8 aAttrEnum) { + if (HasValidDimensions() == !mClone) { + TriggerReclone(); + return; + } + if (mClone && (aAttrEnum == WIDTH || aAttrEnum == HEIGHT)) { nsCOMPtr symbol = do_QueryInterface(mClone); nsCOMPtr svg = do_QueryInterface(mClone); if (symbol || svg) { - if (aAttrEnum == WIDTH) { - nsAutoString width; - GetAttr(kNameSpaceID_None, nsGkAtoms::width, width); - mClone->SetAttr(kNameSpaceID_None, nsGkAtoms::width, width, PR_FALSE); - } else if (aAttrEnum == HEIGHT) { - nsAutoString height; - GetAttr(kNameSpaceID_None, nsGkAtoms::height, height); - mClone->SetAttr(kNameSpaceID_None, nsGkAtoms::height, height, PR_FALSE); + nsIAtom* aAttrName = aAttrEnum == WIDTH ? + nsGkAtoms::width : nsGkAtoms::height; + + if (mLengthAttributes[aAttrEnum].IsExplicitlySet()) { + static_cast(mClone.get())-> + SetLength(aAttrName, mLengthAttributes[aAttrEnum]); + } else { + // Our width/height attribute is now no longer explicitly set, so we + // need to revert the clone's width/height to the width/height of the + // content that's being cloned. + TriggerReclone(); } } } @@ -499,6 +504,14 @@ nsSVGUseElement::DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr) SyncWidthHeight(aAttrEnum); } +void +nsSVGUseElement::DidAnimateLength(PRUint8 aAttrEnum) +{ + nsSVGUseElementBase::DidAnimateLength(aAttrEnum); + + SyncWidthHeight(aAttrEnum); +} + nsSVGElement::LengthAttributesInfo nsSVGUseElement::GetLengthInfo() { diff --git a/content/svg/content/src/nsSVGUseElement.h b/content/svg/content/src/nsSVGUseElement.h index a04fc0020e8..fc1fd64c109 100644 --- a/content/svg/content/src/nsSVGUseElement.h +++ b/content/svg/content/src/nsSVGUseElement.h @@ -104,6 +104,7 @@ public: // nsSVGElement specializations: virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix) const; virtual void DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr); + virtual void DidAnimateLength(PRUint8 aAttrEnum); virtual void DidChangeString(PRUint8 aAttrEnum); virtual void DidAnimateString(PRUint8 aAttrEnum); @@ -131,6 +132,7 @@ protected: virtual LengthAttributesInfo GetLengthInfo(); virtual StringAttributesInfo GetStringInfo(); + PRBool HasValidDimensions(); void SyncWidthHeight(PRUint8 aAttrEnum); void LookupHref(); void TriggerReclone(); diff --git a/content/svg/document/src/Makefile.in b/content/svg/document/src/Makefile.in index b3a77697b1a..63ddb96c0b4 100644 --- a/content/svg/document/src/Makefile.in +++ b/content/svg/document/src/Makefile.in @@ -63,6 +63,7 @@ INCLUDES += \ -I$(srcdir)/../../../../layout/style \ -I$(srcdir)/../../../base/src \ -I$(srcdir)/../../../events/src \ + -I$(topsrcdir)/xpcom/ds \ $(NULL) DEFINES += -D_IMPL_NS_LAYOUT diff --git a/content/xbl/public/nsIXBLService.h b/content/xbl/public/nsIXBLService.h index faf7ef4b45f..e241e2d4b4a 100644 --- a/content/xbl/public/nsIXBLService.h +++ b/content/xbl/public/nsIXBLService.h @@ -49,7 +49,7 @@ class nsIContent; class nsIDocument; -class nsPIDOMEventTarget; +class nsIDOMEventTarget; class nsIDOMNodeList; class nsXBLBinding; class nsXBLDocumentInfo; @@ -88,8 +88,8 @@ public: nsXBLDocumentInfo** aResult) = 0; // Hooks up the global key event handlers to the document root. - NS_IMETHOD AttachGlobalKeyHandler(nsPIDOMEventTarget* aTarget)=0; - NS_IMETHOD DetachGlobalKeyHandler(nsPIDOMEventTarget* aTarget)=0; + NS_IMETHOD AttachGlobalKeyHandler(nsIDOMEventTarget* aTarget) = 0; + NS_IMETHOD DetachGlobalKeyHandler(nsIDOMEventTarget* aTarget) = 0; }; diff --git a/content/xbl/src/Makefile.in b/content/xbl/src/Makefile.in index eddf0b482c9..eefba37a536 100644 --- a/content/xbl/src/Makefile.in +++ b/content/xbl/src/Makefile.in @@ -88,6 +88,7 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../../events/src \ -I$(srcdir)/../../../layout/style \ -I$(srcdir)/../../../dom/base \ + -I$(topsrcdir)/xpcom/ds \ $(NULL) DEFINES += -D_IMPL_NS_LAYOUT diff --git a/content/xbl/src/nsBindingManager.cpp b/content/xbl/src/nsBindingManager.cpp index 191cc7777b6..cf21dc85782 100644 --- a/content/xbl/src/nsBindingManager.cpp +++ b/content/xbl/src/nsBindingManager.cpp @@ -402,6 +402,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsBindingManager) tmp->mWrapperTable.ops = nsnull; NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mAttachedStack) + + if (tmp->mProcessAttachedQueueEvent) { + tmp->mProcessAttachedQueueEvent->Revoke(); + } NS_IMPL_CYCLE_COLLECTION_UNLINK_END diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index 3b4a184103b..b37d537d3b8 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -72,7 +72,7 @@ #include "nsCRT.h" // Event listeners -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsIDOMMouseListener.h" #include "nsIDOMMouseMotionListener.h" #include "nsIDOMLoadListener.h" @@ -80,7 +80,6 @@ #include "nsIDOMKeyListener.h" #include "nsIDOMFormListener.h" #include "nsIDOMContextMenuListener.h" -#include "nsIDOMEventGroup.h" #include "nsAttrName.h" #include "nsGkAtoms.h" @@ -94,7 +93,7 @@ #include "nsXBLBinding.h" #include "nsIPrincipal.h" #include "nsIScriptSecurityManager.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsGUIEvent.h" #include "prprf.h" @@ -314,7 +313,9 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsXBLBinding) tmp->mContent); } NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mContent) - // XXX What about mNextBinding and mInsertionPointTable? + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mNextBinding) + delete tmp->mInsertionPointTable; + tmp->mInsertionPointTable = nsnull; NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(nsXBLBinding) cb.NoteXPCOMChild(static_cast( @@ -834,12 +835,11 @@ nsXBLBinding::InstallEventHandlers() nsXBLPrototypeHandler* handlerChain = mPrototypeBinding->GetPrototypeHandlers(); if (handlerChain) { - nsIEventListenerManager* manager = + nsEventListenerManager* manager = mBoundElement->GetListenerManager(PR_TRUE); if (!manager) return; - nsCOMPtr systemEventGroup; PRBool isChromeDoc = nsContentUtils::IsChromeDoc(mBoundElement->GetOwnerDoc()); PRBool isChromeBinding = mPrototypeBinding->IsChrome(); @@ -853,25 +853,19 @@ nsXBLBinding::InstallEventHandlers() eventAtom == nsGkAtoms::keypress) continue; - // If this is a command, add it in the system event group, otherwise - // add it to the standard event group. - - // This is a weak ref. systemEventGroup above is already a - // strong ref, so we are guaranteed it will not go away. - nsIDOMEventGroup* eventGroup = nsnull; - if ((curr->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) && - (isChromeBinding || mBoundElement->IsInNativeAnonymousSubtree())) { - if (!systemEventGroup) - manager->GetSystemEventGroupLM(getter_AddRefs(systemEventGroup)); - eventGroup = systemEventGroup; - } - nsXBLEventHandler* handler = curr->GetEventHandler(); if (handler) { // Figure out if we're using capturing or not. PRInt32 flags = (curr->GetPhase() == NS_PHASE_CAPTURING) ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; + // If this is a command, add it in the system event group + if ((curr->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | + NS_HANDLER_TYPE_SYSTEM)) && + (isChromeBinding || mBoundElement->IsInNativeAnonymousSubtree())) { + flags |= NS_EVENT_FLAG_SYSTEM_EVENT; + } + PRBool hasAllowUntrustedAttr = curr->HasAllowUntrustedAttr(); if ((hasAllowUntrustedAttr && curr->AllowUntrustedEvents()) || (!hasAllowUntrustedAttr && !isChromeDoc)) { @@ -880,7 +874,7 @@ nsXBLBinding::InstallEventHandlers() manager->AddEventListenerByType(handler, nsDependentAtomString(eventAtom), - flags, eventGroup); + flags); } } @@ -897,26 +891,22 @@ nsXBLBinding::InstallEventHandlers() // If this is a command, add it in the system event group, otherwise // add it to the standard event group. - // This is a weak ref. systemEventGroup above is already a - // strong ref, so we are guaranteed it will not go away. - nsIDOMEventGroup* eventGroup = nsnull; - if ((handler->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) && - (isChromeBinding || mBoundElement->IsInNativeAnonymousSubtree())) { - if (!systemEventGroup) - manager->GetSystemEventGroupLM(getter_AddRefs(systemEventGroup)); - eventGroup = systemEventGroup; - } - // Figure out if we're using capturing or not. PRInt32 flags = (handler->GetPhase() == NS_PHASE_CAPTURING) ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; + if ((handler->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | + NS_HANDLER_TYPE_SYSTEM)) && + (isChromeBinding || mBoundElement->IsInNativeAnonymousSubtree())) { + flags |= NS_EVENT_FLAG_SYSTEM_EVENT; + } + // For key handlers we have to set NS_PRIV_EVENT_UNTRUSTED_PERMITTED flag. // Whether the handling of the event is allowed or not is handled in // nsXBLKeyEventHandler::HandleEvent flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED; - manager->AddEventListenerByType(handler, type, flags, eventGroup); + manager->AddEventListenerByType(handler, type, flags); } } } @@ -994,14 +984,13 @@ nsXBLBinding::UnhookEventHandlers() nsXBLPrototypeHandler* handlerChain = mPrototypeBinding->GetPrototypeHandlers(); if (handlerChain) { - nsCOMPtr manager = + nsEventListenerManager* manager = mBoundElement->GetListenerManager(PR_FALSE); if (!manager) { return; } PRBool isChromeBinding = mPrototypeBinding->IsChrome(); - nsCOMPtr systemEventGroup; nsXBLPrototypeHandler* curr; for (curr = handlerChain; curr; curr = curr->GetNextHandler()) { nsXBLEventHandler* handler = curr->GetCachedEventHandler(); @@ -1023,19 +1012,15 @@ nsXBLBinding::UnhookEventHandlers() // If this is a command, remove it from the system event group, // otherwise remove it from the standard event group. - // This is a weak ref. systemEventGroup above is already a - // strong ref, so we are guaranteed it will not go away. - nsIDOMEventGroup* eventGroup = nsnull; - if ((curr->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) && + if ((curr->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | + NS_HANDLER_TYPE_SYSTEM)) && (isChromeBinding || mBoundElement->IsInNativeAnonymousSubtree())) { - if (!systemEventGroup) - manager->GetSystemEventGroupLM(getter_AddRefs(systemEventGroup)); - eventGroup = systemEventGroup; + flags |= NS_EVENT_FLAG_SYSTEM_EVENT; } manager->RemoveEventListenerByType(handler, nsDependentAtomString(eventAtom), - flags, eventGroup); + flags); } const nsCOMArray* keyHandlers = @@ -1054,17 +1039,12 @@ nsXBLBinding::UnhookEventHandlers() // If this is a command, remove it from the system event group, otherwise // remove it from the standard event group. - // This is a weak ref. systemEventGroup above is already a - // strong ref, so we are guaranteed it will not go away. - nsIDOMEventGroup* eventGroup = nsnull; if ((handler->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) && (isChromeBinding || mBoundElement->IsInNativeAnonymousSubtree())) { - if (!systemEventGroup) - manager->GetSystemEventGroupLM(getter_AddRefs(systemEventGroup)); - eventGroup = systemEventGroup; + flags |= NS_EVENT_FLAG_SYSTEM_EVENT; } - manager->RemoveEventListenerByType(handler, type, flags, eventGroup); + manager->RemoveEventListenerByType(handler, type, flags); } } } diff --git a/content/xbl/src/nsXBLEventHandler.cpp b/content/xbl/src/nsXBLEventHandler.cpp index d55ae4de8f6..a9d0b9db5ce 100644 --- a/content/xbl/src/nsXBLEventHandler.cpp +++ b/content/xbl/src/nsXBLEventHandler.cpp @@ -39,13 +39,11 @@ #include "nsCOMPtr.h" #include "nsIAtom.h" #include "nsIContent.h" -#include "nsIDOMEventGroup.h" #include "nsIDOMEventListener.h" #include "nsIDOMEventTarget.h" #include "nsIDOMKeyEvent.h" #include "nsIDOMMouseEvent.h" #include "nsIDOMText.h" -#include "nsIDOM3EventTarget.h" #include "nsGkAtoms.h" #include "nsXBLPrototypeHandler.h" #include "nsIDOMNSEvent.h" @@ -83,9 +81,8 @@ nsXBLEventHandler::HandleEvent(nsIDOMEvent* aEvent) nsCOMPtr target; aEvent->GetCurrentTarget(getter_AddRefs(target)); - nsCOMPtr piTarget = do_QueryInterface(target); - mProtoHandler->ExecuteHandler(piTarget, aEvent); + mProtoHandler->ExecuteHandler(target, aEvent); return NS_OK; } @@ -133,7 +130,6 @@ nsXBLKeyEventHandler::ExecuteMatchedHandlers(nsIDOMKeyEvent* aKeyEvent, nsCOMPtr target; aKeyEvent->GetCurrentTarget(getter_AddRefs(target)); - nsCOMPtr piTarget = do_QueryInterface(target); PRBool executed = PR_FALSE; for (PRUint32 i = 0; i < mProtoHandlers.Length(); ++i) { @@ -143,7 +139,7 @@ nsXBLKeyEventHandler::ExecuteMatchedHandlers(nsIDOMKeyEvent* aKeyEvent, (hasAllowUntrustedAttr && handler->AllowUntrustedEvents()) || (!hasAllowUntrustedAttr && !mIsBoundToChrome)) && handler->KeyEventMatched(aKeyEvent, aCharCode, aIgnoreShiftKey)) { - handler->ExecuteHandler(piTarget, aKeyEvent); + handler->ExecuteHandler(target, aKeyEvent); executed = PR_TRUE; } } diff --git a/content/xbl/src/nsXBLEventHandler.h b/content/xbl/src/nsXBLEventHandler.h index 9d8a0fea5dd..10743cbe060 100644 --- a/content/xbl/src/nsXBLEventHandler.h +++ b/content/xbl/src/nsXBLEventHandler.h @@ -45,9 +45,7 @@ class nsIAtom; class nsIContent; -class nsIDOM3EventTarget; class nsIDOMKeyEvent; -class nsPIDOMEventTarget; class nsXBLPrototypeHandler; class nsXBLEventHandler : public nsIDOMEventListener diff --git a/content/xbl/src/nsXBLPrototypeHandler.cpp b/content/xbl/src/nsXBLPrototypeHandler.cpp index 2ea2f0b5f9a..91e1fa2aaac 100644 --- a/content/xbl/src/nsXBLPrototypeHandler.cpp +++ b/content/xbl/src/nsXBLPrototypeHandler.cpp @@ -58,7 +58,7 @@ #include "nsIDOMHTMLInputElement.h" #include "nsIDOMText.h" #include "nsFocusManager.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsIDOMEventTarget.h" #include "nsIDOMEventListener.h" #include "nsIPrivateDOMEvent.h" @@ -214,7 +214,7 @@ nsXBLPrototypeHandler::InitAccessKeys() } nsresult -nsXBLPrototypeHandler::ExecuteHandler(nsPIDOMEventTarget* aTarget, +nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventTarget* aTarget, nsIDOMEvent* aEvent) { nsresult rv = NS_ERROR_FAILURE; @@ -379,7 +379,7 @@ nsXBLPrototypeHandler::EnsureEventHandler(nsIScriptGlobalObject* aGlobal, } nsresult -nsXBLPrototypeHandler::DispatchXBLCommand(nsPIDOMEventTarget* aTarget, nsIDOMEvent* aEvent) +nsXBLPrototypeHandler::DispatchXBLCommand(nsIDOMEventTarget* aTarget, nsIDOMEvent* aEvent) { // This is a special-case optimization to make command handling fast. // It isn't really a part of XBL, but it helps speed things up. @@ -547,7 +547,7 @@ nsXBLPrototypeHandler::GetEventName() } already_AddRefed -nsXBLPrototypeHandler::GetController(nsPIDOMEventTarget* aTarget) +nsXBLPrototypeHandler::GetController(nsIDOMEventTarget* aTarget) { // XXX Fix this so there's a generic interface that describes controllers, // This code should have no special knowledge of what objects might have controllers. diff --git a/content/xbl/src/nsXBLPrototypeHandler.h b/content/xbl/src/nsXBLPrototypeHandler.h index e1b4ead037e..527663a3a7f 100644 --- a/content/xbl/src/nsXBLPrototypeHandler.h +++ b/content/xbl/src/nsXBLPrototypeHandler.h @@ -55,8 +55,7 @@ class nsIContent; class nsIDOMUIEvent; class nsIDOMKeyEvent; class nsIDOMMouseEvent; -class nsPIDOMEventTarget; -class nsIDOM3EventTarget; +class nsIDOMEventTarget; class nsXBLPrototypeBinding; #define NS_HANDLER_TYPE_XBL_JS (1 << 0) @@ -126,7 +125,7 @@ public: nsXBLPrototypeHandler* GetNextHandler() { return mNextHandler; } void SetNextHandler(nsXBLPrototypeHandler* aHandler) { mNextHandler = aHandler; } - nsresult ExecuteHandler(nsPIDOMEventTarget* aTarget, nsIDOMEvent* aEvent); + nsresult ExecuteHandler(nsIDOMEventTarget* aTarget, nsIDOMEvent* aEvent); already_AddRefed GetEventName(); void SetEventName(nsIAtom* aName) { mEventName = aName; } @@ -162,7 +161,7 @@ public: static PRUint32 gRefCnt; protected: - already_AddRefed GetController(nsPIDOMEventTarget* aTarget); + already_AddRefed GetController(nsIDOMEventTarget* aTarget); inline PRInt32 GetMatchingKeyCode(const nsAString& aKeyName); void ConstructPrototype(nsIContent* aKeyElement, @@ -178,7 +177,7 @@ protected: void GetEventType(nsAString& type); PRBool ModifiersMatchMask(nsIDOMUIEvent* aEvent, PRBool aIgnoreShiftKey = PR_FALSE); - nsresult DispatchXBLCommand(nsPIDOMEventTarget* aTarget, nsIDOMEvent* aEvent); + nsresult DispatchXBLCommand(nsIDOMEventTarget* aTarget, nsIDOMEvent* aEvent); nsresult DispatchXULKeyCommand(nsIDOMEvent* aEvent); nsresult EnsureEventHandler(nsIScriptGlobalObject* aGlobal, nsIScriptContext *aBoundContext, nsIAtom *aName, diff --git a/content/xbl/src/nsXBLService.cpp b/content/xbl/src/nsXBLService.cpp index f5bf6297956..9bc997ab559 100644 --- a/content/xbl/src/nsXBLService.cpp +++ b/content/xbl/src/nsXBLService.cpp @@ -87,8 +87,7 @@ #ifdef MOZ_XUL #include "nsXULPrototypeCache.h" #endif -#include "nsIDOMLoadListener.h" -#include "nsIDOMEventGroup.h" +#include "nsIDOMEventListener.h" #include "mozilla/Preferences.h" using namespace mozilla; @@ -273,19 +272,13 @@ int nsXBLBindingRequest::gRefCnt = 0; // nsXBLStreamListener, a helper class used for // asynchronous parsing of URLs /* Header file */ -class nsXBLStreamListener : public nsIStreamListener, public nsIDOMLoadListener +class nsXBLStreamListener : public nsIStreamListener, public nsIDOMEventListener { public: NS_DECL_ISUPPORTS NS_DECL_NSISTREAMLISTENER NS_DECL_NSIREQUESTOBSERVER - - NS_IMETHOD Load(nsIDOMEvent* aEvent); - NS_IMETHOD BeforeUnload(nsIDOMEvent* aEvent) { return NS_OK; } - NS_IMETHOD Unload(nsIDOMEvent* aEvent) { return NS_OK; } - NS_IMETHOD Abort(nsIDOMEvent* aEvent) { return NS_OK; } - NS_IMETHOD Error(nsIDOMEvent* aEvent) { return NS_OK; } - NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; } + NS_DECL_NSIDOMEVENTLISTENER nsXBLStreamListener(nsXBLService* aXBLService, nsIDocument* aBoundDocument, @@ -308,7 +301,10 @@ private: }; /* Implementation file */ -NS_IMPL_ISUPPORTS4(nsXBLStreamListener, nsIStreamListener, nsIRequestObserver, nsIDOMLoadListener, nsIDOMEventListener) +NS_IMPL_ISUPPORTS3(nsXBLStreamListener, + nsIStreamListener, + nsIRequestObserver, + nsIDOMEventListener) nsXBLStreamListener::nsXBLStreamListener(nsXBLService* aXBLService, nsIDocument* aBoundDocument, @@ -402,7 +398,7 @@ nsXBLStreamListener::HasRequest(nsIURI* aURI, nsIContent* aElt) } nsresult -nsXBLStreamListener::Load(nsIDOMEvent* aEvent) +nsXBLStreamListener::HandleEvent(nsIDOMEvent* aEvent) { nsresult rv = NS_OK; PRUint32 i; @@ -482,7 +478,7 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent) } } - target->RemoveEventListener(NS_LITERAL_STRING("load"), (nsIDOMLoadListener*)this, PR_FALSE); + target->RemoveEventListener(NS_LITERAL_STRING("load"), this, PR_FALSE); return rv; } @@ -709,20 +705,22 @@ nsXBLService::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, // then extra work needs to be done to hook it up to the document (XXX WHY??) // NS_IMETHODIMP -nsXBLService::AttachGlobalKeyHandler(nsPIDOMEventTarget* aTarget) +nsXBLService::AttachGlobalKeyHandler(nsIDOMEventTarget* aTarget) { // check if the receiver is a content node (not a document), and hook // it to the document if that is the case. - nsCOMPtr piTarget = aTarget; + nsCOMPtr piTarget = aTarget; nsCOMPtr contentNode(do_QueryInterface(aTarget)); if (contentNode) { // Only attach if we're really in a document nsCOMPtr doc = contentNode->GetCurrentDoc(); if (doc) - piTarget = do_QueryInterface(doc); // We're a XUL keyset. Attach to our document. + piTarget = doc; // We're a XUL keyset. Attach to our document. } + + nsEventListenerManager* manager = piTarget->GetListenerManager(PR_TRUE); - if (!piTarget) + if (!piTarget || !manager) return NS_ERROR_FAILURE; // the listener already exists, so skip this @@ -738,16 +736,15 @@ nsXBLService::AttachGlobalKeyHandler(nsPIDOMEventTarget* aTarget) return NS_ERROR_FAILURE; // listen to these events - nsCOMPtr systemGroup; - piTarget->GetSystemEventGroup(getter_AddRefs(systemGroup)); - nsCOMPtr target = do_QueryInterface(piTarget); - - target->AddGroupedEventListener(NS_LITERAL_STRING("keydown"), handler, - PR_FALSE, systemGroup); - target->AddGroupedEventListener(NS_LITERAL_STRING("keyup"), handler, - PR_FALSE, systemGroup); - target->AddGroupedEventListener(NS_LITERAL_STRING("keypress"), handler, - PR_FALSE, systemGroup); + manager->AddEventListenerByType(handler, NS_LITERAL_STRING("keydown"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); + manager->AddEventListenerByType(handler, NS_LITERAL_STRING("keyup"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); + manager->AddEventListenerByType(handler, NS_LITERAL_STRING("keypress"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); if (contentNode) return contentNode->SetProperty(nsGkAtoms::listener, handler, @@ -765,9 +762,9 @@ nsXBLService::AttachGlobalKeyHandler(nsPIDOMEventTarget* aTarget) // Removes a key handler added by DeatchGlobalKeyHandler. // NS_IMETHODIMP -nsXBLService::DetachGlobalKeyHandler(nsPIDOMEventTarget* aTarget) +nsXBLService::DetachGlobalKeyHandler(nsIDOMEventTarget* aTarget) { - nsCOMPtr piTarget = aTarget; + nsCOMPtr piTarget = aTarget; nsCOMPtr contentNode(do_QueryInterface(aTarget)); if (!contentNode) // detaching is only supported for content nodes return NS_ERROR_FAILURE; @@ -776,7 +773,10 @@ nsXBLService::DetachGlobalKeyHandler(nsPIDOMEventTarget* aTarget) nsCOMPtr doc = contentNode->GetCurrentDoc(); if (doc) piTarget = do_QueryInterface(doc); - if (!piTarget) + + nsEventListenerManager* manager = piTarget->GetListenerManager(PR_TRUE); + + if (!piTarget || !manager) return NS_ERROR_FAILURE; nsIDOMEventListener* handler = @@ -784,16 +784,15 @@ nsXBLService::DetachGlobalKeyHandler(nsPIDOMEventTarget* aTarget) if (!handler) return NS_ERROR_FAILURE; - nsCOMPtr systemGroup; - piTarget->GetSystemEventGroup(getter_AddRefs(systemGroup)); - nsCOMPtr target = do_QueryInterface(piTarget); - - target->RemoveGroupedEventListener(NS_LITERAL_STRING("keydown"), handler, - PR_FALSE, systemGroup); - target->RemoveGroupedEventListener(NS_LITERAL_STRING("keyup"), handler, - PR_FALSE, systemGroup); - target->RemoveGroupedEventListener(NS_LITERAL_STRING("keypress"), handler, - PR_FALSE, systemGroup); + manager->RemoveEventListenerByType(handler, NS_LITERAL_STRING("keydown"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); + manager->RemoveEventListenerByType(handler, NS_LITERAL_STRING("keyup"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); + manager->RemoveEventListenerByType(handler, NS_LITERAL_STRING("keypress"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); contentNode->DeleteProperty(nsGkAtoms::listener); diff --git a/content/xbl/src/nsXBLService.h b/content/xbl/src/nsXBLService.h index 561db648baa..7569c9ee860 100644 --- a/content/xbl/src/nsXBLService.h +++ b/content/xbl/src/nsXBLService.h @@ -87,8 +87,8 @@ class nsXBLService : public nsIXBLService, nsXBLDocumentInfo** aResult); // Used by XUL key bindings and for window XBL. - NS_IMETHOD AttachGlobalKeyHandler(nsPIDOMEventTarget* aTarget); - NS_IMETHOD DetachGlobalKeyHandler(nsPIDOMEventTarget* aTarget); + NS_IMETHOD AttachGlobalKeyHandler(nsIDOMEventTarget* aTarget); + NS_IMETHOD DetachGlobalKeyHandler(nsIDOMEventTarget* aTarget); NS_DECL_NSIOBSERVER diff --git a/content/xbl/src/nsXBLWindowKeyHandler.cpp b/content/xbl/src/nsXBLWindowKeyHandler.cpp index a9609bf4dd2..868a7381895 100644 --- a/content/xbl/src/nsXBLWindowKeyHandler.cpp +++ b/content/xbl/src/nsXBLWindowKeyHandler.cpp @@ -179,7 +179,7 @@ nsXBLSpecialDocInfo* nsXBLWindowKeyHandler::sXBLSpecialDocInfo = nsnull; PRUint32 nsXBLWindowKeyHandler::sRefCnt = 0; nsXBLWindowKeyHandler::nsXBLWindowKeyHandler(nsIDOMElement* aElement, - nsPIDOMEventTarget* aTarget) + nsIDOMEventTarget* aTarget) : mTarget(aTarget), mHandler(nsnull), mUserHandler(nsnull) @@ -201,8 +201,7 @@ nsXBLWindowKeyHandler::~nsXBLWindowKeyHandler() } } -NS_IMPL_ISUPPORTS2(nsXBLWindowKeyHandler, - nsIDOMKeyListener, +NS_IMPL_ISUPPORTS1(nsXBLWindowKeyHandler, nsIDOMEventListener) static void @@ -393,28 +392,20 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventTy return NS_OK; } -nsresult nsXBLWindowKeyHandler::KeyUp(nsIDOMEvent* aEvent) +NS_IMETHODIMP +nsXBLWindowKeyHandler::HandleEvent(nsIDOMEvent* aEvent) { nsCOMPtr keyEvent(do_QueryInterface(aEvent)); NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG); - return WalkHandlers(keyEvent, nsGkAtoms::keyup); -} -nsresult nsXBLWindowKeyHandler::KeyDown(nsIDOMEvent* aEvent) -{ - nsCOMPtr keyEvent(do_QueryInterface(aEvent)); - NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG); - return WalkHandlers(keyEvent, nsGkAtoms::keydown); -} + nsAutoString eventType; + aEvent->GetType(eventType); + nsCOMPtr eventTypeAtom = do_GetAtom(eventType); + NS_ENSURE_TRUE(eventTypeAtom, NS_ERROR_OUT_OF_MEMORY); -nsresult nsXBLWindowKeyHandler::KeyPress(nsIDOMEvent* aEvent) -{ - nsCOMPtr keyEvent(do_QueryInterface(aEvent)); - NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG); - return WalkHandlers(keyEvent, nsGkAtoms::keypress); + return WalkHandlers(keyEvent, eventTypeAtom); } - // // EventMatched // @@ -566,7 +557,7 @@ nsXBLWindowKeyHandler::WalkHandlersAndExecute(nsIDOMKeyEvent* aKeyEvent, } } - nsCOMPtr piTarget; + nsCOMPtr piTarget; nsCOMPtr element = GetElement(); if (element) { piTarget = do_QueryInterface(commandElt); @@ -595,7 +586,7 @@ nsXBLWindowKeyHandler::GetElement() /////////////////////////////////////////////////////////////////////////////////// nsresult -NS_NewXBLWindowKeyHandler(nsIDOMElement* aElement, nsPIDOMEventTarget* aTarget, +NS_NewXBLWindowKeyHandler(nsIDOMElement* aElement, nsIDOMEventTarget* aTarget, nsXBLWindowKeyHandler** aResult) { *aResult = new nsXBLWindowKeyHandler(aElement, aTarget); diff --git a/content/xbl/src/nsXBLWindowKeyHandler.h b/content/xbl/src/nsXBLWindowKeyHandler.h index 3277ec8c496..820a704506c 100644 --- a/content/xbl/src/nsXBLWindowKeyHandler.h +++ b/content/xbl/src/nsXBLWindowKeyHandler.h @@ -41,34 +41,25 @@ #define nsXBLWindowKeyHandler_h__ #include "nsWeakPtr.h" -#include "nsIDOMKeyListener.h" +#include "nsIDOMEventListener.h" class nsIAtom; class nsIDOMElement; class nsIDOMEventTarget; class nsIDOMKeyEvent; -class nsPIDOMEventTarget; +class nsIDOMEventTarget; class nsIXBLDocumentInfo; class nsXBLSpecialDocInfo; class nsXBLPrototypeHandler; -class nsXBLWindowKeyHandler : public nsIDOMKeyListener +class nsXBLWindowKeyHandler : public nsIDOMEventListener { public: - nsXBLWindowKeyHandler(nsIDOMElement* aElement, nsPIDOMEventTarget* aTarget); + nsXBLWindowKeyHandler(nsIDOMElement* aElement, nsIDOMEventTarget* aTarget); virtual ~nsXBLWindowKeyHandler(); - - // nsIDOMetc. - NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) - { - return NS_OK; - } - NS_IMETHOD KeyUp(nsIDOMEvent* aKeyEvent); - NS_IMETHOD KeyDown(nsIDOMEvent* aKeyEvent); - NS_IMETHOD KeyPress(nsIDOMEvent* aKeyEvent); - NS_DECL_ISUPPORTS + NS_DECL_NSIDOMEVENTLISTENER // release globals static NS_HIDDEN_(void) ShutDown(); @@ -103,7 +94,7 @@ protected: already_AddRefed GetElement(); // Using weak pointer to the DOM Element. nsWeakPtr mWeakPtrForElement; - nsPIDOMEventTarget* mTarget; // weak ref + nsIDOMEventTarget* mTarget; // weak ref // these are not owning references; the prototype handlers are owned // by the prototype bindings which are owned by the docinfo. @@ -117,7 +108,7 @@ protected: nsresult NS_NewXBLWindowKeyHandler(nsIDOMElement* aElement, - nsPIDOMEventTarget* aTarget, + nsIDOMEventTarget* aTarget, nsXBLWindowKeyHandler** aResult); #endif diff --git a/content/xml/document/src/Makefile.in b/content/xml/document/src/Makefile.in index 64ea73e2f6f..ff0a40ef984 100644 --- a/content/xml/document/src/Makefile.in +++ b/content/xml/document/src/Makefile.in @@ -69,6 +69,7 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../../../events/src \ -I$(srcdir)/../../../../dom/base \ -I$(srcdir)/../../../../caps/include \ + -I$(topsrcdir)/xpcom/ds \ $(NULL) DEFINES += -D_IMPL_NS_LAYOUT diff --git a/content/xml/document/src/nsXMLDocument.cpp b/content/xml/document/src/nsXMLDocument.cpp index 89eb165342c..736eb6a9301 100644 --- a/content/xml/document/src/nsXMLDocument.cpp +++ b/content/xml/document/src/nsXMLDocument.cpp @@ -73,7 +73,7 @@ #include "nsCExternalHandlerService.h" #include "nsNetUtil.h" #include "nsMimeTypes.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsContentUtils.h" #include "nsThreadUtils.h" #include "nsJSUtils.h" @@ -407,7 +407,7 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) // be loaded. Note that we need to hold a strong ref to |principal| // here, because ResetToURI will null out our node principal before // setting the new one. - nsCOMPtr elm(mListenerManager); + nsRefPtr elm(mListenerManager); mListenerManager = nsnull; // When we are called from JS we can find the load group for the page, diff --git a/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp b/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp index 210ea3c51ae..b558f47a2e1 100644 --- a/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp +++ b/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp @@ -1265,7 +1265,8 @@ txMozillaXSLTProcessor::Initialize(nsISupports* aOwner, JSContext* cx, nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager(); NS_ENSURE_TRUE(secMan, NS_ERROR_UNEXPECTED); - secMan->GetSubjectPrincipal(getter_AddRefs(prin)); + nsresult rv = secMan->GetSubjectPrincipal(getter_AddRefs(prin)); + NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_TRUE(prin, NS_ERROR_UNEXPECTED); return Init(prin); diff --git a/content/xtf/src/nsXTFElementWrapper.cpp b/content/xtf/src/nsXTFElementWrapper.cpp index b9e38b52379..76572a2e18f 100644 --- a/content/xtf/src/nsXTFElementWrapper.cpp +++ b/content/xtf/src/nsXTFElementWrapper.cpp @@ -49,7 +49,7 @@ #include "nsIPresShell.h" #include "nsPresContext.h" #include "nsEventStateManager.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsIDOMEvent.h" #include "nsGUIEvent.h" #include "nsContentUtils.h" diff --git a/content/xul/content/src/Makefile.in b/content/xul/content/src/Makefile.in index f8a3d95e926..f5df0223407 100644 --- a/content/xul/content/src/Makefile.in +++ b/content/xul/content/src/Makefile.in @@ -73,6 +73,7 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../../../html/content/src \ -I$(srcdir)/../../../events/src \ -I$(srcdir)/../../../xbl/src \ + -I$(topsrcdir)/xpcom/ds \ $(NULL) DEFINES += -D_IMPL_NS_LAYOUT diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index d610e08a929..57e20072dc5 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -74,14 +74,13 @@ #include "nsIDOMFormListener.h" #include "nsIDOMContextMenuListener.h" #include "nsIDOMEventListener.h" -#include "nsIDOMEventTarget.h" #include "nsIDOMNodeList.h" #include "nsIDOMXULCommandDispatcher.h" #include "nsIDOMXULElement.h" #include "nsIDOMElementCSSInlineStyle.h" #include "nsIDOMXULSelectCntrlItemEl.h" #include "nsIDocument.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsEventStateManager.h" #include "nsFocusManager.h" #include "nsHTMLStyleSheet.h" @@ -133,8 +132,6 @@ #include "nsFrameLoader.h" #include "prlog.h" #include "rdf.h" -#include "nsIDOM3EventTarget.h" -#include "nsIDOMEventGroup.h" #include "nsIControllers.h" // The XUL doc interface @@ -517,7 +514,7 @@ nsXULElement::GetElementsByAttributeNS(const nsAString& aNamespaceURI, } nsresult -nsXULElement::GetEventListenerManagerForAttr(nsIEventListenerManager** aManager, +nsXULElement::GetEventListenerManagerForAttr(nsEventListenerManager** aManager, nsISupports** aTarget, PRBool* aDefer) { @@ -533,7 +530,7 @@ nsXULElement::GetEventListenerManagerForAttr(nsIEventListenerManager** aManager, if ((!root || root == this) && !mNodeInfo->Equals(nsGkAtoms::overlay) && (window = doc->GetInnerWindow()) && window->IsInnerWindow()) { - nsCOMPtr piTarget = do_QueryInterface(window); + nsCOMPtr piTarget = do_QueryInterface(window); if (!piTarget) return NS_ERROR_UNEXPECTED; @@ -2188,19 +2185,17 @@ PopupListenerPropertyDtor(void* aObject, nsIAtom* aPropertyName, if (!listener) { return; } - nsCOMPtr target = - do_QueryInterface(static_cast(aObject)); - if (target) { - nsCOMPtr systemGroup; - static_cast(aObject)-> - GetSystemEventGroup(getter_AddRefs(systemGroup)); - if (systemGroup) { - target->RemoveGroupedEventListener(NS_LITERAL_STRING("mousedown"), - listener, PR_FALSE, systemGroup); - - target->RemoveGroupedEventListener(NS_LITERAL_STRING("contextmenu"), - listener, PR_FALSE, systemGroup); - } + nsEventListenerManager* manager = static_cast(aObject)-> + GetListenerManager(PR_FALSE); + if (manager) { + manager->RemoveEventListenerByType(listener, + NS_LITERAL_STRING("mousedown"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); + manager->RemoveEventListenerByType(listener, + NS_LITERAL_STRING("contextmenu"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); } NS_RELEASE(listener); } @@ -2222,18 +2217,14 @@ nsXULElement::AddPopupListener(nsIAtom* aName) return NS_OK; } - nsCOMPtr systemGroup; - GetSystemEventGroup(getter_AddRefs(systemGroup)); - NS_ENSURE_STATE(systemGroup); - nsresult rv = NS_NewXULPopupListener(this, isContext, getter_AddRefs(popupListener)); if (NS_FAILED(rv)) return rv; // Add the popup as a listener on this element. - nsCOMPtr target(do_QueryInterface(static_cast(this))); - NS_ENSURE_TRUE(target, NS_ERROR_FAILURE); + nsEventListenerManager* manager = GetListenerManager(PR_TRUE); + NS_ENSURE_TRUE(manager, NS_ERROR_FAILURE); rv = SetProperty(listenerAtom, popupListener, PopupListenerPropertyDtor, PR_TRUE); NS_ENSURE_SUCCESS(rv, rv); @@ -2242,11 +2233,15 @@ nsXULElement::AddPopupListener(nsIAtom* aName) popupListener.swap(listener); if (isContext) { - target->AddGroupedEventListener(NS_LITERAL_STRING("contextmenu"), - listener, PR_FALSE, systemGroup); + manager->AddEventListenerByType(listener, + NS_LITERAL_STRING("contextmenu"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); } else { - target->AddGroupedEventListener(NS_LITERAL_STRING("mousedown"), - listener, PR_FALSE, systemGroup); + manager->AddEventListenerByType(listener, + NS_LITERAL_STRING("mousedown"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); } return NS_OK; } diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index c4cb18dfe1b..18b0136f69f 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -49,7 +49,7 @@ #ifndef nsXULElement_h__ #define nsXULElement_h__ -// XXX because nsIEventListenerManager has broken includes +// XXX because nsEventListenerManager has broken includes #include "nsIDOMEvent.h" #include "nsIServiceManager.h" #include "nsIAtom.h" @@ -57,10 +57,9 @@ #include "nsIControllers.h" #include "nsIDOMElement.h" #include "nsIDOMEventTarget.h" -#include "nsIDOM3EventTarget.h" #include "nsIDOMXULElement.h" #include "nsIDOMXULMultSelectCntrlEl.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsIRDFCompositeDataSource.h" #include "nsIRDFResource.h" #include "nsIScriptObjectOwner.h" @@ -659,7 +658,7 @@ protected: nsAttrValue& aResult); virtual nsresult - GetEventListenerManagerForAttr(nsIEventListenerManager** aManager, + GetEventListenerManagerForAttr(nsEventListenerManager** aManager, nsISupports** aTarget, PRBool* aDefer); diff --git a/content/xul/document/src/Makefile.in b/content/xul/document/src/Makefile.in index ccfb4117f2f..81fc321b468 100644 --- a/content/xul/document/src/Makefile.in +++ b/content/xul/document/src/Makefile.in @@ -75,6 +75,7 @@ LOCAL_INCLUDES = -I$(srcdir)/../../../base/src \ -I$(srcdir)/../../../xml/document/src \ -I$(srcdir)/../../../xbl/src \ -I$(srcdir)/../../../events/src \ + -I$(topsrcdir)/xpcom/ds \ $(NULL) DEFINES += -D_IMPL_NS_LAYOUT diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index 63ef81bb0b5..ee187c44d43 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -1717,8 +1717,7 @@ nsXULDocument::AddElementToDocumentPost(Element* aElement) // Create our XUL key listener and hook it up. nsCOMPtr xblService(do_GetService("@mozilla.org/xbl;1")); if (xblService) { - nsCOMPtr piTarget(do_QueryInterface(aElement)); - xblService->AttachGlobalKeyHandler(piTarget); + xblService->AttachGlobalKeyHandler(aElement); } } @@ -1793,8 +1792,7 @@ nsXULDocument::RemoveSubtreeFromDocument(nsIContent* aContent) if (aElement->NodeInfo()->Equals(nsGkAtoms::keyset, kNameSpaceID_XUL)) { nsCOMPtr xblService(do_GetService("@mozilla.org/xbl;1")); if (xblService) { - nsCOMPtr piTarget(do_QueryInterface(aElement)); - xblService->DetachGlobalKeyHandler(piTarget); + xblService->DetachGlobalKeyHandler(aElement); } } diff --git a/content/xul/document/src/nsXULPrototypeCache.cpp b/content/xul/document/src/nsXULPrototypeCache.cpp index 3302ffa545e..94e78ebaed3 100644 --- a/content/xul/document/src/nsXULPrototypeCache.cpp +++ b/content/xul/document/src/nsXULPrototypeCache.cpp @@ -443,7 +443,6 @@ nsXULPrototypeCache::WritePrototype(nsXULPrototypeDocument* aPrototypeDocument) // has completed. RemoveFromCacheSet(protoURI); - PRInt32 count = mCacheURITable.Count(); nsCOMPtr oos; rv = GetOutputStream(protoURI, getter_AddRefs(oos)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/docshell/base/Makefile.in b/docshell/base/Makefile.in index b83f3f220cc..7d3e14277d6 100644 --- a/docshell/base/Makefile.in +++ b/docshell/base/Makefile.in @@ -118,6 +118,8 @@ include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES += \ -I$(srcdir)/../shistory/src \ + -I$(topsrcdir)/dom/base \ -I$(topsrcdir)/layout/base \ -I$(topsrcdir)/js/src/xpconnect/src \ + -I$(topsrcdir)/xpcom/ds \ $(NULL) diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp index a4d762808e1..c910b0a9d70 100644 --- a/docshell/base/nsAboutRedirector.cpp +++ b/docshell/base/nsAboutRedirector.cpp @@ -82,8 +82,6 @@ static RedirEntry kRedirMap[] = { nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT }, { "license", "chrome://global/content/license.html", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT }, - { "licence", "chrome://global/content/license.html", - nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT }, { "neterror", "chrome://global/content/netError.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::ALLOW_SCRIPT | diff --git a/docshell/base/nsDefaultURIFixup.cpp b/docshell/base/nsDefaultURIFixup.cpp index e46cc81f911..0b43f8028f4 100644 --- a/docshell/base/nsDefaultURIFixup.cpp +++ b/docshell/base/nsDefaultURIFixup.cpp @@ -44,8 +44,6 @@ #include "nsEscape.h" #include "nsCRT.h" -#include "nsIPrefService.h" -#include "nsIPrefLocalizedString.h" #include "nsIPlatformCharset.h" #include "nsILocalFile.h" @@ -55,6 +53,9 @@ #include "nsIURIFixup.h" #include "nsDefaultURIFixup.h" +#include "mozilla/Preferences.h" + +using namespace mozilla; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsDefaultURIFixup, nsIURIFixup) @@ -62,9 +63,6 @@ NS_IMPL_ISUPPORTS1(nsDefaultURIFixup, nsIURIFixup) nsDefaultURIFixup::nsDefaultURIFixup() { /* member initializers and constructor code */ - - // Try and get the pref service - mPrefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID); } @@ -134,13 +132,10 @@ nsDefaultURIFixup::CreateExposableURI(nsIURI *aURI, nsIURI **aReturn) } // hide user:pass unless overridden by pref - PRBool hideUserPass = PR_TRUE; - if (mPrefBranch) + if (Preferences::GetBool("browser.fixup.hide_user_pass", PR_TRUE)) { - mPrefBranch->GetBoolPref("browser.fixup.hide_user_pass", &hideUserPass); - } - if (hideUserPass) uri->SetUserPass(EmptyCString()); + } // return the fixed-up URI *aReturn = uri; @@ -274,10 +269,8 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, PRUint32 aFixupF // Test whether keywords need to be fixed up PRBool fixupKeywords = PR_FALSE; if (aFixupFlags & FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP) { - if (mPrefBranch) - { - NS_ENSURE_SUCCESS(mPrefBranch->GetBoolPref("keyword.enabled", &fixupKeywords), NS_ERROR_FAILURE); - } + nsresult rv = Preferences::GetBool("keyword.enabled", &fixupKeywords); + NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); if (fixupKeywords) { KeywordURIFixup(uriString, aURI); @@ -358,7 +351,7 @@ NS_IMETHODIMP nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword, nsIURI **aURI) { *aURI = nsnull; - NS_ENSURE_STATE(mPrefBranch); + NS_ENSURE_STATE(Preferences::GetRootBranch()); // Strip leading "?" and leading/trailing spaces from aKeyword nsCAutoString keyword(aKeyword); @@ -367,19 +360,10 @@ NS_IMETHODIMP nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword, } keyword.Trim(" "); - nsXPIDLCString url; - nsCOMPtr keywordURL; - mPrefBranch->GetComplexValue("keyword.URL", - NS_GET_IID(nsIPrefLocalizedString), - getter_AddRefs(keywordURL)); - - if (keywordURL) { - nsXPIDLString wurl; - keywordURL->GetData(getter_Copies(wurl)); - CopyUTF16toUTF8(wurl, url); - } else { + nsAdoptingCString url = Preferences::GetLocalizedCString("keyword.URL"); + if (!url) { // Fall back to a non-localized pref, for backwards compat - mPrefBranch->GetCharPref("keyword.URL", getter_Copies(url)); + url = Preferences::GetCString("keyword.URL"); } // If the pref is set and non-empty, use it. @@ -441,13 +425,11 @@ NS_IMETHODIMP nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword, PRBool nsDefaultURIFixup::MakeAlternateURI(nsIURI *aURI) { - if (!mPrefBranch) + if (!Preferences::GetRootBranch()) { return PR_FALSE; } - PRBool makeAlternate = PR_TRUE; - mPrefBranch->GetBoolPref("browser.fixup.alternate.enabled", &makeAlternate); - if (!makeAlternate) + if (!Preferences::GetBool("browser.fixup.alternate.enabled", PR_TRUE)) { return PR_FALSE; } @@ -489,17 +471,17 @@ PRBool nsDefaultURIFixup::MakeAlternateURI(nsIURI *aURI) // are www. & .com but they could be any other value, e.g. www. & .org nsCAutoString prefix("www."); - nsXPIDLCString prefPrefix; - rv = mPrefBranch->GetCharPref("browser.fixup.alternate.prefix", getter_Copies(prefPrefix)); - if (NS_SUCCEEDED(rv)) + nsAdoptingCString prefPrefix = + Preferences::GetCString("browser.fixup.alternate.prefix"); + if (prefPrefix) { prefix.Assign(prefPrefix); } nsCAutoString suffix(".com"); - nsXPIDLCString prefSuffix; - rv = mPrefBranch->GetCharPref("browser.fixup.alternate.suffix", getter_Copies(prefSuffix)); - if (NS_SUCCEEDED(rv)) + nsAdoptingCString prefSuffix = + Preferences::GetCString("browser.fixup.alternate.suffix"); + if (prefSuffix) { suffix.Assign(prefSuffix); } diff --git a/docshell/base/nsDefaultURIFixup.h b/docshell/base/nsDefaultURIFixup.h index bc8a5487ef9..388cee5e25c 100644 --- a/docshell/base/nsDefaultURIFixup.h +++ b/docshell/base/nsDefaultURIFixup.h @@ -40,7 +40,6 @@ #ifndef NSDEFAULTURIFIXUP_H #define NSDEFAULTURIFIXUP_H -#include "nsIPrefBranch.h" #include "nsIURIFixup.h" #include "nsCOMPtr.h" @@ -71,7 +70,6 @@ private: const char * GetFileSystemCharset(); const char * GetCharsetForUrlBar(); - nsCOMPtr mPrefBranch; nsCString mFsCharset; }; diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 62a3996e6cb..eac68c47ab0 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -70,7 +70,6 @@ #include "nsIMarkupDocumentViewer.h" #include "nsXPIDLString.h" #include "nsReadableUtils.h" -#include "nsIDOMEventTarget.h" #include "nsIDOMChromeWindow.h" #include "nsIDOMWindowInternal.h" #include "nsIWebBrowserChrome.h" @@ -96,9 +95,6 @@ #include "nsXPCOMCID.h" #include "nsISeekableStream.h" #include "nsAutoPtr.h" -#include "nsIPrefService.h" -#include "nsIPrefBranch.h" -#include "nsIPrefBranch2.h" #include "nsIWritablePropertyBag2.h" #include "nsIAppShell.h" #include "nsWidgetsCID.h" @@ -112,6 +108,7 @@ #include "nsJSON.h" #include "IHistory.h" #include "mozilla/Services.h" +#include "mozilla/Preferences.h" // we want to explore making the document own the load group // so we can associate the document URI with the load group. @@ -234,6 +231,8 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); #include "nsXULAppAPI.h" +#include "nsDOMNavigationTiming.h" + using namespace mozilla; // Number of documents currently loading @@ -306,21 +305,14 @@ FavorPerformanceHint(PRBool perfOverStarvation, PRUint32 starvationDelay) static PRBool PingsEnabled(PRInt32 *maxPerLink, PRBool *requireSameHost) { - PRBool allow = PR_FALSE; + PRBool allow = Preferences::GetBool(PREF_PINGS_ENABLED, PR_FALSE); *maxPerLink = 1; *requireSameHost = PR_TRUE; - nsCOMPtr prefs = - do_GetService(NS_PREFSERVICE_CONTRACTID); - if (prefs) { - PRBool val; - if (NS_SUCCEEDED(prefs->GetBoolPref(PREF_PINGS_ENABLED, &val))) - allow = val; - if (allow) { - prefs->GetIntPref(PREF_PINGS_MAX_PER_LINK, maxPerLink); - prefs->GetBoolPref(PREF_PINGS_REQUIRE_SAME_HOST, requireSameHost); - } + if (allow) { + Preferences::GetInt(PREF_PINGS_MAX_PER_LINK, maxPerLink); + Preferences::GetBool(PREF_PINGS_REQUIRE_SAME_HOST, requireSameHost); } return allow; @@ -673,6 +665,47 @@ DispatchPings(nsIContent *content, nsIURI *referrer) ForEachPing(content, SendPing, &info); } +static nsDOMPerformanceNavigationType +ConvertLoadTypeToNavigationType(PRUint32 aLoadType) +{ + nsDOMPerformanceNavigationType result = nsIDOMPerformanceNavigation::TYPE_RESERVED; + switch (aLoadType) { + case LOAD_NORMAL: + case LOAD_NORMAL_EXTERNAL: + case LOAD_NORMAL_BYPASS_CACHE: + case LOAD_NORMAL_BYPASS_PROXY: + case LOAD_NORMAL_BYPASS_PROXY_AND_CACHE: + case LOAD_LINK: + result = nsIDOMPerformanceNavigation::TYPE_NAVIGATE; + break; + case LOAD_HISTORY: + result = nsIDOMPerformanceNavigation::TYPE_BACK_FORWARD; + break; + case LOAD_RELOAD_NORMAL: + case LOAD_RELOAD_CHARSET_CHANGE: + case LOAD_RELOAD_BYPASS_CACHE: + case LOAD_RELOAD_BYPASS_PROXY: + case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE: + result = nsIDOMPerformanceNavigation::TYPE_RELOAD; + break; + case LOAD_NORMAL_REPLACE: + case LOAD_STOP_CONTENT: + case LOAD_STOP_CONTENT_AND_REPLACE: + case LOAD_REFRESH: + case LOAD_BYPASS_HISTORY: + case LOAD_ERROR_PAGE: + case LOAD_PUSHSTATE: + result = nsIDOMPerformanceNavigation::TYPE_RESERVED; + break; + default: + // NS_NOTREACHED("Unexpected load type value"); + result = nsIDOMPerformanceNavigation::TYPE_RESERVED; + break; + } + + return result; +} + static nsISHEntry* GetRootSHEntry(nsISHEntry *entry); //***************************************************************************** @@ -695,13 +728,16 @@ nsDocShell::nsDocShell(): mMarginHeight(-1), mItemType(typeContent), mPreviousTransIndex(-1), + mLoadType(0), mLoadedTransIndex(-1), + mCreated(PR_FALSE), mAllowSubframes(PR_TRUE), mAllowPlugins(PR_TRUE), mAllowJavascript(PR_TRUE), mAllowMetaRedirects(PR_TRUE), mAllowImages(PR_TRUE), mAllowDNSPrefetch(PR_TRUE), + mAllowWindowControl(PR_TRUE), mCreatingDocument(PR_FALSE), mUseErrorPages(PR_FALSE), mObserveErrorPages(PR_TRUE), @@ -1519,8 +1555,16 @@ nsDocShell::FirePageHideNotification(PRBool aIsUnload) nsCOMPtr kungFuDeathGrip(mContentViewer); mFiredUnloadEvent = PR_TRUE; + if (mTiming) { + mTiming->NotifyUnloadEventStart(); + } + mContentViewer->PageHide(aIsUnload); + if (mTiming) { + mTiming->NotifyUnloadEventEnd(); + } + nsAutoTArray, 8> kids; PRInt32 i, n = mChildList.Count(); kids.SetCapacity(n); @@ -1542,6 +1586,21 @@ nsDocShell::FirePageHideNotification(PRBool aIsUnload) return NS_OK; } +nsresult +nsDocShell::MaybeInitTiming() +{ + if (mTiming) { + return NS_OK; + } + + if (Preferences::GetBool("dom.enable_performance", PR_FALSE)) { + mTiming = new nsDOMNavigationTiming(); + mTiming->NotifyNavigationStart(); + } + return NS_OK; +} + + // // Bug 13871: Prevent frameset spoofing // @@ -1704,14 +1763,12 @@ nsDocShell::GetContentViewer(nsIContentViewer ** aContentViewer) NS_IMETHODIMP nsDocShell::SetChromeEventHandler(nsIDOMEventTarget* aChromeEventHandler) { - nsCOMPtr piTarget = - do_QueryInterface(aChromeEventHandler); // Weak reference. Don't addref. - mChromeEventHandler = piTarget; + mChromeEventHandler = aChromeEventHandler; nsCOMPtr win(do_QueryInterface(mScriptGlobal)); if (win) { - win->SetChromeEventHandler(piTarget); + win->SetChromeEventHandler(aChromeEventHandler); } return NS_OK; @@ -1980,6 +2037,18 @@ NS_IMETHODIMP nsDocShell::SetAllowDNSPrefetch(PRBool aAllowDNSPrefetch) return NS_OK; } +NS_IMETHODIMP nsDocShell::GetAllowWindowControl(PRBool * aAllowWindowControl) +{ + *aAllowWindowControl = mAllowWindowControl; + return NS_OK; +} + +NS_IMETHODIMP nsDocShell::SetAllowWindowControl(PRBool aAllowWindowControl) +{ + mAllowWindowControl = aAllowWindowControl; + return NS_OK; +} + NS_IMETHODIMP nsDocShell::GetDocShellEnumerator(PRInt32 aItemType, PRInt32 aDirection, nsISimpleEnumerator **outEnum) { @@ -2135,11 +2204,8 @@ nsDocShell::SetUseErrorPages(PRBool aUseErrorPages) { // If mUseErrorPages is set explicitly, stop observing the pref. if (mObserveErrorPages) { - nsCOMPtr prefs(do_QueryInterface(mPrefs)); - if (prefs) { - prefs->RemoveObserver("browser.xul.error_pages.enabled", this); - mObserveErrorPages = PR_FALSE; - } + Preferences::RemoveObserver(this, "browser.xul.error_pages.enabled"); + mObserveErrorPages = PR_FALSE; } mUseErrorPages = aUseErrorPages; return NS_OK; @@ -2559,6 +2625,10 @@ nsDocShell::SetDocLoaderParent(nsDocLoader * aParent) { SetAllowImages(value); } + if (NS_SUCCEEDED(parentAsDocShell->GetAllowWindowControl(&value))) + { + SetAllowWindowControl(value); + } if (NS_SUCCEEDED(parentAsDocShell->GetIsActive(&value))) { SetIsActive(value); @@ -3853,17 +3923,15 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI, if (isStsHost) cssClass.AssignLiteral("badStsCert"); - PRBool expert = PR_FALSE; - mPrefs->GetBoolPref("browser.xul.error_pages.expert_bad_cert", - &expert); - if (expert) { + if (Preferences::GetBool( + "browser.xul.error_pages.expert_bad_cert", PR_FALSE)) { cssClass.AssignLiteral("expertBadCert"); } // See if an alternate cert error page is registered - nsXPIDLCString alternateErrorPage; - mPrefs->GetCharPref("security.alternate_certificate_error_page", - getter_Copies(alternateErrorPage)); + nsAdoptingCString alternateErrorPage = + Preferences::GetCString( + "security.alternate_certificate_error_page"); if (alternateErrorPage) errorPage.Assign(alternateErrorPage); } else { @@ -3878,9 +3946,8 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI, // Malware and phishing detectors may want to use an alternate error // page, but if the pref's not set, we'll fall back on the standard page - nsXPIDLCString alternateErrorPage; - mPrefs->GetCharPref("urlclassifier.alternate_error_page", - getter_Copies(alternateErrorPage)); + nsAdoptingCString alternateErrorPage = + Preferences::GetCString("urlclassifier.alternate_error_page"); if (alternateErrorPage) errorPage.Assign(alternateErrorPage); @@ -4426,7 +4493,7 @@ nsDocShell::InitWindow(nativeWindow parentNativeWindow, NS_IMETHODIMP nsDocShell::Create() { - if (mPrefs) { + if (mCreated) { // We've already been created return NS_OK; } @@ -4434,34 +4501,24 @@ nsDocShell::Create() NS_ASSERTION(mItemType == typeContent || mItemType == typeChrome, "Unexpected item type in docshell"); - nsresult rv = NS_ERROR_FAILURE; - mPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); + NS_ENSURE_TRUE(Preferences::GetRootBranch(), NS_ERROR_FAILURE); + mCreated = PR_TRUE; - PRBool tmpbool; - - rv = mPrefs->GetBoolPref("browser.frames.enabled", &tmpbool); - if (NS_SUCCEEDED(rv)) - mAllowSubframes = tmpbool; + mAllowSubframes = + Preferences::GetBool("browser.frames.enabled", mAllowSubframes); if (gValidateOrigin == (PRBool)0xffffffff) { // Check pref to see if we should prevent frameset spoofing - rv = mPrefs->GetBoolPref("browser.frame.validate_origin", &tmpbool); - if (NS_SUCCEEDED(rv)) { - gValidateOrigin = tmpbool; - } else { - gValidateOrigin = PR_TRUE; - } + gValidateOrigin = + Preferences::GetBool("browser.frame.validate_origin", PR_TRUE); } // Should we use XUL error pages instead of alerts if possible? - rv = mPrefs->GetBoolPref("browser.xul.error_pages.enabled", &tmpbool); - if (NS_SUCCEEDED(rv)) - mUseErrorPages = tmpbool; + mUseErrorPages = + Preferences::GetBool("browser.xul.error_pages.enabled", mUseErrorPages); - nsCOMPtr prefs(do_QueryInterface(mPrefs, &rv)); - if (NS_SUCCEEDED(rv) && mObserveErrorPages) { - prefs->AddObserver("browser.xul.error_pages.enabled", this, PR_FALSE); + if (mObserveErrorPages) { + Preferences::AddStrongObserver(this, "browser.xul.error_pages.enabled"); } nsCOMPtr serv = do_GetService(NS_OBSERVERSERVICE_CONTRACTID); @@ -4494,11 +4551,8 @@ nsDocShell::Destroy() // Remove our pref observers if (mObserveErrorPages) { - nsCOMPtr prefs(do_QueryInterface(mPrefs)); - if (prefs) { - prefs->RemoveObserver("browser.xul.error_pages.enabled", this); - mObserveErrorPages = PR_FALSE; - } + Preferences::RemoveObserver(this, "browser.xul.error_pages.enabled"); + mObserveErrorPages = PR_FALSE; } // Make sure to blow away our mLoadingURI just in case. No loads @@ -5829,15 +5883,30 @@ nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest, nsresult rv; if ((~aStateFlags & (STATE_START | STATE_IS_NETWORK)) == 0) { + // Save timing statistics. + nsCOMPtr channel(do_QueryInterface(aRequest)); + nsCOMPtr uri; + channel->GetURI(getter_AddRefs(uri)); + nsCAutoString aURI; + uri->GetAsciiSpec(aURI); + // If load type is not set, this is not a 'normal' load. + // No need to collect timing. + if (mLoadType == 0) { + mTiming = nsnull; + } + else { + rv = MaybeInitTiming(); + } + if (mTiming) { + mTiming->NotifyFetchStart(uri, ConvertLoadTypeToNavigationType(mLoadType)); + } + nsCOMPtr wcwgChannel(do_QueryInterface(aRequest)); nsCOMPtr webProgress = do_QueryInterface(GetAsSupports(this)); // Was the wyciwyg document loaded on this docshell? if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) { - nsCOMPtr uri; - wcwgChannel->GetURI(getter_AddRefs(uri)); - PRBool equalUri = PR_TRUE; // Store the wyciwyg url in session history, only if it is // being loaded fresh for the first time. We don't want @@ -5890,9 +5959,7 @@ nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest, if ((aStateFlags & STATE_RESTORING) == 0) { // Show the progress cursor if the pref is set - PRBool tmpBool = PR_FALSE; - if (NS_SUCCEEDED(mPrefs->GetBoolPref("ui.use_activity_cursor", &tmpBool)) - && tmpBool) { + if (Preferences::GetBool("ui.use_activity_cursor", PR_FALSE)) { nsCOMPtr mainWidget; GetMainWidget(getter_AddRefs(mainWidget)); if (mainWidget) { @@ -5910,9 +5977,7 @@ nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest, mBusyFlags = BUSY_FLAGS_NONE; // Hide the progress cursor if the pref is set - PRBool tmpBool = PR_FALSE; - if (NS_SUCCEEDED(mPrefs->GetBoolPref("ui.use_activity_cursor", &tmpBool)) - && tmpBool) { + if (Preferences::GetBool("ui.use_activity_cursor", PR_FALSE)) { nsCOMPtr mainWidget; GetMainWidget(getter_AddRefs(mainWidget)); if (mainWidget) { @@ -5960,6 +6025,13 @@ nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel, if (!oldURI || !newURI) { return; } + // On session restore we get a redirect from page to itself. Don't count it. + PRBool equals = PR_FALSE; + if (mTiming && + !(mLoadType == LOAD_HISTORY && + NS_SUCCEEDED(newURI->Equals(oldURI, &equals)) && equals)) { + mTiming->NotifyRedirect(oldURI, newURI); + } // Below a URI visit is saved (see AddURIVisit method doc). // The visit chain looks something like: @@ -6043,7 +6115,10 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress, nsCOMPtr url; nsresult rv = aChannel->GetURI(getter_AddRefs(url)); if (NS_FAILED(rv)) return rv; - + + // Timing is picked up by the window, we don't need it anymore + mTiming = nsnull; + // clean up reload state for meta charset if (eCharsetReloadRequested == mCharsetReloadState) mCharsetReloadState = eCharsetReloadStopOrigional; @@ -6149,12 +6224,8 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress, // First try keyword fixup // if (aStatus == NS_ERROR_UNKNOWN_HOST && mAllowKeywordFixup) { - PRBool keywordsEnabled = PR_FALSE; - - if (mPrefs && - NS_FAILED(mPrefs->GetBoolPref("keyword.enabled", - &keywordsEnabled))) - keywordsEnabled = PR_FALSE; + PRBool keywordsEnabled = + Preferences::GetBool("keyword.enabled", PR_FALSE); nsCAutoString host; url->GetHost(host); @@ -6474,6 +6545,13 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal, // with about:blank. And also ensure we fire the unload events // in the current document. + // Make sure timing is created. Unload gets fired first for + // document loaded from the session history. + rv = MaybeInitTiming(); + if (mTiming) { + mTiming->NotifyBeforeUnload(); + } + PRBool okToUnload; rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload); @@ -6485,6 +6563,10 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal, mSavingOldViewer = aTryToSaveOldPresentation && CanSavePresentation(LOAD_NORMAL, nsnull, nsnull); + if (mTiming) { + mTiming->NotifyUnloadAccepted(mCurrentURI); + } + // Make sure to blow away our mLoadingURI just in case. No loads // from inside this pagehide. mLoadingURI = nsnull; @@ -6598,9 +6680,9 @@ nsDocShell::CanSavePresentation(PRUint32 aLoadType, // Don't cache the content viewer if we're in a subframe and the subframe // pref is disabled. - PRBool cacheFrames = PR_FALSE; - mPrefs->GetBoolPref("browser.sessionhistory.cache_subframes", - &cacheFrames); + PRBool cacheFrames = + Preferences::GetBool("browser.sessionhistory.cache_subframes", + PR_FALSE); if (!cacheFrames) { nsCOMPtr root; GetSameTypeParent(getter_AddRefs(root)); @@ -7704,6 +7786,12 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer) nsIntRect bounds(x, y, cx, cy); + nsCOMPtr docviewer = + do_QueryInterface(mContentViewer); + if (docviewer) { + docviewer->SetNavigationTiming(mTiming); + } + if (NS_FAILED(mContentViewer->Init(widget, bounds))) { mContentViewer = nsnull; NS_ERROR("ContentViewer Initialization failed"); @@ -7736,9 +7824,6 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer) // Stuff the bgcolor from the old pres shell into the new // pres shell. This improves page load continuity. - nsCOMPtr docviewer = - do_QueryInterface(mContentViewer); - if (docviewer) { nsCOMPtr shell; docviewer->GetPresShell(getter_AddRefs(shell)); @@ -8519,6 +8604,10 @@ nsDocShell::InternalLoad(nsIURI * aURI, // (bug#331040) nsCOMPtr kungFuDeathGrip(this); + rv = MaybeInitTiming(); + if (mTiming) { + mTiming->NotifyBeforeUnload(); + } // Check if the page doesn't want to be unloaded. The javascript: // protocol handler deals with this for javascript: URLs. if (!bIsJavascript && mContentViewer) { @@ -8532,6 +8621,10 @@ nsDocShell::InternalLoad(nsIURI * aURI, } } + if (mTiming) { + mTiming->NotifyUnloadAccepted(mCurrentURI); + } + // Check for saving the presentation here, before calling Stop(). // This is necessary so that we can catch any pending requests. // Since the new request has not been created yet, we pass null for the @@ -9099,22 +9192,16 @@ nsresult nsDocShell::DoChannelLoad(nsIChannel * aChannel, case LOAD_NORMAL: case LOAD_LINK: // Set cache checking flags - PRInt32 prefSetting; - if (NS_SUCCEEDED - (mPrefs-> - GetIntPref("browser.cache.check_doc_frequency", - &prefSetting))) { - switch (prefSetting) { - case 0: - loadFlags |= nsIRequest::VALIDATE_ONCE_PER_SESSION; - break; - case 1: - loadFlags |= nsIRequest::VALIDATE_ALWAYS; - break; - case 2: - loadFlags |= nsIRequest::VALIDATE_NEVER; - break; - } + switch (Preferences::GetInt("browser.cache.check_doc_frequency", -1)) { + case 0: + loadFlags |= nsIRequest::VALIDATE_ONCE_PER_SESSION; + break; + case 1: + loadFlags |= nsIRequest::VALIDATE_ALWAYS; + break; + case 2: + loadFlags |= nsIRequest::VALIDATE_NEVER; + break; } break; } @@ -9587,11 +9674,8 @@ nsDocShell::AddState(nsIVariant *aData, const nsAString& aTitle, // Check that the state object isn't too long. // Default max length: 640k bytes. - PRInt32 maxStateObjSize = 0xA0000; - if (mPrefs) { - mPrefs->GetIntPref("browser.history.maxStateObjectSize", - &maxStateObjSize); - } + PRInt32 maxStateObjSize = + Preferences::GetInt("browser.history.maxStateObjectSize", 0xA0000); if (maxStateObjSize < 0) { maxStateObjSize = 0; } @@ -11093,11 +11177,8 @@ nsDocShell::Observe(nsISupports *aSubject, const char *aTopic, !nsCRT::strcmp(aData, NS_LITERAL_STRING("browser.xul.error_pages.enabled").get())) { - nsCOMPtr prefs(do_QueryInterface(aSubject, &rv)); - NS_ENSURE_SUCCESS(rv, rv); - PRBool tmpbool; - rv = prefs->GetBoolPref("browser.xul.error_pages.enabled", &tmpbool); + rv = Preferences::GetBool("browser.xul.error_pages.enabled", &tmpbool); if (NS_SUCCEEDED(rv)) mUseErrorPages = tmpbool; @@ -11520,6 +11601,17 @@ nsDocShell::OnLinkClickSync(nsIContent *aContent, nsCOMPtr refererDoc = aContent->GetOwnerDoc(); NS_ENSURE_TRUE(refererDoc, NS_ERROR_UNEXPECTED); + // Now check that the refererDoc's inner window is the current inner + // window for mScriptGlobal. If it's not, then we don't want to + // follow this link. + nsPIDOMWindow* refererInner = refererDoc->GetInnerWindow(); + NS_ENSURE_TRUE(refererInner, NS_ERROR_UNEXPECTED); + nsCOMPtr outerWindow = do_QueryInterface(mScriptGlobal); + if (!outerWindow || outerWindow->GetCurrentInnerWindow() != refererInner) { + // We're no longer the current inner window + return NS_OK; + } + nsCOMPtr referer = refererDoc->GetDocumentURI(); // referer could be null here in some odd cases, but that's ok, diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 09555a93699..da111ae9da4 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -44,7 +44,6 @@ #include "nsIDOMNode.h" #include "nsIDOMNodeList.h" #include "nsIContentViewer.h" -#include "nsIPrefBranch.h" #include "nsInterfaceHashtable.h" #include "nsIScriptContext.h" #include "nsITimer.h" @@ -106,7 +105,7 @@ #include "nsISecureBrowserUI.h" #include "nsIObserver.h" #include "nsDocShellLoadTypes.h" -#include "nsPIDOMEventTarget.h" +#include "nsIDOMEventTarget.h" #include "nsILoadContext.h" #include "nsIWidget.h" #include "nsIWebShellServices.h" @@ -119,6 +118,7 @@ class nsDocShell; class nsIController; class OnLinkClickEvent; class nsIScrollableFrame; +class nsDOMNavigationTiming; /* load commands were moved to nsIDocShell.h */ /* load types were moved to nsDocShellLoadTypes.h */ @@ -684,6 +684,8 @@ protected: void ClearFrameHistory(nsISHEntry* aEntry); + nsresult MaybeInitTiming(); + // Event type dispatched by RestorePresentation class RestorePresentationEvent : public nsRunnable { public: @@ -715,7 +717,6 @@ protected: nsCOMPtr mContentViewer; nsCOMPtr mDocumentCharsetInfo; nsCOMPtr mParentWidget; - nsCOMPtr mPrefs; // mCurrentURI should be marked immutable on set if possible. nsCOMPtr mCurrentURI; @@ -765,7 +766,7 @@ protected: // For that reasons don't use nsCOMPtr. nsIDocShellTreeOwner * mTreeOwner; // Weak Reference - nsPIDOMEventTarget * mChromeEventHandler; //Weak Reference + nsIDOMEventTarget * mChromeEventHandler; //Weak Reference eCharsetReloadState mCharsetReloadState; @@ -788,12 +789,14 @@ protected: PRInt32 mPreviousTransIndex; PRInt32 mLoadedTransIndex; + PRPackedBool mCreated; PRPackedBool mAllowSubframes; PRPackedBool mAllowPlugins; PRPackedBool mAllowJavascript; PRPackedBool mAllowMetaRedirects; PRPackedBool mAllowImages; PRPackedBool mAllowDNSPrefetch; + PRPackedBool mAllowWindowControl; PRPackedBool mCreatingDocument; // (should be) debugging only PRPackedBool mUseErrorPages; PRPackedBool mObserveErrorPages; @@ -837,6 +840,8 @@ protected: static nsIURIFixup *sURIFixup; + nsRefPtr mTiming; + #ifdef DEBUG private: // We're counting the number of |nsDocShells| to help find leaks diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index 959f4afa6b3..f5e944be6aa 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -72,7 +72,7 @@ interface nsIPrincipal; interface nsIWebBrowserPrint; interface nsIVariant; -[scriptable, uuid(f77271a1-0b22-4581-af6d-529125f1901d)] +[scriptable, uuid(0666adf8-8738-4ca7-a917-0348f47d2f40)] interface nsIDocShell : nsISupports { /** @@ -274,6 +274,11 @@ interface nsIDocShell : nsISupports */ attribute boolean allowDNSPrefetch; + /** + * Attribute that determines whether window control (move/resize) is allowed. + */ + attribute boolean allowWindowControl; + /** * Get an enumerator over this docShell and its children. * diff --git a/docshell/build/nsDocShellModule.cpp b/docshell/build/nsDocShellModule.cpp index 9df5c0cee7a..c9b190f0173 100644 --- a/docshell/build/nsDocShellModule.cpp +++ b/docshell/build/nsDocShellModule.cpp @@ -94,6 +94,7 @@ Initialize() static void Shutdown() { + nsSHistory::Shutdown(); nsSHEntry::Shutdown(); gInitialized = PR_FALSE; } diff --git a/docshell/shistory/src/nsSHEntry.cpp b/docshell/shistory/src/nsSHEntry.cpp index 61b6d593091..6989571bc97 100644 --- a/docshell/shistory/src/nsSHEntry.cpp +++ b/docshell/shistory/src/nsSHEntry.cpp @@ -656,7 +656,7 @@ nsSHEntry::AddChild(nsISHEntry * aChild, PRInt32 aOffset) // If there are dynamically added children before that, those must be // moved to be after aOffset. if (mChildren.Count() > 0) { - PRInt32 start = PR_MIN(mChildren.Count() - 1, aOffset); + PRInt32 start = NS_MIN(mChildren.Count() - 1, aOffset); PRInt32 dynEntryIndex = -1; nsISHEntry* dynEntry = nsnull; for (PRInt32 i = start; i >= 0; --i) { diff --git a/docshell/shistory/src/nsSHistory.cpp b/docshell/shistory/src/nsSHistory.cpp index 16bcb5db1ff..b391407daa4 100644 --- a/docshell/shistory/src/nsSHistory.cpp +++ b/docshell/shistory/src/nsSHistory.cpp @@ -43,6 +43,7 @@ // Helper Classes #include "nsXPIDLString.h" #include "nsReadableUtils.h" +#include "mozilla/Preferences.h" // Interfaces Needed #include "nsILayoutHistoryState.h" @@ -53,7 +54,6 @@ #include "nsIDocShellTreeNode.h" #include "nsIDocShellLoadInfo.h" #include "nsIServiceManager.h" -#include "nsIPrefService.h" #include "nsIURI.h" #include "nsIContentViewer.h" #include "nsICacheService.h" @@ -68,10 +68,19 @@ #include "nspr.h" #include // for log() +using namespace mozilla; + #define PREF_SHISTORY_SIZE "browser.sessionhistory.max_entries" #define PREF_SHISTORY_MAX_TOTAL_VIEWERS "browser.sessionhistory.max_total_viewers" #define PREF_SHISTORY_OPTIMIZE_EVICTION "browser.sessionhistory.optimize_eviction" +static const char* kObservedPrefs[] = { + PREF_SHISTORY_SIZE, + PREF_SHISTORY_MAX_TOTAL_VIEWERS, + PREF_SHISTORY_OPTIMIZE_EVICTION, + nsnull +}; + static PRInt32 gHistoryMaxSize = 50; // Max viewers allowed per SHistory objects static const PRInt32 gHistoryMaxViewers = 3; @@ -115,6 +124,8 @@ protected: ~nsSHistoryObserver() {} }; +static nsSHistoryObserver* gObserver = nsnull; + NS_IMPL_ISUPPORTS1(nsSHistoryObserver, nsIObserver) NS_IMETHODIMP @@ -122,11 +133,8 @@ nsSHistoryObserver::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) { if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { - nsCOMPtr prefs = do_QueryInterface(aSubject); - if (prefs) { - nsSHistory::UpdatePrefs(prefs); - nsSHistory::EvictGlobalContentViewer(); - } + nsSHistory::UpdatePrefs(); + nsSHistory::EvictGlobalContentViewer(); } else if (!strcmp(aTopic, NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID) || !strcmp(aTopic, "memory-pressure")) { nsSHistory::EvictAllContentViewersGlobally(); @@ -227,13 +235,12 @@ nsSHistory::CalcMaxTotalViewers() // static void -nsSHistory::UpdatePrefs(nsIPrefBranch *aPrefBranch) +nsSHistory::UpdatePrefs() { - aPrefBranch->GetIntPref(PREF_SHISTORY_SIZE, &gHistoryMaxSize); - aPrefBranch->GetIntPref(PREF_SHISTORY_MAX_TOTAL_VIEWERS, - &sHistoryMaxTotalViewers); - aPrefBranch->GetBoolPref(PREF_SHISTORY_OPTIMIZE_EVICTION, - &gOptimizeEviction); + Preferences::GetInt(PREF_SHISTORY_SIZE, &gHistoryMaxSize); + Preferences::GetInt(PREF_SHISTORY_MAX_TOTAL_VIEWERS, + &sHistoryMaxTotalViewers); + Preferences::GetBool(PREF_SHISTORY_OPTIMIZE_EVICTION, &gOptimizeEviction); // If the pref is negative, that means we calculate how many viewers // we think we should cache, based on total memory if (sHistoryMaxTotalViewers < 0) { @@ -245,52 +252,33 @@ nsSHistory::UpdatePrefs(nsIPrefBranch *aPrefBranch) nsresult nsSHistory::Startup() { - nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); - if (prefs) { - nsCOMPtr sesHBranch; - prefs->GetBranch(nsnull, getter_AddRefs(sesHBranch)); - if (sesHBranch) { - UpdatePrefs(sesHBranch); - } + UpdatePrefs(); - // The goal of this is to unbreak users who have inadvertently set their - // session history size to less than the default value. - PRInt32 defaultHistoryMaxSize = 50; - nsCOMPtr defaultBranch; - prefs->GetDefaultBranch(nsnull, getter_AddRefs(defaultBranch)); - if (defaultBranch) { - defaultBranch->GetIntPref(PREF_SHISTORY_SIZE, &defaultHistoryMaxSize); - } + // The goal of this is to unbreak users who have inadvertently set their + // session history size to less than the default value. + PRInt32 defaultHistoryMaxSize = + Preferences::GetDefaultInt(PREF_SHISTORY_SIZE, 50); + if (gHistoryMaxSize < defaultHistoryMaxSize) { + gHistoryMaxSize = defaultHistoryMaxSize; + } + + // Allow the user to override the max total number of cached viewers, + // but keep the per SHistory cached viewer limit constant + if (!gObserver) { + gObserver = new nsSHistoryObserver(); + NS_ADDREF(gObserver); + Preferences::AddStrongObservers(gObserver, kObservedPrefs); - if (gHistoryMaxSize < defaultHistoryMaxSize) { - gHistoryMaxSize = defaultHistoryMaxSize; - } - - // Allow the user to override the max total number of cached viewers, - // but keep the per SHistory cached viewer limit constant - nsCOMPtr branch = do_QueryInterface(sesHBranch); - if (branch) { - nsSHistoryObserver* obs = new nsSHistoryObserver(); - if (!obs) { - return NS_ERROR_OUT_OF_MEMORY; - } - branch->AddObserver(PREF_SHISTORY_SIZE, obs, PR_FALSE); - branch->AddObserver(PREF_SHISTORY_MAX_TOTAL_VIEWERS, - obs, PR_FALSE); - branch->AddObserver(PREF_SHISTORY_OPTIMIZE_EVICTION, - obs, PR_FALSE); + nsCOMPtr obsSvc = + mozilla::services::GetObserverService(); + if (obsSvc) { + // Observe empty-cache notifications so tahat clearing the disk/memory + // cache will also evict all content viewers. + obsSvc->AddObserver(gObserver, + NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID, PR_FALSE); - nsCOMPtr obsSvc = - mozilla::services::GetObserverService(); - if (obsSvc) { - // Observe empty-cache notifications so tahat clearing the disk/memory - // cache will also evict all content viewers. - obsSvc->AddObserver(obs, - NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID, PR_FALSE); - - // Same for memory-pressure notifications - obsSvc->AddObserver(obs, "memory-pressure", PR_FALSE); - } + // Same for memory-pressure notifications + obsSvc->AddObserver(gObserver, "memory-pressure", PR_FALSE); } } @@ -299,6 +287,22 @@ nsSHistory::Startup() return NS_OK; } +// static +void +nsSHistory::Shutdown() +{ + if (gObserver) { + Preferences::RemoveObservers(gObserver, kObservedPrefs); + nsCOMPtr obsSvc = + mozilla::services::GetObserverService(); + if (obsSvc) { + obsSvc->RemoveObserver(gObserver, NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID); + obsSvc->RemoveObserver(gObserver, "memory-pressure"); + } + NS_RELEASE(gObserver); + } +} + /* Add an entry to the History list at mIndex and * increment the index to point to the new entry */ @@ -888,7 +892,7 @@ nsSHistory::EvictWindowContentViewers(PRInt32 aFromIndex, PRInt32 aToIndex) // Walk the full session history and check that entries outside the window // around aFromIndex have no content viewers - for (PRInt32 i = 0; i < mLength; ++i) { + for (PRInt32 i = 0; trans && i < mLength; ++i) { if (i < aFromIndex - gHistoryMaxViewers || i > aFromIndex + gHistoryMaxViewers) { nsCOMPtr entry; @@ -1087,7 +1091,7 @@ nsSHistory::EvictExpiredContentViewerForEntry(nsISHEntry *aEntry) GetTransactionAtIndex(startIndex, getter_AddRefs(trans)); PRInt32 i; - for (i = startIndex; i <= endIndex; ++i) { + for (i = startIndex; trans && i <= endIndex; ++i) { nsCOMPtr entry; trans->GetSHEntry(getter_AddRefs(entry)); if (entry == aEntry) diff --git a/docshell/shistory/src/nsSHistory.h b/docshell/shistory/src/nsSHistory.h index 94a9650ef73..01cdf465454 100644 --- a/docshell/shistory/src/nsSHistory.h +++ b/docshell/shistory/src/nsSHistory.h @@ -53,7 +53,6 @@ #include "nsISHistoryListener.h" #include "nsIHistoryEntry.h" #include "nsIObserver.h" -#include "nsIPrefBranch2.h" // Needed to maintain global list of all SHistory objects #include "prclist.h" @@ -76,7 +75,8 @@ public: // One time initialization method called upon docshell module construction static nsresult Startup(); - static void UpdatePrefs(nsIPrefBranch *aPrefBranch); + static void Shutdown(); + static void UpdatePrefs(); // Max number of total cached content viewers. If the pref // browser.sessionhistory.max_total_viewers is negative, then diff --git a/docshell/test/Makefile.in b/docshell/test/Makefile.in index 7417072e0f4..0fd0597b514 100644 --- a/docshell/test/Makefile.in +++ b/docshell/test/Makefile.in @@ -111,6 +111,8 @@ _TEST_FILES = \ file_bug660404^headers^ \ test_bug662170.html \ file_bug662170.html \ + test_bug570341.html \ + bug570341_recordevents.html \ $(NULL) ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) diff --git a/docshell/test/bug570341_recordevents.html b/docshell/test/bug570341_recordevents.html new file mode 100644 index 00000000000..51fc1cd7629 --- /dev/null +++ b/docshell/test/bug570341_recordevents.html @@ -0,0 +1,21 @@ + + + + +This document collects time +for events related to the page load progress. + diff --git a/docshell/test/test_bug570341.html b/docshell/test/test_bug570341.html new file mode 100644 index 00000000000..2a430a89ca5 --- /dev/null +++ b/docshell/test/test_bug570341.html @@ -0,0 +1,154 @@ + + + + + Test for Bug 570341 + + + + + + +Mozilla Bug 570341 +
+ +
+ +

+ +
+
+
+ + diff --git a/dom/base/Makefile.in b/dom/base/Makefile.in index 19089fce9f9..cb98ccb277a 100644 --- a/dom/base/Makefile.in +++ b/dom/base/Makefile.in @@ -110,6 +110,8 @@ CPPSRCS = \ nsQueryContentEventResult.cpp \ nsContentPermissionHelper.cpp \ nsStructuredCloneContainer.cpp \ + nsDOMNavigationTiming.cpp \ + nsPerformance.cpp \ $(NULL) include $(topsrcdir)/dom/dom-config.mk @@ -126,6 +128,7 @@ include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES += \ -I$(srcdir)/../../js/src/xpconnect/src \ -I$(srcdir)/../../js/src/xpconnect/wrappers \ + -I$(topsrcdir)/xpcom/ds \ $(NULL) ifdef MOZ_X11 diff --git a/dom/base/crashtests/666869.html b/dom/base/crashtests/666869.html new file mode 100644 index 00000000000..ac11f64e12b --- /dev/null +++ b/dom/base/crashtests/666869.html @@ -0,0 +1,17 @@ + + + + + + + diff --git a/dom/base/crashtests/crashtests.list b/dom/base/crashtests/crashtests.list index 6b1cfba881d..b4ce015721c 100644 --- a/dom/base/crashtests/crashtests.list +++ b/dom/base/crashtests/crashtests.list @@ -27,3 +27,4 @@ load 601247.html load 609560-1.xhtml load 612018-1.html load 637116.html +load 666869.html diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index eca026cc711..dc33cb87415 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -122,13 +122,15 @@ #include "nsIDOMMediaList.h" #include "nsIDOMChromeWindow.h" #include "nsIDOMConstructor.h" +#include "nsIDOMPerformanceTiming.h" +#include "nsIDOMPerformanceNavigation.h" +#include "nsIDOMPerformance.h" #include "nsClientRect.h" // DOM core includes #include "nsDOMError.h" #include "nsIDOMDOMException.h" #include "nsIDOMNode.h" -#include "nsIDOM3Attr.h" #include "nsIDOMNodeList.h" #include "nsIDOMNamedNodeMap.h" #include "nsIDOMDOMStringList.h" @@ -174,9 +176,8 @@ #include "nsGenericElement.h" // Event related includes -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsIDOMEventTarget.h" -#include "nsIDOMNSEventTarget.h" // CSS related includes #include "nsIDOMStyleSheet.h" @@ -246,9 +247,7 @@ #include "nsIDOMNotifyAudioAvailableEvent.h" #include "nsIDOMScrollAreaEvent.h" #include "nsIDOMTransitionEvent.h" -#ifdef MOZ_CSS_ANIMATIONS #include "nsIDOMAnimationEvent.h" -#endif #include "nsIDOMDocumentXBL.h" #include "nsIDOMElementCSSInlineStyle.h" #include "nsIDOMLinkStyle.h" @@ -323,10 +322,8 @@ #include "nsIDOMCSSMediaRule.h" #include "nsIDOMCSSFontFaceRule.h" #include "nsIDOMCSSMozDocumentRule.h" -#ifdef MOZ_CSS_ANIMATIONS #include "nsIDOMMozCSSKeyframeRule.h" #include "nsIDOMMozCSSKeyframesRule.h" -#endif #include "nsIDOMCSSPrimitiveValue.h" #include "nsIDOMCSSStyleRule.h" #include "nsIDOMCSSStyleSheet.h" @@ -688,6 +685,12 @@ static nsDOMClassInfoData sClassInfoData[] = { NS_DEFINE_CLASSINFO_DATA(History, nsHistorySH, ARRAY_SCRIPTABLE_FLAGS | nsIXPCScriptable::WANT_PRECREATE) + NS_DEFINE_CLASSINFO_DATA(PerformanceTiming, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(PerformanceNavigation, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(Performance, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(Screen, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(DOMPrototype, nsDOMConstructorSH, @@ -1469,10 +1472,8 @@ static nsDOMClassInfoData sClassInfoData[] = { DOM_DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(TransitionEvent, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) -#ifdef MOZ_CSS_ANIMATIONS NS_DEFINE_CLASSINFO_DATA(AnimationEvent, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) -#endif NS_DEFINE_CLASSINFO_DATA(ContentFrameMessageManager, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) @@ -1525,12 +1526,10 @@ static nsDOMClassInfoData sClassInfoData[] = { NS_DEFINE_CLASSINFO_DATA(TouchEvent, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) -#ifdef MOZ_CSS_ANIMATIONS NS_DEFINE_CLASSINFO_DATA(MozCSSKeyframeRule, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(MozCSSKeyframesRule, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) -#endif NS_DEFINE_CLASSINFO_DATA(MediaQueryList, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) @@ -2320,7 +2319,6 @@ nsDOMClassInfo::RegisterExternalClasses() #define DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL) \ - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathEvaluator) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMNodeSelector) @@ -2329,7 +2327,6 @@ nsDOMClassInfo::RegisterExternalClasses() #define DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLElement) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMElementCSSInlineStyle) \ - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSElement) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMNodeSelector) @@ -2385,26 +2382,49 @@ nsDOMClassInfo::Init() NS_ENSURE_SUCCESS(rv, rv); if (nsGlobalWindow::HasIndexedDBSupport()) { - DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH) - DOM_CLASSINFO_MAP_END + if (nsGlobalWindow::HasPerformanceSupport()) { + DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance) + DOM_CLASSINFO_MAP_END + } else { + DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH) + DOM_CLASSINFO_MAP_END + } } else { - DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH) - DOM_CLASSINFO_MAP_END + if (nsGlobalWindow::HasPerformanceSupport()) { + DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance) + DOM_CLASSINFO_MAP_END + } else { + DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH) + DOM_CLASSINFO_MAP_END + } } DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils) @@ -2454,6 +2474,21 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMHistory) DOM_CLASSINFO_MAP_END + DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(PerformanceTiming, nsIDOMPerformanceTiming, + !nsGlobalWindow::HasPerformanceSupport()) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformanceTiming) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(PerformanceNavigation, nsIDOMPerformanceNavigation, + !nsGlobalWindow::HasPerformanceSupport()) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformanceNavigation) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(Performance, nsIDOMPerformance, + !nsGlobalWindow::HasPerformanceSupport()) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformance) + DOM_CLASSINFO_MAP_END + DOM_CLASSINFO_MAP_BEGIN(Screen, nsIDOMScreen) DOM_CLASSINFO_MAP_ENTRY(nsIDOMScreen) DOM_CLASSINFO_MAP_END @@ -2483,7 +2518,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(DocumentType, nsIDOMDocumentType) DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentType) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END @@ -2507,46 +2541,38 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(DocumentFragment, nsIDOMDocumentFragment) DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentFragment) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNodeSelector) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(Element, nsIDOMElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNodeSelector) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(Attr, nsIDOMAttr) DOM_CLASSINFO_MAP_ENTRY(nsIDOMAttr) - DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Attr) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(Text, nsIDOMText) DOM_CLASSINFO_MAP_ENTRY(nsIDOMText) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(Comment, nsIDOMComment) DOM_CLASSINFO_MAP_ENTRY(nsIDOMComment) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(CDATASection, nsIDOMCDATASection) DOM_CLASSINFO_MAP_ENTRY(nsIDOMCDATASection) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(ProcessingInstruction, nsIDOMProcessingInstruction) DOM_CLASSINFO_MAP_ENTRY(nsIDOMProcessingInstruction) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END @@ -3068,7 +3094,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(XULElement, nsIDOMXULElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMElementCSSInlineStyle) @@ -3110,7 +3135,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(XMLStylesheetProcessingInstruction, nsIDOMProcessingInstruction) DOM_CLASSINFO_MAP_ENTRY(nsIDOMProcessingInstruction) DOM_CLASSINFO_MAP_ENTRY(nsIDOMLinkStyle) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END @@ -3119,7 +3143,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) DOM_CLASSINFO_MAP_ENTRY(nsIDOMChromeWindow) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB) @@ -3180,7 +3203,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_END #define DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES \ - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGElement) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSElement) \ @@ -3230,7 +3252,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTextPositioningElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTextContentElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGURIReference) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable) DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES @@ -3574,7 +3595,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(SVGSVGElement, nsIDOMSVGSVGElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGSVGElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFitToViewBox) @@ -3590,7 +3610,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(SVGSymbolElement, nsIDOMSVGSymbolElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGSymbolElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFitToViewBox) @@ -3607,7 +3626,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(SVGTextPathElement, nsIDOMSVGTextPathElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTextContentElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGURIReference) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable) DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES @@ -3622,7 +3640,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(SVGTSpanElement, nsIDOMSVGTSpanElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTextPositioningElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTextContentElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable) DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES @@ -3932,7 +3949,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIXMLHttpRequest) DOM_CLASSINFO_MAP_ENTRY(nsIJSXMLHttpRequest) DOM_CLASSINFO_MAP_ENTRY(nsIXMLHttpRequestEventTarget) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor) DOM_CLASSINFO_MAP_END @@ -3946,7 +3962,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(EventSource, nsIEventSource) DOM_CLASSINFO_MAP_ENTRY(nsIEventSource) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(SVGForeignObjectElement, nsIDOMSVGForeignObjectElement) @@ -3966,7 +3981,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(OfflineResourceList, nsIDOMOfflineResourceList) DOM_CLASSINFO_MAP_ENTRY(nsIDOMOfflineResourceList) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END @@ -4003,7 +4017,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(FileReader, nsIDOMFileReader) DOM_CLASSINFO_MAP_ENTRY(nsIDOMFileReader) DOM_CLASSINFO_MAP_ENTRY(nsIXMLHttpRequestEventTarget) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor) DOM_CLASSINFO_MAP_END @@ -4024,7 +4037,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB) @@ -4103,7 +4115,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(XMLHttpRequestUpload, nsIXMLHttpRequestUpload) DOM_CLASSINFO_MAP_ENTRY(nsIXMLHttpRequestEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIXMLHttpRequestUpload) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END @@ -4139,7 +4150,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(MathMLElement, nsIDOMElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNodeSelector) DOM_CLASSINFO_MAP_END @@ -4147,14 +4157,12 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(Worker, nsIWorker) DOM_CLASSINFO_MAP_ENTRY(nsIWorker) DOM_CLASSINFO_MAP_ENTRY(nsIAbstractWorker) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(ChromeWorker, nsIWorker) DOM_CLASSINFO_MAP_ENTRY(nsIWorker) DOM_CLASSINFO_MAP_ENTRY(nsIAbstractWorker) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END @@ -4220,16 +4228,13 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_EVENT_MAP_ENTRIES DOM_CLASSINFO_MAP_END -#ifdef MOZ_CSS_ANIMATIONS DOM_CLASSINFO_MAP_BEGIN(AnimationEvent, nsIDOMAnimationEvent) DOM_CLASSINFO_MAP_ENTRY(nsIDOMAnimationEvent) DOM_CLASSINFO_EVENT_MAP_ENTRIES DOM_CLASSINFO_MAP_END -#endif DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ContentFrameMessageManager, nsIContentFrameMessageManager) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIFrameMessageManager) DOM_CLASSINFO_MAP_ENTRY(nsISyncMessageSender) DOM_CLASSINFO_MAP_ENTRY(nsIContentFrameMessageManager) @@ -4250,7 +4255,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(WebSocket, nsIWebSocket) DOM_CLASSINFO_MAP_ENTRY(nsIWebSocket) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(CloseEvent, nsIDOMCloseEvent) @@ -4264,13 +4268,11 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(IDBRequest, nsIIDBRequest) DOM_CLASSINFO_MAP_ENTRY(nsIIDBRequest) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(IDBDatabase, nsIIDBDatabase) DOM_CLASSINFO_MAP_ENTRY(nsIIDBDatabase) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END @@ -4280,7 +4282,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(IDBTransaction, nsIIDBTransaction) DOM_CLASSINFO_MAP_ENTRY(nsIIDBTransaction) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END @@ -4309,7 +4310,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(IDBVersionChangeRequest, nsIIDBVersionChangeRequest) DOM_CLASSINFO_MAP_ENTRY(nsIIDBVersionChangeRequest) DOM_CLASSINFO_MAP_ENTRY(nsIIDBRequest) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END @@ -4339,7 +4339,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES DOM_CLASSINFO_MAP_END -#ifdef MOZ_CSS_ANIMATIONS DOM_CLASSINFO_MAP_BEGIN(MozCSSKeyframeRule, nsIDOMMozCSSKeyframeRule) DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozCSSKeyframeRule) DOM_CLASSINFO_MAP_END @@ -4347,7 +4346,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(MozCSSKeyframesRule, nsIDOMMozCSSKeyframesRule) DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozCSSKeyframesRule) DOM_CLASSINFO_MAP_END -#endif DOM_CLASSINFO_MAP_BEGIN(MediaQueryList, nsIDOMMediaQueryList) DOM_CLASSINFO_MAP_ENTRY(nsIDOMMediaQueryList) @@ -6828,6 +6826,57 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, return NS_OK; } + if (id == sLocation_id) { + // This must be done even if we're just getting the value of + // window.location (i.e. no checking flags & JSRESOLVE_ASSIGNING + // here) since we must define window.location to prevent the + // getter from being overriden (for security reasons). + + // Note: Because we explicitly don't forward to the inner window + // above, we have to ensure here that our window has a current + // inner window so that the location object we return will work. + + if (win->IsOuterWindow()) { + win->EnsureInnerWindow(); + } + + nsCOMPtr location; + rv = win->GetLocation(getter_AddRefs(location)); + NS_ENSURE_SUCCESS(rv, rv); + + // Make sure we wrap the location object in the inner window's + // scope if we've got an inner window. + JSObject *scope = nsnull; + if (win->IsOuterWindow()) { + nsGlobalWindow *innerWin = win->GetCurrentInnerWindowInternal(); + + if (innerWin) { + scope = innerWin->GetGlobalJSObject(); + } + } + + if (!scope) { + wrapper->GetJSObject(&scope); + } + + nsCOMPtr holder; + jsval v; + rv = WrapNative(cx, scope, location, &NS_GET_IID(nsIDOMLocation), PR_TRUE, + &v, getter_AddRefs(holder)); + NS_ENSURE_SUCCESS(rv, rv); + + JSBool ok = JS_WrapValue(cx, &v) && + JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull, + JSPROP_PERMANENT | JSPROP_ENUMERATE); + + if (!ok) { + return NS_ERROR_FAILURE; + } + + *objp = obj; + + return NS_OK; + } // Hmm, we do an awful lot of QIs here; maybe we should add a // method on an interface that would let us just call into the @@ -6935,58 +6984,6 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, return NS_OK; } - if (id == sLocation_id) { - // This must be done even if we're just getting the value of - // window.location (i.e. no checking flags & JSRESOLVE_ASSIGNING - // here) since we must define window.location to prevent the - // getter from being overriden (for security reasons). - - // Note: Because we explicitly don't forward to the inner window - // above, we have to ensure here that our window has a current - // inner window so that the location object we return will work. - - if (win->IsOuterWindow()) { - win->EnsureInnerWindow(); - } - - nsCOMPtr location; - rv = win->GetLocation(getter_AddRefs(location)); - NS_ENSURE_SUCCESS(rv, rv); - - // Make sure we wrap the location object in the inner window's - // scope if we've got an inner window. - JSObject *scope = nsnull; - if (win->IsOuterWindow()) { - nsGlobalWindow *innerWin = win->GetCurrentInnerWindowInternal(); - - if (innerWin) { - scope = innerWin->GetGlobalJSObject(); - } - } - - if (!scope) { - wrapper->GetJSObject(&scope); - } - - nsCOMPtr holder; - jsval v; - rv = WrapNative(cx, scope, location, &NS_GET_IID(nsIDOMLocation), PR_TRUE, - &v, getter_AddRefs(holder)); - NS_ENSURE_SUCCESS(rv, rv); - - JSBool ok = JS_WrapValue(cx, &v) && - JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull, - JSPROP_PERMANENT | JSPROP_ENUMERATE); - - if (!ok) { - return NS_ERROR_FAILURE; - } - - *objp = obj; - - return NS_OK; - } - if (id == sOnhashchange_id) { // Special handling so |"onhashchange" in window| returns true if (!JS_DefinePropertyById(cx, obj, id, JSVAL_VOID, @@ -7750,35 +7747,33 @@ nsEventReceiverSH::RegisterCompileHandler(nsIXPConnectWrappedNative *wrapper, nsIScriptContext *script_cx = nsJSUtils::GetStaticScriptContext(cx, obj); NS_ENSURE_TRUE(script_cx, NS_ERROR_UNEXPECTED); - nsCOMPtr piTarget = + nsCOMPtr target = do_QueryWrappedNative(wrapper, obj); - if (!piTarget) { + if (!target) { // Doesn't do events - NS_WARNING("Doesn't QI to nsPIDOMEventTarget?"); + NS_WARNING("Doesn't QI to nsIDOMEventTarget?"); return NS_OK; } - nsIEventListenerManager* manager = piTarget->GetListenerManager(PR_TRUE); + nsEventListenerManager* manager = target->GetListenerManager(PR_TRUE); NS_ENSURE_TRUE(manager, NS_ERROR_UNEXPECTED); nsCOMPtr atom(do_GetAtom(nsDependentJSString(id))); NS_ENSURE_TRUE(atom, NS_ERROR_OUT_OF_MEMORY); - nsresult rv; - JSObject *scope = ::JS_GetGlobalForObject(cx, obj); if (compile) { - rv = manager->CompileScriptEventListener(script_cx, scope, piTarget, atom, - did_define); + nsresult rv = manager->CompileScriptEventListener(script_cx, scope, target, + atom, did_define); + NS_ENSURE_SUCCESS(rv, rv); } else if (remove) { - rv = manager->RemoveScriptEventListener(atom); + manager->RemoveScriptEventListener(atom); } else { - rv = manager->RegisterScriptEventListener(script_cx, scope, piTarget, - atom); + manager->RegisterScriptEventListener(script_cx, scope, target, atom); } - return NS_FAILED(rv) ? rv : NS_SUCCESS_I_DID_SOMETHING; + return NS_SUCCESS_I_DID_SOMETHING; } NS_IMETHODIMP diff --git a/dom/base/nsDOMClassInfoClasses.h b/dom/base/nsDOMClassInfoClasses.h index 4daaa29c960..3e0513ff9eb 100644 --- a/dom/base/nsDOMClassInfoClasses.h +++ b/dom/base/nsDOMClassInfoClasses.h @@ -45,6 +45,9 @@ DOMCI_CLASS(MimeType) DOMCI_CLASS(MimeTypeArray) DOMCI_CLASS(BarProp) DOMCI_CLASS(History) +DOMCI_CLASS(PerformanceTiming) +DOMCI_CLASS(PerformanceNavigation) +DOMCI_CLASS(Performance) DOMCI_CLASS(Screen) DOMCI_CLASS(DOMPrototype) DOMCI_CLASS(DOMConstructor) @@ -484,9 +487,7 @@ DOMCI_CLASS(HashChangeEvent) DOMCI_CLASS(EventListenerInfo) DOMCI_CLASS(TransitionEvent) -#ifdef MOZ_CSS_ANIMATIONS DOMCI_CLASS(AnimationEvent) -#endif DOMCI_CLASS(ContentFrameMessageManager) @@ -518,10 +519,8 @@ DOMCI_CLASS(Touch) DOMCI_CLASS(TouchList) DOMCI_CLASS(TouchEvent) -#ifdef MOZ_CSS_ANIMATIONS DOMCI_CLASS(MozCSSKeyframeRule) DOMCI_CLASS(MozCSSKeyframesRule) -#endif DOMCI_CLASS(MediaQueryList) DOMCI_CLASS(CustomEvent) diff --git a/dom/base/nsDOMNavigationTiming.cpp b/dom/base/nsDOMNavigationTiming.cpp new file mode 100644 index 00000000000..34bc1ac1031 --- /dev/null +++ b/dom/base/nsDOMNavigationTiming.cpp @@ -0,0 +1,420 @@ +/* -*- 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 implementation of Web Timing draft specification + * http://dev.w3.org/2006/webapi/WebTiming/ + * + * The Initial Developer of the Original Code is Google Inc. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Sergey Novikov (original author) + * Igor Bazarny (lots of improvements) + * + * 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 ***** */ + +#include "nsDOMNavigationTiming.h" +#include "nsCOMPtr.h" +#include "nscore.h" +#include "TimeStamp.h" +#include "nsContentUtils.h" + +#include "nsIDOMEventTarget.h" +#include "nsIDocument.h" +#include "nsIScriptSecurityManager.h" + +nsDOMNavigationTiming::nsDOMNavigationTiming() +{ + Clear(); +} + +nsDOMNavigationTiming::~nsDOMNavigationTiming() +{ +} + +void +nsDOMNavigationTiming::Clear() +{ + mNavigationType = nsIDOMPerformanceNavigation::TYPE_RESERVED; + mNavigationStart = 0; + mFetchStart = 0; + mRedirectStart = 0; + mRedirectEnd = 0; + mBeforeUnloadStart = 0; + mUnloadStart = 0; + mUnloadEnd = 0; + mLoadEventStart = 0; + mLoadEventEnd = 0; + mDOMLoading = 0; + mDOMInteractive = 0; + mDOMContentLoadedEventStart = 0; + mDOMContentLoadedEventEnd = 0; + mDOMComplete = 0; + mRedirectCheck = NOT_CHECKED; +} + +DOMTimeMilliSec nsDOMNavigationTiming::DurationFromStart(){ + mozilla::TimeDuration duration = mozilla::TimeStamp::Now() - mNavigationStartTimeStamp; + return mNavigationStart + static_cast(duration.ToMilliseconds()); +} + +void +nsDOMNavigationTiming::NotifyNavigationStart() +{ + mNavigationStart = PR_Now() / PR_USEC_PER_MSEC; + mNavigationStartTimeStamp = mozilla::TimeStamp::Now(); +} + +void +nsDOMNavigationTiming::NotifyFetchStart(nsIURI* aURI, nsDOMPerformanceNavigationType aNavigationType) +{ + mFetchStart = DurationFromStart(); + mNavigationType = aNavigationType; + // At the unload event time we don't really know the loading uri. + // Need it for later check for unload timing access. + mLoadedURI = aURI; +} + +void +nsDOMNavigationTiming::NotifyRedirect(nsIURI* aOldURI, nsIURI* aNewURI) +{ + if (mRedirects.Count() == 0) { + mRedirectStart = mFetchStart; + } + mFetchStart = DurationFromStart(); + mRedirectEnd = mFetchStart; + + // At the unload event time we don't really know the loading uri. + // Need it for later check for unload timing access. + mLoadedURI = aNewURI; + + mRedirects.AppendObject(aOldURI); +} + +void +nsDOMNavigationTiming::NotifyBeforeUnload() +{ + mBeforeUnloadStart = DurationFromStart(); +} + +void +nsDOMNavigationTiming::NotifyUnloadAccepted(nsIURI* aOldURI) +{ + mUnloadStart = mBeforeUnloadStart; + mUnloadedURI = aOldURI; +} + +void +nsDOMNavigationTiming::NotifyUnloadEventStart() +{ + mUnloadStart = DurationFromStart(); +} + +void +nsDOMNavigationTiming::NotifyUnloadEventEnd() +{ + mUnloadEnd = DurationFromStart(); +} + +void +nsDOMNavigationTiming::NotifyLoadEventStart() +{ + mLoadEventStart = DurationFromStart(); +} + +void +nsDOMNavigationTiming::NotifyLoadEventEnd() +{ + mLoadEventEnd = DurationFromStart(); +} + +PRBool +nsDOMNavigationTiming::ReportRedirects() +{ + if (mRedirectCheck == NOT_CHECKED) { + if (mRedirects.Count() == 0) { + mRedirectCheck = NO_REDIRECTS; + } else { + mRedirectCheck = CHECK_PASSED; + nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); + for (int i = mRedirects.Count() - 1; i >= 0; --i) { + nsIURI * curr = mRedirects[i]; + nsresult rv = ssm->CheckSameOriginURI(curr, mLoadedURI, PR_FALSE); + if (!NS_SUCCEEDED(rv)) { + mRedirectCheck = CHECK_FAILED; + break; + } + } + // All we need to know is in mRedirectCheck now. Clear history. + mRedirects.Clear(); + } + } + return mRedirectCheck == CHECK_PASSED; +} + +void +nsDOMNavigationTiming::SetDOMLoadingTimeStamp(nsIURI* aURI, mozilla::TimeStamp aValue) +{ + mLoadedURI = aURI; + mozilla::TimeDuration duration = aValue - mNavigationStartTimeStamp; + mDOMLoading = mNavigationStart + (int)(duration.ToMilliseconds()); +} + +void +nsDOMNavigationTiming::NotifyDOMLoading(nsIURI* aURI) +{ + mLoadedURI = aURI; + mDOMLoading = DurationFromStart(); +} + +void +nsDOMNavigationTiming::NotifyDOMInteractive(nsIURI* aURI) +{ + mLoadedURI = aURI; + mDOMInteractive = DurationFromStart(); +} + +void +nsDOMNavigationTiming::NotifyDOMComplete(nsIURI* aURI) +{ + mLoadedURI = aURI; + mDOMComplete = DurationFromStart(); +} + +void +nsDOMNavigationTiming::NotifyDOMContentLoadedStart(nsIURI* aURI) +{ + mLoadedURI = aURI; + mDOMContentLoadedEventStart = DurationFromStart(); +} + +void +nsDOMNavigationTiming::NotifyDOMContentLoadedEnd(nsIURI* aURI) +{ + mLoadedURI = aURI; + mDOMContentLoadedEventEnd = DurationFromStart(); +} + + +NS_IMPL_ADDREF(nsDOMNavigationTiming) +NS_IMPL_RELEASE(nsDOMNavigationTiming) + +// QueryInterface implementation for nsDOMNavigationTiming +NS_INTERFACE_MAP_BEGIN(nsDOMNavigationTiming) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformanceTiming) + NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceTiming) + NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceNavigation) +NS_INTERFACE_MAP_END + +NS_IMETHODIMP +nsDOMNavigationTiming::GetType( + nsDOMPerformanceNavigationType* aNavigationType) +{ + *aNavigationType = mNavigationType; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetRedirectCount(PRUint16* aRedirectCount) +{ + *aRedirectCount = 0; + if (ReportRedirects()) { + *aRedirectCount = mRedirects.Count(); + } + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetRedirectStart(DOMTimeMilliSec* aRedirectStart) +{ + *aRedirectStart = 0; + if (ReportRedirects()) { + *aRedirectStart = mRedirectStart; + } + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetRedirectEnd(DOMTimeMilliSec* aEnd) +{ + *aEnd = 0; + if (ReportRedirects()) { + *aEnd = mRedirectEnd; + } + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetNavigationStart(DOMTimeMilliSec* aNavigationStart) +{ + *aNavigationStart = mNavigationStart; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetUnloadEventStart(DOMTimeMilliSec* aStart) +{ + *aStart = 0; + nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); + nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + *aStart = mUnloadStart; + } + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetUnloadEventEnd(DOMTimeMilliSec* aEnd) +{ + *aEnd = 0; + nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); + nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + *aEnd = mUnloadEnd; + } + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetFetchStart(DOMTimeMilliSec* aStart) +{ + *aStart = mFetchStart; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetDomainLookupStart(DOMTimeMilliSec* aStart) +{ + // TODO: Implement me! (bug 659126) + *aStart = mFetchStart; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetDomainLookupEnd(DOMTimeMilliSec* aEnd) +{ + // TODO: Implement me! (bug 659126) + *aEnd = mFetchStart; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetConnectStart(DOMTimeMilliSec* aStart) +{ + // TODO: Implement me! (bug 659126) + *aStart = mFetchStart; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetConnectEnd(DOMTimeMilliSec* aEnd) +{ + // TODO: Implement me! (bug 659126) + *aEnd = mFetchStart; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetHandshakeStart(DOMTimeMilliSec* aStart) +{ + // TODO: Implement me! (bug 659126) + *aStart = mFetchStart; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetRequestStart(DOMTimeMilliSec* aStart) +{ + // TODO: Implement me! (bug 659126) + *aStart = mFetchStart; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetResponseStart(DOMTimeMilliSec* aStart) +{ + // TODO: Implement me! (bug 659126) + *aStart = mFetchStart; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetResponseEnd(DOMTimeMilliSec* aEnd) +{ + // TODO: Implement me! (bug 659126) + *aEnd = mFetchStart; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetDomLoading(DOMTimeMilliSec* aTime) +{ + *aTime = mDOMLoading; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetDomInteractive(DOMTimeMilliSec* aTime) +{ + *aTime = mDOMInteractive; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetDomContentLoadedEventStart(DOMTimeMilliSec* aStart) +{ + *aStart = mDOMContentLoadedEventStart; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetDomContentLoadedEventEnd(DOMTimeMilliSec* aEnd) +{ + *aEnd = mDOMContentLoadedEventEnd; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetDomComplete(DOMTimeMilliSec* aTime) +{ + *aTime = mDOMComplete; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetLoadEventStart(DOMTimeMilliSec* aStart) +{ + *aStart = mLoadEventStart; + return NS_OK; +} + +NS_IMETHODIMP +nsDOMNavigationTiming::GetLoadEventEnd(DOMTimeMilliSec* aEnd) +{ + *aEnd = mLoadEventEnd; + return NS_OK; +} diff --git a/dom/base/nsDOMNavigationTiming.h b/dom/base/nsDOMNavigationTiming.h new file mode 100644 index 00000000000..4fd3679c3ea --- /dev/null +++ b/dom/base/nsDOMNavigationTiming.h @@ -0,0 +1,121 @@ +/* -*- 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 implementation of Web Timing draft specification + * http://dev.w3.org/2006/webapi/WebTiming/ + * + * The Initial Developer of the Original Code is Google Inc. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Sergey Novikov (original author) + * Igor Bazarny (lots of improvements) + * + * 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 nsDOMNavigationTiming_h___ +#define nsDOMNavigationTiming_h___ + +#include "nsIDOMPerformanceTiming.h" +#include "nsIDOMPerformanceNavigation.h" +#include "nscore.h" +#include "nsCOMPtr.h" +#include "nsCOMArray.h" +#include "TimeStamp.h" + +class nsDOMNavigationTimingClock; +class nsIURI; +class nsIDocument; + +class nsDOMNavigationTiming : public nsIDOMPerformanceTiming, + public nsIDOMPerformanceNavigation +{ +public: + nsDOMNavigationTiming(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIDOMPERFORMANCETIMING + NS_DECL_NSIDOMPERFORMANCENAVIGATION + + void NotifyNavigationStart(); + void NotifyFetchStart(nsIURI* aURI, nsDOMPerformanceNavigationType aNavigationType); + void NotifyRedirect(nsIURI* aOldURI, nsIURI* aNewURI); + void NotifyBeforeUnload(); + void NotifyUnloadAccepted(nsIURI* aOldURI); + void NotifyUnloadEventStart(); + void NotifyUnloadEventEnd(); + void NotifyLoadEventStart(); + void NotifyLoadEventEnd(); + + // Document changes state to 'loading' before connecting to timing + void SetDOMLoadingTimeStamp(nsIURI* aURI, mozilla::TimeStamp aValue); + void NotifyDOMLoading(nsIURI* aURI); + void NotifyDOMInteractive(nsIURI* aURI); + void NotifyDOMComplete(nsIURI* aURI); + void NotifyDOMContentLoadedStart(nsIURI* aURI); + void NotifyDOMContentLoadedEnd(nsIURI* aURI); + +private: + nsDOMNavigationTiming(const nsDOMNavigationTiming &){}; + ~nsDOMNavigationTiming(); + + void Clear(); + PRBool ReportRedirects(); + + nsCOMPtr mUnloadedURI; + nsCOMPtr mLoadedURI; + nsCOMArray mRedirects; + + typedef enum { NOT_CHECKED, + CHECK_PASSED, + NO_REDIRECTS, + CHECK_FAILED} RedirectCheckState; + RedirectCheckState mRedirectCheck; + + nsDOMPerformanceNavigationType mNavigationType; + DOMTimeMilliSec mNavigationStart; + mozilla::TimeStamp mNavigationStartTimeStamp; + DOMTimeMilliSec DurationFromStart(); + + DOMTimeMilliSec mFetchStart; + DOMTimeMilliSec mRedirectStart; + DOMTimeMilliSec mRedirectEnd; + DOMTimeMilliSec mBeforeUnloadStart; + DOMTimeMilliSec mUnloadStart; + DOMTimeMilliSec mUnloadEnd; + DOMTimeMilliSec mNavigationEnd; + DOMTimeMilliSec mLoadEventStart; + DOMTimeMilliSec mLoadEventEnd; + + DOMTimeMilliSec mDOMLoading; + DOMTimeMilliSec mDOMInteractive; + DOMTimeMilliSec mDOMContentLoadedEventStart; + DOMTimeMilliSec mDOMContentLoadedEventEnd; + DOMTimeMilliSec mDOMComplete; +}; + +#endif /* nsDOMNavigationTiming_h___ */ diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index e18afd487e1..f57189c8fb9 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -108,7 +108,7 @@ struct nsDelayedBlurOrFocusEvent nsDelayedBlurOrFocusEvent(PRUint32 aType, nsIPresShell* aPresShell, nsIDocument* aDocument, - nsPIDOMEventTarget* aTarget) + nsIDOMEventTarget* aTarget) : mType(aType), mPresShell(aPresShell), mDocument(aDocument), @@ -123,7 +123,7 @@ struct nsDelayedBlurOrFocusEvent PRUint32 mType; nsCOMPtr mPresShell; nsCOMPtr mDocument; - nsCOMPtr mTarget; + nsCOMPtr mTarget; }; NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFocusManager) @@ -1008,7 +1008,7 @@ nsFocusManager::FireDelayedEvents(nsIDocument* aDocument) if (mDelayedBlurFocusEvents[i].mDocument == aDocument && !aDocument->EventHandlingSuppressed()) { PRUint32 type = mDelayedBlurFocusEvents[i].mType; - nsCOMPtr target = mDelayedBlurFocusEvents[i].mTarget; + nsCOMPtr target = mDelayedBlurFocusEvents[i].mTarget; nsCOMPtr presShell = mDelayedBlurFocusEvents[i].mPresShell; mDelayedBlurFocusEvents.RemoveElementAt(i); SendFocusOrBlurEvent(type, presShell, aDocument, target, 0, PR_FALSE); @@ -1851,7 +1851,7 @@ nsFocusManager::SendFocusOrBlurEvent(PRUint32 aType, NS_ASSERTION(aType == NS_FOCUS_CONTENT || aType == NS_BLUR_CONTENT, "Wrong event type for SendFocusOrBlurEvent"); - nsCOMPtr eventTarget = do_QueryInterface(aTarget); + nsCOMPtr eventTarget = do_QueryInterface(aTarget); // for focus events, if this event was from a mouse or key and event // handling on the document is suppressed, queue the event and fire it diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index a3e0be31d5d..6f3e54ae685 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -52,6 +52,8 @@ #include "nsGlobalWindow.h" #include "nsScreen.h" #include "nsHistory.h" +#include "nsPerformance.h" +#include "nsDOMNavigationTiming.h" #include "nsBarProps.h" #include "nsDOMStorage.h" #include "nsDOMOfflineResourceList.h" @@ -72,7 +74,7 @@ #include "mozilla/Preferences.h" // Other Classes -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsEscape.h" #include "nsStyleCoord.h" #include "nsMimeTypeArray.h" @@ -1118,6 +1120,7 @@ nsGlobalWindow::CleanUp(PRBool aIgnoreModalDialog) mIndexedDB = nsnull; mPendingStorageEventsObsolete = nsnull; + mPerformance = nsnull; ClearControllers(); @@ -1328,20 +1331,17 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptGlobalObject) NS_INTERFACE_MAP_ENTRY(nsIDOMWindowInternal) NS_INTERFACE_MAP_ENTRY(nsIDOMWindow) - NS_INTERFACE_MAP_ENTRY(nsIDOMWindow2) NS_INTERFACE_MAP_ENTRY(nsIDOMJSWindow) NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject) NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal) - NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget) NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget) - NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget) - NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget) NS_INTERFACE_MAP_ENTRY(nsPIDOMWindow) NS_INTERFACE_MAP_ENTRY(nsIDOMStorageWindow) NS_INTERFACE_MAP_ENTRY(nsIDOMStorageIndexedDB) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor) NS_INTERFACE_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH) + NS_INTERFACE_MAP_ENTRY(nsIDOMWindowPerformance) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Window) OUTER_WINDOW_ONLY NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY @@ -1369,7 +1369,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGlobalWindow) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOuterWindow) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOpenerScriptPrincipal) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mListenerManager) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mListenerManager, + nsEventListenerManager) for (nsTimeout* timeout = tmp->FirstTimeout(); tmp->IsTimeout(timeout); @@ -1410,10 +1411,14 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOuterWindow) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOpenerScriptPrincipal) - NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mListenerManager) + if (tmp->mListenerManager) { + tmp->mListenerManager->Disconnect(); + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mListenerManager) + } NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mSessionStorage) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mApplicationCache) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDocumentPrincipal) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDoc) // Unlink stuff from nsPIDOMWindow NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mChromeEventHandler) @@ -1846,9 +1851,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument, if (internal == static_cast(this)) { nsCOMPtr xblService = do_GetService("@mozilla.org/xbl;1"); if (xblService) { - nsCOMPtr piTarget = - do_QueryInterface(mChromeEventHandler); - xblService->AttachGlobalKeyHandler(piTarget); + xblService->AttachGlobalKeyHandler(mChromeEventHandler); } } } @@ -2512,6 +2515,31 @@ nsGlobalWindow::GetIsTabModalPromptAllowed() return allowTabModal; } +nsIDOMEventTarget* +nsGlobalWindow::GetTargetForDOMEvent() +{ + return static_cast(GetOuterWindowInternal()); +} + +nsIDOMEventTarget* +nsGlobalWindow::GetTargetForEventTargetChain() +{ + return IsInnerWindow() ? + this : static_cast(GetCurrentInnerWindowInternal()); +} + +nsresult +nsGlobalWindow::WillHandleEvent(nsEventChainPostVisitor& aVisitor) +{ + return NS_OK; +} + +JSContext* +nsGlobalWindow::GetJSContextForEventHandlers() +{ + return nsnull; +} + nsresult nsGlobalWindow::PreHandleEvent(nsEventChainPreVisitor& aVisitor) { @@ -2677,7 +2705,7 @@ nsGlobalWindow::PostHandleEvent(nsEventChainPostVisitor& aVisitor) /* mChromeEventHandler and mContext go dangling in the middle of this function under some circumstances (events that destroy the window) without this addref. */ - nsCOMPtr kungFuDeathGrip1(mChromeEventHandler); + nsCOMPtr kungFuDeathGrip1(mChromeEventHandler); nsCOMPtr kungFuDeathGrip2(GetContextInternal()); if (aVisitor.mEvent->message == NS_RESIZE_EVENT) { @@ -2721,7 +2749,6 @@ nsGlobalWindow::PostHandleEvent(nsEventChainPostVisitor& aVisitor) // be a pres context available). Since we're not firing a GUI // event we don't need a pres context anyway so we just pass // null as the pres context all the time here. - nsEventDispatcher::Dispatch(content, nsnull, &event, nsnull, &status); } } @@ -2951,6 +2978,28 @@ nsGlobalWindow::GetHistory(nsIDOMHistory** aHistory) return NS_OK; } +NS_IMETHODIMP +nsGlobalWindow::GetPerformance(nsIDOMPerformance** aPerformance) +{ + FORWARD_TO_INNER(GetPerformance, (aPerformance), NS_ERROR_NOT_INITIALIZED); + + *aPerformance = nsnull; + + if (nsGlobalWindow::HasPerformanceSupport()) { + if (!mPerformance) { + if (!mDoc) { + return NS_OK; + } + nsRefPtr timing = mDoc->GetNavigationTiming(); + if (timing) { + mPerformance = new nsPerformance(timing); + } + } + NS_IF_ADDREF(*aPerformance = mPerformance); + } + return NS_OK; +} + NS_IMETHODIMP nsGlobalWindow::GetParent(nsIDOMWindow** aParent) { @@ -3238,18 +3287,6 @@ nsGlobalWindow::GetApplicationCache(nsIDOMOfflineResourceList **aApplicationCach return NS_OK; } -NS_IMETHODIMP -nsGlobalWindow::CreateBlobURL(nsIDOMBlob* aBlob, nsAString& aURL) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsGlobalWindow::RevokeBlobURL(const nsAString& aURL) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - NS_IMETHODIMP nsGlobalWindow::GetCrypto(nsIDOMCrypto** aCrypto) { @@ -4614,6 +4651,13 @@ nsGlobalWindow::CanMoveResizeWindows() } } + if (mDocShell) { + PRBool allow; + nsresult rv = mDocShell->GetAllowWindowControl(&allow); + if (NS_SUCCEEDED(rv) && !allow) + return PR_FALSE; + } + if (gMouseDown && !gDragServiceDisabled) { nsCOMPtr ds = do_GetService("@mozilla.org/widget/dragservice;1"); @@ -7175,29 +7219,22 @@ nsGlobalWindow::Btoa(const nsAString& aBinaryData, // nsGlobalWindow::nsIDOMEventTarget //***************************************************************************** -NS_IMETHODIMP -nsGlobalWindow::AddEventListener(const nsAString& aType, - nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - FORWARD_TO_INNER_CREATE(AddEventListener, (aType, aListener, aUseCapture), - NS_ERROR_NOT_AVAILABLE); - - return AddEventListener(aType, aListener, aUseCapture, PR_FALSE, 1); -} - NS_IMETHODIMP nsGlobalWindow::RemoveEventListener(const nsAString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { - return RemoveGroupedEventListener(aType, aListener, aUseCapture, nsnull); + nsRefPtr elm = GetListenerManager(PR_FALSE); + if (elm) { + elm->RemoveEventListener(aType, aListener, aUseCapture); + } + return NS_OK; } NS_IMETHODIMP -nsGlobalWindow::DispatchEvent(nsIDOMEvent* aEvent, PRBool* _retval) +nsGlobalWindow::DispatchEvent(nsIDOMEvent* aEvent, PRBool* aRetVal) { - FORWARD_TO_INNER(DispatchEvent, (aEvent, _retval), NS_OK); + FORWARD_TO_INNER(DispatchEvent, (aEvent, aRetVal), NS_OK); if (!mDoc) { return NS_ERROR_FAILURE; @@ -7216,68 +7253,17 @@ nsGlobalWindow::DispatchEvent(nsIDOMEvent* aEvent, PRBool* _retval) nsEventDispatcher::DispatchDOMEvent(GetOuterWindow(), nsnull, aEvent, presContext, &status); - *_retval = (status != nsEventStatus_eConsumeNoDefault); + *aRetVal = (status != nsEventStatus_eConsumeNoDefault); return rv; } -//***************************************************************************** -// nsGlobalWindow::nsIDOM3EventTarget -//***************************************************************************** - -NS_IMETHODIMP -nsGlobalWindow::AddGroupedEventListener(const nsAString & aType, - nsIDOMEventListener *aListener, - PRBool aUseCapture, - nsIDOMEventGroup *aEvtGrp) -{ - FORWARD_TO_INNER_CREATE(AddGroupedEventListener, - (aType, aListener, aUseCapture, aEvtGrp), - NS_ERROR_NOT_AVAILABLE); - - nsIEventListenerManager* manager = GetListenerManager(PR_TRUE); - NS_ENSURE_STATE(manager); - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - return manager->AddEventListenerByType(aListener, aType, flags, aEvtGrp); -} - -NS_IMETHODIMP -nsGlobalWindow::RemoveGroupedEventListener(const nsAString & aType, - nsIDOMEventListener *aListener, - PRBool aUseCapture, - nsIDOMEventGroup *aEvtGrp) -{ - FORWARD_TO_INNER(RemoveGroupedEventListener, - (aType, aListener, aUseCapture, aEvtGrp), - NS_ERROR_NOT_INITIALIZED); - - if (mListenerManager) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - mListenerManager->RemoveEventListenerByType(aListener, aType, flags, - aEvtGrp); - } - return NS_OK; -} - -NS_IMETHODIMP -nsGlobalWindow::CanTrigger(const nsAString & type, PRBool *_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsGlobalWindow::IsRegisteredHere(const nsAString & type, PRBool *_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - NS_IMETHODIMP nsGlobalWindow::AddEventListener(const nsAString& aType, nsIDOMEventListener *aListener, PRBool aUseCapture, PRBool aWantsUntrusted, - PRUint8 optional_argc) + PRUint8 aOptionalArgc) { - NS_ASSERTION(!aWantsUntrusted || optional_argc > 1, + NS_ASSERTION(!aWantsUntrusted || aOptionalArgc > 1, "Won't check if this is chrome, you want to set " "aWantsUntrusted to PR_FALSE or make the aWantsUntrusted " "explicit by making optional_argc non-zero."); @@ -7287,24 +7273,22 @@ nsGlobalWindow::AddEventListener(const nsAString& aType, return NS_ERROR_DOM_SECURITY_ERR; } - nsIEventListenerManager* manager = GetListenerManager(PR_TRUE); - NS_ENSURE_STATE(manager); - - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - if (aWantsUntrusted || - (optional_argc < 2 && !nsContentUtils::IsChromeDoc(mDoc))) { - flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED; + if (!aWantsUntrusted && + (aOptionalArgc < 2 && !nsContentUtils::IsChromeDoc(mDoc))) { + aWantsUntrusted = PR_TRUE; } - return manager->AddEventListenerByType(aListener, aType, flags, nsnull); + nsEventListenerManager* manager = GetListenerManager(PR_TRUE); + NS_ENSURE_STATE(manager); + return manager->AddEventListener(aType, aListener, aUseCapture, + aWantsUntrusted); } nsresult nsGlobalWindow::AddEventListenerByIID(nsIDOMEventListener* aListener, const nsIID& aIID) { - nsIEventListenerManager* manager = GetListenerManager(PR_TRUE); + nsEventListenerManager* manager = GetListenerManager(PR_TRUE); NS_ENSURE_STATE(manager); return manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); } @@ -7324,37 +7308,19 @@ nsGlobalWindow::RemoveEventListenerByIID(nsIDOMEventListener* aListener, return NS_ERROR_FAILURE; } -nsIEventListenerManager* +nsEventListenerManager* nsGlobalWindow::GetListenerManager(PRBool aCreateIfNotFound) { FORWARD_TO_INNER_CREATE(GetListenerManager, (aCreateIfNotFound), nsnull); - if (!mListenerManager) { - if (!aCreateIfNotFound) { - return nsnull; - } - - static NS_DEFINE_CID(kEventListenerManagerCID, - NS_EVENTLISTENERMANAGER_CID); - - mListenerManager = do_CreateInstance(kEventListenerManagerCID); - if (mListenerManager) { - mListenerManager->SetListenerTarget( - static_cast(this)); - } + if (!mListenerManager && aCreateIfNotFound) { + mListenerManager = + new nsEventListenerManager(static_cast(this)); } return mListenerManager; } -nsresult -nsGlobalWindow::GetSystemEventGroup(nsIDOMEventGroup **aGroup) -{ - nsIEventListenerManager* manager = GetListenerManager(PR_TRUE); - NS_ENSURE_STATE(manager); - return manager->GetSystemEventGroupLM(aGroup); -} - nsIScriptContext* nsGlobalWindow::GetContextForEventHandlers(nsresult* aRv) { @@ -7562,7 +7528,7 @@ nsGlobalWindow::DisableDeviceMotionUpdates() } void -nsGlobalWindow::SetChromeEventHandler(nsPIDOMEventTarget* aChromeEventHandler) +nsGlobalWindow::SetChromeEventHandler(nsIDOMEventTarget* aChromeEventHandler) { SetChromeEventHandlerInternal(aChromeEventHandler); if (IsOuterWindow()) { @@ -10035,20 +10001,6 @@ nsGlobalWindow::TimeoutSuspendCount() return mTimeoutsSuspendDepth; } -NS_IMETHODIMP -nsGlobalWindow::GetScriptTypeID(PRUint32 *aScriptType) -{ - NS_ERROR("No default script type here - ask some element"); - return nsIProgrammingLanguage::UNKNOWN; -} - -NS_IMETHODIMP -nsGlobalWindow::SetScriptTypeID(PRUint32 aScriptType) -{ - NS_ERROR("Can't change default script type for a document"); - return NS_ERROR_NOT_IMPLEMENTED; -} - void nsGlobalWindow::SetHasOrientationEventListener() { @@ -10077,6 +10029,14 @@ nsGlobalWindow::HasIndexedDBSupport() return Preferences::GetBool("indexedDB.feature.enabled", PR_TRUE); } +// static +bool +nsGlobalWindow::HasPerformanceSupport() +{ + return Preferences::GetBool("dom.enable_performance", PR_FALSE); +} + + // nsGlobalChromeWindow implementation NS_IMPL_CYCLE_COLLECTION_CLASS(nsGlobalChromeWindow) @@ -10086,6 +10046,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGlobalChromeWindow, NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mMessageManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END + +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsGlobalChromeWindow, + nsGlobalWindow) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mBrowserDOMWindow) + if (tmp->mMessageManager) { + static_cast( + tmp->mMessageManager.get())->Disconnect(); + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mMessageManager) + } +NS_IMPL_CYCLE_COLLECTION_UNLINK_END + DOMCI_DATA(ChromeWindow, nsGlobalChromeWindow) // QueryInterface implementation for nsGlobalChromeWindow diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index cb9d143c369..974eae44bcf 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -63,8 +63,6 @@ #include "nsIDocShellTreeItem.h" #include "nsIDOMClientInformation.h" #include "nsIDOMEventTarget.h" -#include "nsIDOM3EventTarget.h" -#include "nsIDOMNSEventTarget.h" #include "nsIDOMNavigator.h" #include "nsIDOMNavigatorGeolocation.h" #include "nsIDOMNavigatorDesktopNotification.h" @@ -83,7 +81,7 @@ #include "nsPIDOMWindow.h" #include "nsIDOMModalContentWindow.h" #include "nsIScriptSecurityManager.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsIDOMDocument.h" #ifndef MOZ_DISABLE_DOMCRYPTO #include "nsIDOMCrypto.h" @@ -103,7 +101,6 @@ #include "nsIDOMStorageEvent.h" #include "nsIDOMStorageIndexedDB.h" #include "nsIDOMOfflineResourceList.h" -#include "nsPIDOMEventTarget.h" #include "nsIArray.h" #include "nsIContent.h" #include "nsIIDBFactory.h" @@ -137,6 +134,7 @@ class nsLocation; class nsNavigator; class nsScreen; class nsHistory; +class nsPerformance; class nsIDocShellLoadInfo; class WindowStateHolder; class nsGlobalWindowObserver; @@ -275,16 +273,14 @@ class nsGlobalWindow : public nsPIDOMWindow, public nsIDOMJSWindow, public nsIScriptObjectPrincipal, public nsIDOMEventTarget, - public nsPIDOMEventTarget, - public nsIDOM3EventTarget, - public nsIDOMNSEventTarget, public nsIDOMStorageWindow, public nsIDOMStorageIndexedDB, public nsSupportsWeakReference, public nsIInterfaceRequestor, public nsIDOMWindow_2_0_BRANCH, public nsWrapperCache, - public PRCListStr + public PRCListStr, + public nsIDOMWindowPerformance { public: friend class nsDOMMozURLProperty; @@ -326,24 +322,18 @@ public: // nsIDOMWindow NS_DECL_NSIDOMWINDOW - // nsIDOMWindow2 - NS_DECL_NSIDOMWINDOW2 - // nsIDOMWindowInternal NS_DECL_NSIDOMWINDOWINTERNAL + // nsIDOMWindowPerformance + NS_DECL_NSIDOMWINDOWPERFORMANCE + // nsIDOMJSWindow NS_DECL_NSIDOMJSWINDOW // nsIDOMEventTarget NS_DECL_NSIDOMEVENTTARGET - // nsIDOM3EventTarget - NS_DECL_NSIDOM3EVENTTARGET - - // nsIDOMNSEventTarget - NS_DECL_NSIDOMNSEVENTTARGET - // nsIDOMWindow_2_0_BRANCH NS_DECL_NSIDOMWINDOW_2_0_BRANCH @@ -351,7 +341,7 @@ public: virtual NS_HIDDEN_(nsPIDOMWindow*) GetPrivateRoot(); virtual NS_HIDDEN_(void) ActivateOrDeactivate(PRBool aActivate); virtual NS_HIDDEN_(void) SetActive(PRBool aActive); - virtual NS_HIDDEN_(void) SetChromeEventHandler(nsPIDOMEventTarget* aChromeEventHandler); + virtual NS_HIDDEN_(void) SetChromeEventHandler(nsIDOMEventTarget* aChromeEventHandler); virtual NS_HIDDEN_(void) SetOpenerScriptPrincipal(nsIPrincipal* aPrincipal); virtual NS_HIDDEN_(nsIPrincipal*) GetOpenerScriptPrincipal(); @@ -374,29 +364,6 @@ public: virtual NS_HIDDEN_(PRBool) WouldReuseInnerWindow(nsIDocument *aNewDocument); - virtual NS_HIDDEN_(nsPIDOMEventTarget*) GetTargetForDOMEvent() - { - return static_cast(GetOuterWindowInternal()); - } - virtual NS_HIDDEN_(nsPIDOMEventTarget*) GetTargetForEventTargetChain() - { - return IsInnerWindow() ? - this : static_cast(GetCurrentInnerWindowInternal()); - } - virtual NS_HIDDEN_(nsresult) PreHandleEvent(nsEventChainPreVisitor& aVisitor); - virtual NS_HIDDEN_(nsresult) PostHandleEvent(nsEventChainPostVisitor& aVisitor); - virtual NS_HIDDEN_(nsresult) DispatchDOMEvent(nsEvent* aEvent, - nsIDOMEvent* aDOMEvent, - nsPresContext* aPresContext, - nsEventStatus* aEventStatus); - virtual NS_HIDDEN_(nsIEventListenerManager*) GetListenerManager(PRBool aCreateIfNotFound); - virtual NS_HIDDEN_(nsresult) AddEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID); - virtual NS_HIDDEN_(nsresult) RemoveEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID); - virtual NS_HIDDEN_(nsresult) GetSystemEventGroup(nsIDOMEventGroup** aGroup); - virtual NS_HIDDEN_(nsIScriptContext*) GetContextForEventHandlers(nsresult* aRv); - virtual NS_HIDDEN_(void) SetDocShell(nsIDocShell* aDocShell); virtual NS_HIDDEN_(nsresult) SetNewDocument(nsIDocument *aDocument, nsISupports *aState, @@ -569,6 +536,8 @@ public: static bool HasIndexedDBSupport(); + static bool HasPerformanceSupport(); + private: // Enable updates for the accelerometer. void EnableDeviceMotionUpdates(); @@ -903,6 +872,7 @@ protected: nsCOMPtr mArgumentsOrigin; nsRefPtr mNavigator; nsRefPtr mScreen; + nsRefPtr mPerformance; nsRefPtr mFrames; nsRefPtr mMenubar; nsRefPtr mToolbar; @@ -926,7 +896,7 @@ protected: // whether to clear scope // These member variable are used only on inner windows. - nsCOMPtr mListenerManager; + nsRefPtr mListenerManager; PRCList mTimeouts; // If mTimeoutInsertionPoint is non-null, insertions should happen after it. nsTimeout* mTimeoutInsertionPoint; @@ -1026,8 +996,8 @@ public: mCleanMessageManager = PR_FALSE; } - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsGlobalChromeWindow, - nsGlobalWindow) + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGlobalChromeWindow, + nsGlobalWindow) nsCOMPtr mBrowserDOMWindow; nsCOMPtr mMessageManager; diff --git a/dom/base/nsIScriptObjectOwner.h b/dom/base/nsIScriptObjectOwner.h index 4d658214524..dd6943b8860 100644 --- a/dom/base/nsIScriptObjectOwner.h +++ b/dom/base/nsIScriptObjectOwner.h @@ -100,7 +100,7 @@ class nsIAtom; /** * Associate a compiled event handler with its target object, which owns it - * This is an adjunct to nsIScriptObjectOwner that nsIEventListenerManager's + * This is an adjunct to nsIScriptObjectOwner that nsEventListenerManager's * implementation queries for, in order to avoid recompiling a recurrent or * prototype-inherited event handler. */ diff --git a/dom/base/nsJSTimeoutHandler.cpp b/dom/base/nsJSTimeoutHandler.cpp index a7adb74cd63..cca7ec56920 100644 --- a/dom/base/nsJSTimeoutHandler.cpp +++ b/dom/base/nsJSTimeoutHandler.cpp @@ -142,13 +142,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsJSScriptTimeoutHandler) } } } - cb.DescribeNode(RefCounted, tmp->mRefCnt.get(), - sizeof(nsJSScriptTimeoutHandler), foo.get()); + cb.DescribeRefCountedNode(tmp->mRefCnt.get(), + sizeof(nsJSScriptTimeoutHandler), foo.get()); } else { - cb.DescribeNode(RefCounted, tmp->mRefCnt.get(), - sizeof(nsJSScriptTimeoutHandler), - "nsJSScriptTimeoutHandler"); + NS_IMPL_CYCLE_COLLECTION_DESCRIBE(nsJSScriptTimeoutHandler, + tmp->mRefCnt.get()) } NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mContext) diff --git a/dom/base/nsPIDOMWindow.h b/dom/base/nsPIDOMWindow.h index e8f9a4dab88..2868a891f69 100644 --- a/dom/base/nsPIDOMWindow.h +++ b/dom/base/nsPIDOMWindow.h @@ -45,7 +45,7 @@ #include "nsIDOMXULCommandDispatcher.h" #include "nsIDOMElement.h" #include "nsIDOMWindowInternal.h" -#include "nsPIDOMEventTarget.h" +#include "nsIDOMEventTarget.h" #include "nsIDOMDocument.h" #include "nsCOMPtr.h" #include "nsEvent.h" @@ -80,8 +80,8 @@ class nsIArray; class nsPIWindowRoot; #define NS_PIDOMWINDOW_IID \ -{ 0x176e69ce, 0x25d3, 0x4f2a, \ - { 0x9d, 0x99, 0x81, 0xa3, 0x9a, 0xfd, 0xe2, 0xf0 } } +{ 0x6c05ae9d, 0x4ad1, 0x4e92, \ + { 0x9c, 0x95, 0xd3, 0x54, 0xea, 0x0f, 0xb9, 0x48 } } class nsPIDOMWindow : public nsIDOMWindowInternal { @@ -92,7 +92,7 @@ public: virtual void ActivateOrDeactivate(PRBool aActivate) = 0; - // this is called GetTopWindowRoot to avoid conflicts with nsIDOMWindow2::GetWindowRoot + // this is called GetTopWindowRoot to avoid conflicts with nsIDOMWindow::GetWindowRoot virtual already_AddRefed GetTopWindowRoot() = 0; virtual void SetActive(PRBool aActive) @@ -115,14 +115,14 @@ public: return mIsBackground; } - nsPIDOMEventTarget* GetChromeEventHandler() const + nsIDOMEventTarget* GetChromeEventHandler() const { return mChromeEventHandler; } - virtual void SetChromeEventHandler(nsPIDOMEventTarget* aChromeEventHandler) = 0; + virtual void SetChromeEventHandler(nsIDOMEventTarget* aChromeEventHandler) = 0; - nsPIDOMEventTarget* GetParentTarget() + nsIDOMEventTarget* GetParentTarget() { if (!mParentTarget) { UpdateParentTarget(); @@ -588,7 +588,7 @@ protected: ~nsPIDOMWindow(); - void SetChromeEventHandlerInternal(nsPIDOMEventTarget* aChromeEventHandler) { + void SetChromeEventHandlerInternal(nsIDOMEventTarget* aChromeEventHandler) { mChromeEventHandler = aChromeEventHandler; // mParentTarget will be set when the next event is dispatched. mParentTarget = nsnull; @@ -599,10 +599,10 @@ protected: // These two variables are special in that they're set to the same // value on both the outer window and the current inner window. Make // sure you keep them in sync! - nsCOMPtr mChromeEventHandler; // strong + nsCOMPtr mChromeEventHandler; // strong nsCOMPtr mDocument; // strong - nsCOMPtr mParentTarget; // strong + nsCOMPtr mParentTarget; // strong // These members are only used on outer windows. nsCOMPtr mFrameElement; diff --git a/dom/base/nsPIWindowRoot.h b/dom/base/nsPIWindowRoot.h index aed29189b94..b8cfaab8b98 100644 --- a/dom/base/nsPIWindowRoot.h +++ b/dom/base/nsPIWindowRoot.h @@ -41,7 +41,7 @@ #define nsPIWindowRoot_h__ #include "nsISupports.h" -#include "nsPIDOMEventTarget.h" +#include "nsIDOMEventTarget.h" class nsPIDOMWindow; class nsIControllers; @@ -53,7 +53,8 @@ struct JSContext; { 0x426c1b56, 0xe38a, 0x435e, \ { 0xb2, 0x91, 0xbe, 0x15, 0x57, 0xf2, 0xa0, 0xa2 } } -class nsPIWindowRoot : public nsPIDOMEventTarget { +class nsPIWindowRoot : public nsIDOMEventTarget +{ public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWINDOWROOT_IID) @@ -67,8 +68,8 @@ public: nsIController** aResult) = 0; virtual nsresult GetControllers(nsIControllers** aResult) = 0; - virtual void SetParentTarget(nsPIDOMEventTarget* aTarget) = 0; - virtual nsPIDOMEventTarget* GetParentTarget() = 0; + virtual void SetParentTarget(nsIDOMEventTarget* aTarget) = 0; + virtual nsIDOMEventTarget* GetParentTarget() = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsPIWindowRoot, NS_IWINDOWROOT_IID) diff --git a/dom/base/nsPerformance.cpp b/dom/base/nsPerformance.cpp new file mode 100644 index 00000000000..b6b4f7469d7 --- /dev/null +++ b/dom/base/nsPerformance.cpp @@ -0,0 +1,276 @@ +/* -*- 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 implementation of Web Timing draft specification + * http://dev.w3.org/2006/webapi/WebTiming/ + * + * The Initial Developer of the Original Code is Google Inc. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Sergey Novikov (original author) + * Igor Bazarny (update to match bearly-final spec) + * + * 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 ***** */ + +#include "nsPerformance.h" +#include "nsCOMPtr.h" +#include "nscore.h" +#include "nsIDocShell.h" +#include "nsDOMClassInfo.h" +#include "nsDOMNavigationTiming.h" + +DOMCI_DATA(PerformanceTiming, nsPerformanceTiming) + +NS_IMPL_ADDREF(nsPerformanceTiming) +NS_IMPL_RELEASE(nsPerformanceTiming) + +// QueryInterface implementation for nsPerformanceTiming +NS_INTERFACE_MAP_BEGIN(nsPerformanceTiming) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformanceTiming) + NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceTiming) + NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(PerformanceTiming) +NS_INTERFACE_MAP_END + +nsPerformanceTiming::nsPerformanceTiming(nsDOMNavigationTiming* aData) +{ + NS_ASSERTION(aData, "Timing data should be provided"); + mData = aData; +} + +nsPerformanceTiming::~nsPerformanceTiming() +{ +} + +NS_IMETHODIMP +nsPerformanceTiming::GetNavigationStart(DOMTimeMilliSec* aTime) +{ + return mData->GetNavigationStart(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetUnloadEventStart(DOMTimeMilliSec* aTime) +{ + return mData->GetUnloadEventStart(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetUnloadEventEnd(DOMTimeMilliSec* aTime) +{ + return mData->GetUnloadEventEnd(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetRedirectStart(DOMTimeMilliSec* aTime) +{ + return mData->GetRedirectStart(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetRedirectEnd(DOMTimeMilliSec* aTime) +{ + return mData->GetRedirectEnd(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetFetchStart(DOMTimeMilliSec* aTime) +{ + return mData->GetFetchStart(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetDomainLookupStart(DOMTimeMilliSec* aTime) +{ + return mData->GetDomainLookupStart(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetDomainLookupEnd(DOMTimeMilliSec* aTime) +{ + return mData->GetDomainLookupEnd(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetConnectStart(DOMTimeMilliSec* aTime) +{ + return mData->GetConnectStart(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetConnectEnd(DOMTimeMilliSec* aTime) +{ + return mData->GetConnectEnd(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetHandshakeStart(DOMTimeMilliSec* aTime) +{ + return mData->GetHandshakeStart(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetRequestStart(DOMTimeMilliSec* aTime) +{ + return mData->GetRequestStart(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetResponseStart(DOMTimeMilliSec* aTime) +{ + return mData->GetResponseStart(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetResponseEnd(DOMTimeMilliSec* aTime) +{ + return mData->GetResponseEnd(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetDomLoading(DOMTimeMilliSec* aTime) +{ + return mData->GetDomLoading(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetDomInteractive(DOMTimeMilliSec* aTime) +{ + return mData->GetDomInteractive(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetDomContentLoadedEventStart(DOMTimeMilliSec* aTime) +{ + return mData->GetDomContentLoadedEventStart(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetDomContentLoadedEventEnd(DOMTimeMilliSec* aTime) +{ + return mData->GetDomContentLoadedEventEnd(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetDomComplete(DOMTimeMilliSec* aTime) +{ + return mData->GetDomComplete(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetLoadEventStart(DOMTimeMilliSec* aTime) +{ + return mData->GetLoadEventStart(aTime); +} + +NS_IMETHODIMP +nsPerformanceTiming::GetLoadEventEnd(DOMTimeMilliSec* aTime) +{ + return mData->GetLoadEventEnd(aTime); +} + + + +DOMCI_DATA(PerformanceNavigation, nsPerformanceNavigation) + +NS_IMPL_ADDREF(nsPerformanceNavigation) +NS_IMPL_RELEASE(nsPerformanceNavigation) + +// QueryInterface implementation for nsPerformanceNavigation +NS_INTERFACE_MAP_BEGIN(nsPerformanceNavigation) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformanceNavigation) + NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceNavigation) + NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(PerformanceNavigation) +NS_INTERFACE_MAP_END + +nsPerformanceNavigation::nsPerformanceNavigation(nsDOMNavigationTiming* aData) +{ + NS_ASSERTION(aData, "Timing data should be provided"); + mData = aData; +} + +nsPerformanceNavigation::~nsPerformanceNavigation() +{ +} + +NS_IMETHODIMP +nsPerformanceNavigation::GetType( + nsDOMPerformanceNavigationType* aNavigationType) +{ + return mData->GetType(aNavigationType); +} + +NS_IMETHODIMP +nsPerformanceNavigation::GetRedirectCount(PRUint16* aRedirectCount) +{ + return mData->GetRedirectCount(aRedirectCount); +} + + +DOMCI_DATA(Performance, nsPerformance) + +NS_IMPL_ADDREF(nsPerformance) +NS_IMPL_RELEASE(nsPerformance) + +nsPerformance::nsPerformance(nsDOMNavigationTiming* aTiming) +{ + NS_ASSERTION(aTiming, "Timing data should be provided"); + mData = aTiming; +} + +nsPerformance::~nsPerformance() +{ +} + +// QueryInterface implementation for nsPerformance +NS_INTERFACE_MAP_BEGIN(nsPerformance) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformance) + NS_INTERFACE_MAP_ENTRY(nsIDOMPerformance) + NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Performance) +NS_INTERFACE_MAP_END + +// +// nsIDOMPerformance methods +// +NS_IMETHODIMP +nsPerformance::GetTiming(nsIDOMPerformanceTiming** aTiming) +{ + if (!mTiming) { + mTiming = new nsPerformanceTiming(mData); + } + NS_IF_ADDREF(*aTiming = mTiming); + return NS_OK; +} + +NS_IMETHODIMP +nsPerformance::GetNavigation(nsIDOMPerformanceNavigation** aNavigation) +{ + if (!mNavigation) { + mNavigation = new nsPerformanceNavigation(mData); + } + NS_IF_ADDREF(*aNavigation = mNavigation); + return NS_OK; +} diff --git a/dom/base/nsPerformance.h b/dom/base/nsPerformance.h new file mode 100644 index 00000000000..be05f1a3830 --- /dev/null +++ b/dom/base/nsPerformance.h @@ -0,0 +1,95 @@ +/* -*- 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 implementation of Web Timing draft specification + * http://dev.w3.org/2006/webapi/WebTiming/ + * + * The Initial Developer of the Original Code is Google Inc. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Sergey Novikov (original author) + * Igor Bazarny (update to match bearly-final spec) + * + * 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 nsPerformance_h___ +#define nsPerformance_h___ + +#include "nsIDOMPerformance.h" +#include "nsIDOMPerformanceTiming.h" +#include "nsIDOMPerformanceNavigation.h" +#include "nscore.h" +#include "nsCOMPtr.h" +#include "nsAutoPtr.h" + +class nsIDocument; +class nsIURI; +class nsDOMNavigationTiming; + +// Script "performance.timing" object +class nsPerformanceTiming : public nsIDOMPerformanceTiming +{ +public: + nsPerformanceTiming(nsDOMNavigationTiming* data); + NS_DECL_ISUPPORTS + NS_DECL_NSIDOMPERFORMANCETIMING +private: + ~nsPerformanceTiming(); + nsRefPtr mData; +}; + +// Script "performance.navigation" object +class nsPerformanceNavigation : public nsIDOMPerformanceNavigation +{ +public: + nsPerformanceNavigation(nsDOMNavigationTiming* data); + NS_DECL_ISUPPORTS + NS_DECL_NSIDOMPERFORMANCENAVIGATION +private: + ~nsPerformanceNavigation(); + nsRefPtr mData; +}; + +// Script "performance" object +class nsPerformance : public nsIDOMPerformance +{ +public: + nsPerformance(nsDOMNavigationTiming* timing); + + NS_DECL_ISUPPORTS + NS_DECL_NSIDOMPERFORMANCE + +private: + ~nsPerformance(); + + nsRefPtr mData; + nsCOMPtr mTiming; + nsCOMPtr mNavigation; +}; + +#endif /* nsPerformance_h___ */ + diff --git a/dom/base/nsWindowRoot.cpp b/dom/base/nsWindowRoot.cpp index 01ca00228a6..406e8fb2f64 100644 --- a/dom/base/nsWindowRoot.cpp +++ b/dom/base/nsWindowRoot.cpp @@ -43,7 +43,7 @@ #include "nsIDOMWindow.h" #include "nsIDOMDocument.h" #include "nsIDocument.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsPresContext.h" #include "nsLayoutCID.h" #include "nsContentCID.h" @@ -79,40 +79,49 @@ nsWindowRoot::~nsWindowRoot() } } -NS_IMPL_CYCLE_COLLECTION_3(nsWindowRoot, mListenerManager, mPopupNode, - mParent) +NS_IMPL_CYCLE_COLLECTION_CLASS(nsWindowRoot) + +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsWindowRoot) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mListenerManager, + nsEventListenerManager) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPopupNode) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mParent) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END + +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsWindowRoot) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mListenerManager) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mPopupNode) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mParent) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsWindowRoot) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventTarget) - NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget) NS_INTERFACE_MAP_ENTRY(nsPIWindowRoot) NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget) - NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget) - NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget) NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTING_ADDREF(nsWindowRoot) NS_IMPL_CYCLE_COLLECTING_RELEASE(nsWindowRoot) -NS_IMETHODIMP -nsWindowRoot::AddEventListener(const nsAString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) -{ - return AddEventListener(aType, aListener, aUseCapture, PR_FALSE, 1); -} +NS_IMPL_DOMTARGET_DEFAULTS(nsWindowRoot) NS_IMETHODIMP nsWindowRoot::RemoveEventListener(const nsAString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { - return RemoveGroupedEventListener(aType, aListener, aUseCapture, nsnull); + nsRefPtr elm = GetListenerManager(PR_FALSE); + if (elm) { + elm->RemoveEventListener(aType, aListener, aUseCapture); + } + return NS_OK; } NS_IMETHODIMP -nsWindowRoot::DispatchEvent(nsIDOMEvent* aEvt, PRBool *_retval) +nsWindowRoot::DispatchEvent(nsIDOMEvent* aEvt, PRBool *aRetVal) { nsEventStatus status = nsEventStatus_eIgnore; nsresult rv = nsEventDispatcher::DispatchDOMEvent( - static_cast(this), nsnull, aEvt, nsnull, &status); - *_retval = (status != nsEventStatus_eConsumeNoDefault); + static_cast(this), nsnull, aEvt, nsnull, &status); + *aRetVal = (status != nsEventStatus_eConsumeNoDefault); return rv; } @@ -122,72 +131,31 @@ nsWindowRoot::DispatchDOMEvent(nsEvent* aEvent, nsPresContext* aPresContext, nsEventStatus* aEventStatus) { - return nsEventDispatcher::DispatchDOMEvent(static_cast(this), + return nsEventDispatcher::DispatchDOMEvent(static_cast(this), aEvent, aDOMEvent, aPresContext, aEventStatus); } -NS_IMETHODIMP -nsWindowRoot::AddGroupedEventListener(const nsAString & aType, nsIDOMEventListener *aListener, - PRBool aUseCapture, nsIDOMEventGroup *aEvtGrp) -{ - nsCOMPtr manager = GetListenerManager(PR_TRUE); - NS_ENSURE_STATE(manager); - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - return manager->AddEventListenerByType(aListener, aType, flags, aEvtGrp); -} - -NS_IMETHODIMP -nsWindowRoot::RemoveGroupedEventListener(const nsAString & aType, nsIDOMEventListener *aListener, - PRBool aUseCapture, nsIDOMEventGroup *aEvtGrp) -{ - if (mListenerManager) { - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - return mListenerManager->RemoveEventListenerByType(aListener, aType, flags, - aEvtGrp); - } - return NS_OK; -} - -NS_IMETHODIMP -nsWindowRoot::CanTrigger(const nsAString & type, PRBool *_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsWindowRoot::IsRegisteredHere(const nsAString & type, PRBool *_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - NS_IMETHODIMP nsWindowRoot::AddEventListener(const nsAString& aType, nsIDOMEventListener *aListener, PRBool aUseCapture, PRBool aWantsUntrusted, - PRUint8 optional_argc) + PRUint8 aOptionalArgc) { - NS_ASSERTION(!aWantsUntrusted || optional_argc > 1, + NS_ASSERTION(!aWantsUntrusted || aOptionalArgc > 1, "Won't check if this is chrome, you want to set " "aWantsUntrusted to PR_FALSE or make the aWantsUntrusted " "explicit by making optional_argc non-zero."); - nsIEventListenerManager* manager = GetListenerManager(PR_TRUE); - NS_ENSURE_STATE(manager); - - PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; - - if (aWantsUntrusted) { - flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED; - } - - return manager->AddEventListenerByType(aListener, aType, flags, nsnull); + nsEventListenerManager* elm = GetListenerManager(PR_TRUE); + NS_ENSURE_STATE(elm); + return elm->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted); } nsresult nsWindowRoot::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) { - nsIEventListenerManager* manager = GetListenerManager(PR_TRUE); + nsEventListenerManager* manager = GetListenerManager(PR_TRUE); NS_ENSURE_STATE(manager); return manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); } @@ -195,41 +163,31 @@ nsWindowRoot::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& nsresult nsWindowRoot::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) { - nsIEventListenerManager* manager = GetListenerManager(PR_TRUE); + nsEventListenerManager* manager = GetListenerManager(PR_TRUE); if (manager) { - return manager->RemoveEventListenerByIID(aListener, aIID, - NS_EVENT_FLAG_BUBBLE); + manager->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); } return NS_OK; } -nsIEventListenerManager* +nsEventListenerManager* nsWindowRoot::GetListenerManager(PRBool aCreateIfNotFound) { - if (!mListenerManager) { - if (!aCreateIfNotFound) { - return nsnull; - } - - mListenerManager = do_CreateInstance(kEventListenerManagerCID); - if (mListenerManager) { - mListenerManager->SetListenerTarget( - static_cast(this)); - } + if (!mListenerManager && aCreateIfNotFound) { + mListenerManager = + new nsEventListenerManager(static_cast(this)); } return mListenerManager; } -nsresult -nsWindowRoot::GetSystemEventGroup(nsIDOMEventGroup **aGroup) +nsIScriptContext* +nsWindowRoot::GetContextForEventHandlers(nsresult* aRv) { - nsIEventListenerManager* manager = GetListenerManager(PR_TRUE); - NS_ENSURE_STATE(manager); - return manager->GetSystemEventGroupLM(aGroup); + *aRv = NS_OK; + return nsnull; } - nsresult nsWindowRoot::PreHandleEvent(nsEventChainPreVisitor& aVisitor) { @@ -253,20 +211,6 @@ nsWindowRoot::GetWindow() return mWindow; } -NS_IMETHODIMP -nsWindowRoot::GetScriptTypeID(PRUint32 *aScriptType) -{ - NS_ERROR("No default script type here - ask some element"); - return nsIProgrammingLanguage::UNKNOWN; -} - -NS_IMETHODIMP -nsWindowRoot::SetScriptTypeID(PRUint32 aScriptType) -{ - NS_ERROR("Can't change default script type for a document"); - return NS_ERROR_NOT_IMPLEMENTED; -} - nsresult nsWindowRoot::GetControllers(nsIControllers** aResult) { @@ -369,7 +313,7 @@ nsWindowRoot::SetPopupNode(nsIDOMNode* aNode) /////////////////////////////////////////////////////////////////////////////////// nsresult -NS_NewWindowRoot(nsPIDOMWindow* aWindow, nsPIDOMEventTarget** aResult) +NS_NewWindowRoot(nsPIDOMWindow* aWindow, nsIDOMEventTarget** aResult) { *aResult = new nsWindowRoot(aWindow); if (!*aResult) diff --git a/dom/base/nsWindowRoot.h b/dom/base/nsWindowRoot.h index 5a456493c95..b1cb93f0ebb 100644 --- a/dom/base/nsWindowRoot.h +++ b/dom/base/nsWindowRoot.h @@ -42,23 +42,17 @@ class nsPIDOMWindow; class nsIDOMEventListener; -class nsIEventListenerManager; +class nsEventListenerManager; class nsIDOMEvent; class nsEventChainPreVisitor; class nsEventChainPostVisitor; #include "nsIDOMEventTarget.h" -#include "nsIDOM3EventTarget.h" -#include "nsIDOMNSEventTarget.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsPIWindowRoot.h" -#include "nsIDOMEventTarget.h" #include "nsCycleCollectionParticipant.h" -class nsWindowRoot : public nsIDOMEventTarget, - public nsIDOM3EventTarget, - public nsIDOMNSEventTarget, - public nsPIWindowRoot +class nsWindowRoot : public nsPIWindowRoot { public: nsWindowRoot(nsPIDOMWindow* aWindow); @@ -66,26 +60,6 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_NSIDOMEVENTTARGET - NS_DECL_NSIDOM3EVENTTARGET - NS_DECL_NSIDOMNSEVENTTARGET - - virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor); - virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor); - virtual nsresult DispatchDOMEvent(nsEvent* aEvent, - nsIDOMEvent* aDOMEvent, - nsPresContext* aPresContext, - nsEventStatus* aEventStatus); - virtual nsIEventListenerManager* GetListenerManager(PRBool aCreateIfNotFound); - virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID); - virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID); - virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup); - virtual nsIScriptContext* GetContextForEventHandlers(nsresult* aRv) - { - *aRv = NS_OK; - return nsnull; - } // nsPIWindowRoot @@ -98,27 +72,27 @@ public: virtual nsIDOMNode* GetPopupNode(); virtual void SetPopupNode(nsIDOMNode* aNode); - virtual void SetParentTarget(nsPIDOMEventTarget* aTarget) + virtual void SetParentTarget(nsIDOMEventTarget* aTarget) { mParent = aTarget; } - virtual nsPIDOMEventTarget* GetParentTarget() { return mParent; } + virtual nsIDOMEventTarget* GetParentTarget() { return mParent; } NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWindowRoot, nsIDOMEventTarget) protected: // Members nsPIDOMWindow* mWindow; // [Weak]. The window will hold on to us and let go when it dies. - nsCOMPtr mListenerManager; // [Strong]. We own the manager, which owns event listeners attached + nsRefPtr mListenerManager; // [Strong]. We own the manager, which owns event listeners attached // to us. nsCOMPtr mPopupNode; // [OWNER] - nsCOMPtr mParent; + nsCOMPtr mParent; }; extern nsresult NS_NewWindowRoot(nsPIDOMWindow* aWindow, - nsPIDOMEventTarget** aResult); + nsIDOMEventTarget** aResult); #endif diff --git a/dom/indexedDB/IDBCursor.cpp b/dom/indexedDB/IDBCursor.cpp index b8e931a4b95..7e31f1e072f 100644 --- a/dom/indexedDB/IDBCursor.cpp +++ b/dom/indexedDB/IDBCursor.cpp @@ -301,9 +301,9 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(IDBCursor) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(IDBCursor) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mRequest, - nsPIDOMEventTarget) + nsIDOMEventTarget) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mTransaction, - nsPIDOMEventTarget) + nsIDOMEventTarget) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mObjectStore) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mIndex) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOwner) diff --git a/dom/indexedDB/IDBDatabase.cpp b/dom/indexedDB/IDBDatabase.cpp index 376b3582342..bd3f67385e8 100644 --- a/dom/indexedDB/IDBDatabase.cpp +++ b/dom/indexedDB/IDBDatabase.cpp @@ -712,7 +712,7 @@ IDBDatabase::SetVersion(const nsAString& aVersion, NS_ENSURE_TRUE(transaction, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); nsRefPtr request = - IDBVersionChangeRequest::Create(static_cast(this), + IDBVersionChangeRequest::Create(static_cast(this), ScriptContext(), Owner(), transaction); NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); @@ -966,7 +966,7 @@ SetVersionHelper::GetSuccessResult(JSContext* aCx, } info->version = mVersion; - nsresult rv = WrapNative(aCx, NS_ISUPPORTS_CAST(nsPIDOMEventTarget*, + nsresult rv = WrapNative(aCx, NS_ISUPPORTS_CAST(nsIDOMEventTarget*, mTransaction), aVal); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/indexedDB/IDBDatabase.h b/dom/indexedDB/IDBDatabase.h index 0c43d3c4c25..14af825b23b 100644 --- a/dom/indexedDB/IDBDatabase.h +++ b/dom/indexedDB/IDBDatabase.h @@ -80,7 +80,7 @@ public: DatabaseInfo* aDatabaseInfo, const nsACString& aASCIIOrigin); - // nsPIDOMEventTarget + // nsIDOMEventTarget virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor); PRUint32 Id() diff --git a/dom/indexedDB/IDBFactory.cpp b/dom/indexedDB/IDBFactory.cpp index 29d55a7f7ca..00eda87a549 100644 --- a/dom/indexedDB/IDBFactory.cpp +++ b/dom/indexedDB/IDBFactory.cpp @@ -1080,6 +1080,6 @@ OpenDatabaseHelper::GetSuccessResult(JSContext* aCx, return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR; } - return WrapNative(aCx, NS_ISUPPORTS_CAST(nsPIDOMEventTarget*, database), + return WrapNative(aCx, NS_ISUPPORTS_CAST(nsIDOMEventTarget*, database), aVal); } diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index 793f52b970c..6e34ad22529 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -63,6 +63,9 @@ USING_INDEXEDDB_NAMESPACE namespace { +// This is just to give us some random marker in the byte stream +static const PRUint64 kTotallyRandomNumber = LL_INIT(0x286F258B, 0x177D47A9); + class AddHelper : public AsyncConnectionHelper { public: @@ -96,7 +99,6 @@ public: AsyncConnectionHelper::ReleaseMainThreadObjects(); } - nsresult ModifyValueForNewKey(); nsresult UpdateIndexes(mozIStorageConnection* aConnection, PRInt64 aObjectDataId); @@ -840,9 +842,8 @@ IDBObjectStore::DeserializeValue(JSContext* aCx, JSAutoStructuredCloneBuffer& aBuffer, jsval* aValue) { - /* - * This function can be called on multiple threads! Be careful! - */ + NS_ASSERTION(NS_IsMainThread(), + "Should only be deserializing on the main thread!"); NS_ASSERTION(aCx, "A JSContext is required!"); if (!aBuffer.data()) { @@ -861,9 +862,8 @@ IDBObjectStore::SerializeValue(JSContext* aCx, JSAutoStructuredCloneBuffer& aBuffer, jsval aValue) { - /* - * This function can be called on multiple threads! Be careful! - */ + NS_ASSERTION(NS_IsMainThread(), + "Should only be serializing on the main thread!"); NS_ASSERTION(aCx, "A JSContext is required!"); JSAutoRequest ar(aCx); @@ -871,9 +871,62 @@ IDBObjectStore::SerializeValue(JSContext* aCx, return aBuffer.write(aCx, aValue, nsnull); } +static inline jsdouble +SwapBytes(PRUint64 u) +{ +#ifdef IS_BIG_ENDIAN + return ((u & 0x00000000000000ffLLU) << 56) | + ((u & 0x000000000000ff00LLU) << 40) | + ((u & 0x0000000000ff0000LLU) << 24) | + ((u & 0x00000000ff000000LLU) << 8) | + ((u & 0x000000ff00000000LLU) >> 8) | + ((u & 0x0000ff0000000000LLU) >> 24) | + ((u & 0x00ff000000000000LLU) >> 40) | + ((u & 0xff00000000000000LLU) >> 56); +#else + return u; +#endif +} + +nsresult +IDBObjectStore::ModifyValueForNewKey(JSAutoStructuredCloneBuffer& aBuffer, + Key& aKey) +{ + NS_ASSERTION(IsAutoIncrement() && KeyPath().IsEmpty() && aKey.IsInt(), + "Don't call me!"); + NS_ASSERTION(!NS_IsMainThread(), "Wrong thread"); + NS_ASSERTION(mKeyPathSerializationOffset, "How did this happen?"); + + // The minus 8 dangling off the end here is to account for the null entry + // that terminates the buffer + const PRUint32 keyPropLen = mKeyPathSerialization.nbytes() - + mKeyPathSerializationOffset - sizeof(PRUint64); + + const char* location = nsCRT::memmem((char*)aBuffer.data(), + aBuffer.nbytes(), + (char*)mKeyPathSerialization.data() + + mKeyPathSerializationOffset, + keyPropLen); + NS_ASSERTION(location, "How did this happen?"); + + // This is a duplicate of the js engine's byte munging here + union { + jsdouble d; + PRUint64 u; + } pun; + + pun.d = SwapBytes(aKey.IntValue()); + + memcpy(const_cast(location) + keyPropLen - + sizeof(pun.u), // We're overwriting the last 8 bytes + &pun.u, sizeof(PRUint64)); + return NS_OK; +} + IDBObjectStore::IDBObjectStore() : mId(LL_MININT), - mAutoIncrement(PR_FALSE) + mAutoIncrement(PR_FALSE), + mKeyPathSerializationOffset(0) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); } @@ -932,11 +985,47 @@ IDBObjectStore::GetAddInfo(JSContext* aCx, rv = GetIndexUpdateInfo(info, aCx, aValue, aUpdateInfoArray); NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); - if (!IDBObjectStore::SerializeValue(aCx, aCloneBuffer, aValue)) { - return NS_ERROR_DOM_DATA_CLONE_ERR; + const jschar* keyPathChars = + reinterpret_cast(mKeyPath.get()); + const size_t keyPathLen = mKeyPath.Length(); + JSBool ok = JS_FALSE; + + if (!mKeyPath.IsEmpty() && aKey.IsUnset()) { + NS_ASSERTION(mAutoIncrement, "Should have bailed earlier!"); + + jsval key; + ok = JS_NewNumberValue(aCx, kTotallyRandomNumber, &key); + NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); + + ok = JS_DefineUCProperty(aCx, JSVAL_TO_OBJECT(aValue), keyPathChars, + keyPathLen, key, nsnull, nsnull, + JSPROP_ENUMERATE); + NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); + + // From this point on we have to try to remove the property. + rv = EnsureKeyPathSerializationData(aCx); } - return NS_OK; + // We guard on rv being a success because we need to run the property + // deletion code below even if we should not be serializing the value + if (NS_SUCCEEDED(rv) && + !IDBObjectStore::SerializeValue(aCx, aCloneBuffer, aValue)) { + rv = NS_ERROR_DOM_DATA_CLONE_ERR; + } + + if (ok) { + // If this fails, we lose, and the web page sees a magical property + // appear on the object :-( + jsval succeeded; + ok = JS_DeleteUCProperty2(aCx, JSVAL_TO_OBJECT(aValue), keyPathChars, + keyPathLen, &succeeded); + NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); + NS_ASSERTION(JSVAL_IS_BOOLEAN(succeeded), "Wtf?"); + NS_ENSURE_TRUE(JSVAL_TO_BOOLEAN(succeeded), + NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); + } + + return rv; } nsresult @@ -987,11 +1076,51 @@ IDBObjectStore::AddOrPut(const jsval& aValue, return NS_OK; } +nsresult +IDBObjectStore::EnsureKeyPathSerializationData(JSContext* aCx) +{ + NS_ASSERTION(NS_IsMainThread(), "Wrong thread"); + + if (!mKeyPathSerializationOffset) { + JSBool ok; + + JSAutoStructuredCloneBuffer emptyObjectBuffer; + JSAutoStructuredCloneBuffer fakeObjectBuffer; + + const jschar* keyPathChars = + reinterpret_cast(mKeyPath.get()); + const size_t keyPathLen = mKeyPath.Length(); + + JSObject* object = JS_NewObject(aCx, nsnull, nsnull, nsnull); + NS_ENSURE_TRUE(object, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); + + ok = emptyObjectBuffer.write(aCx, OBJECT_TO_JSVAL(object)); + NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); + + jsval key; + // This is just to give us some random marker in the byte stream + ok = JS_NewNumberValue(aCx, kTotallyRandomNumber, &key); + NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); + + ok = JS_DefineUCProperty(aCx, object, keyPathChars, keyPathLen, + key, nsnull, nsnull, JSPROP_ENUMERATE); + NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); + + ok = fakeObjectBuffer.write(aCx, OBJECT_TO_JSVAL(object)); + NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); + + mKeyPathSerialization.swap(fakeObjectBuffer); + mKeyPathSerializationOffset = emptyObjectBuffer.nbytes(); + } + + return NS_OK; +} + NS_IMPL_CYCLE_COLLECTION_CLASS(IDBObjectStore) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(IDBObjectStore) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mTransaction, - nsPIDOMEventTarget) + nsIDOMEventTarget) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOwner) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptContext) @@ -1721,7 +1850,7 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection) // Special case where someone put an object into an autoIncrement'ing // objectStore with no key in its keyPath set. We needed to figure out // which row id we would get above before we could set that properly. - rv = ModifyValueForNewKey(); + rv = mObjectStore->ModifyValueForNewKey(mCloneBuffer, mKey); NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); scoper.Abandon(); @@ -1777,58 +1906,6 @@ AddHelper::GetSuccessResult(JSContext* aCx, return IDBObjectStore::GetJSValFromKey(mKey, aCx, aVal); } -nsresult -AddHelper::ModifyValueForNewKey() -{ - NS_ASSERTION(mObjectStore->IsAutoIncrement() && - !mObjectStore->KeyPath().IsEmpty() && - mKey.IsInt(), - "Don't call me!"); - - const nsString& keyPath = mObjectStore->KeyPath(); - - JSContext* cx = nsnull; - nsresult rv = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&cx); - NS_ENSURE_SUCCESS(rv, rv); - - JSAutoRequest ar(cx); - - jsval clone; - if (!IDBObjectStore::DeserializeValue(cx, mCloneBuffer, &clone)) { - return NS_ERROR_DOM_DATA_CLONE_ERR; - } - - NS_ASSERTION(!JSVAL_IS_PRIMITIVE(clone), "We should have an object!"); - - JSObject* obj = JSVAL_TO_OBJECT(clone); - JSBool ok; - - const jschar* keyPathChars = reinterpret_cast(keyPath.get()); - const size_t keyPathLen = keyPath.Length(); - -#ifdef DEBUG - { - jsval prop; - ok = JS_GetUCProperty(cx, obj, keyPathChars, keyPathLen, &prop); - NS_ASSERTION(ok && JSVAL_IS_VOID(prop), "Already has a key prop!"); - } -#endif - - jsval key; - ok = JS_NewNumberValue(cx, mKey.IntValue(), &key); - NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE); - - ok = JS_DefineUCProperty(cx, obj, keyPathChars, keyPathLen, key, nsnull, - nsnull, JSPROP_ENUMERATE); - NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE); - - if (!IDBObjectStore::SerializeValue(cx, mCloneBuffer, OBJECT_TO_JSVAL(obj))) { - return NS_ERROR_DOM_DATA_CLONE_ERR; - } - - return NS_OK; -} - nsresult GetHelper::DoDatabaseWork(mozIStorageConnection* aConnection) { diff --git a/dom/indexedDB/IDBObjectStore.h b/dom/indexedDB/IDBObjectStore.h index cbbaeeb0de9..50ee4c539db 100644 --- a/dom/indexedDB/IDBObjectStore.h +++ b/dom/indexedDB/IDBObjectStore.h @@ -157,6 +157,9 @@ public: return mTransaction; } + nsresult ModifyValueForNewKey(JSAutoStructuredCloneBuffer& aBuffer, + Key& aKey); + protected: IDBObjectStore(); ~IDBObjectStore(); @@ -175,6 +178,8 @@ protected: nsIIDBRequest** _retval, bool aOverwrite); + nsresult EnsureKeyPathSerializationData(JSContext* aCx); + private: nsRefPtr mTransaction; @@ -188,6 +193,11 @@ private: PRUint32 mDatabaseId; PRUint32 mStructuredCloneVersion; + // Used to store a serialized representation of the fake property + // entry used to handle autoincrement with keypaths. + JSAutoStructuredCloneBuffer mKeyPathSerialization; + PRUint32 mKeyPathSerializationOffset; + nsTArray > mCreatedIndexes; }; diff --git a/dom/indexedDB/IDBRequest.h b/dom/indexedDB/IDBRequest.h index a6594f2891e..5bd0a354370 100644 --- a/dom/indexedDB/IDBRequest.h +++ b/dom/indexedDB/IDBRequest.h @@ -72,7 +72,7 @@ public: nsPIDOMWindow* aOwner, IDBTransaction* aTransaction); - // nsPIDOMEventTarget + // nsIDOMEventTarget virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor); nsISupports* Source() diff --git a/dom/indexedDB/IDBTransaction.cpp b/dom/indexedDB/IDBTransaction.cpp index 0817b75b154..46ade9ee89a 100644 --- a/dom/indexedDB/IDBTransaction.cpp +++ b/dom/indexedDB/IDBTransaction.cpp @@ -104,7 +104,7 @@ IDBTransaction::Create(IDBDatabase* aDatabase, } if (!aDispatchDelayed) { - nsCOMPtr thread = + nsCOMPtr thread = do_QueryInterface(NS_GetCurrentThread()); NS_ENSURE_TRUE(thread, nsnull); @@ -628,7 +628,7 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(IDBTransaction) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(IDBTransaction, nsDOMEventTargetHelper) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mDatabase, - nsPIDOMEventTarget) + nsIDOMEventTarget) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnErrorListener) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnCompleteListener) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnAbortListener) @@ -899,10 +899,7 @@ IDBTransaction::AfterProcessNextEvent(nsIThreadInternal* aThread, } // No longer need to observe thread events. - nsCOMPtr thread = do_QueryInterface(aThread); - NS_ASSERTION(thread, "This must never fail!"); - - if(NS_FAILED(thread->RemoveObserver(this))) { + if(NS_FAILED(aThread->RemoveObserver(this))) { NS_ERROR("Failed to remove observer!"); } } diff --git a/dom/indexedDB/IDBTransaction.h b/dom/indexedDB/IDBTransaction.h index 5030d607663..ff59ca1615d 100644 --- a/dom/indexedDB/IDBTransaction.h +++ b/dom/indexedDB/IDBTransaction.h @@ -89,7 +89,7 @@ public: PRUint32 aTimeout, bool aDispatchDelayed = false); - // nsPIDOMEventTarget + // nsIDOMEventTarget virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor); void OnNewRequest(); diff --git a/dom/interfaces/base/Makefile.in b/dom/interfaces/base/Makefile.in index 59541c52b8b..5d438f150d9 100644 --- a/dom/interfaces/base/Makefile.in +++ b/dom/interfaces/base/Makefile.in @@ -50,7 +50,6 @@ SDK_XPIDLSRCS = \ domstubs.idl \ nsIDOMBarProp.idl \ nsIDOMWindow.idl \ - nsIDOMWindow2.idl \ nsIDOMWindowCollection.idl \ nsIDOMWindowUtils.idl \ $(NULL) @@ -87,6 +86,9 @@ XPIDLSRCS = \ nsITabParent.idl \ nsIDOMGlobalPropertyInitializer.idl \ nsIStructuredCloneContainer.idl \ + nsIDOMPerformance.idl \ + nsIDOMPerformanceTiming.idl \ + nsIDOMPerformanceNavigation.idl \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/dom/interfaces/base/domstubs.idl b/dom/interfaces/base/domstubs.idl index ca3cbeafc86..3eb531dd131 100644 --- a/dom/interfaces/base/domstubs.idl +++ b/dom/interfaces/base/domstubs.idl @@ -40,6 +40,7 @@ #include "nsISupports.idl" typedef unsigned long long DOMTimeStamp; +typedef unsigned long long DOMTimeMilliSec; // Core interface nsIDOMAttr; @@ -90,7 +91,6 @@ interface nsIDOMHistory; interface nsIDOMEvent; interface nsIDOMEventTarget; interface nsIDOMEventListener; -interface nsIDOMEventGroup; // HTML interface nsIDOMHTMLElement; diff --git a/dom/interfaces/events/nsIDOMEventGroup.idl b/dom/interfaces/base/nsIDOMPerformance.idl similarity index 72% rename from dom/interfaces/events/nsIDOMEventGroup.idl rename to dom/interfaces/base/nsIDOMPerformance.idl index e9e7c5d782a..242f26fd394 100644 --- a/dom/interfaces/events/nsIDOMEventGroup.idl +++ b/dom/interfaces/base/nsIDOMPerformance.idl @@ -12,15 +12,16 @@ * for the specific language governing rights and limitations under the * License. * - * The Original Code is mozilla.org code. + * The Original Code is implementation of Web Timing draft specification + * http://dev.w3.org/2006/webapi/WebTiming/ * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2000 + * The Initial Developer of the Original Code is Google Inc. + * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Tom Pixley (original author) + * Sergey Novikov (original author) + * Igor Bazarny (update to match nearly-final spec) * * 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"), @@ -36,19 +37,14 @@ * * ***** END LICENSE BLOCK ***** */ -#include "domstubs.idl" +#include "nsISupports.idl" +interface nsIDOMPerformanceTiming; +interface nsIDOMPerformanceNavigation; -/** - * The nsIDOMEventTarget interface is the interface implemented by all - * event targets in the Document Object Model. - * - * For more information on this interface please see - * http://www.w3.org/TR/DOM-Level-3-Events/ - */ - -[scriptable, uuid(33347bee-6620-4841-8152-36091ae80c7e)] -interface nsIDOMEventGroup : nsISupports +[scriptable, uuid(446faf26-000b-4e66-a5fd-ae37c5ed6beb)] +interface nsIDOMPerformance : nsISupports { - // Introduced in DOM Level 3: - boolean isSameEventGroup(in nsIDOMEventGroup other); + readonly attribute nsIDOMPerformanceTiming timing; + readonly attribute nsIDOMPerformanceNavigation navigation; }; + diff --git a/dom/interfaces/base/nsIDOMWindow2.idl b/dom/interfaces/base/nsIDOMPerformanceNavigation.idl similarity index 65% rename from dom/interfaces/base/nsIDOMWindow2.idl rename to dom/interfaces/base/nsIDOMPerformanceNavigation.idl index a69d0ae8816..7cb62ff9410 100644 --- a/dom/interfaces/base/nsIDOMWindow2.idl +++ b/dom/interfaces/base/nsIDOMPerformanceNavigation.idl @@ -12,14 +12,16 @@ * for the specific language governing rights and limitations under the * License. * - * The Original Code is mozilla.org code. + * The Original Code is implementation of Web Timing draft specification + * http://dev.w3.org/2006/webapi/WebTiming/ * - * The Initial Developer of the Original Code is - * Marco Pesenti Gritti - * Portions created by the Initial Developer are Copyright (C) 2004 + * The Initial Developer of the Original Code is Google Inc. + * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Sergey Novikov (original author) + * Igor Bazarny (update to match nearly-final spec) * * 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"), @@ -35,29 +37,19 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMWindow.idl" +#include "domstubs.idl" -interface nsIDOMOfflineResourceList; -interface nsIDOMBlob; +typedef unsigned short nsDOMPerformanceNavigationType; -[scriptable, uuid(e2796e00-14de-4ce0-acfe-0374bc0e715d)] -interface nsIDOMWindow2 : nsIDOMWindow +[scriptable, uuid(a2132ad8-a841-4285-a140-338e8de6c2e0)] +interface nsIDOMPerformanceNavigation : nsISupports { - /** - * Get the window root for this window. This is useful for hooking - * up event listeners to this window and every other window nested - * in the window root. - */ - [noscript] readonly attribute nsIDOMEventTarget windowRoot; + const nsDOMPerformanceNavigationType TYPE_NAVIGATE = 0; + const nsDOMPerformanceNavigationType TYPE_RELOAD = 1; + const nsDOMPerformanceNavigationType TYPE_BACK_FORWARD = 2; + const nsDOMPerformanceNavigationType TYPE_RESERVED = 255; - /** - * Get the application cache object for this window. - */ - readonly attribute nsIDOMOfflineResourceList applicationCache; - - /** - * Deprecated, but can't remove yet since we don't want to change interfaces. - */ - [noscript] DOMString createBlobURL(in nsIDOMBlob blob); - [noscript] void revokeBlobURL(in DOMString URL); + readonly attribute nsDOMPerformanceNavigationType type; + readonly attribute unsigned short redirectCount; }; + diff --git a/dom/interfaces/events/nsIDOM3EventTarget.idl b/dom/interfaces/base/nsIDOMPerformanceTiming.idl similarity index 52% rename from dom/interfaces/events/nsIDOM3EventTarget.idl rename to dom/interfaces/base/nsIDOMPerformanceTiming.idl index 1160a4eb4ff..d037797ed59 100644 --- a/dom/interfaces/events/nsIDOM3EventTarget.idl +++ b/dom/interfaces/base/nsIDOMPerformanceTiming.idl @@ -12,15 +12,16 @@ * for the specific language governing rights and limitations under the * License. * - * The Original Code is mozilla.org code. + * The Original Code is implementation of Web Timing draft specification + * http://dev.w3.org/2006/webapi/WebTiming/ * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2000 + * The Initial Developer of the Original Code is Google Inc. + * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Tom Pixley (original author) + * Sergey Novikov (original author) + * Igor Bazarny (update to match nearly-final spec) * * 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"), @@ -38,29 +39,29 @@ #include "domstubs.idl" -/** - * The nsIDOMEventTarget interface is the interface implemented by all - * event targets in the Document Object Model. - * - * For more information on this interface please see - * http://www.w3.org/TR/DOM-Level-3-Events/ - */ - -[scriptable, uuid(3e9c01a7-de97-4c3b-8294-b4bd9d7056d1)] -interface nsIDOM3EventTarget : nsISupports +[scriptable, uuid(2a630b50-61b6-41b3-996d-70be67fbbcb0)] +interface nsIDOMPerformanceTiming : nsISupports { - // Introduced in DOM Level 3: - void addGroupedEventListener(in DOMString type, - in nsIDOMEventListener listener, - in boolean useCapture, - in nsIDOMEventGroup evtGroup); - // Introduced in DOM Level 3: - void removeGroupedEventListener(in DOMString type, - in nsIDOMEventListener listener, - in boolean useCapture, - in nsIDOMEventGroup evtGroup); - // Introduced in DOM Level 3: - boolean canTrigger(in DOMString type); - // Introduced in DOM Level 3: - boolean isRegisteredHere(in DOMString type); + readonly attribute DOMTimeMilliSec navigationStart; + readonly attribute DOMTimeMilliSec unloadEventStart; + readonly attribute DOMTimeMilliSec unloadEventEnd; + readonly attribute DOMTimeMilliSec redirectStart; + readonly attribute DOMTimeMilliSec redirectEnd; + readonly attribute DOMTimeMilliSec fetchStart; + readonly attribute DOMTimeMilliSec domainLookupStart; + readonly attribute DOMTimeMilliSec domainLookupEnd; + readonly attribute DOMTimeMilliSec connectStart; + readonly attribute DOMTimeMilliSec connectEnd; + readonly attribute DOMTimeMilliSec handshakeStart; + readonly attribute DOMTimeMilliSec requestStart; + readonly attribute DOMTimeMilliSec responseStart; + readonly attribute DOMTimeMilliSec responseEnd; + readonly attribute DOMTimeMilliSec domLoading; + readonly attribute DOMTimeMilliSec domInteractive; + readonly attribute DOMTimeMilliSec domContentLoadedEventStart; + readonly attribute DOMTimeMilliSec domContentLoadedEventEnd; + readonly attribute DOMTimeMilliSec domComplete; + readonly attribute DOMTimeMilliSec loadEventStart; + readonly attribute DOMTimeMilliSec loadEventEnd; }; + diff --git a/dom/interfaces/base/nsIDOMWindow.idl b/dom/interfaces/base/nsIDOMWindow.idl index ec0414e0570..fcd7aaadc0f 100644 --- a/dom/interfaces/base/nsIDOMWindow.idl +++ b/dom/interfaces/base/nsIDOMWindow.idl @@ -39,6 +39,7 @@ #include "domstubs.idl" +interface nsIDOMOfflineResourceList; interface nsISelection; /** @@ -50,7 +51,7 @@ interface nsISelection; * @see */ -[scriptable, uuid(ff7d278f-93db-4078-b89a-058c8e1270b4)] +[scriptable, uuid(90fec5b7-c58b-463f-a147-f91b6b104a96)] interface nsIDOMWindow : nsISupports { /** @@ -59,11 +60,19 @@ interface nsIDOMWindow : nsISupports readonly attribute nsIDOMDocument document; /** - * Accessor for this window's parent window, or the window itself if - * there is no parent, or if the parent is of different type - * (i.e. this does not cross chrome-content boundaries). + * Set/Get the name of this window. + * + * This attribute is "replaceable" in JavaScript */ - readonly attribute nsIDOMWindow parent; + attribute DOMString name; + + /** + * Accessor for the object that controls whether or not scrollbars + * are shown in this window. + * + * This attribute is "replaceable" in JavaScript + */ + readonly attribute nsIDOMBarProp scrollbars; /** * Accessor for the root of this hierarchy of windows. This root may @@ -75,34 +84,19 @@ interface nsIDOMWindow : nsISupports readonly attribute nsIDOMWindow top; /** - * Accessor for the object that controls whether or not scrollbars - * are shown in this window. - * - * This attribute is "replaceable" in JavaScript + * Accessor for this window's parent window, or the window itself if + * there is no parent, or if the parent is of different type + * (i.e. this does not cross chrome-content boundaries). */ - readonly attribute nsIDOMBarProp scrollbars; + readonly attribute nsIDOMWindow parent; /** - * Accessor for the child windows in this window. + * Get the application cache object for this window. */ - [noscript] readonly attribute nsIDOMWindowCollection frames; + readonly attribute nsIDOMOfflineResourceList applicationCache; - /** - * Set/Get the name of this window. - * - * This attribute is "replaceable" in JavaScript - */ - attribute DOMString name; - /** - * Set/Get the document scale factor as a multiplier on the default - * size. When setting this attribute, a NS_ERROR_NOT_IMPLEMENTED - * error may be returned by implementations not supporting - * zoom. Implementations not supporting zoom should return 1.0 all - * the time for the Get operation. 1.0 is equals normal size, - * i.e. no zoom. - */ - [noscript] attribute float textZoom; + // CSSOM-View /** * Accessor for the current x scroll position in this window in * pixels. @@ -130,11 +124,45 @@ interface nsIDOMWindow : nsISupports */ void scrollBy(in long xScrollDif, in long yScrollDif); + + // DOM Range /** * Method for accessing this window's selection object. */ nsISelection getSelection(); + + // CSSOM + /** + * @see + */ + nsIDOMCSSStyleDeclaration getComputedStyle(in nsIDOMElement elt, + [optional] in DOMString pseudoElt); + + + // Mozilla extensions + /** + * Get the window root for this window. This is useful for hooking + * up event listeners to this window and every other window nested + * in the window root. + */ + [noscript] readonly attribute nsIDOMEventTarget windowRoot; + + /** + * Accessor for the child windows in this window. + */ + [noscript] readonly attribute nsIDOMWindowCollection frames; + + /** + * Set/Get the document scale factor as a multiplier on the default + * size. When setting this attribute, a NS_ERROR_NOT_IMPLEMENTED + * error may be returned by implementations not supporting + * zoom. Implementations not supporting zoom should return 1.0 all + * the time for the Get operation. 1.0 is equals normal size, + * i.e. no zoom. + */ + [noscript] attribute float textZoom; + /** * Method for scrolling this window by a number of lines. */ @@ -149,10 +177,4 @@ interface nsIDOMWindow : nsISupports * Method for sizing this window to the content in the window. */ void sizeToContent(); - - /** - * @see - */ - nsIDOMCSSStyleDeclaration getComputedStyle(in nsIDOMElement elt, - [optional] in DOMString pseudoElt); }; diff --git a/dom/interfaces/base/nsIDOMWindowInternal.idl b/dom/interfaces/base/nsIDOMWindowInternal.idl index 4fff38d2457..dd0a325cbf2 100644 --- a/dom/interfaces/base/nsIDOMWindowInternal.idl +++ b/dom/interfaces/base/nsIDOMWindowInternal.idl @@ -37,7 +37,7 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMWindow2.idl" +#include "nsIDOMWindow.idl" %{ C++ #include "jspubtd.h" @@ -46,12 +46,14 @@ interface nsIPrompt; interface nsIControllers; interface nsIDOMLocation; +interface nsIDOMPerformance; interface nsIVariant; interface nsIAnimationFrameListener; interface nsIDOMMediaQueryList; +interface nsIDOMBlob; -[scriptable, uuid(3a7b0839-b9d6-42ff-8ba6-910aba60a966)] -interface nsIDOMWindowInternal : nsIDOMWindow2 +[scriptable, uuid(9d96565f-2064-4d2f-b0e0-6f67a1fad89c)] +interface nsIDOMWindowInternal : nsIDOMWindow { readonly attribute nsIDOMWindowInternal window; @@ -256,3 +258,13 @@ interface nsIDOMWindow_2_0_BRANCH : nsISupports { readonly attribute nsIDOMMozURLProperty URL; }; + +[scriptable, uuid(2146c906-57f7-486c-a1b4-8cdb57ef577f)] +interface nsIDOMWindowPerformance : nsISupports +{ + /** + * A namespace to hold performance related data and statistics. + */ + readonly attribute nsIDOMPerformance performance; +}; + diff --git a/dom/interfaces/core/Makefile.in b/dom/interfaces/core/Makefile.in index 09e14ceb7cb..a1330a1c28e 100644 --- a/dom/interfaces/core/Makefile.in +++ b/dom/interfaces/core/Makefile.in @@ -64,7 +64,6 @@ SDK_XPIDLSRCS = \ nsIDOMText.idl \ $(NULL) XPIDLSRCS = \ - nsIDOM3Attr.idl \ nsIDOMDOMStringList.idl \ nsIDOMNameList.idl \ nsIDOMXMLDocument.idl \ diff --git a/dom/interfaces/core/nsIDOM3Attr.idl b/dom/interfaces/core/nsIDOM3Attr.idl deleted file mode 100644 index 3a4d99b1ee0..00000000000 --- a/dom/interfaces/core/nsIDOM3Attr.idl +++ /dev/null @@ -1,44 +0,0 @@ -/* ***** 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 - * Alexander J. Vincent . - * 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 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 ***** */ - -#include "domstubs.idl" - -[scriptable, uuid(dc3ac0ee-9afb-4d1e-a49c-f5042e5bcf65)] -interface nsIDOM3Attr : nsISupports -{ - // Introduced in DOM Level 3: - readonly attribute boolean isId; -}; diff --git a/dom/interfaces/core/nsIDOMAttr.idl b/dom/interfaces/core/nsIDOMAttr.idl index 5525721281b..a95f1a3a57e 100644 --- a/dom/interfaces/core/nsIDOMAttr.idl +++ b/dom/interfaces/core/nsIDOMAttr.idl @@ -48,7 +48,7 @@ * http://www.w3.org/TR/DOM-Level-2-Core/ */ -[scriptable, uuid(669a0f55-1e5d-4471-8de9-a6c6774354dd)] +[scriptable, uuid(6bdedbc5-681e-4570-a3dc-3685ed8d6e1e)] interface nsIDOMAttr : nsIDOMNode { readonly attribute DOMString name; @@ -58,4 +58,6 @@ interface nsIDOMAttr : nsIDOMNode // Introduced in DOM Level 2: readonly attribute nsIDOMElement ownerElement; + + readonly attribute boolean isId; }; diff --git a/dom/interfaces/css/Makefile.in b/dom/interfaces/css/Makefile.in index ff95037f28f..51de5216622 100644 --- a/dom/interfaces/css/Makefile.in +++ b/dom/interfaces/css/Makefile.in @@ -64,6 +64,8 @@ XPIDLSRCS = \ nsIDOMCSSImportRule.idl \ nsIDOMCSSMediaRule.idl \ nsIDOMCSSMozDocumentRule.idl \ + nsIDOMMozCSSKeyframeRule.idl \ + nsIDOMMozCSSKeyframesRule.idl \ nsIDOMCSSPageRule.idl \ nsIDOMCSSStyleRule.idl \ nsIDOMCSSUnknownRule.idl \ @@ -73,11 +75,4 @@ XPIDLSRCS = \ nsIDOMNSRGBAColor.idl \ $(NULL) -ifdef MOZ_CSS_ANIMATIONS -XPIDLSRCS += \ - nsIDOMMozCSSKeyframeRule.idl \ - nsIDOMMozCSSKeyframesRule.idl \ - $(NULL) -endif - include $(topsrcdir)/config/rules.mk diff --git a/dom/interfaces/css/nsIDOMCSS2Properties.idl b/dom/interfaces/css/nsIDOMCSS2Properties.idl index 3dae2f2dd3d..0c386bf3a32 100644 --- a/dom/interfaces/css/nsIDOMCSS2Properties.idl +++ b/dom/interfaces/css/nsIDOMCSS2Properties.idl @@ -24,6 +24,7 @@ * Johnny Stenback * Jonathon Jongsma , Collabora Ltd. * Robert Longson + * Mats Palmgren * * 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"), @@ -50,7 +51,7 @@ * http://www.w3.org/TR/DOM-Level-2-Style */ -[scriptable, uuid(249755DF-EEFE-4AF4-8127-BE3D6BDAED2D)] +[scriptable, uuid(7cf11a5f-4be5-4e31-b427-58d82746b5f5)] interface nsIDOMCSS2Properties : nsISupports { attribute DOMString background; @@ -344,6 +345,9 @@ interface nsIDOMCSS2Properties : nsISupports attribute DOMString textIndent; // raises(DOMException) on setting + attribute DOMString textOverflow; + // raises(DOMException) on setting + attribute DOMString textShadow; // raises(DOMException) on setting diff --git a/dom/interfaces/events/Makefile.in b/dom/interfaces/events/Makefile.in index 13610fd34ab..ea2da8890d2 100644 --- a/dom/interfaces/events/Makefile.in +++ b/dom/interfaces/events/Makefile.in @@ -50,8 +50,6 @@ SDK_XPIDLSRCS = \ nsIDOMEvent.idl \ nsIDOMEventTarget.idl \ nsIDOMEventListener.idl \ - nsIDOM3EventTarget.idl \ - nsIDOMEventGroup.idl \ nsIDOMMouseEvent.idl \ nsIDOMMouseScrollEvent.idl \ nsIDOMUIEvent.idl \ @@ -68,7 +66,6 @@ XPIDLSRCS = \ nsIDOMDataTransfer.idl \ nsIDOMPopupBlockedEvent.idl \ nsIDOMBeforeUnloadEvent.idl \ - nsIDOMNSEventTarget.idl \ nsIDOMSmartCardEvent.idl \ nsIDOMPageTransitionEvent.idl \ nsIDOMCommandEvent.idl \ @@ -84,6 +81,7 @@ XPIDLSRCS = \ nsIDOMDeviceMotionEvent.idl \ nsIDOMScrollAreaEvent.idl \ nsIDOMTransitionEvent.idl \ + nsIDOMAnimationEvent.idl \ nsIDOMPopStateEvent.idl \ nsIDOMCloseEvent.idl \ nsIDOMEventException.idl \ @@ -92,10 +90,4 @@ XPIDLSRCS = \ nsIDOMCustomEvent.idl \ $(NULL) -ifdef MOZ_CSS_ANIMATIONS -XPIDLSRCS += \ - nsIDOMAnimationEvent.idl \ - $(NULL) -endif - include $(topsrcdir)/config/rules.mk diff --git a/dom/interfaces/events/nsIDOMEventTarget.idl b/dom/interfaces/events/nsIDOMEventTarget.idl index 3d7f3e240e6..211d7f1a1c7 100644 --- a/dom/interfaces/events/nsIDOMEventTarget.idl +++ b/dom/interfaces/events/nsIDOMEventTarget.idl @@ -39,6 +39,16 @@ #include "domstubs.idl" +%{C++ +#include "nsEvent.h" + +class nsPresContext; +class nsEventChainPreVisitor; +class nsEventChainPostVisitor; +struct JSContext; +class nsEventListenerManager; +%} + /** * The nsIDOMEventTarget interface is the interface implemented by all * event targets in the Document Object Model. @@ -47,7 +57,19 @@ * http://www.w3.org/TR/DOM-Level-2-Events/ */ -[scriptable, uuid(1c773b30-d1cf-11d2-bd95-00805f8ae3f4)] +[ref] native nsEventChainPreVisitorRef(nsEventChainPreVisitor); +[ref] native nsEventChainPostVisitorRef(nsEventChainPostVisitor); +[ptr] native nsEventPtr(nsEvent); +[ptr] native nsPresContextPtr(nsPresContext); +[ptr] native nsEventStatusPtr(nsEventStatus); +[ptr] native JSContextPtr(JSContext); +[ptr] native nsEventListenerManagerPtr(nsEventListenerManager); + +interface nsIScriptContext; +interface nsIDOMEventListener; +interface nsIDOMEvent; + +[scriptable, builtinclass, uuid(1797d5a4-b12a-428d-9eef-a0e13839728c)] interface nsIDOMEventTarget : nsISupports { /** @@ -74,10 +96,25 @@ interface nsIDOMEventTarget : nsISupports * in the tree. Events which are bubbling upward * through the tree will not trigger an * EventListener designated to use capture. + * @param wantsUntrusted If false, the listener will not receive any + * untrusted events (see above), if true, the + * listener will receive events whether or not + * they're trusted */ - [noscript] void addEventListener(in DOMString type, - in nsIDOMEventListener listener, - in boolean useCapture); + [optional_argc] void addEventListener(in DOMString type, + in nsIDOMEventListener listener, + [optional] in boolean useCapture, + [optional] in boolean wantsUntrusted); + +%{C++ + // non-virtual so it won't affect the vtable + nsresult AddEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) + { + return AddEventListener(aType, aListener, aUseCapture, PR_FALSE, 1); + } +%} /** * This method allows the removal of event listeners from the event @@ -123,4 +160,127 @@ interface nsIDOMEventTarget : nsISupports */ boolean dispatchEvent(in nsIDOMEvent evt) raises(DOMException); + + /** + * Returns the nsPIDOMEventTarget object which should be used as the target + * of DOMEvents. + * Usually |this| is returned, but for example global object returns + * the outer object. + */ + [notxpcom, nostdcall] nsIDOMEventTarget GetTargetForDOMEvent(); + + /** + * Returns the nsPIDOMEventTarget object which should be used as the target + * of the event and when constructing event target chain. + * Usually |this| is returned, but for example global object returns + * the inner object. + */ + [notxpcom, nostdcall] nsIDOMEventTarget GetTargetForEventTargetChain(); + + /** + * Called before the capture phase of the event flow. + * This is used to create the event target chain and implementations + * should set the necessary members of nsEventChainPreVisitor. + * At least aVisitor.mCanHandle must be set, + * usually also aVisitor.mParentTarget if mCanHandle is PR_TRUE. + * First one tells that this object can handle the aVisitor.mEvent event and + * the latter one is the possible parent object for the event target chain. + * @see nsEventDispatcher.h for more documentation about aVisitor. + * + * @param aVisitor the visitor object which is used to create the + * event target chain for event dispatching. + * + * @note Only nsEventDispatcher should call this method. + */ + [noscript, nostdcall] + void PreHandleEvent(in nsEventChainPreVisitorRef aVisitor); + + /** + * If nsEventChainPreVisitor.mWantsWillHandleEvent is set PR_TRUE, + * called just before possible event handlers on this object will be called. + */ + [noscript, nostdcall] + void WillHandleEvent(in nsEventChainPostVisitorRef aVisitor); + + /** + * Called after the bubble phase of the system event group. + * The default handling of the event should happen here. + * @param aVisitor the visitor object which is used during post handling. + * + * @see nsEventDispatcher.h for documentation about aVisitor. + * @note Only nsEventDispatcher should call this method. + */ + [noscript, nostdcall] + void PostHandleEvent(in nsEventChainPostVisitorRef aVisitor); + + /** + * Dispatch an event. + * @param aEvent the event that is being dispatched. + * @param aDOMEvent the event that is being dispatched, use if you want to + * dispatch nsIDOMEvent, not only nsEvent. + * @param aPresContext the current presentation context, can be nsnull. + * @param aEventStatus the status returned from the function, can be nsnull. + * + * @note If both aEvent and aDOMEvent are used, aEvent must be the internal + * event of the aDOMEvent. + * + * If aDOMEvent is not nsnull (in which case aEvent can be nsnull) it is used + * for dispatching, otherwise aEvent is used. + * + * @deprecated This method is here just until all the callers outside Gecko + * have been converted to use nsIDOMEventTarget::dispatchEvent. + */ + [noscript, nostdcall] + void DispatchDOMEvent(in nsEventPtr aEvent, + in nsIDOMEvent aDOMEvent, + in nsPresContextPtr aPresContext, + in nsEventStatusPtr aEventStatus); + + /** + * Get the event listener manager, the guy you talk to to register for events + * on this node. + * @param aMayCreate If PR_FALSE, returns a listener manager only if + * one already exists. + */ + [notxpcom, nostdcall] + nsEventListenerManagerPtr GetListenerManager(in boolean aMayCreate); + + /** + * Add an event listener for nsIID. + */ + [noscript, nostdcall] + void AddEventListenerByIID(in nsIDOMEventListener aListener, + in nsIIDRef aIID); + /** + * Remove event listener for nsIID. + */ + [noscript, nostdcall] + void RemoveEventListenerByIID(in nsIDOMEventListener aListener, + in nsIIDRef aIID); + + /** + * Get the script context in which the event handlers should be run. + * May return null. + * @note Caller *must* check the value of aRv. + */ + [notxpcom, nostdcall] + nsIScriptContext GetContextForEventHandlers(out nsresult aRv); + + /** + * If the method above returns null, but a success code, this method + * is called. + */ + [notxpcom, nostdcall] JSContextPtr GetJSContextForEventHandlers(); }; + +%{C++ + +typedef nsIDOMEventTarget nsPIDOMEventTarget; + +#define NS_IMPL_DOMTARGET_DEFAULTS(_class) \ +nsPIDOMEventTarget* _class::GetTargetForDOMEvent() { return this; } \ +nsPIDOMEventTarget* _class::GetTargetForEventTargetChain() { return this; } \ +nsresult _class::WillHandleEvent(nsEventChainPostVisitor& aVisitor) { return NS_OK; } \ +JSContext* _class::GetJSContextForEventHandlers() { return nsnull; } + +%} diff --git a/dom/interfaces/events/nsIDOMNSEventTarget.idl b/dom/interfaces/events/nsIDOMNSEventTarget.idl deleted file mode 100644 index 7dc65afd91a..00000000000 --- a/dom/interfaces/events/nsIDOMNSEventTarget.idl +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: IDL; 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 - * The Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2005 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Johnny Stenback (original author) - * - * 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 "domstubs.idl" - -/** - * The nsIDOMNSEventTarget interface is an extension to the standard - * nsIDOMEventTarget interface, implemented by all event targets in - * the Document Object Model. - */ - -[scriptable, uuid(c8b658d5-d583-472a-a7ec-cbc2e79f75dd)] -interface nsIDOMNSEventTarget : nsISupports -{ - /** - * This method is the same as the addEventListener() method defined - * in nsIDOMEventTarget, but it takes one additional argument which - * lets callers control whether or not they want to receive - * untrusted events (synthetic events generated by untrusted code) - * - * @param type See the type argument to the same method in - * nsIDOMEventTarget. - * @param listener See the listener argument to the same method in - * nsIDOMEventTarget. - * @param useCapture See the listener argument to the same method in - * nsIDOMEventTarget. - * @param wantsUntrusted If false, the listener will not receive any - * untrusted events (see above), if true, the - * listener will receive events whether or not - * they're trusted - */ - [optional_argc] void addEventListener(in DOMString type, - in nsIDOMEventListener listener, - [optional] in boolean useCapture, - [optional] in boolean wantsUntrusted); - - /** - * The default script type (language) for events firing on this target. - * Must be one of the nsIProgrammingLanguage enums, but must not be - * nsIProgrammingLanguage::UNKNOWN. Most implementations will provide - * a default type of nsIProgrammingLanguage::JAVASCRIPT. - * - * All targets must support fetching the script language, but not all - * script targets must support changing it - ie, some targets may only - * support event handlers written in their default language. - */ - [noscript] attribute PRUint32 scriptTypeID; -}; diff --git a/dom/interfaces/html/nsIDOMHTMLSelectElement.idl b/dom/interfaces/html/nsIDOMHTMLSelectElement.idl index 5ae36c7ca4e..c87b3b269ee 100644 --- a/dom/interfaces/html/nsIDOMHTMLSelectElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLSelectElement.idl @@ -53,7 +53,7 @@ interface nsIDOMValidityState; -[scriptable, uuid(58cd01b8-c3f2-4e58-b39d-8a0ba941717e)] +[scriptable, uuid(5aeb2480-cb21-4483-b9b3-0c914502eb81)] interface nsIDOMHTMLSelectElement : nsIDOMHTMLElement { attribute boolean autofocus; @@ -70,7 +70,7 @@ interface nsIDOMHTMLSelectElement : nsIDOMHTMLElement nsIDOMNode item(in unsigned long index); nsIDOMNode namedItem(in DOMString name); void add(in nsIDOMHTMLElement element, - in nsIDOMHTMLElement before) + [optional] in nsIDOMHTMLElement before) raises(DOMException); void remove(in long index); diff --git a/dom/interfaces/threads/nsIDOMWorkers.idl b/dom/interfaces/threads/nsIDOMWorkers.idl index cf429390a8a..a30f0a24b87 100644 --- a/dom/interfaces/threads/nsIDOMWorkers.idl +++ b/dom/interfaces/threads/nsIDOMWorkers.idl @@ -128,13 +128,13 @@ interface nsIWorkerScope : nsIWorkerGlobalScope attribute nsIDOMEventListener onclose; }; -[scriptable, uuid(b90b7561-b5e2-4545-84b0-280dbaaa94ea)] +[scriptable, builtinclass, uuid(b90b7561-b5e2-4545-84b0-280dbaaa94ea)] interface nsIAbstractWorker : nsIDOMEventTarget { attribute nsIDOMEventListener onerror; }; -[scriptable, uuid(daf945c3-8d29-4724-8939-dd383f7d27a7)] +[scriptable, builtinclass, uuid(daf945c3-8d29-4724-8939-dd383f7d27a7)] interface nsIWorker : nsIAbstractWorker { void postMessage(/* in JSObject aMessage */); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 479cd58cc74..1b440c4eab4 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -562,6 +562,20 @@ ContentParent::RecvGetSystemColors(const PRUint32& colorsCount, InfallibleTArray return true; } +bool +ContentParent::RecvGetIconForExtension(const nsCString& aFileExt, const PRUint32& aIconSize, InfallibleTArray* bits) +{ +#ifdef ANDROID + if (!AndroidBridge::Bridge()) + return false; + + bits->AppendElements(aIconSize * aIconSize * 4); + + AndroidBridge::Bridge()->GetIconForExtension(aFileExt, aIconSize, bits->Elements()); +#endif + return true; +} + NS_IMPL_THREADSAFE_ISUPPORTS3(ContentParent, nsIObserver, nsIThreadObserver, diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 9d41329b25d..f7f9c4798a7 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -166,6 +166,7 @@ private: virtual bool RecvClipboardHasText(PRBool* hasText); virtual bool RecvGetSystemColors(const PRUint32& colorsCount, InfallibleTArray* colors); + virtual bool RecvGetIconForExtension(const nsCString& aFileExt, const PRUint32& aIconSize, InfallibleTArray* bits); virtual bool RecvStartVisitedQuery(const IPC::URI& uri); diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index 939aa6f9dbd..597a2e12a80 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -197,6 +197,9 @@ parent: sync GetSystemColors(PRUint32 colorsCount) returns (PRUint32[] colors); + sync GetIconForExtension(nsCString aFileExt, PRUint32 aIconSize) + returns (PRUint8[] bits); + both: AsyncMessage(nsString aMessage, nsString aJSON); diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index ab84c54c990..140e2adc6b6 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -88,7 +88,7 @@ #include "nsSerializationHelper.h" #include "nsIFrame.h" #include "nsIView.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "PCOMContentPermissionRequestChild.h" #include "xpcpublic.h" @@ -478,7 +478,7 @@ TabChild::~TabChild() DestroyCx(); } - nsIEventListenerManager* elm = mTabChildGlobal->GetListenerManager(PR_FALSE); + nsEventListenerManager* elm = mTabChildGlobal->GetListenerManager(PR_FALSE); if (elm) { elm->Disconnect(); } @@ -758,7 +758,7 @@ TabChild::RecvAsyncMessage(const nsString& aMessage, nsFrameScriptCx cx(static_cast(this), this); nsRefPtr mm = static_cast(mTabChildGlobal->mMessageManager.get()); - mm->ReceiveMessage(static_cast(mTabChildGlobal), + mm->ReceiveMessage(static_cast(mTabChildGlobal), aMessage, PR_FALSE, aJSON, nsnull, nsnull); } return true; @@ -866,7 +866,7 @@ TabChild::InitTabChildGlobal() mTabChildGlobal = scope; nsISupports* scopeSupports = - NS_ISUPPORTS_CAST(nsPIDOMEventTarget*, scope); + NS_ISUPPORTS_CAST(nsIDOMEventTarget*, scope); JS_SetContextPrivate(cx, scopeSupports); nsresult rv = diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties index a0719a69751..4ce3bc4811c 100644 --- a/dom/locales/en-US/chrome/dom/dom.properties +++ b/dom/locales/en-US/chrome/dom/dom.properties @@ -21,6 +21,7 @@ # Contributor(s): # Mitch (original author) # Ehsan Akhgari +# Ms2ger # # 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"), @@ -75,3 +76,33 @@ FormValidationInvalidURL=Please enter a URL. FormValidationPatternMismatch=Please match the requested format. # LOCALIZATION NOTE (FormValidationPatternMismatchWithTitle): %S is the (possibly truncated) title attribute value. FormValidationPatternMismatchWithTitle=Please match the requested format: %S. +GetAttributeNodeWarning=Use of getAttributeNode() is deprecated. Use getAttribute() instead. +SetAttributeNodeWarning=Use of setAttributeNode() is deprecated. Use setAttribute() instead. +GetAttributeNodeNSWarning=Use of getAttributeNodeNS() is deprecated. Use getAttributeNS() instead. +SetAttributeNodeNSWarning=Use of setAttributeNodeNS() is deprecated. Use setAttributeNS() instead. +RemoveAttributeNodeWarning=Use of removeAttributeNode() is deprecated. Use removeAttribute() instead. +CreateAttribute=Use of document.createAttribute() is deprecated. Use element.setAttribute() instead. +CreateAttributeNS=Use of document.createAttributeNS() is deprecated. Use element.setAttributeNS() instead. +SpecifiedWarning=Use of attributes' specified attribute is deprecated. It always returns true. +OwnerElementWarning=Use of attributes' ownerElement attribute is deprecated. +NodeNameWarning=Use of attributes' nodeName attribute is deprecated. Use name instead. +NodeValueWarning=Use of attributes' nodeValue attribute is deprecated. Use value instead. +NodeTypeWarning=Use of attributes' nodeType attribute is deprecated. It always returns 2. +ParentNodeWarning=Use of attributes' parentNode attribute is deprecated. It always returns null. +ChildNodesWarning=Use of attributes' childNodes attribute is deprecated. It always returns null. +HasChildNodesWarning=Use of attributes' hasChildNodes() is deprecated. It always returns false. +HasAttributesWarning=Use of attributes' hasAttributes() is deprecated. It always returns false. +FirstChildWarning=Use of attributes' firstChild attribute is deprecated. Use value instead. +LastChildWarning=Use of attributes' lastChild attribute is deprecated. Use value instead. +PreviousSiblingWarning=Use of attributes' previousSibling attribute is deprecated. It always returns null. +NextSiblingWarning=Use of attributes' nextSibling attribute is deprecated. It always returns null. +AttributesWarning=Use of attributes' attributes attribute is deprecated. It always returns null. +InsertBeforeWarning=Use of attributes' insertBefore() is deprecated. Use value instead. +ReplaceChildWarning=Use of attributes' replaceChild() is deprecated. Use value instead. +RemoveChildWarning=Use of attributes' removeChild() is deprecated. Use value instead. +AppendChildWarning=Use of attributes' appendChild() is deprecated. Use value instead. +CloneNodeWarning=Use of attributes' cloneNode() is deprecated. +GetOwnerDocumentWarning=Use of attributes' ownerDocument attribute is deprecated. +IsSupportedWarning=Use of attributes' isSupported() is deprecated. +IsEqualNodeWarning=Use of attributes' isEqualNode() is deprecated. +TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead. diff --git a/dom/locales/jar.mn b/dom/locales/jar.mn index 551c31612ce..3aca6adc809 100644 --- a/dom/locales/jar.mn +++ b/dom/locales/jar.mn @@ -25,4 +25,3 @@ locale/@AB_CD@/global-platform/win/accessible.properties (%chrome/accessibility/win/accessible.properties) locale/@AB_CD@/global-platform/mac/accessible.properties (%chrome/accessibility/mac/accessible.properties) locale/@AB_CD@/global-platform/unix/accessible.properties (%chrome/accessibility/unix/accessible.properties) - locale/@AB_CD@/global/storage.properties (%chrome/storage.properties) diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index db16b3bfedc..5830e6f04e4 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -334,7 +334,11 @@ struct AutoCXPusher } }; -static JSContext * +namespace mozilla { +namespace plugins { +namespace parent { + +JSContext * GetJSContext(NPP npp) { NS_ENSURE_TRUE(npp, nsnull); @@ -360,6 +364,9 @@ GetJSContext(NPP npp) return (JSContext *)scx->GetNativeContext(); } +} +} +} static NPP LookupNPP(NPObject *npobj); diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index 8161d05a296..f19eafa8b8d 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -81,7 +81,7 @@ #include "nsIObserverService.h" #include -#ifdef XP_MACOSX +#ifdef MOZ_WIDGET_COCOA #include #include #include diff --git a/dom/plugins/base/nsNPAPIPlugin.h b/dom/plugins/base/nsNPAPIPlugin.h index cf93c889fc6..f5fce944d39 100644 --- a/dom/plugins/base/nsNPAPIPlugin.h +++ b/dom/plugins/base/nsNPAPIPlugin.h @@ -117,7 +117,7 @@ namespace parent { JS_STATIC_ASSERT(sizeof(NPIdentifier) == sizeof(jsid)); -static inline jsid +inline jsid NPIdentifierToJSId(NPIdentifier id) { jsid tmp; @@ -125,52 +125,59 @@ NPIdentifierToJSId(NPIdentifier id) return tmp; } -static inline NPIdentifier +inline NPIdentifier JSIdToNPIdentifier(jsid id) { return (NPIdentifier)JSID_BITS(id); } -static inline bool +inline bool NPIdentifierIsString(NPIdentifier id) { return JSID_IS_STRING(NPIdentifierToJSId(id)); } -static inline JSString * +inline JSString * NPIdentifierToString(NPIdentifier id) { return JSID_TO_STRING(NPIdentifierToJSId(id)); } -static inline NPIdentifier +inline NPIdentifier StringToNPIdentifier(JSContext *cx, JSString *str) { return JSIdToNPIdentifier(INTERNED_STRING_TO_JSID(cx, str)); } -static inline bool +inline bool NPIdentifierIsInt(NPIdentifier id) { return JSID_IS_INT(NPIdentifierToJSId(id)); } -static inline jsint +inline jsint NPIdentifierToInt(NPIdentifier id) { return JSID_TO_INT(NPIdentifierToJSId(id)); } -static inline NPIdentifier +inline NPIdentifier IntToNPIdentifier(jsint i) { return JSIdToNPIdentifier(INT_TO_JSID(i)); } -static inline bool -NPIdentifierIsVoid(NPIdentifier id) +JSContext* GetJSContext(NPP npp); + +inline bool +NPStringIdentifierIsPermanent(NPP npp, NPIdentifier id) { - return JSID_IS_VOID(NPIdentifierToJSId(id)); + JSContext* cx = GetJSContext(npp); + if (!cx) // OOM? + return false; + + JSAutoRequest ar(cx); + return JS_StringHasBeenInterned(cx, NPIdentifierToString(id)); } #define NPIdentifier_VOID (JSIdToNPIdentifier(JSID_VOID)) diff --git a/dom/plugins/ipc/Makefile.in b/dom/plugins/ipc/Makefile.in index cc4c15cbfca..8c03fa6d6f5 100644 --- a/dom/plugins/ipc/Makefile.in +++ b/dom/plugins/ipc/Makefile.in @@ -109,6 +109,8 @@ CPPSRCS = \ ChildAsyncCall.cpp \ ChildTimer.cpp \ PluginMessageUtils.cpp \ + PluginIdentifierChild.cpp \ + PluginIdentifierParent.cpp \ PluginInstanceChild.cpp \ PluginInstanceParent.cpp \ PluginModuleChild.cpp \ diff --git a/dom/plugins/ipc/PPluginIdentifier.ipdl b/dom/plugins/ipc/PPluginIdentifier.ipdl index 8c9703d41e9..9348515010d 100644 --- a/dom/plugins/ipc/PPluginIdentifier.ipdl +++ b/dom/plugins/ipc/PPluginIdentifier.ipdl @@ -48,6 +48,13 @@ async protocol PPluginIdentifier { manager PPluginModule; +parent: + /** + * If this is a temporary identifier, inform the parent that the plugin + * has made the identifier permanent by calling NPN_GetStringIdentifier. + */ + async Retain(); + child: async __delete__(); }; diff --git a/dom/plugins/ipc/PPluginModule.ipdl b/dom/plugins/ipc/PPluginModule.ipdl index 7d67ddb0084..fbb6e722f4f 100644 --- a/dom/plugins/ipc/PPluginModule.ipdl +++ b/dom/plugins/ipc/PPluginModule.ipdl @@ -48,6 +48,7 @@ using NPNVariable; using base::FileDescriptor; using mozilla::plugins::NativeThreadId; using mac_plugin_interposing::NSCursorInfo; +using nsID; namespace mozilla { namespace plugins { @@ -65,9 +66,13 @@ both: * constructor with the same string or int argument then we create two actors * and detect the second instance in the child. We prevent the parent's actor * from leaking out to plugin code and only allow the child's to be used. + * + * When calling into the plugin, the parent may create a "temporary" + * identifier which is only valid for the lifetime of the current RPC frame. */ async PPluginIdentifier(nsCString aString, - int32_t aInt); + int32_t aInt, + bool temporary); // Window-specific message which instructs the RPC mechanism to enter // a nested event loop for the current RPC call. @@ -101,6 +106,11 @@ child: rpc NPP_GetSitesWithData() returns (nsCString[] sites); + // Windows specific message to set up an audio session in the plugin process + async SetAudioSessionData(nsID aID, + nsString aDisplayName, + nsString aIconPath); + parent: /** * This message is only used on X11 platforms. diff --git a/dom/plugins/ipc/PluginIdentifierChild.cpp b/dom/plugins/ipc/PluginIdentifierChild.cpp new file mode 100644 index 00000000000..76f19210c06 --- /dev/null +++ b/dom/plugins/ipc/PluginIdentifierChild.cpp @@ -0,0 +1,174 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * vim: sw=2 ts=2 et : + * ***** 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 Plugins. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Ben Turner + * + * 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 "PluginIdentifierChild.h" +#include "PluginModuleChild.h" + +namespace mozilla { +namespace plugins { + +void +PluginIdentifierChild::MakePermanent() +{ + if (mCanonicalIdentifier) { + NS_ASSERTION(mCanonicalIdentifier->mHashed && mCanonicalIdentifier->mTemporaryRefs == 0, + "Canonical identifiers should always be permanent."); + return; // nothing to do + } + + if (!mHashed) { + NS_ASSERTION(mTemporaryRefs == 0, "Not hashed, but temporary refs?"); + + PluginIdentifierChild* c = GetCanonical(); + if (c) { + NS_ASSERTION(c != this, "How did I get in the hash?"); + mCanonicalIdentifier = c; + NS_ASSERTION(mCanonicalIdentifier->mHashed && mCanonicalIdentifier->mTemporaryRefs == 0, + "Canonical identifiers should always be permanent."); + return; + } + + Hash(); + mHashed = true; + return; + } + + if (mTemporaryRefs) { + SendRetain(); + mTemporaryRefs = 0; + } +} + +void +PluginIdentifierChild::StartTemporary() +{ + if (mCanonicalIdentifier) { + NS_ASSERTION(mCanonicalIdentifier->mHashed && mCanonicalIdentifier->mTemporaryRefs == 0, + "Canonical identifiers should always be permanent."); + return; // nothing to do + } + + if (!mHashed) { + NS_ASSERTION(mTemporaryRefs == 0, "Not hashed, but temporary refs?"); + + PluginIdentifierChild* c = GetCanonical(); + if (c) { + NS_ASSERTION(c != this, "How did I get in the hash?"); + mCanonicalIdentifier = c; + NS_ASSERTION(mCanonicalIdentifier->mHashed && mCanonicalIdentifier->mTemporaryRefs == 0, + "Canonical identifiers should always be permanent."); + return; + } + + Hash(); + mHashed = true; + mTemporaryRefs = 1; + return; + } + + if (mTemporaryRefs) + ++mTemporaryRefs; +} + +void +PluginIdentifierChild::FinishTemporary() +{ + if (mCanonicalIdentifier) + return; + + NS_ASSERTION(mHashed, "Finishing unhashed identifier?"); + if (!mTemporaryRefs) + return; + + --mTemporaryRefs; + if (mTemporaryRefs) + return; + + Unhash(); + mHashed = false; +} + +PluginIdentifierChild* +PluginIdentifierChildString::GetCanonical() +{ + PluginModuleChild* module = static_cast(Manager()); + return module->mStringIdentifiers.Get(mString); +} + +void +PluginIdentifierChildString::Hash() +{ + PluginModuleChild* module = static_cast(Manager()); + NS_ASSERTION(module->mStringIdentifiers.Get(mString) == NULL, "Replacing Hash?"); + module->mStringIdentifiers.Put(mString, this); +} + +void +PluginIdentifierChildString::Unhash() +{ + PluginModuleChild* module = static_cast(Manager()); + NS_ASSERTION(module->mStringIdentifiers.Get(mString) == this, "Incorrect identifier hash?"); + module->mStringIdentifiers.Remove(mString); +} + +PluginIdentifierChild* +PluginIdentifierChildInt::GetCanonical() +{ + PluginModuleChild* module = static_cast(Manager()); + return module->mIntIdentifiers.Get(mInt); +} + +void +PluginIdentifierChildInt::Hash() +{ + PluginModuleChild* module = static_cast(Manager()); + NS_ASSERTION(module->mIntIdentifiers.Get(mInt) == NULL, "Replacing Hash?"); + module->mIntIdentifiers.Put(mInt, this); +} + +void +PluginIdentifierChildInt::Unhash() +{ + PluginModuleChild* module = static_cast(Manager()); + NS_ASSERTION(module->mIntIdentifiers.Get(mInt) == this, "Incorrect identifier hash?"); + module->mIntIdentifiers.Remove(mInt); +} + +} // namespace mozilla::plugins +} // namespace mozilla diff --git a/dom/plugins/ipc/PluginIdentifierChild.h b/dom/plugins/ipc/PluginIdentifierChild.h index a9b7e5a4750..39a7e5e28fa 100644 --- a/dom/plugins/ipc/PluginIdentifierChild.h +++ b/dom/plugins/ipc/PluginIdentifierChild.h @@ -41,36 +41,72 @@ #define dom_plugins_PluginIdentifierChild_h #include "mozilla/plugins/PPluginIdentifierChild.h" -#include "mozilla/plugins/PluginModuleChild.h" +#include "npapi.h" +#include "npruntime.h" #include "nsStringGlue.h" namespace mozilla { namespace plugins { +class PluginModuleChild; + +/** + * Plugin identifiers may be "temporary", see the comment on the + * PPluginIdentifier constructor for details. This means that any IPDL method + * which receives a PPluginIdentifierChild* parameter must use StackIdentifier + * to track it. + */ class PluginIdentifierChild : public PPluginIdentifierChild { friend class PluginModuleChild; public: bool IsString() { - return reinterpret_cast(mCanonicalIdentifier) & 1; + return mIsString; } NPIdentifier ToNPIdentifier() { - return reinterpret_cast( - reinterpret_cast(mCanonicalIdentifier) & ~1); + if (mCanonicalIdentifier) { + return mCanonicalIdentifier; + } + + NS_ASSERTION(mHashed, "Handing out an unhashed identifier?"); + return this; } + void MakePermanent(); + + class NS_STACK_CLASS StackIdentifier + { + public: + StackIdentifier(PPluginIdentifierChild* actor) + : mIdentifier(static_cast(actor)) + { + if (mIdentifier) + mIdentifier->StartTemporary(); + } + + ~StackIdentifier() { + if (mIdentifier) + mIdentifier->FinishTemporary(); + } + + PluginIdentifierChild* operator->() { return mIdentifier; } + + private: + PluginIdentifierChild* mIdentifier; + }; + protected: PluginIdentifierChild(bool aIsString) - : ALLOW_THIS_IN_INITIALIZER_LIST(mCanonicalIdentifier(this)) + : mCanonicalIdentifier(NULL) + , mHashed(false) + , mTemporaryRefs(0) + , mIsString(aIsString) { MOZ_COUNT_CTOR(PluginIdentifierChild); - if (aIsString) { - SetIsString(); - } } virtual ~PluginIdentifierChild() @@ -78,24 +114,37 @@ protected: MOZ_COUNT_DTOR(PluginIdentifierChild); } - void SetCanonicalIdentifier(PluginIdentifierChild* aIdentifier) - { - NS_ASSERTION(ToNPIdentifier() == this, "Already got one!"); - bool isString = IsString(); - mCanonicalIdentifier = aIdentifier; - if (isString) { - SetIsString(); - } - } + // The following functions are implemented by the subclasses for their + // identifier maps. + virtual PluginIdentifierChild* GetCanonical() = 0; + virtual void Hash() = 0; + virtual void Unhash() = 0; private: - void SetIsString() - { - mCanonicalIdentifier = reinterpret_cast( - reinterpret_cast(mCanonicalIdentifier) | 1); - } + void StartTemporary(); + void FinishTemporary(); + + // There's a possibility that we already have an actor that wraps the same + // string or int because we do all this identifier construction + // asynchronously. In this case we need to hand out the canonical version + // created by the child side. + // + // In order to deal with temporary identifiers which appear on the stack, + // identifiers use the following state invariants: + // + // * mCanonicalIdentifier is non-NULL: this is a duplicate identifier, no + // further information is necessary. + // * mHashed is false: this identifier is a newborn, non-permanent identifier + // * mHashed is true, mTemporaryRefs is 0: this identifier is permanent + // * mHashed is true, mTemporaryRefs is non-0: this identifier is temporary; + // if NPN_GetFooIdentifier is called for it, we need to retain it. If + // all stack references are lost, unhash it because it will soon be + // deleted. PluginIdentifierChild* mCanonicalIdentifier; + bool mHashed; + unsigned int mTemporaryRefs; + bool mIsString; }; class PluginIdentifierChildString : public PluginIdentifierChild @@ -113,6 +162,10 @@ protected: mString(aString) { } + virtual PluginIdentifierChild* GetCanonical(); + virtual void Hash(); + virtual void Unhash(); + nsCString mString; }; @@ -131,6 +184,10 @@ protected: mInt(aInt) { } + virtual PluginIdentifierChild* GetCanonical(); + virtual void Hash(); + virtual void Unhash(); + int32_t mInt; }; diff --git a/dom/plugins/ipc/PluginIdentifierParent.cpp b/dom/plugins/ipc/PluginIdentifierParent.cpp new file mode 100644 index 00000000000..f423dc15db8 --- /dev/null +++ b/dom/plugins/ipc/PluginIdentifierParent.cpp @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * vim: sw=2 ts=2 et : + * ***** 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 Plugins. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Ben Turner + * + * 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 "PluginIdentifierParent.h" + +#include "nsServiceManagerUtils.h" +#include "nsNPAPIPlugin.h" +#include "nsIJSContextStack.h" +#include "PluginScriptableObjectUtils.h" +#include "mozilla/unused.h" + +using namespace mozilla::plugins::parent; + +namespace mozilla { +namespace plugins { + +bool +PluginIdentifierParent::RecvRetain() +{ + mTemporaryRefs = 0; + + // Intern the jsid if necessary. + jsid id = NPIdentifierToJSId(mIdentifier); + if (JSID_IS_INT(id)) { + return true; + } + + // The following is what nsNPAPIPlugin.cpp does. Gross, but the API doesn't + // give you a NPP to play with. + nsCOMPtr stack = + do_GetService("@mozilla.org/js/xpc/ContextStack;1"); + if (!stack) { + return false; + } + + JSContext *cx = nsnull; + stack->GetSafeJSContext(&cx); + if (!cx) { + return false; + } + + JSAutoRequest ar(cx); + JSString* str = JSID_TO_STRING(id); + JSString* str2 = JS_InternJSString(cx, str); + if (!str2) { + return false; + } + + NS_ASSERTION(str == str2, "Interning a string in a JSID should always return the same string."); + + return true; +} + +PluginIdentifierParent::StackIdentifier::StackIdentifier + (PluginInstanceParent* inst, NPIdentifier aIdentifier) + : mIdentifier(inst->Module()->GetIdentifierForNPIdentifier(inst->GetNPP(), aIdentifier)) +{ +} + +PluginIdentifierParent::StackIdentifier::StackIdentifier + (NPObject* aObject, NPIdentifier aIdentifier) + : mIdentifier(NULL) +{ + PluginInstanceParent* inst = GetInstance(aObject); + mIdentifier = inst->Module()->GetIdentifierForNPIdentifier(inst->GetNPP(), aIdentifier); +} + +PluginIdentifierParent::StackIdentifier::~StackIdentifier() +{ + if (!mIdentifier) { + return; + } + + if (!mIdentifier->IsTemporary()) { + return; + } + + if (mIdentifier->RemoveTemporaryRef()) { + unused << PPluginIdentifierParent::Send__delete__(mIdentifier); + } +} + +} // namespace mozilla::plugins +} // namespace mozilla diff --git a/dom/plugins/ipc/PluginIdentifierParent.h b/dom/plugins/ipc/PluginIdentifierParent.h index ed35a753d8a..6869381c0ab 100644 --- a/dom/plugins/ipc/PluginIdentifierParent.h +++ b/dom/plugins/ipc/PluginIdentifierParent.h @@ -48,6 +48,8 @@ namespace mozilla { namespace plugins { +class PluginInstanceParent; + class PluginIdentifierParent : public PPluginIdentifierParent { friend class PluginModuleParent; @@ -58,9 +60,34 @@ public: return mIdentifier; } + bool IsTemporary() { + return !!mTemporaryRefs; + } + + /** + * Holds a perhaps-temporary identifier for the current stack frame. + */ + class NS_STACK_CLASS StackIdentifier + { + public: + StackIdentifier(PluginInstanceParent* inst, NPIdentifier aIdentifier); + StackIdentifier(NPObject* aObject, NPIdentifier aIdentifier); + ~StackIdentifier(); + + operator PluginIdentifierParent*() { + return mIdentifier; + } + + private: + DISALLOW_COPY_AND_ASSIGN(StackIdentifier); + + PluginIdentifierParent* mIdentifier; + }; + protected: - PluginIdentifierParent(NPIdentifier aIdentifier) + PluginIdentifierParent(NPIdentifier aIdentifier, bool aTemporary) : mIdentifier(aIdentifier) + , mTemporaryRefs(aTemporary ? 1 : 0) { MOZ_COUNT_CTOR(PluginIdentifierParent); } @@ -70,8 +97,23 @@ protected: MOZ_COUNT_DTOR(PluginIdentifierParent); } + virtual bool RecvRetain(); + + void AddTemporaryRef() { + mTemporaryRefs++; + } + + /** + * @returns true if the last temporary reference was removed. + */ + bool RemoveTemporaryRef() { + --mTemporaryRefs; + return !mTemporaryRefs; + } + private: NPIdentifier mIdentifier; + unsigned int mTemporaryRefs; }; } // namespace plugins diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index 4a2b5b7a54a..d794a427bd7 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -129,7 +129,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface) , mWinlessHiddenMsgHWND(0) #endif // OS_WIN , mAsyncCallMutex("PluginInstanceChild::mAsyncCallMutex") -#if defined(OS_MACOSX) +#if defined(MOZ_WIDGET_COCOA) #if defined(__i386__) , mEventModel(NPEventModelCarbon) #endif @@ -178,7 +178,7 @@ PluginInstanceChild::~PluginInstanceChild() #if defined(OS_WIN) NS_ASSERTION(!mPluginWindowHWND, "Destroying PluginInstanceChild without NPP_Destroy?"); #endif -#if defined(OS_MACOSX) +#if defined(MOZ_WIDGET_COCOA) if (mShColorSpace) { ::CGColorSpaceRelease(mShColorSpace); } diff --git a/dom/plugins/ipc/PluginInstanceChild.h b/dom/plugins/ipc/PluginInstanceChild.h index a299925393d..7134e55d9e4 100644 --- a/dom/plugins/ipc/PluginInstanceChild.h +++ b/dom/plugins/ipc/PluginInstanceChild.h @@ -45,7 +45,7 @@ #include "mozilla/plugins/PPluginSurfaceChild.h" #if defined(OS_WIN) #include "mozilla/gfx/SharedDIBWin.h" -#elif defined(OS_MACOSX) +#elif defined(MOZ_WIDGET_COCOA) #include "nsCoreAnimationSupport.h" #include "base/timer.h" #endif @@ -407,7 +407,7 @@ private: HBITMAP bmp; } mAlphaExtract; #endif // defined(OS_WIN) -#if defined(OS_MACOSX) +#if defined(MOZ_WIDGET_COCOA) private: #if defined(__i386__) NPEventModel mEventModel; diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp index 987f975c31d..47f23980f4d 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -111,7 +111,7 @@ PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent, void PluginInstanceParent::InitQuirksModes(const nsCString& aMimeType) { -#ifdef OS_MACOSX +#ifdef MOZ_WIDGET_COCOA NS_NAMED_LITERAL_CSTRING(flash, "application/x-shockwave-flash"); // Flash sends us Invalidate events so we will use those // instead of the refresh timer. @@ -130,7 +130,7 @@ PluginInstanceParent::~PluginInstanceParent() NS_ASSERTION(!(mPluginHWND || mPluginWndProc), "Subclass was not reset correctly before the dtor was reached!"); #endif -#if defined(OS_MACOSX) +#if defined(MOZ_WIDGET_COCOA) if (mShWidth != 0 && mShHeight != 0) { DeallocShmem(mShSurface); } @@ -1597,6 +1597,12 @@ PluginInstanceParent::PluginWindowHookProc(HWND hWnd, break; } + if (self->mPluginWndProc == PluginWindowHookProc) { + NS_NOTREACHED( + "PluginWindowHookProc invoking mPluginWndProc w/" + "mPluginWndProc == PluginWindowHookProc????"); + return DefWindowProc(hWnd, message, wParam, lParam); + } return ::CallWindowProc(self->mPluginWndProc, hWnd, message, wParam, lParam); } @@ -1777,7 +1783,7 @@ PluginInstanceParent::AnswerPluginFocusChange(const bool& gotFocus) #endif } -#ifdef OS_MACOSX +#ifdef MOZ_WIDGET_COCOA void PluginInstanceParent::Invalidate() { diff --git a/dom/plugins/ipc/PluginInstanceParent.h b/dom/plugins/ipc/PluginInstanceParent.h index 033d0999f01..cad9dd2aa83 100644 --- a/dom/plugins/ipc/PluginInstanceParent.h +++ b/dom/plugins/ipc/PluginInstanceParent.h @@ -43,7 +43,7 @@ #include "mozilla/plugins/PluginScriptableObjectParent.h" #if defined(OS_WIN) #include "mozilla/gfx/SharedDIBWin.h" -#elif defined(OS_MACOSX) +#elif defined(MOZ_WIDGET_COCOA) #include "nsCoreAnimationSupport.h" #endif @@ -275,9 +275,9 @@ public: virtual bool AnswerPluginFocusChange(const bool& gotFocus); -#if defined(OS_MACOSX) +#ifdef MOZ_WIDGET_COCOA void Invalidate(); -#endif // definied(OS_MACOSX) +#endif // definied(MOZ_WIDGET_COCOA) nsresult AsyncSetWindow(NPWindow* window); nsresult GetImage(mozilla::layers::ImageContainer* aContainer, mozilla::layers::Image** aImage); @@ -347,7 +347,7 @@ private: WNDPROC mPluginWndProc; bool mNestedEventState; #endif // defined(XP_WIN) -#if defined(OS_MACOSX) +#if defined(MOZ_WIDGET_COCOA) private: Shmem mShSurface; size_t mShWidth; @@ -355,7 +355,7 @@ private: CGColorSpaceRef mShColorSpace; int16_t mDrawingModel; nsAutoPtr mIOSurface; -#endif // definied(OS_MACOSX) +#endif // definied(MOZ_WIDGET_COCOA) // ObjectFrame layer wrapper nsRefPtr mFrontSurface; diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index b245aec911d..fd43fa3abb0 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -71,9 +71,10 @@ #ifdef XP_WIN #include "COMMessageFilter.h" #include "nsWindowsDllInterceptor.h" +#include "mozilla/widget/AudioSession.h" #endif -#ifdef OS_MACOSX +#ifdef MOZ_WIDGET_COCOA #include "PluginInterposeOSX.h" #include "PluginUtilsOSX.h" #endif @@ -594,6 +595,10 @@ PluginModuleChild::AnswerNP_Shutdown(NPError *rv) { AssertPluginThread(); +#if defined XP_WIN && MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN + mozilla::widget::StopAudioSession(); +#endif + // the PluginModuleParent shuts down this process after this RPC // call pops off its stack @@ -649,6 +654,25 @@ PluginModuleChild::AnswerNPP_GetSitesWithData(InfallibleTArray* aResu return true; } +bool +PluginModuleChild::RecvSetAudioSessionData(const nsID& aId, + const nsString& aDisplayName, + const nsString& aIconPath) +{ + nsresult rv; +#if !defined XP_WIN || MOZ_WINSDK_TARGETVER < MOZ_NTDDI_LONGHORN + NS_RUNTIMEABORT("Not Reached!"); + return false; +#else + rv = mozilla::widget::RecvAudioSessionData(aId, aDisplayName, aIconPath); + NS_ENSURE_SUCCESS(rv, true); // Bail early if this fails + + // Ignore failures here; we can't really do anything about them + mozilla::widget::StartAudioSession(); + return true; +#endif +} + void PluginModuleChild::QuickExit() { @@ -1641,7 +1665,7 @@ _popupcontextmenu(NPP instance, NPMenu* menu) PLUGIN_LOG_DEBUG_FUNCTION; AssertPluginThread(); -#ifdef OS_MACOSX +#ifdef MOZ_WIDGET_COCOA double pluginX, pluginY; double screenX, screenY; @@ -1775,30 +1799,27 @@ PluginModuleChild::AnswerNP_Initialize(NativeThreadId* tid, NPError* _retval) PPluginIdentifierChild* PluginModuleChild::AllocPPluginIdentifier(const nsCString& aString, - const int32_t& aInt) + const int32_t& aInt, + const bool& aTemporary) { - // There's a possibility that we already have an actor that wraps the same - // string or int because we do all this identifier construction - // asynchronously. Check to see if we've already wrapped here, and then set - // canonical actor of the new one to the actor already in our hash. - PluginIdentifierChild* newActor; - PluginIdentifierChild* existingActor; - + // We cannot call SetPermanent within this function because Manager() isn't + // set up yet. if (aString.IsVoid()) { - newActor = new PluginIdentifierChildInt(aInt); - if (mIntIdentifiers.Get(aInt, &existingActor)) - newActor->SetCanonicalIdentifier(existingActor); - else - mIntIdentifiers.Put(aInt, newActor); + return new PluginIdentifierChildInt(aInt); } - else { - newActor = new PluginIdentifierChildString(aString); - if (mStringIdentifiers.Get(aString, &existingActor)) - newActor->SetCanonicalIdentifier(existingActor); - else - mStringIdentifiers.Put(aString, newActor); + return new PluginIdentifierChildString(aString); +} + +bool +PluginModuleChild::RecvPPluginIdentifierConstructor(PPluginIdentifierChild* actor, + const nsCString& aString, + const int32_t& aInt, + const bool& aTemporary) +{ + if (!aTemporary) { + static_cast(actor)->MakePermanent(); } - return newActor; + return true; } bool @@ -2101,15 +2122,14 @@ PluginModuleChild::NPN_GetStringIdentifier(const NPUTF8* aName) PluginModuleChild* self = PluginModuleChild::current(); nsDependentCString name(aName); - PluginIdentifierChild* ident; - if (!self->mStringIdentifiers.Get(name, &ident)) { + PluginIdentifierChildString* ident = self->mStringIdentifiers.Get(name); + if (!ident) { nsCString nameCopy(name); ident = new PluginIdentifierChildString(nameCopy); - self->SendPPluginIdentifierConstructor(ident, nameCopy, -1); - self->mStringIdentifiers.Put(nameCopy, ident); + self->SendPPluginIdentifierConstructor(ident, nameCopy, -1, false); } - + ident->MakePermanent(); return ident; } @@ -2133,14 +2153,14 @@ PluginModuleChild::NPN_GetStringIdentifiers(const NPUTF8** aNames, continue; } nsDependentCString name(aNames[index]); - PluginIdentifierChild* ident; - if (!self->mStringIdentifiers.Get(name, &ident)) { + PluginIdentifierChildString* ident = self->mStringIdentifiers.Get(name); + if (!ident) { nsCString nameCopy(name); ident = new PluginIdentifierChildString(nameCopy); - self->SendPPluginIdentifierConstructor(ident, nameCopy, -1); - self->mStringIdentifiers.Put(nameCopy, ident); + self->SendPPluginIdentifierConstructor(ident, nameCopy, -1, false); } + ident->MakePermanent(); aIdentifiers[index] = ident; } } @@ -2163,15 +2183,15 @@ PluginModuleChild::NPN_GetIntIdentifier(int32_t aIntId) PluginModuleChild* self = PluginModuleChild::current(); - PluginIdentifierChild* ident; - if (!self->mIntIdentifiers.Get(aIntId, &ident)) { + PluginIdentifierChildInt* ident = self->mIntIdentifiers.Get(aIntId); + if (!ident) { nsCString voidString; voidString.SetIsVoid(PR_TRUE); ident = new PluginIdentifierChildInt(aIntId); - self->SendPPluginIdentifierConstructor(ident, voidString, aIntId); - self->mIntIdentifiers.Put(aIntId, ident); + self->SendPPluginIdentifierConstructor(ident, voidString, aIntId, false); } + ident->MakePermanent(); return ident; } @@ -2309,7 +2329,7 @@ PluginModuleChild::RecvProcessNativeEventsInRPCCall() #endif } -#ifdef OS_MACOSX +#ifdef MOZ_WIDGET_COCOA void PluginModuleChild::ProcessNativeEvents() { CallProcessSomeEvents(); diff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h index 4ef972eaef5..6214e4d7da0 100644 --- a/dom/plugins/ipc/PluginModuleChild.h +++ b/dom/plugins/ipc/PluginModuleChild.h @@ -117,7 +117,14 @@ protected: virtual PPluginIdentifierChild* AllocPPluginIdentifier(const nsCString& aString, - const int32_t& aInt); + const int32_t& aInt, + const bool& aTemporary); + + virtual bool + RecvPPluginIdentifierConstructor(PPluginIdentifierChild* actor, + const nsCString& aString, + const int32_t& aInt, + const bool& aTemporary); virtual bool DeallocPPluginIdentifier(PPluginIdentifierChild* aActor); @@ -156,6 +163,11 @@ protected: virtual bool AnswerNPP_GetSitesWithData(InfallibleTArray* aResult); + virtual bool + RecvSetAudioSessionData(const nsID& aId, + const nsString& aDisplayName, + const nsString& aIconPath); + virtual void ActorDestroy(ActorDestroyReason why); @@ -218,7 +230,7 @@ public: static NPUTF8* NP_CALLBACK NPN_UTF8FromIdentifier(NPIdentifier aIdentifier); static int32_t NP_CALLBACK NPN_IntFromIdentifier(NPIdentifier aIdentifier); -#ifdef OS_MACOSX +#ifdef MOZ_WIDGET_COCOA void ProcessNativeEvents(); void PluginShowWindow(uint32_t window_id, bool modal, CGRect r) { @@ -390,8 +402,11 @@ private: */ nsTHashtable mObjectMap; - nsDataHashtable mStringIdentifiers; - nsDataHashtable mIntIdentifiers; + friend class PluginIdentifierChild; + friend class PluginIdentifierChildString; + friend class PluginIdentifierChildInt; + nsDataHashtable mStringIdentifiers; + nsDataHashtable mIntIdentifiers; public: // called by PluginInstanceChild /** diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 597757acf0b..e320a168257 100644 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -66,6 +66,10 @@ #include "nsNPAPIPlugin.h" #include "nsILocalFile.h" +#ifdef XP_WIN +#include "mozilla/widget/AudioSession.h" +#endif + using base::KillProcess; using mozilla::PluginLibrary; @@ -73,6 +77,7 @@ using mozilla::ipc::SyncChannel; using namespace mozilla; using namespace mozilla::plugins; +using namespace mozilla::plugins::parent; static const char kTimeoutPref[] = "dom.ipc.plugins.timeoutSecs"; static const char kLaunchTimeoutPref[] = "dom.ipc.plugins.processLaunchTimeoutSecs"; @@ -341,8 +346,14 @@ PluginModuleParent::NotifyPluginCrashed() PPluginIdentifierParent* PluginModuleParent::AllocPPluginIdentifier(const nsCString& aString, - const int32_t& aInt) + const int32_t& aInt, + const bool& aTemporary) { + if (aTemporary) { + NS_ERROR("Plugins don't create temporary identifiers."); + return NULL; // should abort the plugin + } + NPIdentifier npident = aString.IsVoid() ? mozilla::plugins::parent::_getintidentifier(aInt) : mozilla::plugins::parent::_getstringidentifier(aString.get()); @@ -352,7 +363,7 @@ PluginModuleParent::AllocPPluginIdentifier(const nsCString& aString, return nsnull; } - PluginIdentifierParent* ident = new PluginIdentifierParent(npident); + PluginIdentifierParent* ident = new PluginIdentifierParent(npident, false); mIdentifiers.Put(npident, ident); return ident; } @@ -599,29 +610,39 @@ PluginModuleParent::AnswerNPN_UserAgent(nsCString* userAgent) return true; } -PPluginIdentifierParent* -PluginModuleParent::GetIdentifierForNPIdentifier(NPIdentifier aIdentifier) +PluginIdentifierParent* +PluginModuleParent::GetIdentifierForNPIdentifier(NPP npp, NPIdentifier aIdentifier) { PluginIdentifierParent* ident; - if (!mIdentifiers.Get(aIdentifier, &ident)) { - nsCString string; - int32_t intval = -1; - if (mozilla::plugins::parent::_identifierisstring(aIdentifier)) { - NPUTF8* chars = - mozilla::plugins::parent::_utf8fromidentifier(aIdentifier); - if (!chars) { - return nsnull; - } - string.Adopt(chars); + if (mIdentifiers.Get(aIdentifier, &ident)) { + if (ident->IsTemporary()) { + ident->AddTemporaryRef(); } - else { - intval = mozilla::plugins::parent::_intfromidentifier(aIdentifier); - string.SetIsVoid(PR_TRUE); - } - ident = new PluginIdentifierParent(aIdentifier); - if (!SendPPluginIdentifierConstructor(ident, string, intval)) - return nsnull; + return ident; + } + nsCString string; + int32_t intval = -1; + bool temporary = false; + if (mozilla::plugins::parent::_identifierisstring(aIdentifier)) { + NPUTF8* chars = + mozilla::plugins::parent::_utf8fromidentifier(aIdentifier); + if (!chars) { + return nsnull; + } + string.Adopt(chars); + temporary = !NPStringIdentifierIsPermanent(npp, aIdentifier); + } + else { + intval = mozilla::plugins::parent::_intfromidentifier(aIdentifier); + string.SetIsVoid(PR_TRUE); + } + + ident = new PluginIdentifierParent(aIdentifier, temporary); + if (!SendPPluginIdentifierConstructor(ident, string, intval, temporary)) + return nsnull; + + if (!temporary) { mIdentifiers.Put(aIdentifier, ident); } return ident; @@ -733,6 +754,8 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs { PLUGIN_LOG_DEBUG_METHOD; + nsresult rv; + mNPNIface = bFuncs; if (mShutdown) { @@ -767,6 +790,18 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) if (!CallNP_Initialize(&mPluginThread, error)) return NS_ERROR_FAILURE; +#if defined XP_WIN && MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN + // Send the info needed to join the chrome process's audio session to the + // plugin process + nsID id; + nsString sessionName; + nsString iconPath; + + if (NS_SUCCEEDED(mozilla::widget::GetAudioSessionData(id, sessionName, + iconPath))) + SendSetAudioSessionData(id, sessionName, iconPath); +#endif + return NS_OK; } #endif @@ -1125,9 +1160,11 @@ CAUpdate(nsITimer *aTimer, void *aClosure) { nsTObserverArray *ips = static_cast *>(aClosure); nsTObserverArray::ForwardIterator iter(*ips); +#ifdef MOZ_WIDGET_COCOA while (iter.HasMore()) { iter.GetNext()->Invalidate(); } +#endif // MOZ_WIDGET_COCOA } void diff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h index 5122ef40022..d4790fba5c4 100644 --- a/dom/plugins/ipc/PluginModuleParent.h +++ b/dom/plugins/ipc/PluginModuleParent.h @@ -90,7 +90,8 @@ protected: virtual PPluginIdentifierParent* AllocPPluginIdentifier(const nsCString& aString, - const int32_t& aInt); + const int32_t& aInt, + const bool& aTemporary); virtual bool DeallocPPluginIdentifier(PPluginIdentifierParent* aActor); @@ -136,8 +137,14 @@ public: return !IsOnCxxStack(); } - PPluginIdentifierParent* - GetIdentifierForNPIdentifier(NPIdentifier aIdentifier); + /** + * Get an identifier actor for this NPIdentifier. If this is a temporary + * identifier, the temporary refcount is increased by one. This method + * is intended only for use by StackIdentifier and the scriptable + * Enumerate hook. + */ + PluginIdentifierParent* + GetIdentifierForNPIdentifier(NPP npp, NPIdentifier aIdentifier); void ProcessRemoteNativeEventsInRPCCall(); diff --git a/dom/plugins/ipc/PluginScriptableObjectChild.cpp b/dom/plugins/ipc/PluginScriptableObjectChild.cpp index 2f89c7d378c..4d1e6f34ca2 100644 --- a/dom/plugins/ipc/PluginScriptableObjectChild.cpp +++ b/dom/plugins/ipc/PluginScriptableObjectChild.cpp @@ -42,6 +42,10 @@ using namespace mozilla::plugins; +namespace { +typedef PluginIdentifierChild::StackIdentifier StackIdentifier; +} + // static NPObject* PluginScriptableObjectChild::ScriptableAllocate(NPP aInstance, @@ -660,7 +664,7 @@ PluginScriptableObjectChild::AnswerHasMethod(PPluginIdentifierChild* aId, return true; } - PluginIdentifierChild* id = static_cast(aId); + StackIdentifier id(aId); *aHasMethod = mObject->_class->hasMethod(mObject, id->ToNPIdentifier()); return true; } @@ -704,7 +708,7 @@ PluginScriptableObjectChild::AnswerInvoke(PPluginIdentifierChild* aId, NPVariant result; VOID_TO_NPVARIANT(result); - PluginIdentifierChild* id = static_cast(aId); + StackIdentifier id(aId); bool success = mObject->_class->invoke(mObject, id->ToNPIdentifier(), convertedArgs.Elements(), argCount, &result); @@ -825,7 +829,7 @@ PluginScriptableObjectChild::AnswerHasProperty(PPluginIdentifierChild* aId, return true; } - PluginIdentifierChild* id = static_cast(aId); + StackIdentifier id(aId); *aHasProperty = mObject->_class->hasProperty(mObject, id->ToNPIdentifier()); return true; } @@ -855,7 +859,8 @@ PluginScriptableObjectChild::AnswerGetChildProperty(PPluginIdentifierChild* aId, return true; } - NPIdentifier id = static_cast(aId)->ToNPIdentifier(); + StackIdentifier stackID(aId); + NPIdentifier id = stackID->ToNPIdentifier(); *aHasProperty = mObject->_class->hasProperty(mObject, id); *aHasMethod = mObject->_class->hasMethod(mObject, id); @@ -901,7 +906,8 @@ PluginScriptableObjectChild::AnswerSetProperty(PPluginIdentifierChild* aId, return true; } - NPIdentifier id = static_cast(aId)->ToNPIdentifier(); + StackIdentifier stackID(aId); + NPIdentifier id = stackID->ToNPIdentifier(); if (!mObject->_class->hasProperty(mObject, id)) { *aSuccess = false; @@ -938,7 +944,8 @@ PluginScriptableObjectChild::AnswerRemoveProperty(PPluginIdentifierChild* aId, return true; } - NPIdentifier id = static_cast(aId)->ToNPIdentifier(); + StackIdentifier stackID(aId); + NPIdentifier id = stackID->ToNPIdentifier(); *aSuccess = mObject->_class->hasProperty(mObject, id) ? mObject->_class->removeProperty(mObject, id) : true; diff --git a/dom/plugins/ipc/PluginScriptableObjectParent.cpp b/dom/plugins/ipc/PluginScriptableObjectParent.cpp index 6e47eea058f..25c544cac2b 100644 --- a/dom/plugins/ipc/PluginScriptableObjectParent.cpp +++ b/dom/plugins/ipc/PluginScriptableObjectParent.cpp @@ -39,12 +39,16 @@ #include "PluginScriptableObjectParent.h" #include "PluginScriptableObjectUtils.h" +#include "nsNPAPIPlugin.h" #include "mozilla/unused.h" using namespace mozilla::plugins; +using namespace mozilla::plugins::parent; namespace { +typedef PluginIdentifierParent::StackIdentifier StackIdentifier; + inline void ReleaseVariant(NPVariant& aVariant, PluginInstanceParent* aInstance) @@ -55,32 +59,6 @@ ReleaseVariant(NPVariant& aVariant, } } -inline PPluginIdentifierParent* -GetIdentifier(PluginInstanceParent* aInstance, - NPIdentifier aIdentifier) -{ - PluginModuleParent* module = aInstance->Module(); - if (!module) { - NS_WARNING("Huh?!"); - return false; - } - - return module->GetIdentifierForNPIdentifier(aIdentifier); -} - -inline PPluginIdentifierParent* -GetIdentifier(NPObject* aObject, - NPIdentifier aIdentifier) -{ - PluginInstanceParent* instance = GetInstance(aObject); - if (!instance) { - NS_WARNING("Huh?!"); - return false; - } - - return GetIdentifier(instance, aIdentifier); -} - } // anonymous namespace // static @@ -154,13 +132,13 @@ PluginScriptableObjectParent::ScriptableHasMethod(NPObject* aObject, return false; } - PPluginIdentifierParent* identifier = GetIdentifier(aObject, aName); - if (!identifier) { + ProtectedActor actor(object->parent); + if (!actor) { return false; } - ProtectedActor actor(object->parent); - if (!actor) { + StackIdentifier identifier(aObject, aName); + if (!identifier) { return false; } @@ -194,13 +172,13 @@ PluginScriptableObjectParent::ScriptableInvoke(NPObject* aObject, return false; } - PPluginIdentifierParent* identifier = GetIdentifier(aObject, aName); - if (!identifier) { + ProtectedActor actor(object->parent); + if (!actor) { return false; } - ProtectedActor actor(object->parent); - if (!actor) { + StackIdentifier identifier(aObject, aName); + if (!identifier) { return false; } @@ -296,13 +274,13 @@ PluginScriptableObjectParent::ScriptableHasProperty(NPObject* aObject, return false; } - PPluginIdentifierParent* identifier = GetIdentifier(aObject, aName); - if (!identifier) { + ProtectedActor actor(object->parent); + if (!actor) { return false; } - ProtectedActor actor(object->parent); - if (!actor) { + StackIdentifier identifier(aObject, aName); + if (!identifier) { return false; } @@ -345,13 +323,13 @@ PluginScriptableObjectParent::ScriptableSetProperty(NPObject* aObject, return false; } - PPluginIdentifierParent* identifier = GetIdentifier(aObject, aName); - if (!identifier) { + ProtectedActor actor(object->parent); + if (!actor) { return false; } - ProtectedActor actor(object->parent); - if (!actor) { + StackIdentifier identifier(aObject, aName); + if (!identifier) { return false; } @@ -388,13 +366,13 @@ PluginScriptableObjectParent::ScriptableRemoveProperty(NPObject* aObject, return false; } - PPluginIdentifierParent* identifier = GetIdentifier(aObject, aName); - if (!identifier) { + ProtectedActor actor(object->parent); + if (!actor) { return false; } - ProtectedActor actor(object->parent); - if (!actor) { + StackIdentifier identifier(aObject, aName); + if (!identifier) { return false; } @@ -1096,8 +1074,23 @@ PluginScriptableObjectParent::AnswerEnumerate(InfallibleTArrayGetNPP()); + JSAutoRequest ar(cx); + for (uint32_t index = 0; index < idCount; index++) { - aProperties->AppendElement(GetIdentifier(instance, ids[index])); + // Because of GC hazards, all identifiers returned from enumerate + // must be made permanent. + if (_identifierisstring(ids[index])) { + JSString* str = NPIdentifierToString(ids[index]); + if (!JS_StringHasBeenInterned(cx, str)) { + JSString* str2 = JS_InternJSString(cx, str); + NS_ASSERTION(str2 == str, "Interning a JS string which is currently an ID should return itself."); + } + } + PluginIdentifierParent* id = + instance->Module()->GetIdentifierForNPIdentifier(instance->GetNPP(), ids[index]); + aProperties->AppendElement(id); + NS_ASSERTION(!id->IsTemporary(), "Should only have permanent identifiers!"); } npn->memfree(ids); @@ -1268,7 +1261,7 @@ PluginScriptableObjectParent::GetPropertyHelper(NPIdentifier aName, return JS_FALSE; } - PPluginIdentifierParent* identifier = GetIdentifier(GetInstance(), aName); + StackIdentifier identifier(GetInstance(), aName); if (!identifier) { return JS_FALSE; } diff --git a/dom/plugins/test/mochitest/Makefile.in b/dom/plugins/test/mochitest/Makefile.in index 65985c8ad7b..dc48592f145 100644 --- a/dom/plugins/test/mochitest/Makefile.in +++ b/dom/plugins/test/mochitest/Makefile.in @@ -52,6 +52,7 @@ _MOCHITEST_FILES = \ test_npruntime_npninvoke.html \ test_npruntime_npninvokedefault.html \ test_npruntime_identifiers.html \ + npruntime_identifiers_subpage.html \ loremipsum.txt \ loremipsum_file.txt \ loremipsum_nocache.txt \ diff --git a/dom/plugins/test/mochitest/npruntime_identifiers_subpage.html b/dom/plugins/test/mochitest/npruntime_identifiers_subpage.html new file mode 100644 index 00000000000..38c62e017bc --- /dev/null +++ b/dom/plugins/test/mochitest/npruntime_identifiers_subpage.html @@ -0,0 +1,4 @@ + + + + diff --git a/dom/plugins/test/mochitest/test_crash_submit.xul b/dom/plugins/test/mochitest/test_crash_submit.xul index 5a71e45b13a..a3c47ffbb12 100644 --- a/dom/plugins/test/mochitest/test_crash_submit.xul +++ b/dom/plugins/test/mochitest/test_crash_submit.xul @@ -39,6 +39,7 @@ var testObserver = { "Subject should be a property bag"); ok(subject.hasKey("serverCrashID"), "Should have a server crash ID"); let crashid = subject.getPropertyAsAString("serverCrashID"); + isnot(crashid, "", "Server crash ID should not be an empty string"); // Verify the data. The SJS script will return the data that was POSTed let req = new XMLHttpRequest(); diff --git a/dom/plugins/test/mochitest/test_crashing.html b/dom/plugins/test/mochitest/test_crashing.html index 9956ca0f474..77cf2c40fb4 100644 --- a/dom/plugins/test/mochitest/test_crashing.html +++ b/dom/plugins/test/mochitest/test_crashing.html @@ -14,6 +14,8 @@ return; } + SimpleTest.expectChildProcessCrash(); + var iframe = document.getElementById('iframe1'); var p = iframe.contentDocument.getElementById('plugin1'); diff --git a/dom/plugins/test/mochitest/test_crashing2.html b/dom/plugins/test/mochitest/test_crashing2.html index 6453c9b7430..234405422d6 100644 --- a/dom/plugins/test/mochitest/test_crashing2.html +++ b/dom/plugins/test/mochitest/test_crashing2.html @@ -18,6 +18,8 @@ return; } + SimpleTest.expectChildProcessCrash(); + var p = iframe.contentDocument.createElement('embed'); p.setAttribute('id', 'plugin1'); p.setAttribute('type', 'application/x-test'); diff --git a/dom/plugins/test/mochitest/test_hanging.html b/dom/plugins/test/mochitest/test_hanging.html index c0d60b8a6fb..f28c1166189 100644 --- a/dom/plugins/test/mochitest/test_hanging.html +++ b/dom/plugins/test/mochitest/test_hanging.html @@ -14,6 +14,8 @@ return; } + SimpleTest.expectChildProcessCrash(); + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var prefs = Components.classes['@mozilla.org/preferences-service;1'] .getService(Components.interfaces.nsIPrefBranch); diff --git a/dom/plugins/test/mochitest/test_npruntime_identifiers.html b/dom/plugins/test/mochitest/test_npruntime_identifiers.html index e9020041abd..9c43f2cbac2 100644 --- a/dom/plugins/test/mochitest/test_npruntime_identifiers.html +++ b/dom/plugins/test/mochitest/test_npruntime_identifiers.html @@ -8,11 +8,10 @@ - +

- - + diff --git a/dom/plugins/test/testplugin/nptest.cpp b/dom/plugins/test/testplugin/nptest.cpp index 266a8b456be..ba2c9950670 100644 --- a/dom/plugins/test/testplugin/nptest.cpp +++ b/dom/plugins/test/testplugin/nptest.cpp @@ -312,6 +312,7 @@ static URLNotifyData kNotifyData = { "static-cookie", NULL, NULL, + NULL, false, 0, NULL @@ -321,8 +322,6 @@ static const char* SUCCESS_STRING = "pass"; static bool sIdentifiersInitialized = false; -static uint32_t timerEventCount = 0; - struct timerEvent { int32_t timerIdReceive; int32_t timerIdSchedule; @@ -334,15 +333,12 @@ static timerEvent timerEvents[] = { {-1, 0, 200, false, -1}, {0, 0, 400, false, -1}, {0, 0, 200, true, -1}, - {0, 1, 100, true, -1}, - {1, -1, 0, false, -1}, - {0, -1, 0, false, -1}, - {1, -1, 0, false, -1}, - {1, -1, 0, false, -1}, + {0, 1, 400, true, -1}, {0, -1, 0, false, 0}, - {1, 2, 600, false, 1}, - {2, -1, 0, false, 2}, + {1, -1, 0, false, -1}, + {1, -1, 0, false, 1}, }; +static uint32_t currentTimerEventCount = 0; static uint32_t totalTimerEvents = sizeof(timerEvents) / sizeof(timerEvent); /** @@ -2845,8 +2841,8 @@ getAuthInfo(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant static void timerCallback(NPP npp, uint32_t timerID) { InstanceData* id = static_cast(npp->pdata); - timerEventCount++; - timerEvent event = timerEvents[timerEventCount]; + currentTimerEventCount++; + timerEvent event = timerEvents[currentTimerEventCount]; NPObject* windowObject; NPN_GetValue(npp, NPNVWindowNPObject, &windowObject); @@ -2854,10 +2850,11 @@ static void timerCallback(NPP npp, uint32_t timerID) return; NPVariant rval; - if (timerID != id->timerID[event.timerIdReceive]) + if (timerID != id->timerID[event.timerIdReceive]) { id->timerTestResult = false; + } - if (timerEventCount == totalTimerEvents - 1) { + if (currentTimerEventCount == totalTimerEvents - 1) { NPVariant arg; BOOLEAN_TO_NPVARIANT(id->timerTestResult, arg); NPN_Invoke(npp, windowObject, NPN_GetStringIdentifier(id->timerTestScriptCallback.c_str()), &arg, 1, &rval); @@ -2879,7 +2876,7 @@ timerTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* { NPP npp = static_cast(npobj)->npp; InstanceData* id = static_cast(npp->pdata); - timerEventCount = 0; + currentTimerEventCount = 0; if (argCount < 1 || !NPVARIANT_IS_STRING(args[0])) return false; @@ -2887,7 +2884,7 @@ timerTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* id->timerTestScriptCallback = argstr->UTF8Characters; id->timerTestResult = true; - timerEvent event = timerEvents[timerEventCount]; + timerEvent event = timerEvents[currentTimerEventCount]; id->timerID[event.timerIdSchedule] = NPN_ScheduleTimer(npp, event.timerInterval, event.timerRepeat, timerCallback); diff --git a/dom/plugins/test/testplugin/nptest_macosx.mm b/dom/plugins/test/testplugin/nptest_macosx.mm index 5bf1b09d907..dd7379ec738 100644 --- a/dom/plugins/test/testplugin/nptest_macosx.mm +++ b/dom/plugins/test/testplugin/nptest_macosx.mm @@ -32,6 +32,7 @@ * ***** END LICENSE BLOCK ***** */ #include "nptest_platform.h" +#include "nsAlgorithm.h" #include using namespace std; @@ -191,8 +192,8 @@ pluginDraw(InstanceData* instanceData, NPCocoaEvent* event) // Initialize a rectangular path. CGMutablePathRef path = CGPathCreateMutable(); - CGRect bounds = CGRectMake(10.0, 10.0, PR_MAX(0.0, windowWidth - 20.0), - PR_MAX(0.0, windowHeight - 20.0)); + CGRect bounds = CGRectMake(10.0, 10.0, NS_MAX(0.0, windowWidth - 20.0), + NS_MAX(0.0, windowHeight - 20.0)); CGPathAddRect(path, NULL, bounds); // Initialize an attributed string. diff --git a/dom/src/events/nsJSEventListener.cpp b/dom/src/events/nsJSEventListener.cpp index df313ea3fca..1505af2b8be 100644 --- a/dom/src/events/nsJSEventListener.cpp +++ b/dom/src/events/nsJSEventListener.cpp @@ -52,7 +52,7 @@ #include "nsVariant.h" #include "nsIDOMBeforeUnloadEvent.h" #include "nsGkAtoms.h" -#include "nsPIDOMEventTarget.h" +#include "nsIDOMEventTarget.h" #include "nsIJSContextStack.h" #ifdef NS_DEBUG #include "nsDOMJSUtils.h" @@ -132,7 +132,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsJSEventListener) nsresult nsJSEventListener::GetJSVal(const nsAString& aEventName, jsval* aJSVal) { - nsCOMPtr target = do_QueryInterface(mTarget); + nsCOMPtr target = do_QueryInterface(mTarget); if (target && mContext) { nsAutoString eventString = NS_LITERAL_STRING("on") + aEventName; nsCOMPtr atomName = do_GetAtom(eventString); diff --git a/dom/src/storage/nsDOMStorage.cpp b/dom/src/storage/nsDOMStorage.cpp index 78b985ab927..1c85f4766a3 100644 --- a/dom/src/storage/nsDOMStorage.cpp +++ b/dom/src/storage/nsDOMStorage.cpp @@ -137,8 +137,9 @@ static PRBool IsCallerSecure() { nsCOMPtr subjectPrincipal; - nsContentUtils::GetSecurityManager()-> - GetSubjectPrincipal(getter_AddRefs(subjectPrincipal)); + nsresult rv = nsContentUtils::GetSecurityManager()-> + GetSubjectPrincipal(getter_AddRefs(subjectPrincipal)); + NS_ENSURE_SUCCESS(rv, PR_FALSE); if (!subjectPrincipal) { // No subject principal means no code is running. Default to not @@ -161,7 +162,7 @@ IsCallerSecure() } PRBool isHttps = PR_FALSE; - nsresult rv = innerUri->SchemeIs("https", &isHttps); + rv = innerUri->SchemeIs("https", &isHttps); return NS_SUCCEEDED(rv) && isHttps; } @@ -1470,8 +1471,9 @@ nsDOMStorage::CanUseStorage(PRPackedBool* aSessionOnly) return PR_TRUE; nsCOMPtr subjectPrincipal; - nsContentUtils::GetSecurityManager()-> - GetSubjectPrincipal(getter_AddRefs(subjectPrincipal)); + nsresult rv = nsContentUtils::GetSecurityManager()-> + GetSubjectPrincipal(getter_AddRefs(subjectPrincipal)); + NS_ENSURE_SUCCESS(rv, PR_FALSE); // if subjectPrincipal were null we'd have returned after // IsCallerChrome(). @@ -1533,7 +1535,8 @@ nsDOMStorage::CacheStoragePermissions() return PR_FALSE; nsCOMPtr subjectPrincipal; - ssm->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal)); + nsresult rv = ssm->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal)); + NS_ENSURE_SUCCESS(rv, PR_FALSE); NS_ASSERTION(mSecurityChecker, "Has non-null mSecurityChecker"); return mSecurityChecker->CanAccess(subjectPrincipal); diff --git a/dom/src/threads/nsDOMWorker.cpp b/dom/src/threads/nsDOMWorker.cpp index f540b7d862c..3fa82450f82 100644 --- a/dom/src/threads/nsDOMWorker.cpp +++ b/dom/src/threads/nsDOMWorker.cpp @@ -853,9 +853,8 @@ NS_IMPL_ISUPPORTS_INHERITED3(nsDOMWorkerScope, nsDOMWorkerMessageHandler, nsIWorkerGlobalScope, nsIXPCScriptable) -NS_IMPL_CI_INTERFACE_GETTER5(nsDOMWorkerScope, nsIWorkerScope, +NS_IMPL_CI_INTERFACE_GETTER4(nsDOMWorkerScope, nsIWorkerScope, nsIWorkerGlobalScope, - nsIDOMNSEventTarget, nsIDOMEventTarget, nsIXPCScriptable) @@ -1158,14 +1157,6 @@ nsDOMWorkerScope::SetOnclose(nsIDOMEventListener* aOnclose) return NS_OK; } -NS_IMETHODIMP -nsDOMWorkerScope::AddEventListener(const nsAString& aType, - nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - return AddEventListener(aType, aListener, aUseCapture, PR_FALSE, 1); -} - NS_IMETHODIMP nsDOMWorkerScope::RemoveEventListener(const nsAString& aType, nsIDOMEventListener* aListener, @@ -1439,9 +1430,8 @@ NS_INTERFACE_MAP_BEGIN(nsDOMWorker) NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable) NS_INTERFACE_MAP_ENTRY(nsIWorker) NS_INTERFACE_MAP_ENTRY(nsIAbstractWorker) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMNSEventTarget, + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventTarget, nsDOMWorkerMessageHandler) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventTarget, nsDOMWorkerMessageHandler) NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer) NS_INTERFACE_MAP_ENTRY(nsITimerCallback) NS_INTERFACE_MAP_END @@ -1547,9 +1537,8 @@ nsDOMWorker::Finalize(nsIXPConnectWrappedNative* /* aWrapper */, return NS_OK; } -NS_IMPL_CI_INTERFACE_GETTER4(nsDOMWorker, nsIWorker, +NS_IMPL_CI_INTERFACE_GETTER3(nsDOMWorker, nsIWorker, nsIAbstractWorker, - nsIDOMNSEventTarget, nsIDOMEventTarget) NS_IMPL_THREADSAFE_DOM_CI_GETINTERFACES(nsDOMWorker) NS_IMPL_THREADSAFE_DOM_CI_ALL_THE_REST(nsDOMWorker) @@ -2561,14 +2550,6 @@ nsDOMWorker::QueueSuspendedRunnable(nsIRunnable* aRunnable) return mQueuedRunnables.AppendElement(aRunnable) ? PR_TRUE : PR_FALSE; } -NS_IMETHODIMP -nsDOMWorker::AddEventListener(const nsAString& aType, - nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - return AddEventListener(aType, aListener, aUseCapture, PR_FALSE, 1); -} - NS_IMETHODIMP nsDOMWorker::RemoveEventListener(const nsAString& aType, nsIDOMEventListener* aListener, @@ -2608,7 +2589,7 @@ nsDOMWorker::AddEventListener(const nsAString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture, PRBool aWantsUntrusted, - PRUint8 optional_argc) + PRUint8 aOptionalArgc) { NS_ASSERTION(mWrappedNative, "Called after Finalize!"); if (IsCanceled()) { @@ -2618,7 +2599,7 @@ nsDOMWorker::AddEventListener(const nsAString& aType, return nsDOMWorkerMessageHandler::AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted, - optional_argc); + aOptionalArgc); } /** diff --git a/dom/src/threads/nsDOMWorker.h b/dom/src/threads/nsDOMWorker.h index 33979d2686b..890fb9a5274 100644 --- a/dom/src/threads/nsDOMWorker.h +++ b/dom/src/threads/nsDOMWorker.h @@ -81,13 +81,19 @@ class nsDOMWorkerScope : public nsDOMWorkerMessageHandler, public: NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSIDOMEVENTTARGET - // nsIDOMNSEventTarget + + // nsIDOMEventHandler + NS_FORWARD_INTERNAL_NSIDOMEVENTTARGET(nsDOMWorkerMessageHandler::) NS_IMETHOD AddEventListener(const nsAString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture, PRBool aWantsUntrusted, PRUint8 optional_argc); + NS_IMETHOD RemoveEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture); + NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent, + PRBool* _retval); NS_DECL_NSIWORKERGLOBALSCOPE NS_DECL_NSIWORKERSCOPE NS_DECL_NSIXPCSCRIPTABLE @@ -162,13 +168,20 @@ class nsDOMWorker : public nsDOMWorkerMessageHandler, public: NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSIDOMEVENTTARGET - // nsIDOMNSEventTarget + + // nsIDOMEventHandler + NS_FORWARD_INTERNAL_NSIDOMEVENTTARGET(nsDOMWorkerMessageHandler::) NS_IMETHOD AddEventListener(const nsAString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture, PRBool aWantsUntrusted, PRUint8 optional_argc); + NS_IMETHOD RemoveEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture); + NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent, + PRBool* _retval); + NS_DECL_NSIABSTRACTWORKER NS_DECL_NSIWORKER NS_DECL_NSITIMERCALLBACK diff --git a/dom/src/threads/nsDOMWorkerMessageHandler.cpp b/dom/src/threads/nsDOMWorkerMessageHandler.cpp index 4feb0494ae2..693ea2af493 100644 --- a/dom/src/threads/nsDOMWorkerMessageHandler.cpp +++ b/dom/src/threads/nsDOMWorkerMessageHandler.cpp @@ -89,13 +89,11 @@ nsDOMWorkerWrappedWeakEventListener(nsDOMWorkerWeakEventListener* aInner) NS_ASSERTION(aInner, "Null pointer!"); } -NS_IMPL_THREADSAFE_ISUPPORTS3(nsDOMWorkerMessageHandler, - nsIDOMNSEventTarget, +NS_IMPL_THREADSAFE_ISUPPORTS2(nsDOMWorkerMessageHandler, nsIDOMEventTarget, nsIClassInfo) -NS_IMPL_CI_INTERFACE_GETTER2(nsDOMWorkerMessageHandler, - nsIDOMNSEventTarget, +NS_IMPL_CI_INTERFACE_GETTER1(nsDOMWorkerMessageHandler, nsIDOMEventTarget) NS_IMPL_THREADSAFE_DOM_CI(nsDOMWorkerMessageHandler) @@ -246,17 +244,6 @@ nsDOMWorkerMessageHandler::Trace(JSTracer* aTracer) } } -/** - * See nsIDOMEventTarget - */ -NS_IMETHODIMP -nsDOMWorkerMessageHandler::AddEventListener(const nsAString& aType, - nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - return AddEventListener(aType, aListener, aUseCapture, PR_FALSE, 1); -} - /** * See nsIDOMEventTarget */ @@ -337,17 +324,17 @@ nsDOMWorkerMessageHandler::DispatchEvent(nsIDOMEvent* aEvent, } /** - * See nsIDOMNSEventTarget + * See nsIDOMEventTarget */ NS_IMETHODIMP nsDOMWorkerMessageHandler::AddEventListener(const nsAString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture, PRBool aWantsUntrusted, - PRUint8 optional_argc) + PRUint8 aOptionalArgc) { // We don't support aWantsUntrusted yet. - NS_ENSURE_TRUE(optional_argc < 2, NS_ERROR_NOT_IMPLEMENTED); + NS_ENSURE_TRUE(aOptionalArgc < 2, NS_ERROR_NOT_IMPLEMENTED); ListenerCollection* collection = const_cast(GetListenerCollection(aType)); @@ -370,21 +357,84 @@ nsDOMWorkerMessageHandler::AddEventListener(const nsAString& aType, return NS_OK; } -/** - * See nsIDOMNSEventTarget - */ -NS_IMETHODIMP -nsDOMWorkerMessageHandler::GetScriptTypeID(PRUint32 *aScriptType) +nsIDOMEventTarget * +nsDOMWorkerMessageHandler::GetTargetForDOMEvent() { - *aScriptType = nsIProgrammingLanguage::JAVASCRIPT; - - return NS_OK; + NS_ERROR("Should not be called"); + return nsnull; } -NS_IMETHODIMP -nsDOMWorkerMessageHandler::SetScriptTypeID(PRUint32 aScriptType) +nsIDOMEventTarget * +nsDOMWorkerMessageHandler::GetTargetForEventTargetChain() { - NS_ERROR("Can't change default script type for workers"); + NS_ERROR("Should not be called"); + return nsnull; +} +nsresult +nsDOMWorkerMessageHandler::PreHandleEvent(nsEventChainPreVisitor & aVisitor) +{ + NS_ERROR("Should not be called"); return NS_ERROR_NOT_IMPLEMENTED; } + +nsresult +nsDOMWorkerMessageHandler::WillHandleEvent(nsEventChainPostVisitor & aVisitor) +{ + NS_ERROR("Should not be called"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +nsresult +nsDOMWorkerMessageHandler::PostHandleEvent(nsEventChainPostVisitor & aVisitor) +{ + NS_ERROR("Should not be called"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +nsresult +nsDOMWorkerMessageHandler::DispatchDOMEvent(nsEvent *aEvent, nsIDOMEvent *aDOMEvent, + nsPresContext *aPresContext, + nsEventStatus *aEventStatus) +{ + NS_ERROR("Should not be called"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +nsEventListenerManager* +nsDOMWorkerMessageHandler::GetListenerManager(PRBool aMayCreate) +{ + NS_ERROR("Should not be called"); + return nsnull; +} + +nsresult +nsDOMWorkerMessageHandler::AddEventListenerByIID(nsIDOMEventListener *aListener, + const nsIID & aIID) +{ + NS_ERROR("Should not be called"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +nsresult +nsDOMWorkerMessageHandler::RemoveEventListenerByIID(nsIDOMEventListener *aListener, + const nsIID & aIID) +{ + NS_ERROR("Should not be called"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +nsIScriptContext* +nsDOMWorkerMessageHandler::GetContextForEventHandlers(nsresult *aRv) +{ + NS_ERROR("Should not be called"); + *aRv = NS_ERROR_NOT_IMPLEMENTED; + return nsnull; +} + +JSContext* +nsDOMWorkerMessageHandler::GetJSContextForEventHandlers() +{ + NS_ERROR("Should not be called"); + return nsnull; +} diff --git a/dom/src/threads/nsDOMWorkerMessageHandler.h b/dom/src/threads/nsDOMWorkerMessageHandler.h index 0fc9c3e9ffb..af7f0061ccb 100644 --- a/dom/src/threads/nsDOMWorkerMessageHandler.h +++ b/dom/src/threads/nsDOMWorkerMessageHandler.h @@ -42,7 +42,6 @@ #include "nsIClassInfo.h" #include "nsIDOMEventListener.h" #include "nsIDOMEventTarget.h" -#include "nsIDOMNSEventTarget.h" #include "nsIDOMWorkers.h" #include "nsIProgrammingLanguage.h" @@ -106,13 +105,11 @@ private: }; class nsDOMWorkerMessageHandler : public nsIDOMEventTarget, - public nsIDOMNSEventTarget, public nsIClassInfo { public: NS_DECL_ISUPPORTS NS_DECL_NSIDOMEVENTTARGET - NS_DECL_NSIDOMNSEVENTTARGET NS_DECL_NSICLASSINFO virtual nsresult SetOnXListener(const nsAString& aType, @@ -161,4 +158,18 @@ private: nsTArray mCollections; }; +#define NS_FORWARD_INTERNAL_NSIDOMEVENTTARGET(_to) \ + virtual nsIDOMEventTarget * GetTargetForDOMEvent(void) { return _to GetTargetForDOMEvent(); } \ + virtual nsIDOMEventTarget * GetTargetForEventTargetChain(void) { return _to GetTargetForEventTargetChain(); } \ + virtual nsresult PreHandleEvent(nsEventChainPreVisitor & aVisitor) { return _to PreHandleEvent(aVisitor); } \ + virtual nsresult WillHandleEvent(nsEventChainPostVisitor & aVisitor) { return _to WillHandleEvent(aVisitor); } \ + virtual nsresult PostHandleEvent(nsEventChainPostVisitor & aVisitor) { return _to PostHandleEvent(aVisitor); } \ + virtual nsresult DispatchDOMEvent(nsEvent *aEvent, nsIDOMEvent *aDOMEvent, nsPresContext *aPresContext, nsEventStatus *aEventStatus) { return _to DispatchDOMEvent(aEvent, aDOMEvent, aPresContext, aEventStatus); } \ + virtual nsEventListenerManager * GetListenerManager(PRBool aMayCreate) { return _to GetListenerManager(aMayCreate); } \ + virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID & aIID) { return _to AddEventListenerByIID(aListener, aIID); } \ + virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID & aIID) { return _to RemoveEventListenerByIID(aListener, aIID); } \ + virtual nsIScriptContext * GetContextForEventHandlers(nsresult *aRv NS_OUTPARAM) { return _to GetContextForEventHandlers(aRv); } \ + virtual JSContext * GetJSContextForEventHandlers(void) { return _to GetJSContextForEventHandlers(); } + + #endif /* __NSDOMWORKERMESSAGEHANDLER_H__ */ diff --git a/dom/src/threads/nsDOMWorkerXHR.cpp b/dom/src/threads/nsDOMWorkerXHR.cpp index 87e06bf550c..3e8094da7f3 100644 --- a/dom/src/threads/nsDOMWorkerXHR.cpp +++ b/dom/src/threads/nsDOMWorkerXHR.cpp @@ -274,21 +274,12 @@ nsDOMWorkerXHRUpload::nsDOMWorkerXHRUpload(nsDOMWorkerXHR* aWorkerXHR) NS_IMPL_ISUPPORTS_INHERITED1(nsDOMWorkerXHRUpload, nsDOMWorkerXHREventTarget, nsIXMLHttpRequestUpload) -NS_IMPL_CI_INTERFACE_GETTER4(nsDOMWorkerXHRUpload, nsIDOMNSEventTarget, - nsIDOMEventTarget, +NS_IMPL_CI_INTERFACE_GETTER3(nsDOMWorkerXHRUpload, nsIDOMEventTarget, nsIXMLHttpRequestEventTarget, nsIXMLHttpRequestUpload) NS_IMPL_THREADSAFE_DOM_CI_GETINTERFACES(nsDOMWorkerXHRUpload) -NS_IMETHODIMP -nsDOMWorkerXHRUpload::AddEventListener(const nsAString& aType, - nsIDOMEventListener* aListener, - PRBool aUseCapture) -{ - return AddEventListener(aType, aListener, aUseCapture, PR_FALSE, 1); -} - NS_IMETHODIMP nsDOMWorkerXHRUpload::RemoveEventListener(const nsAString& aType, nsIDOMEventListener* aListener, @@ -405,8 +396,7 @@ NS_IMPL_QUERY_INTERFACE_INHERITED2(nsDOMWorkerXHR, nsDOMWorkerXHREventTarget, nsIXMLHttpRequest, nsIXPCScriptable) -NS_IMPL_CI_INTERFACE_GETTER4(nsDOMWorkerXHR, nsIDOMNSEventTarget, - nsIDOMEventTarget, +NS_IMPL_CI_INTERFACE_GETTER3(nsDOMWorkerXHR, nsIDOMEventTarget, nsIXMLHttpRequestEventTarget, nsIXMLHttpRequest) diff --git a/dom/src/threads/nsDOMWorkerXHR.h b/dom/src/threads/nsDOMWorkerXHR.h index a3d0a748f38..830dbd2c5d5 100644 --- a/dom/src/threads/nsDOMWorkerXHR.h +++ b/dom/src/threads/nsDOMWorkerXHR.h @@ -71,7 +71,6 @@ class nsDOMWorkerXHREventTarget : public nsDOMWorkerMessageHandler, public: NS_DECL_ISUPPORTS_INHERITED NS_FORWARD_NSIDOMEVENTTARGET(nsDOMWorkerMessageHandler::) - NS_FORWARD_NSIDOMNSEVENTTARGET(nsDOMWorkerMessageHandler::) NS_DECL_NSIXMLHTTPREQUESTEVENTTARGET static const char* const sListenerTypes[]; @@ -141,12 +140,19 @@ class nsDOMWorkerXHRUpload : public nsDOMWorkerXHREventTarget, public: NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSIDOMEVENTTARGET + + // nsIDOMEventHandler + NS_FORWARD_INTERNAL_NSIDOMEVENTTARGET(nsDOMWorkerMessageHandler::) NS_IMETHOD AddEventListener(const nsAString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture, PRBool aWantsUntrusted, PRUint8 optional_argc); + NS_IMETHOD RemoveEventListener(const nsAString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture); + NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent, + PRBool* _retval); NS_FORWARD_NSIXMLHTTPREQUESTEVENTTARGET(nsDOMWorkerXHREventTarget::) NS_DECL_NSIXMLHTTPREQUESTUPLOAD NS_FORWARD_NSICLASSINFO_NOGETINTERFACES(nsDOMWorkerXHREventTarget::) diff --git a/dom/src/threads/nsDOMWorkerXHRProxy.cpp b/dom/src/threads/nsDOMWorkerXHRProxy.cpp index c0bd215338b..87506f563a3 100644 --- a/dom/src/threads/nsDOMWorkerXHRProxy.cpp +++ b/dom/src/threads/nsDOMWorkerXHRProxy.cpp @@ -40,7 +40,6 @@ // Interfaces #include "nsIDOMEvent.h" -#include "nsIDOMEventTarget.h" #include "nsIDOMProgressEvent.h" #include "nsILoadGroup.h" #include "nsIRequest.h" @@ -495,11 +494,6 @@ nsDOMWorkerXHRProxy::AddRemoveXHRListeners(PRBool aAdd) nsCOMPtr xhrTarget(do_QueryInterface(mXHR)); NS_ASSERTION(xhrTarget, "This shouldn't fail!"); - EventListenerFunction addRemoveEventListener = - aAdd ? - &nsIDOMEventTarget::AddEventListener : - &nsIDOMEventTarget::RemoveEventListener; - nsAutoString eventName; PRUint32 index = 0; @@ -509,14 +503,25 @@ nsDOMWorkerXHRProxy::AddRemoveXHRListeners(PRBool aAdd) for (; index < MAX_UPLOAD_LISTENER_TYPE; index++) { eventName.AssignASCII(nsDOMWorkerXHREventTarget::sListenerTypes[index]); - (xhrTarget.get()->*addRemoveEventListener)(eventName, this, PR_FALSE); - (uploadTarget.get()->*addRemoveEventListener)(eventName, this, PR_FALSE); + if (aAdd) { + xhrTarget->AddEventListener(eventName, this, PR_FALSE); + uploadTarget->AddEventListener(eventName, this, PR_FALSE); + } + else { + xhrTarget->RemoveEventListener(eventName, this, PR_FALSE); + uploadTarget->RemoveEventListener(eventName, this, PR_FALSE); + } } } for (; index < MAX_XHR_LISTENER_TYPE; index++) { eventName.AssignASCII(nsDOMWorkerXHREventTarget::sListenerTypes[index]); - (xhrTarget.get()->*addRemoveEventListener)(eventName, this, PR_FALSE); + if (aAdd) { + xhrTarget->AddEventListener(eventName, this, PR_FALSE); + } + else { + xhrTarget->RemoveEventListener(eventName, this, PR_FALSE); + } } } diff --git a/dom/src/threads/nsDOMWorkerXHRProxy.h b/dom/src/threads/nsDOMWorkerXHRProxy.h index 02f1e6852df..873826fd03e 100644 --- a/dom/src/threads/nsDOMWorkerXHRProxy.h +++ b/dom/src/threads/nsDOMWorkerXHRProxy.h @@ -75,10 +75,6 @@ class nsDOMWorkerXHRProxy : public nsIRunnable, friend class nsDOMWorkerXHR; friend class nsDOMWorkerXHRUpload; - typedef NS_STDCALL_FUNCPROTO(nsresult, EventListenerFunction, nsIDOMEventTarget, - AddEventListener, - (const nsAString&, nsIDOMEventListener*, PRBool)); - public: typedef nsAutoTArray, 5> SyncEventQueue; diff --git a/dom/system/unix/nsDeviceMotionSystem.cpp b/dom/system/unix/nsDeviceMotionSystem.cpp index e92c6511613..4d84539afb3 100644 --- a/dom/system/unix/nsDeviceMotionSystem.cpp +++ b/dom/system/unix/nsDeviceMotionSystem.cpp @@ -42,10 +42,10 @@ typedef struct { const char* mPosition; const char* mCalibrate; - nsDeviceMotionSystemDriver mToken; -} DeviceMotion; + nsAccelerometerSystemDriver mToken; +} AccelerometerData; -static const DeviceMotion gDeviceMotions[] = { +static const AccelerometerData gAccelerometers[] = { // MacBook {"/sys/devices/platform/applesmc.768/position", "/sys/devices/platform/applesmc.768/calibrate", @@ -192,15 +192,15 @@ nsDeviceMotionSystem::UpdateHandler(nsITimer *aTimer, void *aClosure) void nsDeviceMotionSystem::Startup() { - // DeviceMotions in Linux are used by reading a file (yay UNIX!), which is + // Accelerometers in Linux are used by reading a file (yay UNIX!), which is // in a slightly different location depending on the driver. - for (unsigned int i = 0; i < NS_ARRAY_LENGTH(gDeviceMotions); i++) { - if (!(mPositionFile = fopen(gDeviceMotions[i].mPosition, "r"))) + for (unsigned int i = 0; i < NS_ARRAY_LENGTH(gAccelerometers); i++) { + if (!(mPositionFile = fopen(gAccelerometers[i].mPosition, "r"))) continue; - mType = gDeviceMotions[i].mToken; - if (gDeviceMotions[i].mCalibrate) { - mCalibrateFile = fopen(gDeviceMotions[i].mCalibrate, "r"); + mType = gAccelerometers[i].mToken; + if (gAccelerometers[i].mCalibrate) { + mCalibrateFile = fopen(gAccelerometers[i].mCalibrate, "r"); if (!mCalibrateFile) { fclose(mPositionFile); mPositionFile = nsnull; diff --git a/dom/system/unix/nsDeviceMotionSystem.h b/dom/system/unix/nsDeviceMotionSystem.h index 4a94eb9e53e..b26f00c21f9 100644 --- a/dom/system/unix/nsDeviceMotionSystem.h +++ b/dom/system/unix/nsDeviceMotionSystem.h @@ -41,7 +41,7 @@ #include #include "nsDeviceMotion.h" -enum nsDeviceMotionSystemDriver +enum nsAccelerometerSystemDriver { eNoSensor, eAppleSensor, @@ -61,7 +61,7 @@ class nsDeviceMotionSystem : public nsDeviceMotion FILE* mPositionFile; FILE* mCalibrateFile; - nsDeviceMotionSystemDriver mType; + nsAccelerometerSystemDriver mType; nsCOMPtr mUpdateTimer; static void UpdateHandler(nsITimer *aTimer, void *aClosure); diff --git a/dom/system/windows/nsDeviceMotionSystem.cpp b/dom/system/windows/nsDeviceMotionSystem.cpp index ec6efe89b92..b683b5594e6 100644 --- a/dom/system/windows/nsDeviceMotionSystem.cpp +++ b/dom/system/windows/nsDeviceMotionSystem.cpp @@ -52,11 +52,11 @@ typedef struct { char temp; // raw value (could be deg celsius?) unsigned short x0; // Used for "auto-center" unsigned short y0; // Used for "auto-center" -} ThinkPadDeviceMotionData; +} ThinkPadAccelerometerData; -typedef void (__stdcall *ShockproofGetDeviceMotionData)(ThinkPadDeviceMotionData*); +typedef void (__stdcall *ShockproofGetAccelerometerData)(ThinkPadAccelerometerData*); -ShockproofGetDeviceMotionData gShockproofGetDeviceMotionData = nsnull; +ShockproofGetAccelerometerData gShockproofGetAccelerometerData = nsnull; class ThinkPadSensor : public Sensor { @@ -85,9 +85,9 @@ ThinkPadSensor::Startup() if (!mLibrary) return PR_FALSE; - gShockproofGetDeviceMotionData = (ShockproofGetDeviceMotionData) - GetProcAddress(mLibrary, "ShockproofGetDeviceMotionData"); - if (!gShockproofGetDeviceMotionData) { + gShockproofGetAccelerometerData = (ShockproofGetAccelerometerData) + GetProcAddress(mLibrary, "ShockproofGetAccelerometerData"); + if (!gShockproofGetAccelerometerData) { FreeLibrary(mLibrary); mLibrary = nsnull; return PR_FALSE; @@ -101,15 +101,15 @@ ThinkPadSensor::Shutdown() NS_ASSERTION(mLibrary, "Shutdown called when mLibrary is null?"); FreeLibrary(mLibrary); mLibrary = nsnull; - gShockproofGetDeviceMotionData = nsnull; + gShockproofGetAccelerometerData = nsnull; } void ThinkPadSensor::GetValues(double *x, double *y, double *z) { - ThinkPadDeviceMotionData accelData; + ThinkPadAccelerometerData accelData; - gShockproofGetDeviceMotionData(&accelData); + gShockproofGetAccelerometerData(&accelData); // accelData.x and accelData.y is the acceleration measured from the accelerometer. // x and y is switched from what we use, and the accelerometer does not support z axis. diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 1b0c62df82b..8669a59c05c 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -43,9 +43,7 @@ #include "nsIDOMDocument.h" #include "nsIDOMHTMLElement.h" #include "nsIDOMNSHTMLElement.h" -#include "nsIDOMEventTarget.h" #include "nsIDOMNSEvent.h" -#include "nsPIDOMEventTarget.h" #include "nsIMEStateManager.h" #include "nsFocusManager.h" #include "nsUnicharUtils.h" @@ -60,7 +58,6 @@ #include "nsIDOMNodeList.h" #include "nsIDOMRange.h" #include "nsIDOMHTMLBRElement.h" -#include "nsIDOMEventTarget.h" #include "nsIDocument.h" #include "nsITransactionManager.h" #include "nsIAbsorbingTransaction.h" @@ -5237,7 +5234,7 @@ nsEditor::GetNativeKeyEvent(nsIDOMKeyEvent* aDOMKeyEvent) already_AddRefed nsEditor::GetFocusedContent() { - nsCOMPtr piTarget = GetPIDOMEventTarget(); + nsCOMPtr piTarget = GetDOMEventTarget(); if (!piTarget) { return nsnull; } @@ -5252,7 +5249,7 @@ nsEditor::GetFocusedContent() PRBool nsEditor::IsActiveInDOMWindow() { - nsCOMPtr piTarget = GetPIDOMEventTarget(); + nsCOMPtr piTarget = GetDOMEventTarget(); if (!piTarget) { return PR_FALSE; } diff --git a/editor/libeditor/base/nsEditor.h b/editor/libeditor/base/nsEditor.h index 8fdbc0d9054..7e3161853fc 100644 --- a/editor/libeditor/base/nsEditor.h +++ b/editor/libeditor/base/nsEditor.h @@ -62,7 +62,7 @@ #include "nsSelectionState.h" #include "nsIEditorSpellCheck.h" #include "nsIInlineSpellChecker.h" -#include "nsPIDOMEventTarget.h" +#include "nsIDOMEventTarget.h" #include "nsStubMutationObserver.h" #include "nsIViewManager.h" #include "nsCycleCollectionParticipant.h" @@ -613,7 +613,7 @@ public: nsIDOMNode *aEndNode, PRInt32 aEndOffset); - virtual already_AddRefed GetPIDOMEventTarget() = 0; + virtual already_AddRefed GetDOMEventTarget() = 0; // Fast non-refcounting editor root element accessor nsIDOMElement *GetRoot(); @@ -764,7 +764,7 @@ protected: PRInt8 mDocDirtyState; // -1 = not initialized nsWeakPtr mDocWeak; // weak reference to the nsIDOMDocument // The form field as an event receiver - nsCOMPtr mEventTarget; + nsCOMPtr mEventTarget; nsString* mPhonetic; diff --git a/editor/libeditor/base/nsEditorEventListener.cpp b/editor/libeditor/base/nsEditorEventListener.cpp index ebc0d59553c..063993593f9 100644 --- a/editor/libeditor/base/nsEditorEventListener.cpp +++ b/editor/libeditor/base/nsEditorEventListener.cpp @@ -44,7 +44,7 @@ #include "nsIDOMEvent.h" #include "nsIDOMNSEvent.h" #include "nsIDOMDocument.h" -#include "nsPIDOMEventTarget.h" +#include "nsIDOMEventTarget.h" #include "nsIDocument.h" #include "nsIPresShell.h" #include "nsISelection.h" @@ -56,8 +56,7 @@ #include "nsIEditorMailSupport.h" #include "nsILookAndFeel.h" #include "nsFocusManager.h" -#include "nsIEventListenerManager.h" -#include "nsIDOMEventGroup.h" +#include "nsEventListenerManager.h" #include "mozilla/Preferences.h" // Drag & Drop, Clipboard @@ -69,7 +68,6 @@ #include "nsISupportsPrimitives.h" #include "nsIDOMNSRange.h" #include "nsEditorUtils.h" -#include "nsIDOMEventTarget.h" #include "nsISelectionPrivate.h" #include "nsIDOMDragEvent.h" #include "nsIFocusManager.h" @@ -125,16 +123,13 @@ nsEditorEventListener::InstallToEditor() { NS_PRECONDITION(mEditor, "The caller must set mEditor"); - nsCOMPtr piTarget = mEditor->GetPIDOMEventTarget(); + nsCOMPtr piTarget = mEditor->GetDOMEventTarget(); NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE); nsresult rv; // register the event listeners with the listener manager - nsCOMPtr sysGroup; - piTarget->GetSystemEventGroup(getter_AddRefs(sysGroup)); - NS_ENSURE_STATE(sysGroup); - nsIEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE); + nsEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE); NS_ENSURE_STATE(elmP); nsCOMPtr listenerBase; @@ -143,29 +138,34 @@ nsEditorEventListener::InstallToEditor() rv = elmP->AddEventListenerByType(listenerBase, NS_LITERAL_STRING("keypress"), NS_EVENT_FLAG_BUBBLE | - NS_PRIV_EVENT_UNTRUSTED_PERMITTED, - sysGroup); + NS_PRIV_EVENT_UNTRUSTED_PERMITTED | + NS_EVENT_FLAG_SYSTEM_EVENT); NS_ENSURE_SUCCESS(rv, rv); // See bug 455215, we cannot use the standard dragstart event yet rv = elmP->AddEventListenerByType(listenerBase, NS_LITERAL_STRING("draggesture"), - NS_EVENT_FLAG_BUBBLE, sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); NS_ENSURE_SUCCESS(rv, rv); rv = elmP->AddEventListenerByType(listenerBase, NS_LITERAL_STRING("dragenter"), - NS_EVENT_FLAG_BUBBLE, sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); NS_ENSURE_SUCCESS(rv, rv); rv = elmP->AddEventListenerByType(listenerBase, NS_LITERAL_STRING("dragover"), - NS_EVENT_FLAG_BUBBLE, sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); NS_ENSURE_SUCCESS(rv, rv); rv = elmP->AddEventListenerByType(listenerBase, NS_LITERAL_STRING("dragexit"), - NS_EVENT_FLAG_BUBBLE, sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); NS_ENSURE_SUCCESS(rv, rv); rv = elmP->AddEventListenerByType(listenerBase, NS_LITERAL_STRING("drop"), - NS_EVENT_FLAG_BUBBLE, sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); NS_ENSURE_SUCCESS(rv, rv); rv = elmP->AddEventListenerByIID(listenerBase, @@ -204,43 +204,44 @@ nsEditorEventListener::Disconnect() void nsEditorEventListener::UninstallFromEditor() { - nsCOMPtr piTarget = mEditor->GetPIDOMEventTarget(); + nsCOMPtr piTarget = mEditor->GetDOMEventTarget(); if (!piTarget) { return; } - nsCOMPtr elmP = + nsEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE); if (!elmP) { return; } - nsCOMPtr sysGroup; - piTarget->GetSystemEventGroup(getter_AddRefs(sysGroup)); - if (!sysGroup) { - return; - } nsCOMPtr listenerBase; CallQueryInterface(this, getter_AddRefs(listenerBase)); elmP->RemoveEventListenerByType(listenerBase, NS_LITERAL_STRING("keypress"), - NS_EVENT_FLAG_BUBBLE, sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); elmP->RemoveEventListenerByType(listenerBase, NS_LITERAL_STRING("draggesture"), - NS_EVENT_FLAG_BUBBLE, sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); elmP->RemoveEventListenerByType(listenerBase, NS_LITERAL_STRING("dragenter"), - NS_EVENT_FLAG_BUBBLE, sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); elmP->RemoveEventListenerByType(listenerBase, NS_LITERAL_STRING("dragover"), - NS_EVENT_FLAG_BUBBLE, sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); elmP->RemoveEventListenerByType(listenerBase, NS_LITERAL_STRING("dragexit"), - NS_EVENT_FLAG_BUBBLE, sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); elmP->RemoveEventListenerByType(listenerBase, NS_LITERAL_STRING("drop"), - NS_EVENT_FLAG_BUBBLE, sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); elmP->RemoveEventListenerByIID(listenerBase, NS_GET_IID(nsIDOMMouseListener), diff --git a/editor/libeditor/base/nsEditorEventListener.h b/editor/libeditor/base/nsEditorEventListener.h index 05a36f1f048..b5d756fe3eb 100644 --- a/editor/libeditor/base/nsEditorEventListener.h +++ b/editor/libeditor/base/nsEditorEventListener.h @@ -52,7 +52,6 @@ class nsEditor; class nsIDOMDragEvent; -class nsPIDOMEventTarget; class nsEditorEventListener : public nsIDOMKeyListener, public nsIDOMTextListener, diff --git a/editor/libeditor/html/nsHTMLAbsPosition.cpp b/editor/libeditor/html/nsHTMLAbsPosition.cpp index e850c6dfdf0..9dd6648ee3d 100644 --- a/editor/libeditor/html/nsHTMLAbsPosition.cpp +++ b/editor/libeditor/html/nsHTMLAbsPosition.cpp @@ -411,7 +411,7 @@ nsHTMLEditor::GrabberClicked() mMouseMotionListenerP = new ResizerMouseMotionListener(this); if (!mMouseMotionListenerP) {return NS_ERROR_NULL_POINTER;} - nsCOMPtr piTarget = GetPIDOMEventTarget(); + nsCOMPtr piTarget = GetDOMEventTarget(); NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE); res = piTarget->AddEventListenerByIID(mMouseMotionListenerP, @@ -441,7 +441,7 @@ nsHTMLEditor::EndMoving() mPositioningShadow = nsnull; } - nsCOMPtr piTarget = GetPIDOMEventTarget(); + nsCOMPtr piTarget = GetDOMEventTarget(); if (piTarget && mMouseMotionListenerP) { #ifdef DEBUG diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index 8c4138fb91f..3f36166e9df 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -168,11 +168,6 @@ nsHTMLEditor::~nsHTMLEditor() // free any default style propItems RemoveAllDefaultProperties(); - while (mStyleSheetURLs.Length()) - { - RemoveOverrideStyleSheet(mStyleSheetURLs[0]); - } - if (mLinkHandler && mDocWeak) { nsCOMPtr ps = GetPresShell(); @@ -359,6 +354,11 @@ nsHTMLEditor::PreDestroy(PRBool aDestroyingFrames) document->RemoveMutationObserver(this); } + while (mStyleSheetURLs.Length()) + { + RemoveOverrideStyleSheet(mStyleSheetURLs[0]); + } + return nsPlaintextEditor::PreDestroy(aDestroyingFrames); } @@ -473,10 +473,9 @@ nsHTMLEditor::RemoveEventListeners() return; } - nsCOMPtr piTarget = GetPIDOMEventTarget(); - nsCOMPtr target = do_QueryInterface(piTarget); + nsCOMPtr target = GetDOMEventTarget(); - if (piTarget && target) + if (target) { // Both mMouseMotionListenerP and mResizeEventListenerP can be // registerd with other targets than the DOM event receiver that @@ -489,8 +488,8 @@ nsHTMLEditor::RemoveEventListeners() { // mMouseMotionListenerP might be registerd either by IID or // name, unregister by both. - piTarget->RemoveEventListenerByIID(mMouseMotionListenerP, - NS_GET_IID(nsIDOMMouseMotionListener)); + target->RemoveEventListenerByIID(mMouseMotionListenerP, + NS_GET_IID(nsIDOMMouseMotionListener)); target->RemoveEventListener(NS_LITERAL_STRING("mousemove"), mMouseMotionListenerP, PR_TRUE); @@ -5826,15 +5825,15 @@ nsHTMLEditor::IsActiveInDOMWindow() return PR_TRUE; } -already_AddRefed -nsHTMLEditor::GetPIDOMEventTarget() +already_AddRefed +nsHTMLEditor::GetDOMEventTarget() { // Don't use getDocument here, because we have no way of knowing // whether Init() was ever called. So we need to get the document // ourselves, if it exists. NS_PRECONDITION(mDocWeak, "This editor has not been initialized yet"); - nsCOMPtr piTarget = do_QueryReferent(mDocWeak.get()); - return piTarget.forget(); + nsCOMPtr target = do_QueryReferent(mDocWeak.get()); + return target.forget(); } PRBool diff --git a/editor/libeditor/html/nsHTMLEditor.h b/editor/libeditor/html/nsHTMLEditor.h index 3b3caf0dd31..7f1f6c5798a 100644 --- a/editor/libeditor/html/nsHTMLEditor.h +++ b/editor/libeditor/html/nsHTMLEditor.h @@ -151,7 +151,7 @@ public: virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent); virtual already_AddRefed GetFocusedContent(); virtual PRBool IsActiveInDOMWindow(); - virtual already_AddRefed GetPIDOMEventTarget(); + virtual already_AddRefed GetDOMEventTarget(); virtual already_AddRefed FindSelectionRoot(nsINode *aNode); virtual PRBool IsAcceptableInputEvent(nsIDOMEvent* aEvent); diff --git a/editor/libeditor/html/nsHTMLObjectResizer.cpp b/editor/libeditor/html/nsHTMLObjectResizer.cpp index 8ed0a9eb34f..e603f2083c9 100644 --- a/editor/libeditor/html/nsHTMLObjectResizer.cpp +++ b/editor/libeditor/html/nsHTMLObjectResizer.cpp @@ -38,9 +38,8 @@ #include "nsHTMLObjectResizer.h" -#include "nsIDOMEventTarget.h" #include "nsIDOMNSHTMLElement.h" -#include "nsPIDOMEventTarget.h" +#include "nsIDOMEventTarget.h" #include "nsIDOMText.h" #include "nsIDOMCSSValue.h" @@ -497,8 +496,7 @@ nsHTMLEditor::HideResizers(void) // don't forget to remove the listeners ! - nsCOMPtr piTarget = GetPIDOMEventTarget(); - nsCOMPtr target = do_QueryInterface(piTarget); + nsCOMPtr target = GetDOMEventTarget(); if (target && mMouseMotionListenerP) { @@ -606,8 +604,7 @@ nsHTMLEditor::StartResizing(nsIDOMElement *aHandle) return NS_ERROR_OUT_OF_MEMORY; } - nsCOMPtr piTarget = GetPIDOMEventTarget(); - nsCOMPtr target = do_QueryInterface(piTarget); + nsCOMPtr target = GetDOMEventTarget(); NS_ENSURE_TRUE(target, NS_ERROR_FAILURE); result = target->AddEventListener(NS_LITERAL_STRING("mousemove"), diff --git a/editor/libeditor/html/tests/test_contenteditable_text_input_handling.html b/editor/libeditor/html/tests/test_contenteditable_text_input_handling.html index 4b80eb86039..c84d3caa5cf 100644 --- a/editor/libeditor/html/tests/test_contenteditable_text_input_handling.html +++ b/editor/libeditor/html/tests/test_contenteditable_text_input_handling.html @@ -37,12 +37,9 @@ function runTests() aEvent.preventDefault(); // prevent the browser default behavior } }; - var systemGroup = - Components.classes["@mozilla.org/eventlistenerservice;1"]. - getService(Components.interfaces.nsIEventListenerService). - systemEventGroup; - window.QueryInterface(Components.interfaces.nsIDOM3EventTarget); - window.addGroupedEventListener("keypress", listener, false, systemGroup); + var els = Components.classes["@mozilla.org/eventlistenerservice;1"]. + getService(Components.interfaces.nsIEventListenerService); + els.addSystemEventListener(window, "keypress", listener, false); var staticContent = document.getElementById("static"); staticContent._defaultValue = getTextValue(staticContent); @@ -324,7 +321,7 @@ function runTests() testTextInput(inputInEditor); testTextInput(textareaInEditor); - window.removeGroupedEventListener("keypress", listener, false, systemGroup); + els.removeSystemEventListener(window, "keypress", listener, false); SimpleTest.finish(); } diff --git a/editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html b/editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html index 5ae1423f53a..ace19ffbea2 100644 --- a/editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html +++ b/editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html @@ -85,13 +85,8 @@ function runTests() getDesciption(aPreventedOnBubbling) + "prevented on bubbling phase"); } - var systemGroup = - Components.classes["@mozilla.org/eventlistenerservice;1"]. - getService(Components.interfaces.nsIEventListenerService). - systemEventGroup; - window.QueryInterface(Components.interfaces.nsIDOM3EventTarget); - window.addGroupedEventListener("keypress", listener, true, systemGroup); - window.addGroupedEventListener("keypress", listener, false, systemGroup); + SpecialPowers.addSystemEventListener(window, "keypress", listener, true); + SpecialPowers.addSystemEventListener(window, "keypress", listener, false); function doTest(aElement, aDescription, aIsReadonly, aIsTabbable, aIsPlaintext) @@ -660,8 +655,8 @@ function runTests() doTest(htmlEditor, "readonly and non-tabbable HTML editor but plaintext mode", true, false, true); - window.removeGroupedEventListener("keypress", listener, true, systemGroup); - window.removeGroupedEventListener("keypress", listener, false, systemGroup); + SpecialPowers.removeSystemEventListener(window, "keypress", listener, true); + SpecialPowers.removeSystemEventListener(window, "keypress", listener, false); SimpleTest.finish(); } diff --git a/editor/libeditor/text/nsPlaintextEditor.cpp b/editor/libeditor/text/nsPlaintextEditor.cpp index 2f223907bf7..e420debb037 100644 --- a/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/editor/libeditor/text/nsPlaintextEditor.cpp @@ -47,14 +47,12 @@ #include "nsIDOMDocument.h" #include "nsIDocument.h" #include "nsIDOMEventTarget.h" -#include "nsIDOM3EventTarget.h" #include "nsIDOMKeyEvent.h" #include "nsIDOMMouseListener.h" #include "nsISelection.h" #include "nsISelectionPrivate.h" #include "nsISelectionController.h" #include "nsGUIEvent.h" -#include "nsIDOMEventGroup.h" #include "nsCRT.h" #include "nsIEnumerator.h" @@ -1715,8 +1713,8 @@ nsPlaintextEditor::SelectEntireDocument(nsISelection *aSelection) return NS_OK; } -already_AddRefed -nsPlaintextEditor::GetPIDOMEventTarget() +already_AddRefed +nsPlaintextEditor::GetDOMEventTarget() { NS_IF_ADDREF(mEventTarget); return mEventTarget.get(); diff --git a/editor/libeditor/text/nsPlaintextEditor.h b/editor/libeditor/text/nsPlaintextEditor.h index 46758dc9acc..b2ada597934 100644 --- a/editor/libeditor/text/nsPlaintextEditor.h +++ b/editor/libeditor/text/nsPlaintextEditor.h @@ -145,7 +145,7 @@ public: virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent); - virtual already_AddRefed GetPIDOMEventTarget(); + virtual already_AddRefed GetDOMEventTarget(); virtual nsresult BeginIMEComposition(); virtual nsresult UpdateIMEComposition(const nsAString &aCompositionString, diff --git a/editor/libeditor/text/tests/test_bug569988.html b/editor/libeditor/text/tests/test_bug569988.html index a1765c4065c..77a40922f53 100644 --- a/editor/libeditor/text/tests/test_bug569988.html +++ b/editor/libeditor/text/tests/test_bug569988.html @@ -60,24 +60,18 @@ function onPromptFocus() { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); gPromptInput.removeEventListener("focus", onPromptFocus, false); - var systemGroup = - Components.classes["@mozilla.org/eventlistenerservice;1"]. - getService(Components.interfaces.nsIEventListenerService). - systemEventGroup; - gPromptInput.QueryInterface(Components.interfaces.nsIDOM3EventTarget); var listener = { handleEvent: function _hv(aEvent) { - netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var isPrevented = aEvent.getPreventDefault(); ok(!isPrevented, "ESC key event is prevented by editor"); - gPromptInput.removeGroupedEventListener("keypress", listener, false, - systemGroup); + SpecialPowers.removeSystemEventListener(gPromptInput, "keypress", + listener, false); SimpleTest.finish(); } }; - gPromptInput.addGroupedEventListener("keypress", listener, false, - systemGroup); + SpecialPowers.addSystemEventListener(gPromptInput, "keypress", listener, + false); ok(true, "sending key"); synthesizeKey("VK_ESCAPE", { }, gPromptInput.ownerDocument.defaultView); } diff --git a/editor/libeditor/text/tests/test_texteditor_keyevent_handling.html b/editor/libeditor/text/tests/test_texteditor_keyevent_handling.html index 627ebd5bb29..b92d94b9f13 100644 --- a/editor/libeditor/text/tests/test_texteditor_keyevent_handling.html +++ b/editor/libeditor/text/tests/test_texteditor_keyevent_handling.html @@ -90,14 +90,11 @@ function runTests() getDesciption(aPreventedOnBubbling) + "prevented on bubbling phase"); } - var systemGroup = - Components.classes["@mozilla.org/eventlistenerservice;1"]. - getService(Components.interfaces.nsIEventListenerService). - systemEventGroup; var parentElement = document.getElementById("display"); - parentElement.QueryInterface(Components.interfaces.nsIDOM3EventTarget); - parentElement.addGroupedEventListener("keypress", listener, true, systemGroup); - parentElement.addGroupedEventListener("keypress", listener, false, systemGroup); + SpecialPowers.addSystemEventListener(parentElement, "keypress", listener, + true); + SpecialPowers.addSystemEventListener(parentElement, "keypress", listener, + false); function doTest(aElement, aDescription, aIsSingleLine, aIsReadonly, aIsTabbable) @@ -407,8 +404,10 @@ function runTests() editor.flags = flags; - parentElement.removeGroupedEventListener("keypress", listener, true, systemGroup); - parentElement.removeGroupedEventListener("keypress", listener, false, systemGroup); + SpecialPowers.removeSystemEventListener(parentElement, "keypress", listener, + true); + SpecialPowers.removeSystemEventListener(parentElement, "keypress", listener, + false); SimpleTest.finish(); } diff --git a/embedding/android/AndroidManifest.xml.in b/embedding/android/AndroidManifest.xml.in index e66ba5aae08..aa463b6f2ca 100644 --- a/embedding/android/AndroidManifest.xml.in +++ b/embedding/android/AndroidManifest.xml.in @@ -21,7 +21,11 @@ +#else android:debuggable="true"> +#endif 0) { intent.setDataAndType(Uri.parse(aUriSpec), aMimeType); } else { - intent.setData(Uri.parse(aUriSpec)); + Uri uri = Uri.parse(aUriSpec); + if ("sms".equals(uri.getScheme())) { + // Have a apecial handling for the SMS, as the message body + // is not extracted from the URI automatically + final String query = uri.getEncodedQuery(); + if (query != null && query.length() > 0) { + final String[] fields = query.split("&"); + boolean foundBody = false; + String resultQuery = ""; + for (int i = 0; i < fields.length; i++) { + final String field = fields[i]; + if (field.length() > 5 && "body=".equals(field.substring(0, 5))) { + final String body = Uri.decode(field.substring(5)); + intent.putExtra("sms_body", body); + foundBody = true; + } + else { + resultQuery = resultQuery.concat(resultQuery.length() > 0 ? "&" + field : field); + } + } + if (foundBody) { + // Put the query without the body field back into the URI + final String prefix = aUriSpec.substring(0, aUriSpec.indexOf('?')); + uri = Uri.parse(resultQuery.length() > 0 ? prefix + "?" + resultQuery : prefix); + } + } + } + intent.setData(uri); } if (aPackageName.length() > 0 && aClassName.length() > 0) intent.setClassName(aPackageName, aClassName); @@ -1151,4 +1181,57 @@ public class GeckoAppShell Context context = GeckoApp.surfaceView.getContext(); GeckoMediaScannerClient client = new GeckoMediaScannerClient(context, aFile, aMimeType); } + + public static byte[] getIconForExtension(String aExt, int iconSize) { + try { + if (iconSize <= 0) + iconSize = 16; + + if (aExt != null && aExt.length() > 1 && aExt.charAt(0) == '.') + aExt = aExt.substring(1); + + PackageManager pm = GeckoApp.surfaceView.getContext().getPackageManager(); + Drawable icon = getDrawableForExtension(pm, aExt); + if (icon == null) { + // Use a generic icon + icon = pm.getDefaultActivityIcon(); + } + + Bitmap bitmap = ((BitmapDrawable)icon).getBitmap(); + if (bitmap.getWidth() != iconSize || bitmap.getHeight() != iconSize) + bitmap = Bitmap.createScaledBitmap(bitmap, iconSize, iconSize, true); + + ByteBuffer buf = ByteBuffer.allocate(iconSize * iconSize * 4); + bitmap.copyPixelsToBuffer(buf); + + return buf.array(); + } + catch (Exception e) { + Log.i("GeckoAppShell", "getIconForExtension error: ", e); + return null; + } + } + + private static Drawable getDrawableForExtension(PackageManager pm, String aExt) { + Intent intent = new Intent(Intent.ACTION_VIEW); + MimeTypeMap mtm = MimeTypeMap.getSingleton(); + String mimeType = mtm.getMimeTypeFromExtension(aExt); + if (mimeType != null && mimeType.length() > 0) + intent.setType(mimeType); + else + return null; + + List list = pm.queryIntentActivities(intent, 0); + if (list.size() == 0) + return null; + + ResolveInfo resolveInfo = list.get(0); + + if (resolveInfo == null) + return null; + + ActivityInfo activityInfo = resolveInfo.activityInfo; + + return activityInfo.loadIcon(pm); + } } diff --git a/embedding/android/GeckoSurfaceView.java b/embedding/android/GeckoSurfaceView.java index fa5c1ef5b6b..65778f84171 100644 --- a/embedding/android/GeckoSurfaceView.java +++ b/embedding/android/GeckoSurfaceView.java @@ -176,13 +176,15 @@ class GeckoSurfaceView Log.w("GeckoAppJava", "surfaceChanged while mInDrawing is true!"); } - boolean invalidSize = false; + boolean invalidSize; if (width == 0 || height == 0) { mSoftwareBitmap = null; mSoftwareBuffer = null; mSoftwareBufferCopy = null; invalidSize = true; + } else { + invalidSize = false; } boolean doSyncDraw = @@ -205,9 +207,6 @@ class GeckoSurfaceView metrics.widthPixels, metrics.heightPixels); GeckoAppShell.sendEventToGecko(e); - if (!invalidSize) - GeckoAppShell.scheduleRedraw(); - if (!doSyncDraw) { if (mDrawMode == DRAW_GLES_2 || mShowingSplashScreen) return; @@ -215,6 +214,8 @@ class GeckoSurfaceView c.drawARGB(255, 255, 255, 255); holder.unlockCanvasAndPost(c); return; + } else { + GeckoAppShell.scheduleRedraw(); } } finally { mSurfaceLock.unlock(); @@ -222,7 +223,7 @@ class GeckoSurfaceView Object syncDrawObject = null; try { - Object syncObject = mSyncDraws.take(); + syncDrawObject = mSyncDraws.take(); } catch (InterruptedException ie) { Log.e("GeckoAppJava", "Threw exception while getting sync draw bitmap/buffer: ", ie); } @@ -231,6 +232,8 @@ class GeckoSurfaceView draw(holder, (Bitmap)syncDrawObject); else draw(holder, (ByteBuffer)syncDrawObject); + } else { + Log.e("GeckoSurfaceViewJava", "Synchronised draw object is null"); } } diff --git a/embedding/android/Makefile.in b/embedding/android/Makefile.in index 6e68c3012ff..a1ddc8fb19c 100644 --- a/embedding/android/Makefile.in +++ b/embedding/android/Makefile.in @@ -81,6 +81,7 @@ DEFINES += \ -DMOZ_MIN_CPU_VERSION=$(MIN_CPU_VERSION) \ -DMOZ_CRASHREPORTER=$(MOZ_CRASHREPORTER) \ -DANDROID_VERSION_CODE=$(ANDROID_VERSION_CODE) \ + -DMOZILLA_OFFICIAL=$(MOZILLA_OFFICIAL) \ $(NULL) GARBAGE += \ diff --git a/embedding/browser/Makefile.in b/embedding/browser/Makefile.in index 72130b61e64..e4bd9d09deb 100644 --- a/embedding/browser/Makefile.in +++ b/embedding/browser/Makefile.in @@ -45,10 +45,4 @@ include $(DEPTH)/config/autoconf.mk DIRS = webBrowser build -ifeq ($(OS_ARCH),WINNT) -ifndef MOZ_NO_ACTIVEX_SUPPORT -TOOL_DIRS += activex/src -endif -endif - include $(topsrcdir)/config/rules.mk diff --git a/embedding/browser/activex/src/common/CPMozillaControl.h b/embedding/browser/activex/src/common/CPMozillaControl.h deleted file mode 100644 index 14283f177b6..00000000000 --- a/embedding/browser/activex/src/common/CPMozillaControl.h +++ /dev/null @@ -1,949 +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 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 CPMOZILLACONTROL_H -#define CPMOZILLACONTROL_H - -////////////////////////////////////////////////////////////////////////////// -// CProxyDWebBrowserEvents -template -class CProxyDWebBrowserEvents : public IConnectionPointImpl -{ -public: -//methods: -//DWebBrowserEvents : IDispatch -public: - void Fire_BeforeNavigate( - BSTR URL, - long Flags, - BSTR TargetFrameName, - VARIANT * PostData, - BSTR Headers, - VARIANT_BOOL * Cancel) - { - VARIANTARG* pvars = new VARIANTARG[6]; - for (int i = 0; i < 6; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[5].vt = VT_BSTR; - pvars[5].bstrVal= URL; - pvars[4].vt = VT_I4; - pvars[4].lVal= Flags; - pvars[3].vt = VT_BSTR; - pvars[3].bstrVal= TargetFrameName; - pvars[2].vt = VT_VARIANT | VT_BYREF; - pvars[2].byref= PostData; - pvars[1].vt = VT_BSTR; - pvars[1].bstrVal= Headers; - pvars[0].vt = VT_BOOL | VT_BYREF; - pvars[0].byref= Cancel; - DISPPARAMS disp = { pvars, NULL, 6, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x64, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_NavigateComplete( - BSTR URL) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BSTR; - pvars[0].bstrVal= URL; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x65, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_StatusTextChange( - BSTR Text) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BSTR; - pvars[0].bstrVal= Text; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x66, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_ProgressChange( - long Progress, - long ProgressMax) - { - VARIANTARG* pvars = new VARIANTARG[2]; - for (int i = 0; i < 2; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[1].vt = VT_I4; - pvars[1].lVal= Progress; - pvars[0].vt = VT_I4; - pvars[0].lVal= ProgressMax; - DISPPARAMS disp = { pvars, NULL, 2, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x6c, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_DownloadComplete() - { - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x68, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - } - void Fire_CommandStateChange( - long Command, - VARIANT_BOOL Enable) - { - VARIANTARG* pvars = new VARIANTARG[2]; - for (int i = 0; i < 2; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[1].vt = VT_I4; - pvars[1].lVal= Command; - pvars[0].vt = VT_BOOL; - pvars[0].boolVal= Enable; - DISPPARAMS disp = { pvars, NULL, 2, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x69, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_DownloadBegin() - { - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x6a, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - } - void Fire_NewWindow( - BSTR URL, - long Flags, - BSTR TargetFrameName, - VARIANT * PostData, - BSTR Headers, - VARIANT_BOOL * Processed) - { - VARIANTARG* pvars = new VARIANTARG[6]; - for (int i = 0; i < 6; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[5].vt = VT_BSTR; - pvars[5].bstrVal= URL; - pvars[4].vt = VT_I4; - pvars[4].lVal= Flags; - pvars[3].vt = VT_BSTR; - pvars[3].bstrVal= TargetFrameName; - pvars[2].vt = VT_VARIANT | VT_BYREF; - pvars[2].byref= PostData; - pvars[1].vt = VT_BSTR; - pvars[1].bstrVal= Headers; - pvars[0].vt = VT_BOOL | VT_BYREF; - pvars[0].byref= Processed; - DISPPARAMS disp = { pvars, NULL, 6, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x6b, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_TitleChange( - BSTR Text) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BSTR; - pvars[0].bstrVal= Text; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x71, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_FrameBeforeNavigate( - BSTR URL, - long Flags, - BSTR TargetFrameName, - VARIANT * PostData, - BSTR Headers, - VARIANT_BOOL * Cancel) - { - VARIANTARG* pvars = new VARIANTARG[6]; - for (int i = 0; i < 6; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[5].vt = VT_BSTR; - pvars[5].bstrVal= URL; - pvars[4].vt = VT_I4; - pvars[4].lVal= Flags; - pvars[3].vt = VT_BSTR; - pvars[3].bstrVal= TargetFrameName; - pvars[2].vt = VT_VARIANT | VT_BYREF; - pvars[2].byref= PostData; - pvars[1].vt = VT_BSTR; - pvars[1].bstrVal= Headers; - pvars[0].vt = VT_BOOL | VT_BYREF; - pvars[0].byref= Cancel; - DISPPARAMS disp = { pvars, NULL, 6, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0xc8, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_FrameNavigateComplete( - BSTR URL) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BSTR; - pvars[0].bstrVal= URL; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0xc9, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_FrameNewWindow( - BSTR URL, - long Flags, - BSTR TargetFrameName, - VARIANT * PostData, - BSTR Headers, - VARIANT_BOOL * Processed) - { - VARIANTARG* pvars = new VARIANTARG[6]; - for (int i = 0; i < 6; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[5].vt = VT_BSTR; - pvars[5].bstrVal= URL; - pvars[4].vt = VT_I4; - pvars[4].lVal= Flags; - pvars[3].vt = VT_BSTR; - pvars[3].bstrVal= TargetFrameName; - pvars[2].vt = VT_VARIANT | VT_BYREF; - pvars[2].byref= PostData; - pvars[1].vt = VT_BSTR; - pvars[1].bstrVal= Headers; - pvars[0].vt = VT_BOOL | VT_BYREF; - pvars[0].byref= Processed; - DISPPARAMS disp = { pvars, NULL, 6, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0xcc, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_Quit( - VARIANT_BOOL * Cancel) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BOOL | VT_BYREF; - pvars[0].byref= Cancel; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x67, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_WindowMove() - { - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x6d, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - } - void Fire_WindowResize() - { - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x6e, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - } - void Fire_WindowActivate() - { - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x6f, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - } - void Fire_PropertyChange( - BSTR Property) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BSTR; - pvars[0].bstrVal= Property; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x70, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - -}; - - -////////////////////////////////////////////////////////////////////////////// -// CProxyDWebBrowserEvents2 -template -class CProxyDWebBrowserEvents2 : public IConnectionPointImpl -{ -public: -//methods: -//DWebBrowserEvents2 : IDispatch -public: - void Fire_StatusTextChange( - BSTR Text) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BSTR; - pvars[0].bstrVal= Text; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x66, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_ProgressChange( - long Progress, - long ProgressMax) - { - VARIANTARG* pvars = new VARIANTARG[2]; - for (int i = 0; i < 2; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[1].vt = VT_I4; - pvars[1].lVal= Progress; - pvars[0].vt = VT_I4; - pvars[0].lVal= ProgressMax; - DISPPARAMS disp = { pvars, NULL, 2, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x6c, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_CommandStateChange( - long Command, - VARIANT_BOOL Enable) - { - VARIANTARG* pvars = new VARIANTARG[2]; - for (int i = 0; i < 2; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[1].vt = VT_I4; - pvars[1].lVal= Command; - pvars[0].vt = VT_BOOL; - pvars[0].boolVal= Enable; - DISPPARAMS disp = { pvars, NULL, 2, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x69, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_DownloadBegin() - { - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x6a, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - } - void Fire_DownloadComplete() - { - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x68, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - } - void Fire_TitleChange( - BSTR Text) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BSTR; - pvars[0].bstrVal= Text; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x71, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_PropertyChange( - BSTR szProperty) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BSTR; - pvars[0].bstrVal= szProperty; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x70, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_BeforeNavigate2( - IDispatch * pDisp, - VARIANT * URL, - VARIANT * Flags, - VARIANT * TargetFrameName, - VARIANT * PostData, - VARIANT * Headers, - VARIANT_BOOL * Cancel) - { - VARIANTARG* pvars = new VARIANTARG[7]; - for (int i = 0; i < 7; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[6].vt = VT_DISPATCH; - pvars[6].pdispVal= pDisp; - pvars[5].vt = VT_VARIANT | VT_BYREF; - pvars[5].byref= URL; - pvars[4].vt = VT_VARIANT | VT_BYREF; - pvars[4].byref= Flags; - pvars[3].vt = VT_VARIANT | VT_BYREF; - pvars[3].byref= TargetFrameName; - pvars[2].vt = VT_VARIANT | VT_BYREF; - pvars[2].byref= PostData; - pvars[1].vt = VT_VARIANT | VT_BYREF; - pvars[1].byref= Headers; - pvars[0].vt = VT_BOOL | VT_BYREF; - pvars[0].byref= Cancel; - DISPPARAMS disp = { pvars, NULL, 7, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0xfa, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_NewWindow2( - IDispatch * * ppDisp, - VARIANT_BOOL * Cancel) - { - VARIANTARG* pvars = new VARIANTARG[2]; - for (int i = 0; i < 2; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[1].vt = VT_DISPATCH | VT_BYREF; - pvars[1].byref= ppDisp; - pvars[0].vt = VT_BOOL | VT_BYREF; - pvars[0].byref= Cancel; - DISPPARAMS disp = { pvars, NULL, 2, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0xfb, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_NavigateComplete2( - IDispatch * pDisp, - VARIANT * URL) - { - VARIANTARG* pvars = new VARIANTARG[2]; - for (int i = 0; i < 2; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[1].vt = VT_DISPATCH; - pvars[1].pdispVal= pDisp; - pvars[0].vt = VT_VARIANT | VT_BYREF; - pvars[0].byref= URL; - DISPPARAMS disp = { pvars, NULL, 2, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0xfc, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_DocumentComplete( - IDispatch * pDisp, - VARIANT * URL) - { - VARIANTARG* pvars = new VARIANTARG[2]; - for (int i = 0; i < 2; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[1].vt = VT_DISPATCH; - pvars[1].pdispVal= pDisp; - pvars[0].vt = VT_VARIANT | VT_BYREF; - pvars[0].byref= URL; - DISPPARAMS disp = { pvars, NULL, 2, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x103, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_OnQuit() - { - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0xfd, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - } - void Fire_OnVisible( - VARIANT_BOOL Visible) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BOOL; - pvars[0].boolVal= Visible; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0xfe, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_OnToolBar( - VARIANT_BOOL ToolBar) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BOOL; - pvars[0].boolVal= ToolBar; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0xff, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_OnMenuBar( - VARIANT_BOOL MenuBar) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BOOL; - pvars[0].boolVal= MenuBar; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x100, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_OnStatusBar( - VARIANT_BOOL StatusBar) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BOOL; - pvars[0].boolVal= StatusBar; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x101, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_OnFullScreen( - VARIANT_BOOL FullScreen) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BOOL; - pvars[0].boolVal= FullScreen; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x102, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - void Fire_OnTheaterMode( - VARIANT_BOOL TheaterMode) - { - VARIANTARG* pvars = new VARIANTARG[1]; - for (int i = 0; i < 1; i++) - VariantInit(&pvars[i]); - T* pT = (T*)this; - pT->Lock(); - IUnknown** pp = m_vec.begin(); - while (pp < m_vec.end()) - { - if (*pp != NULL) - { - pvars[0].vt = VT_BOOL; - pvars[0].boolVal= TheaterMode; - DISPPARAMS disp = { pvars, NULL, 1, 0 }; - IDispatch* pDispatch = reinterpret_cast(*pp); - pDispatch->Invoke(0x104, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); - } - pp++; - } - pT->Unlock(); - delete[] pvars; - } - -}; - - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/common/ControlEventSink.cpp b/embedding/browser/activex/src/common/ControlEventSink.cpp deleted file mode 100644 index 59ef0805daf..00000000000 --- a/embedding/browser/activex/src/common/ControlEventSink.cpp +++ /dev/null @@ -1,216 +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): - * Adam Lock - * - * 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 "StdAfx.h" - -#include "ControlEventSink.h" - -CControlEventSink::CControlEventSink() : - m_dwEventCookie(0), - m_EventIID(GUID_NULL) -{ -} - -CControlEventSink::~CControlEventSink() -{ - UnsubscribeFromEvents(); -} - -BOOL -CControlEventSink::GetEventSinkIID(IUnknown *pControl, IID &iid, ITypeInfo **typeInfo) -{ - iid = GUID_NULL; - if (!pControl) - { - return E_INVALIDARG; - } - - // IProvideClassInfo2 way is easiest -// CComQIPtr classInfo2 = pControl; -// if (classInfo2) -// { -// classInfo2->GetGUID(GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid); -// if (!::IsEqualIID(iid, GUID_NULL)) -// { -// return TRUE; -// } -// } - - // Yuck, the hard way - CComQIPtr classInfo = pControl; - if (!classInfo) - { - return FALSE; - } - - // Search the class type information for the default source interface - // which is the outgoing event sink. - - CComPtr classTypeInfo; - classInfo->GetClassInfo(&classTypeInfo); - if (!classTypeInfo) - { - return FALSE; - } - TYPEATTR *classAttr = NULL; - if (FAILED(classTypeInfo->GetTypeAttr(&classAttr))) - { - return FALSE; - } - INT implFlags = 0; - for (UINT i = 0; i < classAttr->cImplTypes; i++) - { - // Search for the interface with the [default, source] attr - if (SUCCEEDED(classTypeInfo->GetImplTypeFlags(i, &implFlags)) && - implFlags == (IMPLTYPEFLAG_FDEFAULT | IMPLTYPEFLAG_FSOURCE)) - { - CComPtr eventSinkTypeInfo; - HREFTYPE hRefType; - if (SUCCEEDED(classTypeInfo->GetRefTypeOfImplType(i, &hRefType)) && - SUCCEEDED(classTypeInfo->GetRefTypeInfo(hRefType, &eventSinkTypeInfo))) - { - TYPEATTR *eventSinkAttr = NULL; - if (SUCCEEDED(eventSinkTypeInfo->GetTypeAttr(&eventSinkAttr))) - { - iid = eventSinkAttr->guid; - if (typeInfo) - { - *typeInfo = eventSinkTypeInfo.p; - (*typeInfo)->AddRef(); - } - eventSinkTypeInfo->ReleaseTypeAttr(eventSinkAttr); - } - } - break; - } - } - classTypeInfo->ReleaseTypeAttr(classAttr); - - return (!::IsEqualIID(iid, GUID_NULL)); -} - -void CControlEventSink::UnsubscribeFromEvents() -{ - if (m_spEventCP) - { - // Unsubscribe and reset - m_spEventCP->Unadvise(m_dwEventCookie); - m_dwEventCookie = 0; - m_spEventCP.Release(); - } -} - -HRESULT CControlEventSink::SubscribeToEvents(IUnknown *pControl) -{ - if (!pControl) - { - return E_INVALIDARG; - } - - // Throw away any existing connections - UnsubscribeFromEvents(); - - // Grab the outgoing event sink IID which will be used to subscribe - // to events via the connection point container. - - IID iidEventSink; - CComPtr typeInfo; - if (!GetEventSinkIID(pControl, iidEventSink, &typeInfo)) - { - return E_FAIL; - } - - // Get the connection point - CComQIPtr ccp = pControl; - CComPtr cp; - if (!ccp) - { - return E_FAIL; - } - - // Custom IID - m_EventIID = iidEventSink; - DWORD dwCookie = 0; - if (!ccp || - FAILED(ccp->FindConnectionPoint(m_EventIID, &cp)) || - FAILED(cp->Advise(this, &dwCookie))) - { - return E_FAIL; - } - - m_spEventCP = cp; - m_dwEventCookie = dwCookie; - m_spEventSinkTypeInfo = typeInfo; - return S_OK; -} - -HRESULT -CControlEventSink::InternalInvoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) -{ - // Override me! - return E_NOTIMPL; -} - -/////////////////////////////////////////////////////////////////////////////// -// IDispatch implementation - - -HRESULT STDMETHODCALLTYPE CControlEventSink::GetTypeInfoCount(/* [out] */ UINT __RPC_FAR *pctinfo) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CControlEventSink::GetTypeInfo(/* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CControlEventSink::GetIDsOfNames(/* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CControlEventSink::Invoke(/* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr) -{ - return InternalInvoke(dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); -} - - diff --git a/embedding/browser/activex/src/common/ControlEventSink.h b/embedding/browser/activex/src/common/ControlEventSink.h deleted file mode 100644 index 44b45bad40b..00000000000 --- a/embedding/browser/activex/src/common/ControlEventSink.h +++ /dev/null @@ -1,92 +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): - * Adam Lock - * - * 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 ***** */ - -#ifndef CONTROLEVENTSINK_H -#define CONTROLEVENTSINK_H - -// This class listens for events from the specified control - -class CControlEventSink : - public CComObjectRootEx, - public IDispatch -{ -public: - CControlEventSink(); - - // Current event connection point - CComPtr m_spEventCP; - CComPtr m_spEventSinkTypeInfo; - DWORD m_dwEventCookie; - IID m_EventIID; - -protected: - virtual ~CControlEventSink(); - - static HRESULT WINAPI SinkQI(void* pv, REFIID riid, LPVOID* ppv, DWORD_PTR dw) - { - CControlEventSink *pThis = (CControlEventSink *) pv; - if (!IsEqualIID(pThis->m_EventIID, GUID_NULL) && - IsEqualIID(pThis->m_EventIID, riid)) - { - return pThis->QueryInterface(__uuidof(IDispatch), ppv); - } - return E_NOINTERFACE; - } - -public: - -BEGIN_COM_MAP(CControlEventSink) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY_FUNC_BLIND(0, SinkQI) -END_COM_MAP() - - virtual HRESULT SubscribeToEvents(IUnknown *pControl); - virtual void UnsubscribeFromEvents(); - virtual BOOL GetEventSinkIID(IUnknown *pControl, IID &iid, ITypeInfo **typeInfo); - virtual HRESULT InternalInvoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr); - -// IDispatch - virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(/* [out] */ UINT __RPC_FAR *pctinfo); - virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(/* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); - virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(/* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Invoke(/* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); -}; - -typedef CComObject CControlEventSinkInstance; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/common/ControlSite.cpp b/embedding/browser/activex/src/common/ControlSite.cpp deleted file mode 100644 index 6bb8c4946e9..00000000000 --- a/embedding/browser/activex/src/common/ControlSite.cpp +++ /dev/null @@ -1,1421 +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): - * Adam Lock - * - * 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 "StdAfx.h" - -#include - -#include "ControlSite.h" -#include "PropertyBag.h" -#include "ControlSiteIPFrame.h" - -class CDefaultControlSiteSecurityPolicy : public CControlSiteSecurityPolicy -{ - // Test if the specified class id implements the specified category - BOOL ClassImplementsCategory(const CLSID & clsid, const CATID &catid, BOOL &bClassExists); -public: - // Test if the class is safe to host - virtual BOOL IsClassSafeToHost(const CLSID & clsid); - // Test if the specified class is marked safe for scripting - virtual BOOL IsClassMarkedSafeForScripting(const CLSID & clsid, BOOL &bClassExists); - // Test if the instantiated object is safe for scripting on the specified interface - virtual BOOL IsObjectSafeForScripting(IUnknown *pObject, const IID &iid); -}; - -BOOL -CDefaultControlSiteSecurityPolicy::ClassImplementsCategory(const CLSID &clsid, const CATID &catid, BOOL &bClassExists) -{ - bClassExists = FALSE; - - // Test if there is a CLSID entry. If there isn't then obviously - // the object doesn't exist and therefore doesn't implement any category. - // In this situation, the function returns REGDB_E_CLASSNOTREG. - - CRegKey key; - if (key.Open(HKEY_CLASSES_ROOT, _T("CLSID"), KEY_READ) != ERROR_SUCCESS) - { - // Must fail if we can't even open this! - return FALSE; - } - LPOLESTR szCLSID = NULL; - if (FAILED(StringFromCLSID(clsid, &szCLSID))) - { - return FALSE; - } - USES_CONVERSION; - CRegKey keyCLSID; - LONG lResult = keyCLSID.Open(key, W2CT(szCLSID), KEY_READ); - CoTaskMemFree(szCLSID); - if (lResult != ERROR_SUCCESS) - { - // Class doesn't exist - return FALSE; - } - keyCLSID.Close(); - - // CLSID exists, so try checking what categories it implements - bClassExists = TRUE; - CComQIPtr spCatInfo; - HRESULT hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatInformation, (LPVOID*) &spCatInfo); - if (spCatInfo == NULL) - { - // Must fail if we can't open the category manager - return FALSE; - } - - // See what categories the class implements - CComQIPtr spEnumCATID; - if (FAILED(spCatInfo->EnumImplCategoriesOfClass(clsid, &spEnumCATID))) - { - // Can't enumerate classes in category so fail - return FALSE; - } - - // Search for matching categories - BOOL bFound = FALSE; - CATID catidNext = GUID_NULL; - while (spEnumCATID->Next(1, &catidNext, NULL) == S_OK) - { - if (::IsEqualCATID(catid, catidNext)) - { - return TRUE; - } - } - - return FALSE; -} - -// Test if the class is safe to host -BOOL CDefaultControlSiteSecurityPolicy::IsClassSafeToHost(const CLSID & clsid) -{ - return TRUE; -} - -// Test if the specified class is marked safe for scripting -BOOL CDefaultControlSiteSecurityPolicy::IsClassMarkedSafeForScripting(const CLSID & clsid, BOOL &bClassExists) -{ - // Test the category the object belongs to - return ClassImplementsCategory(clsid, CATID_SafeForScripting, bClassExists); -} - -// Test if the instantiated object is safe for scripting on the specified interface -BOOL CDefaultControlSiteSecurityPolicy::IsObjectSafeForScripting(IUnknown *pObject, const IID &iid) -{ - if (!pObject) { - return FALSE; - } - // Ask the control if its safe for scripting - CComQIPtr spObjectSafety = pObject; - if (!spObjectSafety) - { - return FALSE; - } - - DWORD dwSupported = 0; // Supported options (mask) - DWORD dwEnabled = 0; // Enabled options - - // Assume scripting via IDispatch - if (FAILED(spObjectSafety->GetInterfaceSafetyOptions( - iid, &dwSupported, &dwEnabled))) - { - // Interface is not safe or failure. - return FALSE; - } - - // Test if safe for scripting - if (!(dwEnabled & dwSupported) & INTERFACESAFE_FOR_UNTRUSTED_CALLER) - { - // Object says it is not set to be safe, but supports unsafe calling, - // try enabling it and asking again. - - if(!(dwSupported & INTERFACESAFE_FOR_UNTRUSTED_CALLER) || - FAILED(spObjectSafety->SetInterfaceSafetyOptions( - iid, INTERFACESAFE_FOR_UNTRUSTED_CALLER, INTERFACESAFE_FOR_UNTRUSTED_CALLER)) || - FAILED(spObjectSafety->GetInterfaceSafetyOptions( - iid, &dwSupported, &dwEnabled)) || - !(dwEnabled & dwSupported) & INTERFACESAFE_FOR_UNTRUSTED_CALLER) - { - return FALSE; - } - } - - return TRUE; -} - -/////////////////////////////////////////////////////////////////////////////// - -// Constructor -CControlSite::CControlSite() -{ - TRACE_METHOD(CControlSite::CControlSite); - - m_hWndParent = NULL; - m_CLSID = CLSID_NULL; - m_bSetClientSiteFirst = FALSE; - m_bVisibleAtRuntime = TRUE; - memset(&m_rcObjectPos, 0, sizeof(m_rcObjectPos)); - - m_bInPlaceActive = FALSE; - m_bUIActive = FALSE; - m_bInPlaceLocked = FALSE; - m_bWindowless = FALSE; - m_bSupportWindowlessActivation = TRUE; - m_bSafeForScriptingObjectsOnly = FALSE; - m_pSecurityPolicy = GetDefaultControlSecurityPolicy(); - - // Initialise ambient properties - m_nAmbientLocale = 0; - m_clrAmbientForeColor = ::GetSysColor(COLOR_WINDOWTEXT); - m_clrAmbientBackColor = ::GetSysColor(COLOR_WINDOW); - m_bAmbientUserMode = true; - m_bAmbientShowHatching = true; - m_bAmbientShowGrabHandles = true; - m_bAmbientAppearance = true; // 3d - - // Windowless variables - m_hDCBuffer = NULL; - m_hRgnBuffer = NULL; - m_hBMBufferOld = NULL; - m_hBMBuffer = NULL; -} - - -// Destructor -CControlSite::~CControlSite() -{ - TRACE_METHOD(CControlSite::~CControlSite); - Detach(); -} - -// Create the specified control, optionally providing properties to initialise -// it with and a name. -HRESULT CControlSite::Create(REFCLSID clsid, PropertyList &pl, - LPCWSTR szCodebase, IBindCtx *pBindContext) -{ - TRACE_METHOD(CControlSite::Create); - - m_CLSID = clsid; - m_ParameterList = pl; - - // See if security policy will allow the control to be hosted - if (m_pSecurityPolicy && !m_pSecurityPolicy->IsClassSafeToHost(clsid)) - { - return E_FAIL; - } - - // See if object is script safe - BOOL checkForObjectSafety = FALSE; - if (m_pSecurityPolicy && m_bSafeForScriptingObjectsOnly) - { - BOOL bClassExists = FALSE; - BOOL bIsSafe = m_pSecurityPolicy->IsClassMarkedSafeForScripting(clsid, bClassExists); - if (!bClassExists && szCodebase) - { - // Class doesn't exist, so allow code below to fetch it - } - else if (!bIsSafe) - { - // The class is not flagged as safe for scripting, so - // we'll have to create it to ask it if its safe. - checkForObjectSafety = TRUE; - } - } - - // Create the object - CComPtr spObject; - HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IUnknown, (void **) &spObject); - if (SUCCEEDED(hr) && checkForObjectSafety) - { - // Assume scripting via IDispatch - if (!m_pSecurityPolicy->IsObjectSafeForScripting(spObject, __uuidof(IDispatch))) - { - return E_FAIL; - } - // Drop through, success! - } - - // Do we need to download the control? - if (FAILED(hr) && szCodebase) - { - wchar_t *szURL = NULL; - - // Test if the code base ends in #version=a,b,c,d - DWORD dwFileVersionMS = 0xffffffff; - DWORD dwFileVersionLS = 0xffffffff; - const wchar_t *szHash = wcsrchr(szCodebase, wchar_t('#')); - if (szHash) - { - if (wcsnicmp(szHash, L"#version=", 9) == 0) - { - int a, b, c, d; - if (swscanf(szHash + 9, L"%d,%d,%d,%d", &a, &b, &c, &d) == 4) - { - dwFileVersionMS = MAKELONG(b,a); - dwFileVersionLS = MAKELONG(d,c); - } - } - szURL = _wcsdup(szCodebase); - // Terminate at the hash mark - if (szURL) - szURL[szHash - szCodebase] = wchar_t('\0'); - } - else - { - szURL = _wcsdup(szCodebase); - } - if (!szURL) - return E_OUTOFMEMORY; - - CComPtr spBindContext; - CComPtr spBindStatusCallback; - CComPtr spOldBSC; - - // Create our own bind context or use the one provided? - BOOL useInternalBSC = FALSE; - if (!pBindContext) - { - useInternalBSC = TRUE; - hr = CreateBindCtx(0, &spBindContext); - if (FAILED(hr)) - { - free(szURL); - return hr; - } - spBindStatusCallback = dynamic_cast(this); - hr = RegisterBindStatusCallback(spBindContext, spBindStatusCallback, &spOldBSC, 0); - if (FAILED(hr)) - { - free(szURL); - return hr; - } - } - else - { - spBindContext = pBindContext; - } - - hr = CoGetClassObjectFromURL(clsid, szURL, dwFileVersionMS, dwFileVersionLS, - NULL, spBindContext, CLSCTX_ALL, NULL, IID_IUnknown, (void **) &m_spObject); - - free(szURL); - - // Handle the internal binding synchronously so the object exists - // or an error code is available when the method returns. - if (useInternalBSC) - { - if (MK_S_ASYNCHRONOUS == hr) - { - m_bBindingInProgress = TRUE; - m_hrBindResult = E_FAIL; - - // Spin around waiting for binding to complete - HANDLE hFakeEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL); - while (m_bBindingInProgress) - { - MSG msg; - // Process pending messages - while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) - { - if (!::GetMessage(&msg, NULL, 0, 0)) - { - m_bBindingInProgress = FALSE; - break; - } - ::TranslateMessage(&msg); - ::DispatchMessage(&msg); - } - if (!m_bBindingInProgress) - break; - // Sleep for a bit or the next msg to appear - ::MsgWaitForMultipleObjects(1, &hFakeEvent, FALSE, 500, QS_ALLEVENTS); - } - ::CloseHandle(hFakeEvent); - - // Set the result - hr = m_hrBindResult; - } - - // Destroy the bind status callback & context - if (spBindStatusCallback) - { - RevokeBindStatusCallback(spBindContext, spBindStatusCallback); - spBindContext.Release(); - } - } - } - - if (spObject) - m_spObject = spObject; - - return hr; -} - - -// Attach the created control to a window and activate it -HRESULT CControlSite::Attach(HWND hwndParent, const RECT &rcPos, IUnknown *pInitStream) -{ - TRACE_METHOD(CControlSite::Attach); - - if (hwndParent == NULL) - { - NS_ERROR("No parent hwnd"); - return E_INVALIDARG; - } - - m_hWndParent = hwndParent; - m_rcObjectPos = rcPos; - - // Object must have been created - if (m_spObject == NULL) - { - return E_UNEXPECTED; - } - - m_spIViewObject = m_spObject; - m_spIOleObject = m_spObject; - - if (m_spIOleObject == NULL) - { - return E_FAIL; - } - - DWORD dwMiscStatus; - m_spIOleObject->GetMiscStatus(DVASPECT_CONTENT, &dwMiscStatus); - - if (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST) - { - m_bSetClientSiteFirst = TRUE; - } - if (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME) - { - m_bVisibleAtRuntime = FALSE; - } - - // Some objects like to have the client site as the first thing - // to be initialised (for ambient properties and so forth) - if (m_bSetClientSiteFirst) - { - m_spIOleObject->SetClientSite(this); - } - - // If there is a parameter list for the object and no init stream then - // create one here. - CPropertyBagInstance *pPropertyBag = NULL; - if (pInitStream == NULL && m_ParameterList.GetSize() > 0) - { - CPropertyBagInstance::CreateInstance(&pPropertyBag); - pPropertyBag->AddRef(); - for (unsigned long i = 0; i < m_ParameterList.GetSize(); i++) - { - pPropertyBag->Write(m_ParameterList.GetNameOf(i), - const_cast(m_ParameterList.GetValueOf(i))); - } - pInitStream = (IPersistPropertyBag *) pPropertyBag; - } - - // Initialise the control from store if one is provided - if (pInitStream) - { - CComQIPtr spPropertyBag = pInitStream; - CComQIPtr spStream = pInitStream; - CComQIPtr spIPersistStream = m_spIOleObject; - CComQIPtr spIPersistPropertyBag = m_spIOleObject; - - if (spIPersistPropertyBag && spPropertyBag) - { - spIPersistPropertyBag->Load(spPropertyBag, NULL); - } - else if (spIPersistStream && spStream) - { - spIPersistStream->Load(spStream); - } - } - else - { - // Initialise the object if possible - CComQIPtr spIPersistStreamInit = m_spIOleObject; - if (spIPersistStreamInit) - { - spIPersistStreamInit->InitNew(); - } - } - - m_spIOleInPlaceObject = m_spObject; - m_spIOleInPlaceObjectWindowless = m_spObject; - - // In-place activate the object - if (m_bVisibleAtRuntime) - { - DoVerb(OLEIVERB_INPLACEACTIVATE); - } - - m_spIOleInPlaceObject->SetObjectRects(&m_rcObjectPos, &m_rcObjectPos); - - // For those objects which haven't had their client site set yet, - // it's done here. - if (!m_bSetClientSiteFirst) - { - m_spIOleObject->SetClientSite(this); - } - - return S_OK; -} - - -// Unhook the control from the window and throw it all away -HRESULT CControlSite::Detach() -{ - TRACE_METHOD(CControlSite::Detach); - - if (m_spIOleInPlaceObjectWindowless) - { - m_spIOleInPlaceObjectWindowless.Release(); - } - - if (m_spIOleInPlaceObject) - { - m_spIOleInPlaceObject->InPlaceDeactivate(); - m_spIOleInPlaceObject.Release(); - } - - if (m_spIOleObject) - { - m_spIOleObject->Close(OLECLOSE_NOSAVE); - m_spIOleObject->SetClientSite(NULL); - m_spIOleObject.Release(); - } - - m_spIViewObject.Release(); - m_spObject.Release(); - - return S_OK; -} - - -// Return the IUnknown of the contained control -HRESULT CControlSite::GetControlUnknown(IUnknown **ppObject) -{ - *ppObject = NULL; - if (m_spObject) - { - m_spObject->QueryInterface(IID_IUnknown, (void **) ppObject); - } - return S_OK; -} - - -// Subscribe to an event sink on the control -HRESULT CControlSite::Advise(IUnknown *pIUnkSink, const IID &iid, DWORD *pdwCookie) -{ - if (m_spObject == NULL) - { - return E_UNEXPECTED; - } - - if (pIUnkSink == NULL || pdwCookie == NULL) - { - return E_INVALIDARG; - } - - return AtlAdvise(m_spObject, pIUnkSink, iid, pdwCookie); -} - - -// Unsubscribe event sink from the control -HRESULT CControlSite::Unadvise(const IID &iid, DWORD dwCookie) -{ - if (m_spObject == NULL) - { - return E_UNEXPECTED; - } - - return AtlUnadvise(m_spObject, iid, dwCookie); -} - - -// Draw the control -HRESULT CControlSite::Draw(HDC hdc) -{ - TRACE_METHOD(CControlSite::Draw); - - // Draw only when control is windowless or deactivated - if (m_spIViewObject) - { - if (m_bWindowless || !m_bInPlaceActive) - { - RECTL *prcBounds = (m_bWindowless) ? NULL : (RECTL *) &m_rcObjectPos; - m_spIViewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdc, prcBounds, NULL, NULL, 0); - } - } - else - { - // Draw something to indicate no control is there - HBRUSH hbr = CreateSolidBrush(RGB(200,200,200)); - FillRect(hdc, &m_rcObjectPos, hbr); - DeleteObject(hbr); - } - - return S_OK; -} - - -// Execute the specified verb -HRESULT CControlSite::DoVerb(LONG nVerb, LPMSG lpMsg) -{ - TRACE_METHOD(CControlSite::DoVerb); - - if (m_spIOleObject == NULL) - { - return E_FAIL; - } - - return m_spIOleObject->DoVerb(nVerb, lpMsg, this, 0, m_hWndParent, &m_rcObjectPos); -} - - -// Set the position on the control -HRESULT CControlSite::SetPosition(const RECT &rcPos) -{ - TRACE_METHOD(CControlSite::SetPosition); - m_rcObjectPos = rcPos; - if (m_spIOleInPlaceObject) - { - m_spIOleInPlaceObject->SetObjectRects(&m_rcObjectPos, &m_rcObjectPos); - } - return S_OK; -} - - -void CControlSite::FireAmbientPropertyChange(DISPID id) -{ - if (m_spObject) - { - CComQIPtr spControl = m_spObject; - if (spControl) - { - spControl->OnAmbientPropertyChange(id); - } - } -} - - -void CControlSite::SetAmbientUserMode(BOOL bUserMode) -{ - bool bNewMode = bUserMode ? true : false; - if (m_bAmbientUserMode != bNewMode) - { - m_bAmbientUserMode = bNewMode; - FireAmbientPropertyChange(DISPID_AMBIENT_USERMODE); - } -} - -/////////////////////////////////////////////////////////////////////////////// -// CControlSiteSecurityPolicy implementation - -CControlSiteSecurityPolicy *CControlSite::GetDefaultControlSecurityPolicy() -{ - static CDefaultControlSiteSecurityPolicy defaultControlSecurityPolicy; - return &defaultControlSecurityPolicy; -} - -// Test if the class is safe to host -BOOL CControlSite::IsClassSafeToHost(const CLSID & clsid) -{ - if (m_pSecurityPolicy) - return m_pSecurityPolicy->IsClassSafeToHost(clsid); - return TRUE; -} - -// Test if the specified class is marked safe for scripting -BOOL CControlSite::IsClassMarkedSafeForScripting(const CLSID & clsid, BOOL &bClassExists) -{ - if (m_pSecurityPolicy) - return m_pSecurityPolicy->IsClassMarkedSafeForScripting(clsid, bClassExists); - return TRUE; -} - -// Test if the instantiated object is safe for scripting on the specified interface -BOOL CControlSite::IsObjectSafeForScripting(IUnknown *pObject, const IID &iid) -{ - if (m_pSecurityPolicy) - return m_pSecurityPolicy->IsObjectSafeForScripting(pObject, iid); - return TRUE; -} - -BOOL CControlSite::IsObjectSafeForScripting(const IID &iid) -{ - return IsObjectSafeForScripting(m_spObject, iid); -} - -/////////////////////////////////////////////////////////////////////////////// -// IServiceProvider implementation - -HRESULT STDMETHODCALLTYPE CControlSite::QueryService(REFGUID guidService, REFIID riid, void** ppv) -{ - if (m_spServiceProvider) - return m_spServiceProvider->QueryService(guidService, riid, ppv); - return E_NOINTERFACE; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IDispatch implementation - - -HRESULT STDMETHODCALLTYPE CControlSite::GetTypeInfoCount(/* [out] */ UINT __RPC_FAR *pctinfo) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::GetTypeInfo(/* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::GetIDsOfNames(/* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::Invoke(/* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr) -{ - if (wFlags & DISPATCH_PROPERTYGET) - { - CComVariant vResult; - - switch (dispIdMember) - { - case DISPID_AMBIENT_APPEARANCE: - vResult = CComVariant(m_bAmbientAppearance); - break; - - case DISPID_AMBIENT_FORECOLOR: - vResult = CComVariant((long) m_clrAmbientForeColor); - break; - - case DISPID_AMBIENT_BACKCOLOR: - vResult = CComVariant((long) m_clrAmbientBackColor); - break; - - case DISPID_AMBIENT_LOCALEID: - vResult = CComVariant((long) m_nAmbientLocale); - break; - - case DISPID_AMBIENT_USERMODE: - vResult = CComVariant(m_bAmbientUserMode); - break; - - case DISPID_AMBIENT_SHOWGRABHANDLES: - vResult = CComVariant(m_bAmbientShowGrabHandles); - break; - - case DISPID_AMBIENT_SHOWHATCHING: - vResult = CComVariant(m_bAmbientShowHatching); - break; - - default: - return DISP_E_MEMBERNOTFOUND; - } - - VariantCopy(pVarResult, &vResult); - return S_OK; - } - - return E_FAIL; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IAdviseSink implementation - - -void STDMETHODCALLTYPE CControlSite::OnDataChange(/* [unique][in] */ FORMATETC __RPC_FAR *pFormatetc, /* [unique][in] */ STGMEDIUM __RPC_FAR *pStgmed) -{ -} - - -void STDMETHODCALLTYPE CControlSite::OnViewChange(/* [in] */ DWORD dwAspect, /* [in] */ LONG lindex) -{ - // Redraw the control - InvalidateRect(NULL, FALSE); -} - - -void STDMETHODCALLTYPE CControlSite::OnRename(/* [in] */ IMoniker __RPC_FAR *pmk) -{ -} - - -void STDMETHODCALLTYPE CControlSite::OnSave(void) -{ -} - - -void STDMETHODCALLTYPE CControlSite::OnClose(void) -{ -} - - -/////////////////////////////////////////////////////////////////////////////// -// IAdviseSink2 implementation - - -void STDMETHODCALLTYPE CControlSite::OnLinkSrcChange(/* [unique][in] */ IMoniker __RPC_FAR *pmk) -{ -} - - -/////////////////////////////////////////////////////////////////////////////// -// IAdviseSinkEx implementation - - -void STDMETHODCALLTYPE CControlSite::OnViewStatusChange(/* [in] */ DWORD dwViewStatus) -{ -} - - -/////////////////////////////////////////////////////////////////////////////// -// IOleWindow implementation - -HRESULT STDMETHODCALLTYPE CControlSite::GetWindow(/* [out] */ HWND __RPC_FAR *phwnd) -{ - *phwnd = m_hWndParent; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::ContextSensitiveHelp(/* [in] */ BOOL fEnterMode) -{ - return S_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IOleClientSite implementation - - -HRESULT STDMETHODCALLTYPE CControlSite::SaveObject(void) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::GetMoniker(/* [in] */ DWORD dwAssign, /* [in] */ DWORD dwWhichMoniker, /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmk) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::GetContainer(/* [out] */ IOleContainer __RPC_FAR *__RPC_FAR *ppContainer) -{ - if (!ppContainer) return E_INVALIDARG; - *ppContainer = m_spContainer; - if (*ppContainer) - { - (*ppContainer)->AddRef(); - } - return (*ppContainer) ? S_OK : E_NOINTERFACE; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::ShowObject(void) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::OnShowWindow(/* [in] */ BOOL fShow) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::RequestNewObjectLayout(void) -{ - return E_NOTIMPL; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IOleInPlaceSite implementation - - -HRESULT STDMETHODCALLTYPE CControlSite::CanInPlaceActivate(void) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceActivate(void) -{ - m_bInPlaceActive = TRUE; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::OnUIActivate(void) -{ - m_bUIActive = TRUE; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::GetWindowContext(/* [out] */ IOleInPlaceFrame __RPC_FAR *__RPC_FAR *ppFrame, /* [out] */ IOleInPlaceUIWindow __RPC_FAR *__RPC_FAR *ppDoc, /* [out] */ LPRECT lprcPosRect, /* [out] */ LPRECT lprcClipRect, /* [out][in] */ LPOLEINPLACEFRAMEINFO lpFrameInfo) -{ - *lprcPosRect = m_rcObjectPos; - *lprcClipRect = m_rcObjectPos; - - CControlSiteIPFrameInstance *pIPFrame = NULL; - CControlSiteIPFrameInstance::CreateInstance(&pIPFrame); - pIPFrame->AddRef(); - - *ppFrame = (IOleInPlaceFrame *) pIPFrame; - *ppDoc = NULL; - - lpFrameInfo->fMDIApp = FALSE; - lpFrameInfo->hwndFrame = NULL; - lpFrameInfo->haccel = NULL; - lpFrameInfo->cAccelEntries = 0; - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::Scroll(/* [in] */ SIZE scrollExtant) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::OnUIDeactivate(/* [in] */ BOOL fUndoable) -{ - m_bUIActive = FALSE; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceDeactivate(void) -{ - m_bInPlaceActive = FALSE; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::DiscardUndoState(void) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::DeactivateAndUndo(void) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::OnPosRectChange(/* [in] */ LPCRECT lprcPosRect) -{ - if (lprcPosRect == NULL) - { - return E_INVALIDARG; - } - SetPosition(m_rcObjectPos); - return S_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IOleInPlaceSiteEx implementation - - -HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceActivateEx(/* [out] */ BOOL __RPC_FAR *pfNoRedraw, /* [in] */ DWORD dwFlags) -{ - m_bInPlaceActive = TRUE; - - if (pfNoRedraw) - { - *pfNoRedraw = FALSE; - } - if (dwFlags & ACTIVATE_WINDOWLESS) - { - if (!m_bSupportWindowlessActivation) - { - return E_INVALIDARG; - } - m_bWindowless = TRUE; - } - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceDeactivateEx(/* [in] */ BOOL fNoRedraw) -{ - m_bInPlaceActive = FALSE; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::RequestUIActivate(void) -{ - return S_FALSE; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IOleInPlaceSiteWindowless implementation - - -HRESULT STDMETHODCALLTYPE CControlSite::CanWindowlessActivate(void) -{ - // Allow windowless activation? - return (m_bSupportWindowlessActivation) ? S_OK : S_FALSE; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::GetCapture(void) -{ - // TODO capture the mouse for the object - return S_FALSE; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::SetCapture(/* [in] */ BOOL fCapture) -{ - // TODO capture the mouse for the object - return S_FALSE; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::GetFocus(void) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::SetFocus(/* [in] */ BOOL fFocus) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::GetDC(/* [in] */ LPCRECT pRect, /* [in] */ DWORD grfFlags, /* [out] */ HDC __RPC_FAR *phDC) -{ - if (phDC == NULL) - { - return E_INVALIDARG; - } - - // Can't do nested painting - if (m_hDCBuffer != NULL) - { - return E_UNEXPECTED; - } - - m_rcBuffer = m_rcObjectPos; - if (pRect != NULL) - { - m_rcBuffer = *pRect; - } - - m_hBMBuffer = NULL; - m_dwBufferFlags = grfFlags; - - // See if the control wants a DC that is onscreen or offscreen - if (m_dwBufferFlags & OLEDC_OFFSCREEN) - { - m_hDCBuffer = CreateCompatibleDC(NULL); - if (m_hDCBuffer == NULL) - { - // Error - return E_OUTOFMEMORY; - } - - long cx = m_rcBuffer.right - m_rcBuffer.left; - long cy = m_rcBuffer.bottom - m_rcBuffer.top; - - m_hBMBuffer = CreateCompatibleBitmap(m_hDCBuffer, cx, cy); - m_hBMBufferOld = (HBITMAP) SelectObject(m_hDCBuffer, m_hBMBuffer); - SetViewportOrgEx(m_hDCBuffer, m_rcBuffer.left, m_rcBuffer.top, NULL); - - // TODO When OLEDC_PAINTBKGND we must draw every site behind this one - } - else - { - // TODO When OLEDC_PAINTBKGND we must draw every site behind this one - - // Get the window DC - m_hDCBuffer = GetWindowDC(m_hWndParent); - if (m_hDCBuffer == NULL) - { - // Error - return E_OUTOFMEMORY; - } - - // Clip the control so it can't trash anywhere it isn't allowed to draw - if (!(m_dwBufferFlags & OLEDC_NODRAW)) - { - m_hRgnBuffer = CreateRectRgnIndirect(&m_rcBuffer); - - // TODO Clip out opaque areas of sites behind this one - - SelectClipRgn(m_hDCBuffer, m_hRgnBuffer); - } - } - - *phDC = m_hDCBuffer; - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::ReleaseDC(/* [in] */ HDC hDC) -{ - // Release the DC - if (hDC == NULL || hDC != m_hDCBuffer) - { - return E_INVALIDARG; - } - - // Test if the DC was offscreen or onscreen - if ((m_dwBufferFlags & OLEDC_OFFSCREEN) && - !(m_dwBufferFlags & OLEDC_NODRAW)) - { - // BitBlt the buffer into the control's object - SetViewportOrgEx(m_hDCBuffer, 0, 0, NULL); - HDC hdc = GetWindowDC(m_hWndParent); - - long cx = m_rcBuffer.right - m_rcBuffer.left; - long cy = m_rcBuffer.bottom - m_rcBuffer.top; - - BitBlt(hdc, m_rcBuffer.left, m_rcBuffer.top, cx, cy, m_hDCBuffer, 0, 0, SRCCOPY); - - ::ReleaseDC(m_hWndParent, hdc); - } - else - { - // TODO If OLEDC_PAINTBKGND is set draw the DVASPECT_CONTENT of every object above this one - } - - // Clean up settings ready for next drawing - if (m_hRgnBuffer) - { - SelectClipRgn(m_hDCBuffer, NULL); - DeleteObject(m_hRgnBuffer); - m_hRgnBuffer = NULL; - } - - SelectObject(m_hDCBuffer, m_hBMBufferOld); - if (m_hBMBuffer) - { - DeleteObject(m_hBMBuffer); - m_hBMBuffer = NULL; - } - - // Delete the DC - if (m_dwBufferFlags & OLEDC_OFFSCREEN) - { - ::DeleteDC(m_hDCBuffer); - } - else - { - ::ReleaseDC(m_hWndParent, m_hDCBuffer); - } - m_hDCBuffer = NULL; - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::InvalidateRect(/* [in] */ LPCRECT pRect, /* [in] */ BOOL fErase) -{ - // Clip the rectangle against the object's size and invalidate it - RECT rcI = { 0, 0, 0, 0 }; - if (pRect == NULL) - { - rcI = m_rcObjectPos; - } - else - { - IntersectRect(&rcI, &m_rcObjectPos, pRect); - } - ::InvalidateRect(m_hWndParent, &rcI, fErase); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CControlSite::InvalidateRgn(/* [in] */ HRGN hRGN, /* [in] */ BOOL fErase) -{ - if (hRGN == NULL) - { - ::InvalidateRect(m_hWndParent, &m_rcObjectPos, fErase); - } - else - { - // Clip the region with the object's bounding area - HRGN hrgnClip = CreateRectRgnIndirect(&m_rcObjectPos); - if (CombineRgn(hrgnClip, hrgnClip, hRGN, RGN_AND) != ERROR) - { - ::InvalidateRgn(m_hWndParent, hrgnClip, fErase); - } - DeleteObject(hrgnClip); - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CControlSite::ScrollRect(/* [in] */ INT dx, /* [in] */ INT dy, /* [in] */ LPCRECT pRectScroll, /* [in] */ LPCRECT pRectClip) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CControlSite::AdjustRect(/* [out][in] */ LPRECT prc) -{ - if (prc == NULL) - { - return E_INVALIDARG; - } - - // Clip the rectangle against the object position - RECT rcI = { 0, 0, 0, 0 }; - IntersectRect(&rcI, &m_rcObjectPos, prc); - *prc = rcI; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CControlSite::OnDefWindowMessage(/* [in] */ UINT msg, /* [in] */ WPARAM wParam, /* [in] */ LPARAM lParam, /* [out] */ LRESULT __RPC_FAR *plResult) -{ - if (plResult == NULL) - { - return E_INVALIDARG; - } - - // Pass the message to the windowless control - if (m_bWindowless && m_spIOleInPlaceObjectWindowless) - { - return m_spIOleInPlaceObjectWindowless->OnWindowMessage(msg, wParam, lParam, plResult); - } - - return S_FALSE; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IOleControlSite implementation - - -HRESULT STDMETHODCALLTYPE CControlSite::OnControlInfoChanged(void) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::LockInPlaceActive(/* [in] */ BOOL fLock) -{ - m_bInPlaceLocked = fLock; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::GetExtendedControl(/* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::TransformCoords(/* [out][in] */ POINTL __RPC_FAR *pPtlHimetric, /* [out][in] */ POINTF __RPC_FAR *pPtfContainer, /* [in] */ DWORD dwFlags) -{ - HRESULT hr = S_OK; - - if (pPtlHimetric == NULL) - { - return E_INVALIDARG; - } - if (pPtfContainer == NULL) - { - return E_INVALIDARG; - } - - HDC hdc = ::GetDC(m_hWndParent); - ::SetMapMode(hdc, MM_HIMETRIC); - POINT rgptConvert[2]; - rgptConvert[0].x = 0; - rgptConvert[0].y = 0; - - if (dwFlags & XFORMCOORDS_HIMETRICTOCONTAINER) - { - rgptConvert[1].x = pPtlHimetric->x; - rgptConvert[1].y = pPtlHimetric->y; - ::LPtoDP(hdc, rgptConvert, 2); - if (dwFlags & XFORMCOORDS_SIZE) - { - pPtfContainer->x = (float)(rgptConvert[1].x - rgptConvert[0].x); - pPtfContainer->y = (float)(rgptConvert[0].y - rgptConvert[1].y); - } - else if (dwFlags & XFORMCOORDS_POSITION) - { - pPtfContainer->x = (float)rgptConvert[1].x; - pPtfContainer->y = (float)rgptConvert[1].y; - } - else - { - hr = E_INVALIDARG; - } - } - else if (dwFlags & XFORMCOORDS_CONTAINERTOHIMETRIC) - { - rgptConvert[1].x = (int)(pPtfContainer->x); - rgptConvert[1].y = (int)(pPtfContainer->y); - ::DPtoLP(hdc, rgptConvert, 2); - if (dwFlags & XFORMCOORDS_SIZE) - { - pPtlHimetric->x = rgptConvert[1].x - rgptConvert[0].x; - pPtlHimetric->y = rgptConvert[0].y - rgptConvert[1].y; - } - else if (dwFlags & XFORMCOORDS_POSITION) - { - pPtlHimetric->x = rgptConvert[1].x; - pPtlHimetric->y = rgptConvert[1].y; - } - else - { - hr = E_INVALIDARG; - } - } - else - { - hr = E_INVALIDARG; - } - - ::ReleaseDC(m_hWndParent, hdc); - - return hr; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::TranslateAccelerator(/* [in] */ MSG __RPC_FAR *pMsg, /* [in] */ DWORD grfModifiers) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::OnFocus(/* [in] */ BOOL fGotFocus) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSite::ShowPropertyFrame(void) -{ - return E_NOTIMPL; -} - -/////////////////////////////////////////////////////////////////////////////// -// IBindStatusCallback implementation - -HRESULT STDMETHODCALLTYPE CControlSite::OnStartBinding(DWORD dwReserved, - IBinding __RPC_FAR *pib) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CControlSite::GetPriority(LONG __RPC_FAR *pnPriority) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CControlSite::OnLowResource(DWORD reserved) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CControlSite::OnProgress(ULONG ulProgress, - ULONG ulProgressMax, - ULONG ulStatusCode, - LPCWSTR szStatusText) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CControlSite::OnStopBinding(HRESULT hresult, LPCWSTR szError) -{ - m_bBindingInProgress = FALSE; - m_hrBindResult = hresult; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CControlSite::GetBindInfo(DWORD __RPC_FAR *pgrfBINDF, - BINDINFO __RPC_FAR *pbindInfo) -{ - *pgrfBINDF = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | - BINDF_GETNEWESTVERSION | BINDF_NOWRITECACHE; - pbindInfo->cbSize = sizeof(BINDINFO); - pbindInfo->szExtraInfo = NULL; - memset(&pbindInfo->stgmedData, 0, sizeof(STGMEDIUM)); - pbindInfo->grfBindInfoF = 0; - pbindInfo->dwBindVerb = 0; - pbindInfo->szCustomVerb = NULL; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CControlSite::OnDataAvailable(DWORD grfBSCF, - DWORD dwSize, - FORMATETC __RPC_FAR *pformatetc, - STGMEDIUM __RPC_FAR *pstgmed) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CControlSite::OnObjectAvailable(REFIID riid, - IUnknown __RPC_FAR *punk) -{ - return S_OK; -} - -// IWindowForBindingUI -HRESULT STDMETHODCALLTYPE CControlSite::GetWindow( - /* [in] */ REFGUID rguidReason, - /* [out] */ HWND *phwnd) -{ - *phwnd = NULL; - return S_OK; -} - - diff --git a/embedding/browser/activex/src/common/ControlSite.h b/embedding/browser/activex/src/common/ControlSite.h deleted file mode 100644 index 3e493b50139..00000000000 --- a/embedding/browser/activex/src/common/ControlSite.h +++ /dev/null @@ -1,393 +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): - * Adam Lock - * - * 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 ***** */ -#ifndef CONTROLSITE_H -#define CONTROLSITE_H - -#include "IOleCommandTargetImpl.h" - -#include "PropertyList.h" - -// If you created a class derived from CControlSite, use the following macro -// in the interface map of the derived class to include all the necessary -// interfaces. -#define CCONTROLSITE_INTERFACES() \ - COM_INTERFACE_ENTRY(IOleWindow) \ - COM_INTERFACE_ENTRY(IOleClientSite) \ - COM_INTERFACE_ENTRY(IOleInPlaceSite) \ - COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceSite, IOleInPlaceSiteWindowless) \ - COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceSiteEx, IOleInPlaceSiteWindowless) \ - COM_INTERFACE_ENTRY(IOleControlSite) \ - COM_INTERFACE_ENTRY(IDispatch) \ - COM_INTERFACE_ENTRY_IID(IID_IAdviseSink, IAdviseSinkEx) \ - COM_INTERFACE_ENTRY_IID(IID_IAdviseSink2, IAdviseSinkEx) \ - COM_INTERFACE_ENTRY_IID(IID_IAdviseSinkEx, IAdviseSinkEx) \ - COM_INTERFACE_ENTRY(IOleCommandTarget) \ - COM_INTERFACE_ENTRY(IServiceProvider) \ - COM_INTERFACE_ENTRY(IBindStatusCallback) \ - COM_INTERFACE_ENTRY(IWindowForBindingUI) - -// Temoporarily removed by bug 200680. Stops controls misbehaving and calling -// windowless methods when they shouldn't. -// COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceSiteWindowless, IOleInPlaceSiteWindowless) \ - - -// Class that defines the control's security policy with regards to -// what controls it hosts etc. - -class CControlSiteSecurityPolicy -{ -public: - // Test if the class is safe to host - virtual BOOL IsClassSafeToHost(const CLSID & clsid) = 0; - // Test if the specified class is marked safe for scripting - virtual BOOL IsClassMarkedSafeForScripting(const CLSID & clsid, BOOL &bClassExists) = 0; - // Test if the instantiated object is safe for scripting on the specified interface - virtual BOOL IsObjectSafeForScripting(IUnknown *pObject, const IID &iid) = 0; -}; - -// -// Class for hosting an ActiveX control -// -// This class supports both windowed and windowless classes. The normal -// steps to hosting a control are this: -// -// CControlSiteInstance *pSite = NULL; -// CControlSiteInstance::CreateInstance(&pSite); -// pSite->AddRef(); -// pSite->Create(clsidControlToCreate); -// pSite->Attach(hwndParentWindow, rcPosition); -// -// Where propertyList is a named list of values to initialise the new object -// with, hwndParentWindow is the window in which the control is being created, -// and rcPosition is the position in window coordinates where the control will -// be rendered. -// -// Destruction is this: -// -// pSite->Detach(); -// pSite->Release(); -// pSite = NULL; - -class CControlSite : public CComObjectRootEx, - public CControlSiteSecurityPolicy, - public IOleClientSite, - public IOleInPlaceSiteWindowless, - public IOleControlSite, - public IAdviseSinkEx, - public IDispatch, - public IServiceProvider, - public IOleCommandTargetImpl, - public IBindStatusCallback, - public IWindowForBindingUI -{ -public: -// Site management values - // Handle to parent window - HWND m_hWndParent; - // Position of the site and the contained object - RECT m_rcObjectPos; - // Flag indicating if client site should be set early or late - unsigned m_bSetClientSiteFirst:1; - // Flag indicating whether control is visible or not - unsigned m_bVisibleAtRuntime:1; - // Flag indicating if control is in-place active - unsigned m_bInPlaceActive:1; - // Flag indicating if control is UI active - unsigned m_bUIActive:1; - // Flag indicating if control is in-place locked and cannot be deactivated - unsigned m_bInPlaceLocked:1; - // Flag indicating if the site allows windowless controls - unsigned m_bSupportWindowlessActivation:1; - // Flag indicating if control is windowless (after being created) - unsigned m_bWindowless:1; - // Flag indicating if only safely scriptable controls are allowed - unsigned m_bSafeForScriptingObjectsOnly:1; - // Pointer to an externally registered service provider - CComPtr m_spServiceProvider; - // Pointer to the OLE container - CComPtr m_spContainer; - // Return the default security policy object - static CControlSiteSecurityPolicy *GetDefaultControlSecurityPolicy(); - -protected: -// Pointers to object interfaces - // Raw pointer to the object - CComPtr m_spObject; - // Pointer to objects IViewObject interface - CComQIPtr m_spIViewObject; - // Pointer to object's IOleObject interface - CComQIPtr m_spIOleObject; - // Pointer to object's IOleInPlaceObject interface - CComQIPtr m_spIOleInPlaceObject; - // Pointer to object's IOleInPlaceObjectWindowless interface - CComQIPtr m_spIOleInPlaceObjectWindowless; - // CLSID of the control - CLSID m_CLSID; - // Parameter list - PropertyList m_ParameterList; - // Pointer to the security policy - CControlSiteSecurityPolicy *m_pSecurityPolicy; - -// Binding variables - // Flag indicating whether binding is in progress - unsigned m_bBindingInProgress; - // Result from the binding operation - HRESULT m_hrBindResult; - -// Double buffer drawing variables used for windowless controls - // Area of buffer - RECT m_rcBuffer; - // Bitmap to buffer - HBITMAP m_hBMBuffer; - // Bitmap to buffer - HBITMAP m_hBMBufferOld; - // Device context - HDC m_hDCBuffer; - // Clipping area of site - HRGN m_hRgnBuffer; - // Flags indicating how the buffer was painted - DWORD m_dwBufferFlags; - -// Ambient properties - // Locale ID - LCID m_nAmbientLocale; - // Foreground colour - COLORREF m_clrAmbientForeColor; - // Background colour - COLORREF m_clrAmbientBackColor; - // Flag indicating if control should hatch itself - bool m_bAmbientShowHatching:1; - // Flag indicating if control should have grab handles - bool m_bAmbientShowGrabHandles:1; - // Flag indicating if control is in edit/user mode - bool m_bAmbientUserMode:1; - // Flag indicating if control has a 3d border or not - bool m_bAmbientAppearance:1; - -protected: - // Notifies the attached control of a change to an ambient property - virtual void FireAmbientPropertyChange(DISPID id); - -public: -// Construction and destruction - // Constructor - CControlSite(); - // Destructor - virtual ~CControlSite(); - -BEGIN_COM_MAP(CControlSite) - CCONTROLSITE_INTERFACES() -END_COM_MAP() - -BEGIN_OLECOMMAND_TABLE() -END_OLECOMMAND_TABLE() - - // Returns the window used when processing ole commands - HWND GetCommandTargetWindow() - { - return NULL; // TODO - } - -// Object creation and management functions - // Creates and initialises an object - virtual HRESULT Create(REFCLSID clsid, PropertyList &pl = PropertyList(), - LPCWSTR szCodebase = NULL, IBindCtx *pBindContext = NULL); - // Attaches the object to the site - virtual HRESULT Attach(HWND hwndParent, const RECT &rcPos, IUnknown *pInitStream = NULL); - // Detaches the object from the site - virtual HRESULT Detach(); - // Returns the IUnknown pointer for the object - virtual HRESULT GetControlUnknown(IUnknown **ppObject); - // Sets the bounding rectangle for the object - virtual HRESULT SetPosition(const RECT &rcPos); - // Draws the object using the provided DC - virtual HRESULT Draw(HDC hdc); - // Performs the specified action on the object - virtual HRESULT DoVerb(LONG nVerb, LPMSG lpMsg = NULL); - // Sets an advise sink up for changes to the object - virtual HRESULT Advise(IUnknown *pIUnkSink, const IID &iid, DWORD *pdwCookie); - // Removes an advise sink - virtual HRESULT Unadvise(const IID &iid, DWORD dwCookie); - // Register an external service provider object - virtual void SetServiceProvider(IServiceProvider *pSP) - { - m_spServiceProvider = pSP; - } - virtual void SetContainer(IOleContainer *pContainer) - { - m_spContainer = pContainer; - } - // Set the security policy object. Ownership of this object remains with the caller and the security - // policy object is meant to exist for as long as it is set here. - virtual void SetSecurityPolicy(CControlSiteSecurityPolicy *pSecurityPolicy) - { - m_pSecurityPolicy = pSecurityPolicy; - } - virtual CControlSiteSecurityPolicy *GetSecurityPolicy() const - { - return m_pSecurityPolicy; - } - -// Methods to set ambient properties - virtual void SetAmbientUserMode(BOOL bUser); - -// Inline helper methods - // Returns the object's CLSID - virtual const CLSID &GetObjectCLSID() const - { - return m_CLSID; - } - // Tests if the object is valid or not - virtual BOOL IsObjectValid() const - { - return (m_spObject) ? TRUE : FALSE; - } - // Returns the parent window to this one - virtual HWND GetParentWindow() const - { - return m_hWndParent; - } - // Returns the inplace active state of the object - virtual BOOL IsInPlaceActive() const - { - return m_bInPlaceActive; - } - -// CControlSiteSecurityPolicy - // Test if the class is safe to host - virtual BOOL IsClassSafeToHost(const CLSID & clsid); - // Test if the specified class is marked safe for scripting - virtual BOOL IsClassMarkedSafeForScripting(const CLSID & clsid, BOOL &bClassExists); - // Test if the instantiated object is safe for scripting on the specified interface - virtual BOOL IsObjectSafeForScripting(IUnknown *pObject, const IID &iid); - // Test if the instantiated object is safe for scripting on the specified interface - virtual BOOL IsObjectSafeForScripting(const IID &iid); - -// IServiceProvider - virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void** ppv); - -// IDispatch - virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(/* [out] */ UINT __RPC_FAR *pctinfo); - virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(/* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); - virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(/* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Invoke(/* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); - -// IAdviseSink implementation - virtual /* [local] */ void STDMETHODCALLTYPE OnDataChange(/* [unique][in] */ FORMATETC __RPC_FAR *pFormatetc, /* [unique][in] */ STGMEDIUM __RPC_FAR *pStgmed); - virtual /* [local] */ void STDMETHODCALLTYPE OnViewChange(/* [in] */ DWORD dwAspect, /* [in] */ LONG lindex); - virtual /* [local] */ void STDMETHODCALLTYPE OnRename(/* [in] */ IMoniker __RPC_FAR *pmk); - virtual /* [local] */ void STDMETHODCALLTYPE OnSave(void); - virtual /* [local] */ void STDMETHODCALLTYPE OnClose(void); - -// IAdviseSink2 - virtual /* [local] */ void STDMETHODCALLTYPE OnLinkSrcChange(/* [unique][in] */ IMoniker __RPC_FAR *pmk); - -// IAdviseSinkEx implementation - virtual /* [local] */ void STDMETHODCALLTYPE OnViewStatusChange(/* [in] */ DWORD dwViewStatus); - -// IOleWindow implementation - virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE GetWindow(/* [out] */ HWND __RPC_FAR *phwnd); - virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(/* [in] */ BOOL fEnterMode); - -// IOleClientSite implementation - virtual HRESULT STDMETHODCALLTYPE SaveObject(void); - virtual HRESULT STDMETHODCALLTYPE GetMoniker(/* [in] */ DWORD dwAssign, /* [in] */ DWORD dwWhichMoniker, /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmk); - virtual HRESULT STDMETHODCALLTYPE GetContainer(/* [out] */ IOleContainer __RPC_FAR *__RPC_FAR *ppContainer); - virtual HRESULT STDMETHODCALLTYPE ShowObject(void); - virtual HRESULT STDMETHODCALLTYPE OnShowWindow(/* [in] */ BOOL fShow); - virtual HRESULT STDMETHODCALLTYPE RequestNewObjectLayout(void); - -// IOleInPlaceSite implementation - virtual HRESULT STDMETHODCALLTYPE CanInPlaceActivate(void); - virtual HRESULT STDMETHODCALLTYPE OnInPlaceActivate(void); - virtual HRESULT STDMETHODCALLTYPE OnUIActivate(void); - virtual HRESULT STDMETHODCALLTYPE GetWindowContext(/* [out] */ IOleInPlaceFrame __RPC_FAR *__RPC_FAR *ppFrame, /* [out] */ IOleInPlaceUIWindow __RPC_FAR *__RPC_FAR *ppDoc, /* [out] */ LPRECT lprcPosRect, /* [out] */ LPRECT lprcClipRect, /* [out][in] */ LPOLEINPLACEFRAMEINFO lpFrameInfo); - virtual HRESULT STDMETHODCALLTYPE Scroll(/* [in] */ SIZE scrollExtant); - virtual HRESULT STDMETHODCALLTYPE OnUIDeactivate(/* [in] */ BOOL fUndoable); - virtual HRESULT STDMETHODCALLTYPE OnInPlaceDeactivate(void); - virtual HRESULT STDMETHODCALLTYPE DiscardUndoState(void); - virtual HRESULT STDMETHODCALLTYPE DeactivateAndUndo(void); - virtual HRESULT STDMETHODCALLTYPE OnPosRectChange(/* [in] */ LPCRECT lprcPosRect); - -// IOleInPlaceSiteEx implementation - virtual HRESULT STDMETHODCALLTYPE OnInPlaceActivateEx(/* [out] */ BOOL __RPC_FAR *pfNoRedraw, /* [in] */ DWORD dwFlags); - virtual HRESULT STDMETHODCALLTYPE OnInPlaceDeactivateEx(/* [in] */ BOOL fNoRedraw); - virtual HRESULT STDMETHODCALLTYPE RequestUIActivate(void); - -// IOleInPlaceSiteWindowless implementation - virtual HRESULT STDMETHODCALLTYPE CanWindowlessActivate(void); - virtual HRESULT STDMETHODCALLTYPE GetCapture(void); - virtual HRESULT STDMETHODCALLTYPE SetCapture(/* [in] */ BOOL fCapture); - virtual HRESULT STDMETHODCALLTYPE GetFocus(void); - virtual HRESULT STDMETHODCALLTYPE SetFocus(/* [in] */ BOOL fFocus); - virtual HRESULT STDMETHODCALLTYPE GetDC(/* [in] */ LPCRECT pRect, /* [in] */ DWORD grfFlags, /* [out] */ HDC __RPC_FAR *phDC); - virtual HRESULT STDMETHODCALLTYPE ReleaseDC(/* [in] */ HDC hDC); - virtual HRESULT STDMETHODCALLTYPE InvalidateRect(/* [in] */ LPCRECT pRect, /* [in] */ BOOL fErase); - virtual HRESULT STDMETHODCALLTYPE InvalidateRgn(/* [in] */ HRGN hRGN, /* [in] */ BOOL fErase); - virtual HRESULT STDMETHODCALLTYPE ScrollRect(/* [in] */ INT dx, /* [in] */ INT dy, /* [in] */ LPCRECT pRectScroll, /* [in] */ LPCRECT pRectClip); - virtual HRESULT STDMETHODCALLTYPE AdjustRect(/* [out][in] */ LPRECT prc); - virtual HRESULT STDMETHODCALLTYPE OnDefWindowMessage(/* [in] */ UINT msg, /* [in] */ WPARAM wParam, /* [in] */ LPARAM lParam, /* [out] */ LRESULT __RPC_FAR *plResult); - -// IOleControlSite implementation - virtual HRESULT STDMETHODCALLTYPE OnControlInfoChanged(void); - virtual HRESULT STDMETHODCALLTYPE LockInPlaceActive(/* [in] */ BOOL fLock); - virtual HRESULT STDMETHODCALLTYPE GetExtendedControl(/* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); - virtual HRESULT STDMETHODCALLTYPE TransformCoords(/* [out][in] */ POINTL __RPC_FAR *pPtlHimetric, /* [out][in] */ POINTF __RPC_FAR *pPtfContainer, /* [in] */ DWORD dwFlags); - virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(/* [in] */ MSG __RPC_FAR *pMsg, /* [in] */ DWORD grfModifiers); - virtual HRESULT STDMETHODCALLTYPE OnFocus(/* [in] */ BOOL fGotFocus); - virtual HRESULT STDMETHODCALLTYPE ShowPropertyFrame( void); - -// IBindStatusCallback - virtual HRESULT STDMETHODCALLTYPE OnStartBinding(/* [in] */ DWORD dwReserved, /* [in] */ IBinding __RPC_FAR *pib); - virtual HRESULT STDMETHODCALLTYPE GetPriority(/* [out] */ LONG __RPC_FAR *pnPriority); - virtual HRESULT STDMETHODCALLTYPE OnLowResource(/* [in] */ DWORD reserved); - virtual HRESULT STDMETHODCALLTYPE OnProgress(/* [in] */ ULONG ulProgress, /* [in] */ ULONG ulProgressMax, /* [in] */ ULONG ulStatusCode, /* [in] */ LPCWSTR szStatusText); - virtual HRESULT STDMETHODCALLTYPE OnStopBinding(/* [in] */ HRESULT hresult, /* [unique][in] */ LPCWSTR szError); - virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetBindInfo( /* [out] */ DWORD __RPC_FAR *grfBINDF, /* [unique][out][in] */ BINDINFO __RPC_FAR *pbindinfo); - virtual /* [local] */ HRESULT STDMETHODCALLTYPE OnDataAvailable(/* [in] */ DWORD grfBSCF, /* [in] */ DWORD dwSize, /* [in] */ FORMATETC __RPC_FAR *pformatetc, /* [in] */ STGMEDIUM __RPC_FAR *pstgmed); - virtual HRESULT STDMETHODCALLTYPE OnObjectAvailable(/* [in] */ REFIID riid, /* [iid_is][in] */ IUnknown __RPC_FAR *punk); - -// IWindowForBindingUI - virtual HRESULT STDMETHODCALLTYPE GetWindow(/* [in] */ REFGUID rguidReason, /* [out] */ HWND *phwnd); -}; - -typedef CComObject CControlSiteInstance; - - - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/common/ControlSiteIPFrame.cpp b/embedding/browser/activex/src/common/ControlSiteIPFrame.cpp deleted file mode 100644 index a63b6a41058..00000000000 --- a/embedding/browser/activex/src/common/ControlSiteIPFrame.cpp +++ /dev/null @@ -1,136 +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): - * Adam Lock - * - * 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 "stdafx.h" - -#include "ControlSiteIPFrame.h" - -CControlSiteIPFrame::CControlSiteIPFrame() -{ - m_hwndFrame = NULL; -} - - -CControlSiteIPFrame::~CControlSiteIPFrame() -{ -} - -/////////////////////////////////////////////////////////////////////////////// -// IOleWindow implementation - -HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::GetWindow(/* [out] */ HWND __RPC_FAR *phwnd) -{ - if (phwnd == NULL) - { - return E_INVALIDARG; - } - *phwnd = m_hwndFrame; - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::ContextSensitiveHelp(/* [in] */ BOOL fEnterMode) -{ - return S_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IOleInPlaceUIWindow implementation - -HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::GetBorder(/* [out] */ LPRECT lprectBorder) -{ - return INPLACE_E_NOTOOLSPACE; -} - - -HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::RequestBorderSpace(/* [unique][in] */ LPCBORDERWIDTHS pborderwidths) -{ - return INPLACE_E_NOTOOLSPACE; -} - - -HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::SetBorderSpace(/* [unique][in] */ LPCBORDERWIDTHS pborderwidths) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::SetActiveObject(/* [unique][in] */ IOleInPlaceActiveObject __RPC_FAR *pActiveObject, /* [unique][string][in] */ LPCOLESTR pszObjName) -{ - return S_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IOleInPlaceFrame implementation - -HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::InsertMenus(/* [in] */ HMENU hmenuShared, /* [out][in] */ LPOLEMENUGROUPWIDTHS lpMenuWidths) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::SetMenu(/* [in] */ HMENU hmenuShared, /* [in] */ HOLEMENU holemenu, /* [in] */ HWND hwndActiveObject) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::RemoveMenus(/* [in] */ HMENU hmenuShared) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::SetStatusText(/* [in] */ LPCOLESTR pszStatusText) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::EnableModeless(/* [in] */ BOOL fEnable) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::TranslateAccelerator(/* [in] */ LPMSG lpmsg, /* [in] */ WORD wID) -{ - return E_NOTIMPL; -} - diff --git a/embedding/browser/activex/src/common/ControlSiteIPFrame.h b/embedding/browser/activex/src/common/ControlSiteIPFrame.h deleted file mode 100644 index 43f02a24573..00000000000 --- a/embedding/browser/activex/src/common/ControlSiteIPFrame.h +++ /dev/null @@ -1,77 +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): - * Adam Lock - * - * 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 ***** */ -#ifndef CONTROLSITEIPFRAME_H -#define CONTROLSITEIPFRAME_H - -class CControlSiteIPFrame : public CComObjectRootEx, - public IOleInPlaceFrame -{ -public: - CControlSiteIPFrame(); - virtual ~CControlSiteIPFrame(); - - HWND m_hwndFrame; - -BEGIN_COM_MAP(CControlSiteIPFrame) - COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleInPlaceFrame) - COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceUIWindow, IOleInPlaceFrame) - COM_INTERFACE_ENTRY(IOleInPlaceFrame) -END_COM_MAP() - - // IOleWindow - virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE GetWindow(/* [out] */ HWND __RPC_FAR *phwnd); - virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(/* [in] */ BOOL fEnterMode); - - // IOleInPlaceUIWindow implementation - virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE GetBorder(/* [out] */ LPRECT lprectBorder); - virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE RequestBorderSpace(/* [unique][in] */ LPCBORDERWIDTHS pborderwidths); - virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE SetBorderSpace(/* [unique][in] */ LPCBORDERWIDTHS pborderwidths); - virtual HRESULT STDMETHODCALLTYPE SetActiveObject(/* [unique][in] */ IOleInPlaceActiveObject __RPC_FAR *pActiveObject, /* [unique][string][in] */ LPCOLESTR pszObjName); - - // IOleInPlaceFrame implementation - virtual HRESULT STDMETHODCALLTYPE InsertMenus(/* [in] */ HMENU hmenuShared, /* [out][in] */ LPOLEMENUGROUPWIDTHS lpMenuWidths); - virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE SetMenu(/* [in] */ HMENU hmenuShared, /* [in] */ HOLEMENU holemenu, /* [in] */ HWND hwndActiveObject); - virtual HRESULT STDMETHODCALLTYPE RemoveMenus(/* [in] */ HMENU hmenuShared); - virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE SetStatusText(/* [in] */ LPCOLESTR pszStatusText); - virtual HRESULT STDMETHODCALLTYPE EnableModeless(/* [in] */ BOOL fEnable); - virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(/* [in] */ LPMSG lpmsg, /* [in] */ WORD wID); -}; - -typedef CComObject CControlSiteIPFrameInstance; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/common/IEHtmlButtonElement.cpp b/embedding/browser/activex/src/common/IEHtmlButtonElement.cpp deleted file mode 100644 index 989e0427c52..00000000000 --- a/embedding/browser/activex/src/common/IEHtmlButtonElement.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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): - * Alexandre Trémon - * - * 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 "stdafx.h" -#include "IEHTMLButtonElement.h" -#include "IEHtmlElement.h" -#include "nsIDOMHTMLButtonElement.h" - -HRESULT CIEHtmlButtonElement::FinalConstruct( ) -{ - return CComCreator >::CreateInstance(GetControllingUnknown(), - IID_IUnknown, reinterpret_cast(&m_pHtmlElementAgg)); -} - -HRESULT CIEHtmlButtonElement::GetHtmlElement(CIEHtmlElement **ppHtmlElement) -{ - if (ppHtmlElement == NULL) - return E_FAIL; - *ppHtmlElement = NULL; - IHTMLElement* pHtmlElement = NULL; - // This causes an AddRef on outer unknown: - HRESULT hr = m_pHtmlElementAgg->QueryInterface(IID_IHTMLElement, (void**)&pHtmlElement); - *ppHtmlElement = (CIEHtmlElement*)pHtmlElement; - return hr; -} - -HRESULT CIEHtmlButtonElement::SetDOMNode(nsIDOMNode *pDomNode) -{ - mDOMNode = pDomNode; - //Forward to aggregated object: - CIEHtmlElement *pHtmlElement; - GetHtmlElement(&pHtmlElement); - HRESULT hr = pHtmlElement->SetDOMNode(pDomNode); - // Release on outer unknown because GetHtmlDomNode does AddRef on it: - GetControllingUnknown()->Release(); - return hr; -} - -HRESULT CIEHtmlButtonElement::SetParent(CNode *pParent) -{ - CNode::SetParent(pParent); - //Forward to aggregated object: - CIEHtmlElement *pHtmlElement; - GetHtmlElement(&pHtmlElement); - HRESULT hr = pHtmlElement->SetParent(pParent); - // Release on outer unknown because GetHtmlDomNode does AddRef on it: - GetControllingUnknown()->Release(); - return hr; -} - -// ----------------------------------------------------------------------- -// IHTMLButtonElement Implementation -// ----------------------------------------------------------------------- - -HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::get_type(BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::put_value(BSTR v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::get_value(BSTR __RPC_FAR *p) -{ - if (p == NULL) - return E_INVALIDARG; - - *p = NULL; - nsCOMPtr domHtmlButtonElement = do_QueryInterface(mDOMNode); - if (!domHtmlButtonElement) - return E_UNEXPECTED; - nsAutoString strValue; - domHtmlButtonElement->GetValue(strValue); - *p = SysAllocString(strValue.get()); - if (!*p) - return E_OUTOFMEMORY; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::put_name(BSTR v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::get_name(BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::put_status(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::get_status(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::put_disabled(VARIANT_BOOL v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::get_disabled(VARIANT_BOOL __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::get_form(IHTMLFormElement __RPC_FAR *__RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::createTextRange(IHTMLTxtRange __RPC_FAR *__RPC_FAR *range) -{ - return E_NOTIMPL; -} diff --git a/embedding/browser/activex/src/common/IEHtmlButtonElement.h b/embedding/browser/activex/src/common/IEHtmlButtonElement.h deleted file mode 100644 index e619e8e3538..00000000000 --- a/embedding/browser/activex/src/common/IEHtmlButtonElement.h +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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): - * Alexandre Trémon - * - * 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 ***** */ - -// -// Declaration of IHTMLButtonElement and related classes -// -#ifndef IHTMLBUTTONELEMENT_H -#define IHTMLBUTTONELEMENT_H - -#include "IEHtmlNode.h" - -class CIEHtmlElement; - -// NOTE: Nasty hack in case arcane SDK does not define IHTMLButtonElement - -#ifndef __IHTMLButtonElement_INTERFACE_DEFINED__ - MIDL_INTERFACE("3050f2bb-98b5-11cf-bb82-00aa00bdce0b") - IHTMLButtonElement : public IDispatch - { - public: - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_type( - /* [out][retval] */ BSTR *p) = 0; - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_value( - /* [in] */ BSTR v) = 0; - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_value( - /* [out][retval] */ BSTR *p) = 0; - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_name( - /* [in] */ BSTR v) = 0; - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_name( - /* [out][retval] */ BSTR *p) = 0; - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_status( - /* [in] */ VARIANT v) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_status( - /* [out][retval] */ VARIANT *p) = 0; - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_disabled( - /* [in] */ VARIANT_BOOL v) = 0; - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_disabled( - /* [out][retval] */ VARIANT_BOOL *p) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_form( - /* [out][retval] */ IHTMLFormElement **p) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE createTextRange( - /* [out][retval] */ IHTMLTxtRange **range) = 0; - - }; -#endif - -class CIEHtmlButtonElement : - public CNode, - public IDispatchImpl -{ -public: - CIEHtmlButtonElement() { - }; - - HRESULT FinalConstruct( ); - virtual HRESULT GetHtmlElement(CIEHtmlElement **ppHtmlElement); - virtual HRESULT SetDOMNode(nsIDOMNode *pDomNode); - virtual HRESULT SetParent(CNode *pParent); - -DECLARE_GET_CONTROLLING_UNKNOWN() - -protected: - virtual ~CIEHtmlButtonElement() { - }; - -public: - -BEGIN_COM_MAP(CIEHtmlButtonElement) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IHTMLButtonElement) - COM_INTERFACE_ENTRY_AGGREGATE(IID_IHTMLElement, m_pHtmlElementAgg.p) - COM_INTERFACE_ENTRY_AGGREGATE(__uuidof(IHTMLDOMNode), m_pHtmlElementAgg.p) -END_COM_MAP() - - // IHTMLButtonElement Implementation: - virtual HRESULT STDMETHODCALLTYPE get_type(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_value(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_value(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_name(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_name(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_status(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_status(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_disabled(VARIANT_BOOL v); - virtual HRESULT STDMETHODCALLTYPE get_disabled(VARIANT_BOOL __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_form(IHTMLFormElement __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE createTextRange(IHTMLTxtRange __RPC_FAR *__RPC_FAR *range); - -protected: - CComPtr m_pHtmlElementAgg; -}; - -typedef CComObject CIEHtmlButtonElementInstance; - -#endif //IHTMLBUTTONELEMENT_H diff --git a/embedding/browser/activex/src/common/IEHtmlElement.cpp b/embedding/browser/activex/src/common/IEHtmlElement.cpp deleted file mode 100644 index c993fa15a8b..00000000000 --- a/embedding/browser/activex/src/common/IEHtmlElement.cpp +++ /dev/null @@ -1,976 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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): - * Adam Lock - * - * 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 "stdafx.h" - -#include "nsCOMPtr.h" -#include "nsIDOMElement.h" - -#include "IEHtmlElement.h" -#include "IEHtmlElementCollection.h" - -#include "nsIDOMHTMLElement.h" -#include "nsIDOMNSHTMLElement.h" -#include "nsIDOMDocumentRange.h" -#include "nsIDOMRange.h" -#include "nsIDOMNSRange.h" -#include "nsIDOMDocumentFragment.h" -#include "nsIDocumentEncoder.h" -#include "nsContentCID.h" - -CIEHtmlElement::CIEHtmlElement() -{ - m_pNodeAgg = NULL; -} - -HRESULT CIEHtmlElement::FinalConstruct( ) -{ - return CComCreator >::CreateInstance(GetControllingUnknown(), - IID_IUnknown, reinterpret_cast(&m_pNodeAgg)); -} - -CIEHtmlElement::~CIEHtmlElement() -{ -} - -void CIEHtmlElement::FinalRelease( ) -{ - m_pNodeAgg->Release(); -} - -HRESULT CIEHtmlElement::GetChildren(CIEHtmlElementCollectionInstance **ppCollection) -{ - // Validate parameters - if (ppCollection == NULL) - { - return E_INVALIDARG; - } - - *ppCollection = NULL; - - // Create a collection representing the children of this node - CIEHtmlElementCollectionInstance *pCollection = NULL; - CIEHtmlElementCollection::CreateFromParentNode(this, FALSE, (CIEHtmlElementCollection **) &pCollection); - if (pCollection) - { - pCollection->AddRef(); - *ppCollection = pCollection; - } - - return S_OK; -} - -HRESULT CIEHtmlElement::GetHtmlDomNode(CIEHtmlDomNode **ppHtmlDomNode) -{ - if (ppHtmlDomNode == NULL) - return E_FAIL; - *ppHtmlDomNode = NULL; - IHTMLDOMNode* pHtmlNode = NULL; - // This causes an AddRef on outer unknown: - HRESULT hr = m_pNodeAgg->QueryInterface(__uuidof(IHTMLDOMNode), (void**)&pHtmlNode); - *ppHtmlDomNode = (CIEHtmlDomNode*)pHtmlNode; - return hr; -} - -HRESULT CIEHtmlElement::SetDOMNode(nsIDOMNode *pDomNode) -{ - mDOMNode = pDomNode; - // Forward to aggregated object: - CIEHtmlDomNode *pHtmlDomNode; - GetHtmlDomNode(&pHtmlDomNode); - HRESULT hr = pHtmlDomNode->SetDOMNode(pDomNode); - // Release on outer unknown because GetHtmlDomNode does AddRef on it: - GetControllingUnknown()->Release(); - return hr; -} - -HRESULT CIEHtmlElement::SetParent(CNode *pParent) -{ - CNode::SetParent(pParent); - // Forward to aggregated object: - CIEHtmlDomNode *pHtmlDomNode; - GetHtmlDomNode(&pHtmlDomNode); - HRESULT hr = pHtmlDomNode->SetParent(pParent); - // Release on outer unknown because GetHtmlDomNode does AddRef on it: - GetControllingUnknown()->Release(); - return hr; -} - -/////////////////////////////////////////////////////////////////////////////// -// IHTMLElement implementation - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::setAttribute(BSTR strAttributeName, VARIANT AttributeValue, LONG lFlags) -{ - if (strAttributeName == NULL) - { - return E_INVALIDARG; - } - - nsCOMPtr element = do_QueryInterface(mDOMNode); - if (!element) - { - return E_UNEXPECTED; - } - - // Get the name from the BSTR - USES_CONVERSION; - nsAutoString name(OLE2W(strAttributeName)); - - // Get the value from the variant - CComVariant vValue; - if (FAILED(vValue.ChangeType(VT_BSTR, &AttributeValue))) - { - return E_INVALIDARG; - } - - // Set the attribute - nsAutoString value(OLE2W(vValue.bstrVal)); - element->SetAttribute(name, value); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::getAttribute(BSTR strAttributeName, LONG lFlags, VARIANT __RPC_FAR *AttributeValue) -{ - if (strAttributeName == NULL) - { - return E_INVALIDARG; - } - if (AttributeValue == NULL) - { - return E_INVALIDARG; - } - VariantInit(AttributeValue); - - // Get the name from the BSTR - USES_CONVERSION; - nsAutoString name(OLE2W(strAttributeName)); - - nsCOMPtr element = do_QueryInterface(mDOMNode); - if (!element) - { - return E_UNEXPECTED; - } - - BOOL bCaseSensitive = (lFlags == VARIANT_TRUE) ? TRUE : FALSE; - - - // Get the attribute - nsAutoString value; - nsresult rv = element->GetAttribute(name, value); - if (NS_SUCCEEDED(rv)) - { - USES_CONVERSION; - AttributeValue->vt = VT_BSTR; - AttributeValue->bstrVal = SysAllocString(W2COLE(value.get())); - return S_OK; - } - else - { - return S_FALSE; - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::removeAttribute(BSTR strAttributeName, LONG lFlags, VARIANT_BOOL __RPC_FAR *pfSuccess) -{ - if (strAttributeName == NULL) - { - return E_INVALIDARG; - } - - nsCOMPtr element = do_QueryInterface(mDOMNode); - if (!element) - { - return E_UNEXPECTED; - } - - BOOL bCaseSensitive = (lFlags == VARIANT_TRUE) ? TRUE : FALSE; - - // Get the name from the BSTR - USES_CONVERSION; - nsAutoString name(OLE2W(strAttributeName)); - - // Remove the attribute - nsresult nr = element->RemoveAttribute(name); - BOOL bRemoved = (nr == NS_OK) ? TRUE : FALSE; - - if (pfSuccess) - { - *pfSuccess = (bRemoved) ? VARIANT_TRUE : VARIANT_FALSE; - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_className(BSTR v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_className(BSTR __RPC_FAR *p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - - VARIANT vValue; - VariantInit(&vValue); - BSTR bstrName = SysAllocString(OLESTR("class")); - getAttribute(bstrName, FALSE, &vValue); - SysFreeString(bstrName); - - *p = vValue.bstrVal; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_id(BSTR v) -{ - nsCOMPtr domHtmlElmt = do_QueryInterface(mDOMNode); - if (!domHtmlElmt) - return E_UNEXPECTED; - USES_CONVERSION; - nsDependentString strID(OLE2CW(v)); - if (FAILED(domHtmlElmt->SetId(strID))) - return E_FAIL; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_id(BSTR __RPC_FAR *p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - - VARIANT vValue; - VariantInit(&vValue); - BSTR bstrName = SysAllocString(OLESTR("id")); - getAttribute(bstrName, FALSE, &vValue); - SysFreeString(bstrName); - - *p = vValue.bstrVal; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_tagName(BSTR __RPC_FAR *p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - - nsCOMPtr element = do_QueryInterface(mDOMNode); - if (!element) - { - return E_UNEXPECTED; - } - - nsAutoString tagName; - element->GetTagName(tagName); - - USES_CONVERSION; - *p = SysAllocString(W2COLE(tagName.get())); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_parentElement(IHTMLElement __RPC_FAR *__RPC_FAR *p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - - *p = NULL; - if (mParent) - { - CIEHtmlElement *pElt = static_cast(mParent); - pElt->QueryInterface(IID_IHTMLElement, (void **) p); - } - else - { - nsCOMPtr parentNode; - mDOMNode->GetParentNode(getter_AddRefs(parentNode)); - nsCOMPtr domElement = do_QueryInterface(parentNode); - if (domElement) - { - CComPtr pNode; - HRESULT hr = CIEHtmlDomNode::FindOrCreateFromDOMNode(parentNode, &pNode); - if (FAILED(hr)) - return hr; - if (FAILED(pNode->QueryInterface(IID_IHTMLElement, (void **) p))) - return E_UNEXPECTED; - } - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_style(IHTMLStyle __RPC_FAR *__RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onhelp(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onhelp(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onclick(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onclick(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_ondblclick(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_ondblclick(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onkeydown(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onkeydown(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onkeyup(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onkeyup(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onkeypress(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onkeypress(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onmouseout(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onmouseout(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onmouseover(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onmouseover(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onmousemove(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onmousemove(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onmousedown(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onmousedown(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onmouseup(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onmouseup(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_document(IDispatch __RPC_FAR *__RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_title(BSTR v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_title(BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_language(BSTR v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_language(BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onselectstart(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onselectstart(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::scrollIntoView(VARIANT varargStart) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::contains(IHTMLElement __RPC_FAR *pChild, VARIANT_BOOL __RPC_FAR *pfResult) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_sourceIndex(long __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_recordNumber(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_lang(BSTR v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_lang(BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetLeft(long __RPC_FAR *p) -{ - nsCOMPtr nodeAsHTMLElement = do_QueryInterface(mDOMNode); - if (!nodeAsHTMLElement) - { - return E_NOINTERFACE; - } - - PRInt32 nData; - nodeAsHTMLElement->GetOffsetLeft(&nData); - *p = nData; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetTop(long __RPC_FAR *p) -{ - nsCOMPtr nodeAsHTMLElement = do_QueryInterface(mDOMNode); - if (!nodeAsHTMLElement) - { - return E_NOINTERFACE; - } - - PRInt32 nData; - nodeAsHTMLElement->GetOffsetTop(&nData); - *p = nData; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetWidth(long __RPC_FAR *p) -{ - nsCOMPtr nodeAsHTMLElement = do_QueryInterface(mDOMNode); - if (!nodeAsHTMLElement) - { - return E_NOINTERFACE; - } - - PRInt32 nData; - nodeAsHTMLElement->GetOffsetWidth(&nData); - *p = nData; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetHeight(long __RPC_FAR *p) -{ - nsCOMPtr nodeAsHTMLElement = do_QueryInterface(mDOMNode); - if (!nodeAsHTMLElement) - { - return E_NOINTERFACE; - } - - PRInt32 nData; - nodeAsHTMLElement->GetOffsetHeight(&nData); - *p = nData; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetParent(IHTMLElement __RPC_FAR *__RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_innerHTML(BSTR v) -{ - nsCOMPtr elementHTML = do_QueryInterface(mDOMNode); - if (!elementHTML) - { - return E_UNEXPECTED; - } - - USES_CONVERSION; - nsAutoString innerHTML(OLE2W(v)); - elementHTML->SetInnerHTML(innerHTML); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_innerHTML(BSTR __RPC_FAR *p) -{ - nsCOMPtr elementHTML = do_QueryInterface(mDOMNode); - if (!elementHTML) - { - return E_UNEXPECTED; - } - - nsAutoString innerHTML; - elementHTML->GetInnerHTML(innerHTML); - - USES_CONVERSION; - *p = SysAllocString(W2COLE(innerHTML.get())); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_innerText(BSTR v) -{ - if (!mDOMNode) - { - return E_UNEXPECTED; - } - - USES_CONVERSION; - nsAutoString innerText(OLE2W(v)); - mDOMNode->SetTextContent(innerText); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_innerText(BSTR __RPC_FAR *p) -{ - if (!mDOMNode) - { - return E_UNEXPECTED; - } - - nsAutoString innerText; - mDOMNode->GetTextContent(innerText); - - USES_CONVERSION; - *p = SysAllocString(W2COLE(innerText.get())); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_outerHTML(BSTR v) -{ - nsresult rv; - nsCOMPtr domDoc; - nsCOMPtr domRange; - nsCOMPtr domDocFragment; - - mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc)); - nsCOMPtr domDocRange = do_QueryInterface(domDoc); - if (!domDocRange) - return E_FAIL; - domDocRange->CreateRange(getter_AddRefs(domRange)); - if (!domRange) - return E_FAIL; - if (domRange->SetStartBefore(mDOMNode)) - return E_FAIL; - if (domRange->DeleteContents()) - return E_FAIL; - nsAutoString outerHTML(OLE2W(v)); - nsCOMPtr domNSRange = do_QueryInterface(domRange); - rv = domNSRange->CreateContextualFragment(outerHTML, getter_AddRefs(domDocFragment)); - if (!domDocFragment) - return E_FAIL; - nsCOMPtr parentNode; - mDOMNode->GetParentNode(getter_AddRefs(parentNode)); - nsCOMPtr domNode; - parentNode->ReplaceChild(domDocFragment, mDOMNode, getter_AddRefs(domNode)); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_outerHTML(BSTR __RPC_FAR *p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - - *p = NULL; - - nsresult rv; - nsAutoString outerHTML; - nsCOMPtr domDoc; - nsCOMPtr docEncoder; - nsCOMPtr domRange; - - mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc)); - if (!domDoc) - return E_FAIL; - - docEncoder = do_CreateInstance(NS_DOC_ENCODER_CONTRACTID_BASE "text/html"); - NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE); - docEncoder->Init(domDoc, NS_LITERAL_STRING("text/html"), - nsIDocumentEncoder::OutputEncodeBasicEntities); - nsCOMPtr domDocRange = do_QueryInterface(domDoc); - if (!domDocRange) - return E_FAIL; - domDocRange->CreateRange(getter_AddRefs(domRange)); - if (!domRange) - return E_FAIL; - rv = domRange->SelectNode(mDOMNode); - NS_ENSURE_SUCCESS(rv, rv); - docEncoder->SetRange(domRange); - docEncoder->EncodeToString(outerHTML); - - USES_CONVERSION; - *p = SysAllocString(W2COLE(outerHTML.get())); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_outerText(BSTR v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_outerText(BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::insertAdjacentHTML(BSTR where, BSTR html) -{ - nsresult rv; - nsCOMPtr domDoc; - nsCOMPtr domRange; - nsCOMPtr domDocFragment; - - NS_ASSERTION(mDOMNode, ""); - //Create a range: - mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc)); - nsCOMPtr domDocRange = do_QueryInterface(domDoc); - if (!domDocRange) - return E_FAIL; - domDocRange->CreateRange(getter_AddRefs(domRange)); - if (!domRange) - return E_FAIL; - // Must position range first before calling CreateContextualFragment: - if (domRange->SetStartBefore(mDOMNode)) - return E_FAIL; - USES_CONVERSION; - // Create doc fragment: - nsDependentString strAdjacentHTML(OLE2CW(html)); - nsCOMPtr domNSRange = do_QueryInterface(domRange); - domNSRange->CreateContextualFragment(strAdjacentHTML, getter_AddRefs(domDocFragment)); - if (!domDocFragment) - return E_FAIL; - if (_wcsicmp(OLE2CW(where), L"beforeBegin") == 0) - { - // Insert fragment immediately before us: - nsCOMPtr parentNode; - mDOMNode->GetParentNode(getter_AddRefs(parentNode)); - nsCOMPtr dummyNode; - rv = parentNode->InsertBefore(domDocFragment, mDOMNode, getter_AddRefs(dummyNode)); - return SUCCEEDED(rv)? S_OK: E_FAIL; - } - if (_wcsicmp(OLE2CW(where), L"afterEnd") == 0) - { - // Insert fragment immediately after us: - nsCOMPtr parentNode; - mDOMNode->GetParentNode(getter_AddRefs(parentNode)); - nsCOMPtr dummyNode; - nsCOMPtr nextNode; - mDOMNode->GetNextSibling(getter_AddRefs(nextNode)); - if (nextNode) - { - // Insert immediately before next node: - rv = parentNode->InsertBefore(domDocFragment, nextNode, getter_AddRefs(dummyNode)); - } - else - { - // We are the last child, insert after us: - rv = parentNode->AppendChild(domDocFragment, getter_AddRefs(dummyNode)); - } - return SUCCEEDED(rv)? S_OK: E_FAIL; - } - if (_wcsicmp(OLE2CW(where), L"afterBegin") == 0) - { - // Insert fragment immediately before first child: - nsCOMPtr firstChildNode; - mDOMNode->GetFirstChild(getter_AddRefs(firstChildNode)); - if (!firstChildNode) - return E_FAIL; // IE fails when inserting into a tag that has no childs - nsCOMPtr dummyNode; - rv = mDOMNode->InsertBefore(domDocFragment, firstChildNode, getter_AddRefs(dummyNode)); - return SUCCEEDED(rv)? S_OK: E_FAIL; - } - if (_wcsicmp(OLE2CW(where), L"beforeEnd") == 0) - { - // Insert fragment immediately as last child: - nsCOMPtr dummyNode; - rv = mDOMNode->AppendChild(domDocFragment, getter_AddRefs(dummyNode)); - return SUCCEEDED(rv)? S_OK: E_FAIL; - } - return E_INVALIDARG; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::insertAdjacentText(BSTR where, BSTR text) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_parentTextEdit(IHTMLElement __RPC_FAR *__RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_isTextEdit(VARIANT_BOOL __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::click(void) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_filters(IHTMLFiltersCollection __RPC_FAR *__RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_ondragstart(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_ondragstart(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::toString(BSTR __RPC_FAR *String) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onbeforeupdate(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onbeforeupdate(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onafterupdate(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onafterupdate(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onerrorupdate(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onerrorupdate(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onrowexit(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onrowexit(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onrowenter(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onrowenter(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_ondatasetchanged(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_ondatasetchanged(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_ondataavailable(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_ondataavailable(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_ondatasetcomplete(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_ondatasetcomplete(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onfilterchange(VARIANT v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onfilterchange(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_children(IDispatch __RPC_FAR *__RPC_FAR *p) -{ - // Validate parameters - if (p == NULL) - { - return E_INVALIDARG; - } - - *p = NULL; - - // Create a collection representing the children of this node - CIEHtmlElementCollectionInstance *pCollection = NULL; - HRESULT hr = GetChildren(&pCollection); - if (SUCCEEDED(hr)) - { - *p = pCollection; - } - - return hr; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_all(IDispatch __RPC_FAR *__RPC_FAR *p) -{ - // Validate parameters - if (p == NULL) - { - return E_INVALIDARG; - } - - *p = NULL; - - // TODO get ALL contained elements, not just the immediate children - - CIEHtmlElementCollectionInstance *pCollection = NULL; - CIEHtmlElementCollection::CreateFromParentNode(this, TRUE, (CIEHtmlElementCollection **) &pCollection); - if (pCollection) - { - pCollection->AddRef(); - *p = pCollection; - } - - return S_OK; -} - diff --git a/embedding/browser/activex/src/common/IEHtmlElement.h b/embedding/browser/activex/src/common/IEHtmlElement.h deleted file mode 100644 index 84f0a88b781..00000000000 --- a/embedding/browser/activex/src/common/IEHtmlElement.h +++ /dev/null @@ -1,173 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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): - * Adam Lock - * - * 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 ***** */ -#ifndef IEHTMLELEMENT_H -#define IEHTMLELEMENT_H - -#include "IEHtmlNode.h" -#include "IEHtmlElementCollection.h" - -class CIEHtmlElement : - public CNode, - public IDispatchImpl -{ -public: - DECLARE_AGGREGATABLE(CIEHtmlElement) - CIEHtmlElement(); - HRESULT FinalConstruct( ); - void FinalRelease( ); - -DECLARE_GET_CONTROLLING_UNKNOWN() - -protected: - virtual ~CIEHtmlElement(); - -public: - -BEGIN_COM_MAP(CIEHtmlElement) - COM_INTERFACE_ENTRY2(IDispatch, IHTMLElement) - COM_INTERFACE_ENTRY(IHTMLElement) - COM_INTERFACE_ENTRY_AGGREGATE(__uuidof(IHTMLDOMNode), m_pNodeAgg) -END_COM_MAP() - - virtual HRESULT GetChildren(CIEHtmlElementCollectionInstance **ppCollection); - virtual HRESULT GetHtmlDomNode(CIEHtmlDomNode **ppHtmlDomNode); - virtual HRESULT SetDOMNode(nsIDOMNode *pDomNode); - virtual HRESULT SetParent(CNode *pParent); - - // Implementation of IHTMLElement - virtual HRESULT STDMETHODCALLTYPE setAttribute(BSTR strAttributeName, VARIANT AttributeValue, LONG lFlags); - virtual HRESULT STDMETHODCALLTYPE getAttribute(BSTR strAttributeName, LONG lFlags, VARIANT __RPC_FAR *AttributeValue); - virtual HRESULT STDMETHODCALLTYPE removeAttribute(BSTR strAttributeName, LONG lFlags, VARIANT_BOOL __RPC_FAR *pfSuccess); - virtual HRESULT STDMETHODCALLTYPE put_className(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_className(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_id(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_id(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_tagName(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_parentElement(IHTMLElement __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_style(IHTMLStyle __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onhelp(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onhelp(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onclick(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onclick(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_ondblclick(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_ondblclick(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onkeydown(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onkeydown(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onkeyup(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onkeyup(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onkeypress(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onkeypress(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onmouseout(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onmouseout(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onmouseover(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onmouseover(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onmousemove(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onmousemove(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onmousedown(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onmousedown(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onmouseup(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onmouseup(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_document(IDispatch __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_title(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_title(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_language(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_language(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onselectstart(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onselectstart(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE scrollIntoView(VARIANT varargStart); - virtual HRESULT STDMETHODCALLTYPE contains(IHTMLElement __RPC_FAR *pChild, VARIANT_BOOL __RPC_FAR *pfResult); - virtual HRESULT STDMETHODCALLTYPE get_sourceIndex(long __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_recordNumber(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_lang(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_lang(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_offsetLeft(long __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_offsetTop(long __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_offsetWidth(long __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_offsetHeight(long __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_offsetParent(IHTMLElement __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_innerHTML(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_innerHTML(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_innerText(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_innerText(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_outerHTML(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_outerHTML(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_outerText(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_outerText(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE insertAdjacentHTML(BSTR where, BSTR html); - virtual HRESULT STDMETHODCALLTYPE insertAdjacentText(BSTR where, BSTR text); - virtual HRESULT STDMETHODCALLTYPE get_parentTextEdit(IHTMLElement __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_isTextEdit(VARIANT_BOOL __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE click(void); - virtual HRESULT STDMETHODCALLTYPE get_filters(IHTMLFiltersCollection __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_ondragstart(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_ondragstart(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE toString(BSTR __RPC_FAR *String); - virtual HRESULT STDMETHODCALLTYPE put_onbeforeupdate(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onbeforeupdate(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onafterupdate(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onafterupdate(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onerrorupdate(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onerrorupdate(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onrowexit(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onrowexit(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onrowenter(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onrowenter(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_ondatasetchanged(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_ondatasetchanged(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_ondataavailable(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_ondataavailable(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_ondatasetcomplete(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_ondatasetcomplete(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onfilterchange(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onfilterchange(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_children(IDispatch __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_all(IDispatch __RPC_FAR *__RPC_FAR *p); - -protected: - IUnknown* m_pNodeAgg; -}; - -#define CIEHTMLELEMENT_INTERFACES \ - COM_INTERFACE_ENTRY_IID(IID_IDispatch, IHTMLElement) \ - COM_INTERFACE_ENTRY_IID(IID_IHTMLElement, IHTMLElement) - -typedef CComObject CIEHtmlElementInstance; - -#endif - - diff --git a/embedding/browser/activex/src/common/IEHtmlElementCollection.cpp b/embedding/browser/activex/src/common/IEHtmlElementCollection.cpp deleted file mode 100644 index 8b1c78aac42..00000000000 --- a/embedding/browser/activex/src/common/IEHtmlElementCollection.cpp +++ /dev/null @@ -1,723 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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): - * Adam Lock - * - * 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 "stdafx.h" - -#include "nsIDOMDocumentTraversal.h" -#include "nsIDOMTreeWalker.h" -#include "nsIDOMNodeFilter.h" -#include "nsIDOMDocument.h" -#include "nsIDOMHtmlElement.h" - -#include "IEHtmlElement.h" -#include "IEHtmlElementCollection.h" - -CIEHtmlElementCollection::CIEHtmlElementCollection() -{ - mNodeList = NULL; - mNodeListCount = 0; - mNodeListCapacity = 0; -} - -CIEHtmlElementCollection::~CIEHtmlElementCollection() -{ - // Clean the node list - if (mNodeList) - { - for (PRUint32 i = 0; i < mNodeListCount; i++) - { - IDispatch *pDisp = mNodeList[i]; - if (pDisp) - { - pDisp->Release(); - } - } - free(mNodeList); - mNodeList = NULL; - mNodeListCount = 0; - mNodeListCapacity = 0; - } -} - -HRESULT CIEHtmlElementCollection::FindOrCreateIEElement(nsIDOMNode* domNode, IHTMLElement** pIHtmlElement) -{ - CComPtr pNode; - HRESULT hr = CIEHtmlDomNode::FindOrCreateFromDOMNode(domNode, &pNode); - if (FAILED(hr)) - return hr; - if (FAILED(pNode->QueryInterface(IID_IHTMLElement, (void**)pIHtmlElement))) - return E_UNEXPECTED; - return S_OK; -} - -HRESULT CIEHtmlElementCollection::PopulateFromDOMHTMLCollection(nsIDOMHTMLCollection *pNodeList) -{ - if (pNodeList == nsnull) - { - return S_OK; - } - - // Recurse through the children of the node (and the children of that) - // to populate the collection - - // Iterate through items in list - PRUint32 length = 0; - pNodeList->GetLength(&length); - for (PRUint32 i = 0; i < length; i++) - { - // Get the next item from the list - nsCOMPtr childNode; - pNodeList->Item(i, getter_AddRefs(childNode)); - if (!childNode) - { - // Empty node (unexpected, but try and carry on anyway) - NS_ERROR("Empty node"); - continue; - } - - // Skip nodes representing, text, attributes etc. - PRUint16 nodeType; - childNode->GetNodeType(&nodeType); - if (nodeType != nsIDOMNode::ELEMENT_NODE) - { - continue; - } - - // Create an equivalent IE element - CComQIPtr pHtmlElement; - HRESULT hr = FindOrCreateIEElement(childNode, &pHtmlElement); - if (FAILED(hr)) - return hr; - AddNode(pHtmlElement); - } - return S_OK; -} - -HRESULT CIEHtmlElementCollection::PopulateFromDOMNode(nsIDOMNode *aDOMNode, BOOL bRecurseChildren) -{ - if (aDOMNode == nsnull) - { - NS_ERROR("No dom node"); - return E_INVALIDARG; - } - - PRBool hasChildNodes = PR_FALSE; - aDOMNode->HasChildNodes(&hasChildNodes); - if (hasChildNodes) - { - if (bRecurseChildren) - { - nsresult rv; - - // Search through parent nodes, looking for the DOM document - nsCOMPtr docAsNode = aDOMNode; - nsCOMPtr doc = do_QueryInterface(aDOMNode); - while (!doc) { - nsCOMPtr parentNode; - docAsNode->GetParentNode(getter_AddRefs(parentNode)); - docAsNode = parentNode; - if (!docAsNode) - { - return E_FAIL; - } - doc = do_QueryInterface(docAsNode); - } - - // Walk the DOM - nsCOMPtr trav = do_QueryInterface(doc, &rv); - NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); - nsCOMPtr walker; - rv = trav->CreateTreeWalker(aDOMNode, - nsIDOMNodeFilter::SHOW_ELEMENT, - nsnull, PR_TRUE, getter_AddRefs(walker)); - NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); - - // We're not interested in the document node, so we always start - // with the next one, walking through them all to make the collection - nsCOMPtr currentNode; - walker->FirstChild(getter_AddRefs(currentNode)); - while (currentNode) - { - // Create an equivalent IE element - CComQIPtr pHtmlElement; - HRESULT hr = FindOrCreateIEElement(currentNode, &pHtmlElement); - if (FAILED(hr)) - return hr; - AddNode(pHtmlElement); - walker->NextNode(getter_AddRefs(currentNode)); - } - } - else - { - nsCOMPtr nodeList; - aDOMNode->GetChildNodes(getter_AddRefs(nodeList)); - mDOMNodeList = nodeList; - } - } - return S_OK; -} - - -HRESULT CIEHtmlElementCollection::CreateFromDOMHTMLCollection(CNode *pParentNode, nsIDOMHTMLCollection *pNodeList, CIEHtmlElementCollection **pInstance) -{ - if (pInstance == NULL || pParentNode == NULL) - { - NS_ERROR("No instance or parent node"); - return E_INVALIDARG; - } - - // Get the DOM node from the parent node - if (!pParentNode->mDOMNode) - { - NS_ERROR("Parent has no DOM node"); - return E_INVALIDARG; - } - - *pInstance = NULL; - - // Create a collection object - CIEHtmlElementCollectionInstance *pCollection = NULL; - CIEHtmlElementCollectionInstance::CreateInstance(&pCollection); - if (pCollection == NULL) - { - NS_ERROR("Could not create collection"); - return E_OUTOFMEMORY; - } - - // Initialise and populate the collection - pCollection->SetParent(pParentNode); - pCollection->PopulateFromDOMHTMLCollection(pNodeList); - - *pInstance = pCollection; - - return S_OK; -} - -HRESULT CIEHtmlElementCollection::CreateFromParentNode(CNode *pParentNode, BOOL bRecurseChildren, CIEHtmlElementCollection **pInstance) -{ - if (pInstance == NULL || pParentNode == NULL) - { - NS_ERROR("No instance or parent node"); - return E_INVALIDARG; - } - - // Get the DOM node from the parent node - if (!pParentNode->mDOMNode) - { - NS_ERROR("Parent has no DOM node"); - return E_INVALIDARG; - } - - *pInstance = NULL; - - // Create a collection object - CIEHtmlElementCollectionInstance *pCollection = NULL; - CIEHtmlElementCollectionInstance::CreateInstance(&pCollection); - if (pCollection == NULL) - { - NS_ERROR("Could not create collection"); - return E_OUTOFMEMORY; - } - - // Initialise and populate the collection - pCollection->SetParent(pParentNode); - pCollection->PopulateFromDOMNode(pParentNode->mDOMNode, bRecurseChildren); - - *pInstance = pCollection; - - return S_OK; -} - - -HRESULT CIEHtmlElementCollection::AddNode(IDispatch *pNode) -{ - if (pNode == NULL) - { - NS_ERROR("No node"); - return E_INVALIDARG; - } - - const PRUint32 c_NodeListResizeBy = 100; - - if (mNodeList == NULL) - { - mNodeListCapacity = c_NodeListResizeBy; - mNodeList = (IDispatch **) malloc(sizeof(IDispatch *) * mNodeListCapacity); - mNodeListCount = 0; - } - else if (mNodeListCount == mNodeListCapacity) - { - mNodeListCapacity += c_NodeListResizeBy; - mNodeList = (IDispatch **) realloc(mNodeList, sizeof(IDispatch *) * mNodeListCapacity); - } - - if (mNodeList == NULL) - { - NS_ERROR("Could not realloc node list"); - return E_OUTOFMEMORY; - } - - pNode->AddRef(); - mNodeList[mNodeListCount++] = pNode; - - return S_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IHTMLElementCollection methods - - -HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::toString(BSTR __RPC_FAR *String) -{ - if (String == NULL) - { - return E_INVALIDARG; - } - *String = SysAllocString(OLESTR("ElementCollection")); - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::put_length(long v) -{ - // What is the point of this method? - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::get_length(long __RPC_FAR *p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - - // Return the size of the collection - if (mDOMNodeList) - { - // Count the number of elements in the list - PRUint32 elementCount = 0; - PRUint32 length = 0; - mDOMNodeList->GetLength(&length); - for (PRUint32 i = 0; i < length; i++) - { - // Get the next item from the list - nsCOMPtr childNode; - mDOMNodeList->Item(i, getter_AddRefs(childNode)); - if (!childNode) - { - // Empty node (unexpected, but try and carry on anyway) - NS_ERROR("Empty node"); - continue; - } - - // Only count elements - PRUint16 nodeType; - childNode->GetNodeType(&nodeType); - if (nodeType == nsIDOMNode::ELEMENT_NODE) - { - elementCount++; - } - } - *p = elementCount; - } - else - { - *p = mNodeListCount; - } - return S_OK; -} - -typedef CComObject > > CComEnumVARIANT; - -HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::get__newEnum(IUnknown __RPC_FAR *__RPC_FAR *p) -{ - TRACE_METHOD(CIEHtmlElementCollection::get__newEnum); - - if (p == NULL) - { - return E_INVALIDARG; - } - - *p = NULL; - - // Create a new IEnumVARIANT object - CComEnumVARIANT *pEnumVARIANT = NULL; - CComEnumVARIANT::CreateInstance(&pEnumVARIANT); - if (pEnumVARIANT == NULL) - { - NS_ERROR("Could not creat Enum"); - return E_OUTOFMEMORY; - } - - int nObject = 0; - long nObjects = 0; - get_length(&nObjects); - - // Create an array of VARIANTs - VARIANT *avObjects = new VARIANT[nObjects]; - if (avObjects == NULL) - { - NS_ERROR("Could not create variant array"); - return E_OUTOFMEMORY; - } - - if (mDOMNodeList) - { - // Fill the variant array with elements from the DOM node list - PRUint32 length = 0; - mDOMNodeList->GetLength(&length); - for (PRUint32 i = 0; i < length; i++) - { - // Get the next item from the list - nsCOMPtr childNode; - mDOMNodeList->Item(i, getter_AddRefs(childNode)); - if (!childNode) - { - // Empty node (unexpected, but try and carry on anyway) - NS_ERROR("Could not get node"); - continue; - } - - // Skip nodes representing, text, attributes etc. - PRUint16 nodeType; - childNode->GetNodeType(&nodeType); - if (nodeType != nsIDOMNode::ELEMENT_NODE) - { - continue; - } - - // Store the element in the array - CComQIPtr pHtmlElement; - HRESULT hr = FindOrCreateIEElement(childNode, &pHtmlElement); - if (FAILED(hr)) - return hr; - VARIANT *pVariant = &avObjects[nObject++]; - VariantInit(pVariant); - pVariant->vt = VT_DISPATCH; - pHtmlElement->QueryInterface(IID_IDispatch, (void **) &pVariant->pdispVal); - } - } - else - { - // Copy the contents of the collection to the array - for (nObject = 0; nObject < nObjects; nObject++) - { - VARIANT *pVariant = &avObjects[nObject]; - IDispatch *pDispObject = mNodeList[nObject]; - VariantInit(pVariant); - pVariant->vt = VT_DISPATCH; - pVariant->pdispVal = pDispObject; - pDispObject->AddRef(); - } - } - - // Copy the variants to the enumeration object - pEnumVARIANT->Init(&avObjects[0], &avObjects[nObjects], NULL, AtlFlagCopy); - - // Cleanup the array - for (nObject = 0; nObject < nObjects; nObject++) - { - VARIANT *pVariant = &avObjects[nObject]; - VariantClear(pVariant); - } - delete []avObjects; - - return pEnumVARIANT->QueryInterface(IID_IUnknown, (void**) p); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::item(VARIANT name, VARIANT index, IDispatch __RPC_FAR *__RPC_FAR *pdisp) -{ - TRACE_METHOD(CIEHtmlElementCollection::item); - - if (pdisp == NULL) - { - return E_INVALIDARG; - } - - *pdisp = NULL; - - // Parameter name is either a string or a number - - PRBool searchForName = PR_FALSE; - nsAutoString nameToSearch; - PRInt32 idxForSearch = 0; - - if (name.vt == VT_BSTR && name.bstrVal && wcslen(name.bstrVal) > 0) - { - nameToSearch.Assign(name.bstrVal); - searchForName = PR_TRUE; - } - else switch (name.vt) - { - case VT_UI1: - case VT_UI2: - case VT_UI4: - case VT_I1: - case VT_I2: - case VT_I1 | VT_BYREF: - case VT_I2 | VT_BYREF: - // Coerce the variant into a long - if (FAILED(VariantChangeType(&name, &name, 0, VT_I4))) - { - return E_INVALIDARG; - } - // Fall through - case VT_I4: - idxForSearch = name.lVal; - if (idxForSearch < 0) - return E_INVALIDARG; - break; - default: - // Unknown arg. - // As per documentation, no attempt to be lenient with crappy clients - // for the time being. - return E_INVALIDARG; - } - - CIEHtmlElementCollectionInstance* pCollection = NULL; - - if (mDOMNodeList) - { - CComQIPtr pHtmlElement; - // Search for the Nth element in the list - PRUint32 elementCount = 0; - PRUint32 length = 0; - mDOMNodeList->GetLength(&length); - for (PRUint32 i = 0; i < length; i++) - { - // Get the next item from the list - nsCOMPtr childNode; - mDOMNodeList->Item(i, getter_AddRefs(childNode)); - if (!childNode) - { - // Empty node (unexpected, but try and carry on anyway) - NS_ERROR("Could not get node"); - continue; - } - - // Skip nodes representing, text, attributes etc. - nsCOMPtr nodeAsElement = do_QueryInterface(childNode); - if (!nodeAsElement) - { - continue; - } - - // Have we found the element we need? - PRBool grabThisNode = PR_FALSE; - if (searchForName) - { - nsCOMPtr nodeAsHtmlElement = do_QueryInterface(childNode); - if (nodeAsHtmlElement) - { - NS_NAMED_LITERAL_STRING(nameAttr, "name"); - nsAutoString nodeName; - nsAutoString nodeId; - nodeAsHtmlElement->GetAttribute(nameAttr, nodeName); - nodeAsHtmlElement->GetId(nodeId); - if (nodeName.Equals(nameToSearch) || nodeId.Equals(nameToSearch)) - { - grabThisNode = PR_TRUE; - } - } - } - else if (elementCount == idxForSearch) - { - grabThisNode = PR_TRUE; - } - - if (grabThisNode) - { - if (pHtmlElement) - { - if (pCollection == NULL) - CIEHtmlElementCollectionInstance::CreateInstance(&pCollection); - // Add existing to collection - pCollection->AddNode(pHtmlElement); - } - // Create new element: - HRESULT hr = FindOrCreateIEElement(childNode, &pHtmlElement); - if (FAILED(hr)) - return hr; - ((CIEHtmlElement*)pHtmlElement.p)->SetParent(mParent); - } - elementCount++; - } - // Return the element or collection : - if (pCollection != NULL) - { - // Add last created element to collection - pCollection->AddNode(pHtmlElement); - pCollection->QueryInterface(IID_IDispatch, (void **) pdisp); - } - else if (pHtmlElement != NULL) - pHtmlElement->QueryInterface(IID_IDispatch, (void **) pdisp); - } - else - { - if (searchForName) - { - CComPtr element = NULL; - for (PRUint32 i = 0; i < mNodeListCount; i++) - { - CComQIPtr currElement = mNodeList[i]; - if (currElement.p) - { - CComVariant elementName; - CComBSTR elementId; - currElement->get_id(&elementId); - currElement->getAttribute(L"name", 0, &elementName); - if ((elementId && wcscmp(elementId, name.bstrVal) == 0) || - (elementName.vt == VT_BSTR && elementName.bstrVal && - wcscmp(elementName.bstrVal, name.bstrVal) == 0)) - { - if (element != NULL) - { - if (!pCollection) - CIEHtmlElementCollectionInstance::CreateInstance(&pCollection); - pCollection->AddNode(element); - } - element = currElement; - } - } - } - // Return the element or collection : - if (pCollection != NULL) - { - pCollection->AddNode(element); - pCollection->QueryInterface(IID_IDispatch, (void **) pdisp); - } - else if (element != NULL) - element->QueryInterface(IID_IDispatch, (void **) pdisp); - } - else - { - // Test for stupid values - if (idxForSearch >= mNodeListCount) - { - return E_INVALIDARG; - } - - *pdisp = NULL; - IDispatch *pNode = mNodeList[idxForSearch]; - if (pNode == NULL) - { - NS_ERROR("No node"); - return E_UNEXPECTED; - } - pNode->QueryInterface(IID_IDispatch, (void **) pdisp); - } - } - - // Note: As per docs S_OK is fine even if no node is returned - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::tags(VARIANT tagName, IDispatch __RPC_FAR *__RPC_FAR *pdisp) -{ - if (pdisp == NULL || tagName.vt != VT_BSTR) - { - return E_INVALIDARG; - } - - *pdisp = NULL; - - CIEHtmlElementCollectionInstance* pCollection = NULL; - CIEHtmlElementCollectionInstance::CreateInstance(&pCollection); - if (mNodeList) - { - for (PRUint32 i = 0; i < mNodeListCount; i++) - { - CComQIPtr element = mNodeList[i]; - if (element.p) - { - CComBSTR elementTagName; - element->get_tagName(&elementTagName); - if (elementTagName && _wcsicmp(elementTagName, tagName.bstrVal) == 0) - pCollection->AddNode(element); - } - } - pCollection->QueryInterface(IID_IDispatch, (void**)pdisp); - return S_OK; - } - else if (mDOMNodeList) - { - PRUint32 length = 0; - mDOMNodeList->GetLength(&length); - for (PRUint32 i = 0; i < length; i++) - { - // Get the next item from the list - nsCOMPtr childNode; - mDOMNodeList->Item(i, getter_AddRefs(childNode)); - if (!childNode) - { - // Empty node (unexpected, but try and carry on anyway) - NS_ERROR("Could not get node"); - continue; - } - - // Skip nodes representing, text, attributes etc. - nsCOMPtr nodeAsElement = do_QueryInterface(childNode); - if (!nodeAsElement) - { - continue; - } - - nsCOMPtr nodeAsHtmlElement = do_QueryInterface(childNode); - if (nodeAsHtmlElement) - { - nsAutoString elementTagName; - nodeAsHtmlElement->GetTagName(elementTagName); - if (_wcsicmp(elementTagName.get(), OLE2CW(tagName.bstrVal)) == 0) - { - CComQIPtr pHtmlElement; - HRESULT hr = FindOrCreateIEElement(childNode, &pHtmlElement); - if (FAILED(hr)) - return hr; - //Add to collection : - pCollection->AddNode(pHtmlElement); - } - } - } - pCollection->QueryInterface(IID_IDispatch, (void**)pdisp); - return S_OK; - } - return E_UNEXPECTED; -} - diff --git a/embedding/browser/activex/src/common/IEHtmlElementCollection.h b/embedding/browser/activex/src/common/IEHtmlElementCollection.h deleted file mode 100644 index 999ea41ba26..00000000000 --- a/embedding/browser/activex/src/common/IEHtmlElementCollection.h +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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): - * Adam Lock - * - * 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 ***** */ -#ifndef IEHTMLNODECOLLECTION_H -#define IEHTMLNODECOLLECTION_H - -#include "nsIDOMHTMLCollection.h" -#include "nsIDOMNodeList.h" - -#include "IEHtmlNode.h" - -class CIEHtmlElement; - -class CIEHtmlElementCollection : - public CNode, - public IDispatchImpl -{ -private: - // Hold a DOM node list - nsCOMPtr mDOMNodeList; - // Or hold a static collection - IDispatch **mNodeList; - PRUint32 mNodeListCount; - PRUint32 mNodeListCapacity; - -public: - CIEHtmlElementCollection(); - -protected: - virtual ~CIEHtmlElementCollection(); - virtual HRESULT FindOrCreateIEElement(nsIDOMNode* domNode, IHTMLElement** pIHtmlElement); - -public: - // Adds a node to the collection - virtual HRESULT AddNode(IDispatch *pNode); - - virtual HRESULT PopulateFromDOMHTMLCollection(nsIDOMHTMLCollection *pNodeList); - - // Populates the collection with items from the DOM node - virtual HRESULT PopulateFromDOMNode(nsIDOMNode *pIDOMNode, BOOL bRecurseChildren); - - // Helper method creates a collection from a parent node - static HRESULT CreateFromParentNode(CNode *pParentNode, BOOL bRecurseChildren, CIEHtmlElementCollection **pInstance); - - // Helper method creates a collection from the specified HTML collection - static HRESULT CreateFromDOMHTMLCollection(CNode *pParentNode, nsIDOMHTMLCollection *pNodeList, CIEHtmlElementCollection **pInstance); - - -BEGIN_COM_MAP(CIEHtmlElementCollection) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IHTMLElementCollection) -END_COM_MAP() - - // IHTMLElementCollection methods - virtual HRESULT STDMETHODCALLTYPE toString(BSTR __RPC_FAR *String); - virtual HRESULT STDMETHODCALLTYPE put_length(long v); - virtual HRESULT STDMETHODCALLTYPE get_length(long __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get__newEnum(IUnknown __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE item(VARIANT name, VARIANT index, IDispatch __RPC_FAR *__RPC_FAR *pdisp); - virtual HRESULT STDMETHODCALLTYPE tags(VARIANT tagName, IDispatch __RPC_FAR *__RPC_FAR *pdisp); -}; - -typedef CComObject CIEHtmlElementCollectionInstance; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/common/IEHtmlNode.cpp b/embedding/browser/activex/src/common/IEHtmlNode.cpp deleted file mode 100644 index 087580e01ef..00000000000 --- a/embedding/browser/activex/src/common/IEHtmlNode.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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): - * Adam Lock - * - * 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 "stdafx.h" -#include "IEHtmlNode.h" - -#include "plhash.h" - -static PLHashTable *g_NodeLookupTable; - -static PLHashNumber HashFunction(const void *key) -{ - return (PRUint32) key; -} - -PRIntn HashComparator(const void *v1, const void *v2) -{ - if (v1 == v2) - { - return 1; - } - return 0; -} - - -CNode::CNode() : - mParent(NULL),mDOMNode(NULL) -{ -} - -CNode::~CNode() -{ -} - - -HRESULT CNode::SetParent(CNode *pParent) -{ - mParent = pParent; - return S_OK; -} - - -HRESULT CNode::FindFromDOMNode(nsIDOMNode *pIDOMNode, CNode **pNode) -{ - if (pIDOMNode == nsnull) - { - return E_FAIL; - } - - if (g_NodeLookupTable == NULL) - { - return E_FAIL; - } - - nsCOMPtr nodeAsSupports = do_QueryInterface(pIDOMNode); - *pNode = (CNode *) PL_HashTableLookup(g_NodeLookupTable, nodeAsSupports); - - return S_OK; -} - -HRESULT CNode::SetDOMNode(nsIDOMNode *pIDOMNode) -{ - if (pIDOMNode) - { - if (g_NodeLookupTable == NULL) - { - g_NodeLookupTable = PL_NewHashTable(123, HashFunction, HashComparator, HashComparator, NULL, NULL); - } - - mDOMNode = pIDOMNode; - nsCOMPtr nodeAsSupports= do_QueryInterface(mDOMNode); - PL_HashTableAdd(g_NodeLookupTable, nodeAsSupports, this); - } - else if (mDOMNode) - { - // Remove the entry from the hashtable - nsCOMPtr nodeAsSupports = do_QueryInterface(mDOMNode); - PL_HashTableRemove(g_NodeLookupTable, nodeAsSupports); - mDOMNode = nsnull; - - if (g_NodeLookupTable->nentries == 0) - { - PL_HashTableDestroy(g_NodeLookupTable); - g_NodeLookupTable = NULL; - } - } - return S_OK; -} - -/////////////////////////////////////////////////////////////////////////////// -// CIEHtmlDomNode methods - -#include "nsIDOMHTMLButtonElement.h" -#include "nsIDOMHTMLElement.h" - -#include "IEHtmlButtonElement.h" -#include "IEHtmlElement.h" - -CIEHtmlDomNode::CIEHtmlDomNode() -{ -} - -CIEHtmlDomNode::~CIEHtmlDomNode() -{ - SetDOMNode(nsnull); -} - -#define CREATE_FROM_DOMNODE(nsInterface, WrapperType, errorMsg) \ - nsCOMPtr domNode_##nsInterface = do_QueryInterface(pIDOMNode); \ - if (domNode_##nsInterface) \ - { \ - WrapperType *pWrapper = NULL; \ - WrapperType::CreateInstance(&pWrapper); \ - if (!pWrapper) \ - { \ - NS_ERROR(errorMsg); \ - return E_OUTOFMEMORY; \ - } \ - if (FAILED(pWrapper->QueryInterface(IID_IUnknown, (void**)pNode))) \ - return E_UNEXPECTED; \ - pWrapper->SetDOMNode(pIDOMNode); \ - return S_OK; \ - } - - -HRESULT CIEHtmlDomNode::CreateFromDOMNode(nsIDOMNode *pIDOMNode, IUnknown **pNode) -{ - CREATE_FROM_DOMNODE(nsIDOMHTMLButtonElement, CIEHtmlButtonElementInstance, "") - CREATE_FROM_DOMNODE(nsIDOMHTMLElement, CIEHtmlElementInstance, "Could not create element") - CREATE_FROM_DOMNODE(nsIDOMNode, CIEHtmlDomNodeInstance, "Could not create node") - return E_FAIL; -} - -HRESULT CIEHtmlDomNode::FindFromDOMNode(nsIDOMNode *pIDOMNode, IUnknown **pNode) -{ - if (pIDOMNode == nsnull) - { - return E_FAIL; - } - - if (g_NodeLookupTable == NULL) - { - return E_FAIL; - } - - nsCOMPtr nodeAsSupports = do_QueryInterface(pIDOMNode); - *pNode = (IUnknown *) PL_HashTableLookup(g_NodeLookupTable, nodeAsSupports); - - return S_OK; -} - -HRESULT CIEHtmlDomNode::FindOrCreateFromDOMNode(nsIDOMNode *pIDOMNode, IUnknown **pNode) -{ - FindFromDOMNode(pIDOMNode,pNode); - - if (*pNode) - { - (*pNode)->AddRef(); - return S_OK; - } - - HRESULT hr = CreateFromDOMNode(pIDOMNode, pNode); - if SUCCEEDED(hr) - return S_OK; - return hr; -} - -HRESULT CIEHtmlDomNode::SetDOMNode(nsIDOMNode *pIDOMNode) -{ - if (pIDOMNode) - { - if (g_NodeLookupTable == NULL) - { - g_NodeLookupTable = PL_NewHashTable(123, HashFunction, HashComparator, HashComparator, NULL, NULL); - } - - mDOMNode = pIDOMNode; - nsCOMPtr nodeAsSupports= do_QueryInterface(mDOMNode); - PL_HashTableAdd(g_NodeLookupTable, nodeAsSupports, (IUnknown *)this ); - } - else if (mDOMNode) - { - // Remove the entry from the hashtable - nsCOMPtr nodeAsSupports = do_QueryInterface(mDOMNode); - PL_HashTableRemove(g_NodeLookupTable, nodeAsSupports); - mDOMNode = nsnull; - - if (g_NodeLookupTable->nentries == 0) - { - PL_HashTableDestroy(g_NodeLookupTable); - g_NodeLookupTable = NULL; - } - } - return S_OK; -} - -/////////////////////////////////////////////////////////////////////////////// -// IHTMLDOMNode methods - -#define SIB_NODE_GET_NUMERIC(function,numtype) \ -{ \ - if (!p) return E_INVALIDARG; \ - if (!mDOMNode) return E_UNEXPECTED; \ - numtype nData; \ - HRESULT rc = mDOMNode->function(&nData); \ - *p=nData; \ - return rc; \ -} - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::get_nodeType(long __RPC_FAR *p) - SIB_NODE_GET_NUMERIC(GetNodeType,PRUint16) - -#define SIB_NODE_GET_ELEMENT(function,fn_elt_type) \ -{ \ - return E_NOTIMPL; \ -} - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::get_parentNode(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p) - SIB_NODE_GET_ELEMENT(GetParentNode,nsIDOMNode) - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::hasChildNodes(VARIANT_BOOL __RPC_FAR *p) - SIB_NODE_GET_NUMERIC(HasChildNodes,PRBool) - -#define SIB_STD_NOTIMPL \ -{ \ - return E_NOTIMPL; \ -} - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::get_childNodes(IDispatch __RPC_FAR *__RPC_FAR *p) - SIB_STD_NOTIMPL - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::get_attributes(IDispatch __RPC_FAR *__RPC_FAR *p) - SIB_STD_NOTIMPL - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::insertBefore(IHTMLDOMNode __RPC_FAR *newChild, - VARIANT refChild, - IHTMLDOMNode __RPC_FAR *__RPC_FAR *node) - SIB_STD_NOTIMPL - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::removeChild( - IHTMLDOMNode __RPC_FAR *oldChild, - IHTMLDOMNode __RPC_FAR *__RPC_FAR *node) - SIB_STD_NOTIMPL - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::replaceChild( - IHTMLDOMNode __RPC_FAR *newChild, - IHTMLDOMNode __RPC_FAR *oldChild, - IHTMLDOMNode __RPC_FAR *__RPC_FAR *node) - SIB_STD_NOTIMPL - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::cloneNode( - VARIANT_BOOL fDeep, - IHTMLDOMNode __RPC_FAR *__RPC_FAR *clonedNode) - SIB_STD_NOTIMPL - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::removeNode( - VARIANT_BOOL fDeep, - IHTMLDOMNode __RPC_FAR *__RPC_FAR *removed) - SIB_STD_NOTIMPL - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::swapNode( - IHTMLDOMNode __RPC_FAR *otherNode, - IHTMLDOMNode __RPC_FAR *__RPC_FAR *swappedNode) - SIB_STD_NOTIMPL - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::replaceNode( - IHTMLDOMNode __RPC_FAR *replacement, - IHTMLDOMNode __RPC_FAR *__RPC_FAR *replaced) - SIB_STD_NOTIMPL - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::appendChild(IHTMLDOMNode *newChild, IHTMLDOMNode **node) -{ - if (!newChild || !node) - return E_INVALIDARG; - *node = NULL; - if (!mDOMNode) - return E_UNEXPECTED; - nsCOMPtr domNode; - nsresult rv = mDOMNode->AppendChild(((CIEHtmlDomNode*)newChild)->mDOMNode, getter_AddRefs(domNode)); - if (NS_FAILED(rv)) - return E_FAIL; - // Create com object: - CComPtr pNode = NULL; - HRESULT hr = CIEHtmlDomNode::FindOrCreateFromDOMNode(domNode, &pNode); - if (FAILED(hr)) - return hr; - if (FAILED(pNode->QueryInterface(__uuidof(IHTMLDOMNode), (void**)node))) - return E_UNEXPECTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::get_nodeName(BSTR __RPC_FAR *p) -{ - if (!mDOMNode) return E_UNEXPECTED; - nsString szTagName; - HRESULT rc = mDOMNode->GetNodeName(szTagName); - USES_CONVERSION; - *p = SysAllocString(W2COLE(ToNewUnicode(szTagName))); - return rc; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::put_nodeValue(VARIANT p) -{ - if (!mDOMNode) return E_UNEXPECTED; - CComVariant vValue; - if (FAILED(vValue.ChangeType(VT_BSTR, &p))) { - return E_INVALIDARG; - } - nsString szValue(OLE2W(vValue.bstrVal)); - if (!mDOMNode->SetNodeValue(szValue)) - return E_FAIL; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::get_nodeValue(VARIANT __RPC_FAR *p) -{ - if (p == NULL) { - return E_INVALIDARG; - } - if (!mDOMNode) return E_UNEXPECTED; - nsString szValue; - nsresult nr = mDOMNode->GetNodeValue(szValue); - if (nr == NS_OK) { - USES_CONVERSION; - p->vt = VT_BSTR; - p->bstrVal = SysAllocString(W2COLE(ToNewUnicode(szValue))); - return S_OK; - } - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::get_firstChild(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p) - SIB_NODE_GET_ELEMENT(GetFirstChild,nsIDOMNode) - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::get_lastChild(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p) - SIB_NODE_GET_ELEMENT(GetLastChild,nsIDOMNode) - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::get_previousSibling(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlDomNode::get_nextSibling(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p) -{ - return E_NOTIMPL; -} diff --git a/embedding/browser/activex/src/common/IEHtmlNode.h b/embedding/browser/activex/src/common/IEHtmlNode.h deleted file mode 100644 index 827be1b8841..00000000000 --- a/embedding/browser/activex/src/common/IEHtmlNode.h +++ /dev/null @@ -1,194 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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): - * Adam Lock - * Alexandre Trémon - * - * 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 ***** */ -#ifndef IEHTMLNODE_H -#define IEHTMLNODE_H - - -#include "nsCOMPtr.h" -#include "nsIDOMNode.h" - -// NOTE: Nasty hack in case arcane SDK doesn't define IHTMLDOMNode -#ifndef __IHTMLDOMNode_INTERFACE_DEFINED__ -#define __IHTMLDOMNode_INTERFACE_DEFINED__ - MIDL_INTERFACE("3050f5da-98b5-11cf-bb82-00aa00bdce0b") - IHTMLDOMNode : public IDispatch - { - public: - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nodeType( - /* [out][retval] */ long *p) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_parentNode( - /* [out][retval] */ IHTMLDOMNode **p) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE hasChildNodes( - /* [out][retval] */ VARIANT_BOOL *fChildren) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_childNodes( - /* [out][retval] */ IDispatch **p) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_attributes( - /* [out][retval] */ IDispatch **p) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE insertBefore( - /* [in] */ IHTMLDOMNode *newChild, - /* [in][optional] */ VARIANT refChild, - /* [out][retval] */ IHTMLDOMNode **node) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE removeChild( - /* [in] */ IHTMLDOMNode *oldChild, - /* [out][retval] */ IHTMLDOMNode **node) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE replaceChild( - /* [in] */ IHTMLDOMNode *newChild, - /* [in] */ IHTMLDOMNode *oldChild, - /* [out][retval] */ IHTMLDOMNode **node) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE cloneNode( - /* [in] */ VARIANT_BOOL fDeep, - /* [out][retval] */ IHTMLDOMNode **clonedNode) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE removeNode( - /* [in][defaultvalue] */ VARIANT_BOOL fDeep, - /* [out][retval] */ IHTMLDOMNode **removed) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE swapNode( - /* [in] */ IHTMLDOMNode *otherNode, - /* [out][retval] */ IHTMLDOMNode **swappedNode) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE replaceNode( - /* [in] */ IHTMLDOMNode *replacement, - /* [out][retval] */ IHTMLDOMNode **replaced) = 0; - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE appendChild( - /* [in] */ IHTMLDOMNode *newChild, - /* [out][retval] */ IHTMLDOMNode **node) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nodeName( - /* [out][retval] */ BSTR *p) = 0; - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_nodeValue( - /* [in] */ VARIANT v) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nodeValue( - /* [out][retval] */ VARIANT *p) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_firstChild( - /* [out][retval] */ IHTMLDOMNode **p) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_lastChild( - /* [out][retval] */ IHTMLDOMNode **p) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_previousSibling( - /* [out][retval] */ IHTMLDOMNode **p) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nextSibling( - /* [out][retval] */ IHTMLDOMNode **p) = 0; - - }; -#endif - -class CNode : - public CComObjectRootEx -{ -protected: - CNode(); - virtual ~CNode(); - -public: - CNode *mParent; - nsCOMPtr mDOMNode; - - static HRESULT FindFromDOMNode(nsIDOMNode *pIDOMNode, CNode **pNode); - virtual HRESULT SetParent(CNode *pParent); - virtual HRESULT SetDOMNode(nsIDOMNode *pIDOMNode); -}; - -class CIEHtmlDomNode : - public CNode, - public IDispatchImpl -{ -public: - DECLARE_AGGREGATABLE(CIEHtmlDomNode) - CIEHtmlDomNode(); - - static HRESULT FindFromDOMNode(nsIDOMNode *pIDOMNode, IUnknown **pNode); - static HRESULT FindOrCreateFromDOMNode(nsIDOMNode *pIDOMNode, IUnknown **pNode); - static HRESULT CreateFromDOMNode(nsIDOMNode *pIDOMNode, IUnknown **pNode); - virtual HRESULT SetDOMNode(nsIDOMNode *pIDOMNode); - - DECLARE_GET_CONTROLLING_UNKNOWN() -protected: - virtual ~CIEHtmlDomNode(); - -public: - -BEGIN_COM_MAP(CIEHtmlDomNode) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IHTMLDOMNode) - //COM_INTERFACE_ENTRY_FUNC(IID_IHTMLElement, 0, QueryInterfaceOnNode) -END_COM_MAP() - - static HRESULT WINAPI QueryInterfaceOnNode(void* pv, REFIID riid, LPVOID* ppv, DWORD dw); - - //IID_IHTMLDOMNode - virtual HRESULT STDMETHODCALLTYPE get_nodeType(long __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_parentNode(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE hasChildNodes(VARIANT_BOOL __RPC_FAR *fChildren); - virtual HRESULT STDMETHODCALLTYPE get_childNodes(IDispatch __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_attributes(IDispatch __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE insertBefore(IHTMLDOMNode __RPC_FAR *newChild, VARIANT refChild, IHTMLDOMNode __RPC_FAR *__RPC_FAR *node); - virtual HRESULT STDMETHODCALLTYPE removeChild(IHTMLDOMNode __RPC_FAR *oldChild, IHTMLDOMNode __RPC_FAR *__RPC_FAR *node); - virtual HRESULT STDMETHODCALLTYPE replaceChild(IHTMLDOMNode __RPC_FAR *newChild, IHTMLDOMNode __RPC_FAR *oldChild, IHTMLDOMNode __RPC_FAR *__RPC_FAR *node); - virtual HRESULT STDMETHODCALLTYPE cloneNode(VARIANT_BOOL fDeep, IHTMLDOMNode __RPC_FAR *__RPC_FAR *clonedNode); - virtual HRESULT STDMETHODCALLTYPE removeNode(VARIANT_BOOL fDeep, IHTMLDOMNode __RPC_FAR *__RPC_FAR *removed); - virtual HRESULT STDMETHODCALLTYPE swapNode(IHTMLDOMNode __RPC_FAR *otherNode, IHTMLDOMNode __RPC_FAR *__RPC_FAR *swappedNode); - virtual HRESULT STDMETHODCALLTYPE replaceNode(IHTMLDOMNode __RPC_FAR *replacement, IHTMLDOMNode __RPC_FAR *__RPC_FAR *replaced); - virtual HRESULT STDMETHODCALLTYPE appendChild(IHTMLDOMNode __RPC_FAR *newChild, IHTMLDOMNode __RPC_FAR *__RPC_FAR *node); - virtual HRESULT STDMETHODCALLTYPE get_nodeName(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_nodeValue(VARIANT p); - virtual HRESULT STDMETHODCALLTYPE get_nodeValue(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_firstChild(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_lastChild(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_previousSibling(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_nextSibling(IHTMLDOMNode __RPC_FAR *__RPC_FAR *p); -}; - -typedef CComObject CIEHtmlDomNodeInstance; - -#endif diff --git a/embedding/browser/activex/src/common/IEHtmlSelectionObject.cpp b/embedding/browser/activex/src/common/IEHtmlSelectionObject.cpp deleted file mode 100644 index 4ee2a45a24c..00000000000 --- a/embedding/browser/activex/src/common/IEHtmlSelectionObject.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Alexandre Trémon - * - * 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 "stdafx.h" -#include "IEHtmlSelectionObject.h" -#include "IEHtmlTxtRange.h" - -CIEHtmlSelectionObject::CIEHtmlSelectionObject() -{ -} - -CIEHtmlSelectionObject::~CIEHtmlSelectionObject() -{ -} - -void CIEHtmlSelectionObject::SetSelection(nsISelection *pSelection) -{ - mSelection = pSelection; -} - -void CIEHtmlSelectionObject::SetDOMDocumentRange(nsIDOMDocumentRange *pDOMDocumentRange) { - mDOMDocumentRange = pDOMDocumentRange; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlSelectionObject::createRange(IDispatch __RPC_FAR *__RPC_FAR *range) -{ - if (range == NULL) - return E_INVALIDARG; - *range = NULL; - if (!mSelection) - return E_FAIL; - // get range corresponding to mSelection: - nsCOMPtr domRange; - int rc; - mSelection->GetRangeCount(&rc); - if (rc>0) - mSelection->GetRangeAt(0, getter_AddRefs(domRange)); - else - { - // create empty range - mDOMDocumentRange->CreateRange(getter_AddRefs(domRange)); - } - if (!domRange) - return E_FAIL; - // create com object: - CComBSTR strType; - get_type(&strType); - if (wcscmp(OLE2W(strType), L"Control") == 0) - { - // IHTMLControlRange: - CIEHtmlControlRangeInstance *pControlRange = NULL; - CIEHtmlControlRangeInstance::CreateInstance(&pControlRange); - if (!pControlRange) - return E_FAIL; - // gives the range to the com object: - pControlRange->SetRange(domRange); - // return com object: - pControlRange->QueryInterface(IID_IDispatch, (void **)range); - } else - { - // IHTMLTxtRange: - CIEHtmlTxtRangeInstance *pTxtRange = NULL; - CIEHtmlTxtRangeInstance::CreateInstance(&pTxtRange); - if (!pTxtRange) - return E_FAIL; - // gives the range to the com object: - pTxtRange->SetRange(domRange); - // return com object: - pTxtRange->QueryInterface(IID_IDispatch, (void **)range); - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlSelectionObject::get_type(BSTR __RPC_FAR *p) -{ - static NS_NAMED_LITERAL_STRING(strText,"Text"); - static NS_NAMED_LITERAL_STRING(strControl,"Control"); - static NS_NAMED_LITERAL_STRING(strNone,"None"); - nsCOMPtr domRange; - nsCOMPtr domNode; - - if (p == NULL) - return E_INVALIDARG; - *p = NULL; - - // get range corresponding to mSelection: - int rc; - mSelection->GetRangeCount(&rc); - if (rc<1) { - *p = SysAllocString(strNone.get()); - return p ? S_OK : E_OUTOFMEMORY; - } - mSelection->GetRangeAt(0, getter_AddRefs(domRange)); - if (!domRange) - return E_FAIL; - domRange->GetStartContainer(getter_AddRefs(domNode)); - if (!domNode) - return E_FAIL; - unsigned short nodeType; - domNode->GetNodeType(&nodeType); - switch (nodeType) - { - case nsIDOMNode::ELEMENT_NODE: - *p = SysAllocString(strControl.get()); - break; - case nsIDOMNode::TEXT_NODE: - *p = SysAllocString(strText.get()); - break; - default: - return E_UNEXPECTED; - } - return p ? S_OK : E_OUTOFMEMORY; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlSelectionObject::empty() -{ - if (!mSelection) - return E_FAIL; - mSelection->RemoveAllRanges(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlSelectionObject::clear() -{ - if (!mSelection) - return E_FAIL; - mSelection->DeleteFromDocument(); - return S_OK; -} - diff --git a/embedding/browser/activex/src/common/IEHtmlSelectionObject.h b/embedding/browser/activex/src/common/IEHtmlSelectionObject.h deleted file mode 100644 index af8984f910e..00000000000 --- a/embedding/browser/activex/src/common/IEHtmlSelectionObject.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Alexandre Trémon - * - * 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 ***** */ -#ifndef IEHTMLSELECTIONOBJECT_H -#define IEHTMLSELECTIONOBJECT_H - -#include "nsISelection.h" -#include "nsIDOMDocumentRange.h" - -class CIEHtmlSelectionObject : - public IDispatchImpl, - public CComObjectRootEx -{ -public: - CIEHtmlSelectionObject(); - -protected: - virtual ~CIEHtmlSelectionObject(); - -public: - void SetSelection(nsISelection *pSelection); - void SetDOMDocumentRange(nsIDOMDocumentRange *pDOMDocumentRange); - -BEGIN_COM_MAP(CIEHtmlSelectionObject) - COM_INTERFACE_ENTRY_IID(IID_IDispatch, IHTMLSelectionObject) - COM_INTERFACE_ENTRY(IHTMLSelectionObject) -END_COM_MAP() - - - // Implementation of IHTMLSelectionObject - virtual HRESULT STDMETHODCALLTYPE createRange(IDispatch __RPC_FAR *__RPC_FAR *range); - virtual HRESULT STDMETHODCALLTYPE empty(); - virtual HRESULT STDMETHODCALLTYPE clear(); - virtual HRESULT STDMETHODCALLTYPE get_type(BSTR __RPC_FAR *p); - -protected: - nsCOMPtr mSelection; - // IE does not return null range when selection is empty - // so this reference allows for creating an empty range : - nsCOMPtr mDOMDocumentRange; -}; - -#define CIEHTMLSELECTIONOBJECT_INTERFACES \ - COM_INTERFACE_ENTRY_IID(IID_IDispatch, IHTMLSelectionObject \ - COM_INTERFACE_ENTRY_IID(IID_IHTMLSelectionObject, IHTMLSelectionObject) - -typedef CComObject CIEHtmlSelectionObjectInstance; - -#endif //IEHTMLSELECTIONOBJECT_H \ No newline at end of file diff --git a/embedding/browser/activex/src/common/IEHtmlTxtRange.cpp b/embedding/browser/activex/src/common/IEHtmlTxtRange.cpp deleted file mode 100644 index 0ff7e5665d5..00000000000 --- a/embedding/browser/activex/src/common/IEHtmlTxtRange.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Alexandre Trémon - * - * 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 "stdafx.h" -#include "IEHtmlTxtRange.h" -#include "IEHtmlNode.h" -#include "IEHtmlElement.h" - -#include "nsIDomNsRange.h" -#include "nsIDOMDocumentFragment.h" - -CRange::CRange() -{ -} - -CRange::~CRange() -{ -} - -void CRange::SetRange(nsIDOMRange *pRange) -{ - mRange = pRange; -} - -HRESULT CRange::GetParentElement(IHTMLElement **ppParent) -{ - if (ppParent == NULL) - return E_INVALIDARG; - *ppParent = NULL; - // get common ancestor property: - nsCOMPtr domNode; - mRange->GetCommonAncestorContainer(getter_AddRefs(domNode)); - if (!domNode) - return S_OK; - nsCOMPtr domElement = do_QueryInterface(domNode); - if (!domElement) - { - // domNode can be a nsITextNode. In this case, its parent is a nsIDOMElement: - nsCOMPtr parentNode; - domNode->GetParentNode(getter_AddRefs(parentNode)); - domElement = do_QueryInterface(parentNode); - // Is a textrange always supposed to have a parentElement? Remove 2 lines if not: - if (!domElement) - return E_UNEXPECTED; - domNode = parentNode; - } - // get or create com object: - CComPtr pNode; - HRESULT hr = CIEHtmlDomNode::FindOrCreateFromDOMNode(domNode, &pNode); - if (FAILED(hr)) - return hr; - if (FAILED(pNode->QueryInterface(IID_IHTMLElement, (void **)ppParent))) - return E_UNEXPECTED; - - return S_OK; -} - -// CIEHtmlTxtRange - -CIEHtmlTxtRange::CIEHtmlTxtRange() -{ -} - -CIEHtmlTxtRange::~CIEHtmlTxtRange() -{ -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::pasteHTML(BSTR html) -{ - nsCOMPtr domDocFragment; - nsAutoString nsStrHtml(OLE2W(html)); - - if (NS_FAILED(mRange->DeleteContents())) - return E_FAIL; - nsCOMPtr domNSRange = do_QueryInterface(mRange); - if (!domNSRange) - return E_FAIL; - domNSRange->CreateContextualFragment(nsStrHtml, getter_AddRefs(domDocFragment)); - if (!domDocFragment) - return E_FAIL; - mRange->InsertNode(domDocFragment); - mRange->Detach(); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::get_text(BSTR __RPC_FAR *p) -{ - if (p == NULL) - return E_INVALIDARG; - *p = NULL; - - nsAutoString strText; - mRange->ToString(strText); - - *p = SysAllocString(strText.get()); - return *p ? S_OK : E_OUTOFMEMORY; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::parentElement(IHTMLElement __RPC_FAR *__RPC_FAR *Parent) -{ - return GetParentElement(Parent); -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::get_htmlText(BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::put_text(BSTR v) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::duplicate(IHTMLTxtRange __RPC_FAR *__RPC_FAR *Duplicate) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::inRange(IHTMLTxtRange __RPC_FAR *Range, VARIANT_BOOL __RPC_FAR *InRange) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::isEqual(IHTMLTxtRange __RPC_FAR *Range, VARIANT_BOOL __RPC_FAR *IsEqual) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::scrollIntoView(VARIANT_BOOL fStart/* = -1*/) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::collapse(VARIANT_BOOL Start/* = -1*/) -{ - nsresult rv = mRange->Collapse(Start?PR_TRUE:PR_FALSE); - return FAILED(rv)?E_FAIL:S_OK; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::expand(BSTR Unit,VARIANT_BOOL __RPC_FAR *Success) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::move(BSTR Unit, long Count, long __RPC_FAR *ActualCount) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::moveStart(BSTR Unit, long Count, long __RPC_FAR *ActualCount) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::moveEnd(BSTR Unit, long Count, long __RPC_FAR *ActualCount) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::select( void) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::moveToElementText(IHTMLElement __RPC_FAR *element) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::setEndPoint(BSTR how, IHTMLTxtRange __RPC_FAR *SourceRange) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::compareEndPoints(BSTR how, IHTMLTxtRange __RPC_FAR *SourceRange, long __RPC_FAR *ret) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::findText(BSTR String, long count, long Flags, VARIANT_BOOL __RPC_FAR *Success) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::moveToPoint(long x, long y) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::getBookmark(BSTR __RPC_FAR *Boolmark) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::moveToBookmark(BSTR Bookmark, VARIANT_BOOL __RPC_FAR *Success) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::queryCommandSupported(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::queryCommandEnabled(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::queryCommandState(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::queryCommandIndeterm(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::queryCommandText(BSTR cmdID, BSTR __RPC_FAR *pcmdText) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::queryCommandValue(BSTR cmdID, VARIANT __RPC_FAR *pcmdValue) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::execCommand(BSTR cmdID, VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlTxtRange::execCommandShowHelp(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - -// IHTMLControlRange - -CIEHtmlControlRange::CIEHtmlControlRange() -{ -} - -CIEHtmlControlRange::~CIEHtmlControlRange() -{ -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::commonParentElement(IHTMLElement __RPC_FAR *__RPC_FAR *parent) -{ - return GetParentElement(parent); -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::select( void) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::add(IHTMLControlElement __RPC_FAR *item) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::remove(long index) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::item(long index, IHTMLElement __RPC_FAR *__RPC_FAR *pdisp) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::scrollIntoView(VARIANT varargStart) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::queryCommandSupported(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::queryCommandEnabled(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::queryCommandState(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::queryCommandIndeterm(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::queryCommandText(BSTR cmdID, BSTR __RPC_FAR *pcmdText) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::queryCommandValue(BSTR cmdID, VARIANT __RPC_FAR *pcmdValue) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::execCommand(BSTR cmdID, VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::execCommandShowHelp(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CIEHtmlControlRange::get_length(long __RPC_FAR *p) -{ - return E_NOTIMPL; -} - diff --git a/embedding/browser/activex/src/common/IEHtmlTxtRange.h b/embedding/browser/activex/src/common/IEHtmlTxtRange.h deleted file mode 100644 index 09cc522b29f..00000000000 --- a/embedding/browser/activex/src/common/IEHtmlTxtRange.h +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Alexandre Trémon - * - * 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 ***** */ -#ifndef IEHTMLTXTRANGE_H -#define IEHTMLTXTRANGE_H - -#include "nsIDOMRange.h" - -class CRange : - public CComObjectRootEx -{ -public: - CRange(); - -protected: - virtual ~CRange(); - -public: - void SetRange(nsIDOMRange *pRange); - - virtual HRESULT GetParentElement(IHTMLElement **ppParent); - -protected: - nsCOMPtr mRange; -}; - -class CIEHtmlTxtRange : - public CRange, - public IDispatchImpl -{ -public: - CIEHtmlTxtRange(); - -protected: - virtual ~CIEHtmlTxtRange(); - -public: - -BEGIN_COM_MAP(CIEHtmlTxtRange) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IHTMLTxtRange) -END_COM_MAP() - - - // Implementation of IHTMLTxtRange - virtual HRESULT STDMETHODCALLTYPE pasteHTML(BSTR html); - virtual HRESULT STDMETHODCALLTYPE get_text(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE parentElement(IHTMLElement __RPC_FAR *__RPC_FAR *Parent); - // Not yet implemented - virtual HRESULT STDMETHODCALLTYPE get_htmlText(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_text(BSTR v); - virtual HRESULT STDMETHODCALLTYPE duplicate(IHTMLTxtRange __RPC_FAR *__RPC_FAR *Duplicate); - virtual HRESULT STDMETHODCALLTYPE inRange(IHTMLTxtRange __RPC_FAR *Range, VARIANT_BOOL __RPC_FAR *InRange); - virtual HRESULT STDMETHODCALLTYPE isEqual(IHTMLTxtRange __RPC_FAR *Range, VARIANT_BOOL __RPC_FAR *IsEqual); - virtual HRESULT STDMETHODCALLTYPE scrollIntoView(VARIANT_BOOL fStart = -1); - virtual HRESULT STDMETHODCALLTYPE collapse(VARIANT_BOOL Start = -1); - virtual HRESULT STDMETHODCALLTYPE expand(BSTR Unit,VARIANT_BOOL __RPC_FAR *Success); - virtual HRESULT STDMETHODCALLTYPE move(BSTR Unit, long Count, long __RPC_FAR *ActualCount); - virtual HRESULT STDMETHODCALLTYPE moveStart(BSTR Unit, long Count, long __RPC_FAR *ActualCount); - virtual HRESULT STDMETHODCALLTYPE moveEnd(BSTR Unit, long Count, long __RPC_FAR *ActualCount); - virtual HRESULT STDMETHODCALLTYPE select( void); - virtual HRESULT STDMETHODCALLTYPE moveToElementText(IHTMLElement __RPC_FAR *element); - virtual HRESULT STDMETHODCALLTYPE setEndPoint(BSTR how, IHTMLTxtRange __RPC_FAR *SourceRange); - virtual HRESULT STDMETHODCALLTYPE compareEndPoints(BSTR how, IHTMLTxtRange __RPC_FAR *SourceRange, long __RPC_FAR *ret); - virtual HRESULT STDMETHODCALLTYPE findText(BSTR String, long count, long Flags, VARIANT_BOOL __RPC_FAR *Success); - virtual HRESULT STDMETHODCALLTYPE moveToPoint(long x, long y); - virtual HRESULT STDMETHODCALLTYPE getBookmark(BSTR __RPC_FAR *Boolmark); - virtual HRESULT STDMETHODCALLTYPE moveToBookmark(BSTR Bookmark, VARIANT_BOOL __RPC_FAR *Success); - virtual HRESULT STDMETHODCALLTYPE queryCommandSupported(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE queryCommandEnabled(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE queryCommandState(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE queryCommandIndeterm(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE queryCommandText(BSTR cmdID, BSTR __RPC_FAR *pcmdText); - virtual HRESULT STDMETHODCALLTYPE queryCommandValue(BSTR cmdID, VARIANT __RPC_FAR *pcmdValue); - virtual HRESULT STDMETHODCALLTYPE execCommand(BSTR cmdID, VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE execCommandShowHelp(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); -}; - -#define CIEHTMLTXTRANGE_INTERFACES \ - COM_INTERFACE_ENTRY_IID(IID_IDispatch, IHTMLTxtRange \ - COM_INTERFACE_ENTRY_IID(IID_IHTMLTxtRange, IHTMLTxtRange) - -typedef CComObject CIEHtmlTxtRangeInstance; - -class CIEHtmlControlRange : - public CRange, - public IDispatchImpl -{ -public: - CIEHtmlControlRange(); - -protected: - virtual ~CIEHtmlControlRange(); - -public: - -BEGIN_COM_MAP(CIEHtmlControlRange) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IHTMLControlRange) -END_COM_MAP() - - // Implementation of IHTMLControlRange - virtual HRESULT STDMETHODCALLTYPE commonParentElement(IHTMLElement __RPC_FAR *__RPC_FAR *parent); - // Not yet implemented - virtual HRESULT STDMETHODCALLTYPE select( void); - virtual HRESULT STDMETHODCALLTYPE add(IHTMLControlElement __RPC_FAR *item); - virtual HRESULT STDMETHODCALLTYPE remove(long index); - virtual HRESULT STDMETHODCALLTYPE item(long index, IHTMLElement __RPC_FAR *__RPC_FAR *pdisp); - virtual HRESULT STDMETHODCALLTYPE scrollIntoView(VARIANT varargStart); - virtual HRESULT STDMETHODCALLTYPE queryCommandSupported(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE queryCommandEnabled(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE queryCommandState(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE queryCommandIndeterm(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE queryCommandText(BSTR cmdID, BSTR __RPC_FAR *pcmdText); - virtual HRESULT STDMETHODCALLTYPE queryCommandValue(BSTR cmdID, VARIANT __RPC_FAR *pcmdValue); - virtual HRESULT STDMETHODCALLTYPE execCommand(BSTR cmdID, VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE execCommandShowHelp(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE get_length(long __RPC_FAR *p); -}; - -typedef CComObject CIEHtmlControlRangeInstance; - -#endif //IEHTMLTXTRANGE_H \ No newline at end of file diff --git a/embedding/browser/activex/src/common/IHTMLLocationImpl.h b/embedding/browser/activex/src/common/IHTMLLocationImpl.h deleted file mode 100644 index 741dfc6613a..00000000000 --- a/embedding/browser/activex/src/common/IHTMLLocationImpl.h +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Adam Lock - * - * 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 ***** */ - -#ifndef IHTMLLOCATIONIMPL_H -#define IHTMLLOCATIONIMPL_H - -#include "nsIDOMLocation.h" - -#define IHTMLLOCATION_GET_IMPL(prop) \ - if (!p) return E_INVALIDARG; \ - nsCOMPtr location; \ - if (NS_FAILED(GetDOMLocation(getter_AddRefs(location))) || !location) \ - return E_UNEXPECTED; \ - nsAutoString value; \ - NS_ENSURE_SUCCESS(location->Get ## prop(value), E_UNEXPECTED); \ - *p = ::SysAllocString(value.get()); \ - return (*p) ? S_OK : E_OUTOFMEMORY; - -#define IHTMLLOCATION_PUT_IMPL(prop) \ - return E_NOTIMPL; // For now - -template -class IHTMLLocationImpl : - public IDispatchImpl -{ -protected: -// Methods to be implemented by the derived class - virtual nsresult GetDOMLocation(nsIDOMLocation **aLocation) = 0; -public: - -// IHTMLLocation - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_href( - /* [in] */ BSTR v) - { - IHTMLLOCATION_PUT_IMPL(Href); - } - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_href( - /* [out][retval] */ BSTR *p) - { - IHTMLLOCATION_GET_IMPL(Href); - } - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_protocol( - /* [in] */ BSTR v) - { - IHTMLLOCATION_PUT_IMPL(Protocol); - } - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_protocol( - /* [out][retval] */ BSTR *p) - { - IHTMLLOCATION_GET_IMPL(Protocol); - } - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_host( - /* [in] */ BSTR v) - { - IHTMLLOCATION_PUT_IMPL(Host); - } - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_host( - /* [out][retval] */ BSTR *p) - { - IHTMLLOCATION_GET_IMPL(Host); - } - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_hostname( - /* [in] */ BSTR v) - { - IHTMLLOCATION_PUT_IMPL(Hostname); - } - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_hostname( - /* [out][retval] */ BSTR *p) - { - IHTMLLOCATION_GET_IMPL(Hostname); - } - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_port( - /* [in] */ BSTR v) - { - IHTMLLOCATION_PUT_IMPL(Port); - } - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_port( - /* [out][retval] */ BSTR *p) - { - IHTMLLOCATION_GET_IMPL(Port); - } - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_pathname( - /* [in] */ BSTR v) - { - IHTMLLOCATION_PUT_IMPL(Pathname); - } - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_pathname( - /* [out][retval] */ BSTR *p) - { - IHTMLLOCATION_GET_IMPL(Pathname); - } - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_search( - /* [in] */ BSTR v) - { - IHTMLLOCATION_PUT_IMPL(Search); - } - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_search( - /* [out][retval] */ BSTR *p) - { - IHTMLLOCATION_GET_IMPL(Search); - } - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_hash( - /* [in] */ BSTR v) - { - IHTMLLOCATION_PUT_IMPL(Hash); - } - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_hash( - /* [out][retval] */ BSTR *p) - { - IHTMLLOCATION_GET_IMPL(Hash); - } - virtual /* [id] */ HRESULT STDMETHODCALLTYPE reload( - /* [in][defaultvalue] */ VARIANT_BOOL flag) - { - nsCOMPtr location; - if (NS_FAILED(GetDOMLocation(getter_AddRefs(location))) || !location) - return E_UNEXPECTED; - return NS_SUCCEEDED(location->Reload(flag)) ? S_OK : E_FAIL; - } - virtual /* [id] */ HRESULT STDMETHODCALLTYPE replace( - /* [in] */ BSTR bstr) - { - nsCOMPtr location; - if (NS_FAILED(GetDOMLocation(getter_AddRefs(location))) || !location) - return E_UNEXPECTED; - nsAutoString value(bstr); - return NS_SUCCEEDED(location->Replace(value)) ? S_OK : E_FAIL; - } - virtual /* [id] */ HRESULT STDMETHODCALLTYPE assign( - /* [in] */ BSTR bstr) - { - nsCOMPtr location; - if (NS_FAILED(GetDOMLocation(getter_AddRefs(location))) || !location) - return E_UNEXPECTED; - nsAutoString value(bstr); - return NS_SUCCEEDED(location->Assign(value)) ? S_OK : E_FAIL; - } - virtual /* [id] */ HRESULT STDMETHODCALLTYPE toString( - /* [out][retval] */ BSTR *string) - { - if (!string) return E_INVALIDARG; - nsCOMPtr location; - if (NS_FAILED(GetDOMLocation(getter_AddRefs(location))) || !location) - return E_UNEXPECTED; - nsAutoString value; - NS_ENSURE_SUCCESS(location->ToString(value), E_UNEXPECTED); - *string = ::SysAllocString(value.get()); - return (*string) ? S_OK : E_OUTOFMEMORY; - } -}; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/common/IOleCommandTargetImpl.h b/embedding/browser/activex/src/common/IOleCommandTargetImpl.h deleted file mode 100644 index f712572d0e9..00000000000 --- a/embedding/browser/activex/src/common/IOleCommandTargetImpl.h +++ /dev/null @@ -1,288 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Adam Lock - * - * 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 ***** */ -#ifndef IOLECOMMANDIMPL_H -#define IOLECOMMANDIMPL_H - -// Implementation of the IOleCommandTarget interface. The template is -// reasonably generic and reusable which is a good thing given how needlessly -// complicated this interface is. Blame Microsoft for that and not me. -// -// To use this class, derive your class from it like this: -// -// class CComMyClass : public IOleCommandTargetImpl -// { -// ... Ensure IOleCommandTarget is listed in the interface map ... -// BEGIN_COM_MAP(CComMyClass) -// COM_INTERFACE_ENTRY(IOleCommandTarget) -// // etc. -// END_COM_MAP() -// ... And then later on define the command target table ... -// BEGIN_OLECOMMAND_TABLE() -// OLECOMMAND_MESSAGE(OLECMDID_PRINT, NULL, ID_PRINT, L"Print", L"Print the page") -// OLECOMMAND_MESSAGE(OLECMDID_SAVEAS, NULL, 0, L"SaveAs", L"Save the page") -// OLECOMMAND_HANDLER(IDM_EDITMODE, &CGID_MSHTML, EditModeHandler, L"EditMode", L"Switch to edit mode") -// END_OLECOMMAND_TABLE() -// ... Now the window that OLECOMMAND_MESSAGE sends WM_COMMANDs to ... -// HWND GetCommandTargetWindow() const -// { -// return m_hWnd; -// } -// ... Now procedures that OLECOMMAND_HANDLER calls ... -// static HRESULT _stdcall EditModeHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); -// } -// -// The command table defines which commands the object supports. Commands are -// defined by a command id and a command group plus a WM_COMMAND id or procedure, -// and a verb and short description. -// -// Notice that there are two macros for handling Ole Commands. The first, -// OLECOMMAND_MESSAGE sends a WM_COMMAND message to the window returned from -// GetCommandTargetWindow() (that the derived class must implement if it uses -// this macro). -// -// The second, OLECOMMAND_HANDLER calls a static handler procedure that -// conforms to the OleCommandProc typedef. The first parameter, pThis means -// the static handler has access to the methods and variables in the class -// instance. -// -// The OLECOMMAND_HANDLER macro is generally more useful when a command -// takes parameters or needs to return a result to the caller. -// -template< class T > -class IOleCommandTargetImpl : public IOleCommandTarget -{ - struct OleExecData - { - const GUID *pguidCmdGroup; - DWORD nCmdID; - DWORD nCmdexecopt; - VARIANT *pvaIn; - VARIANT *pvaOut; - }; - -public: - typedef HRESULT (_stdcall *OleCommandProc)(T *pT, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); - - struct OleCommandInfo - { - ULONG nCmdID; - const GUID *pCmdGUID; - ULONG nWindowsCmdID; - OleCommandProc pfnCommandProc; - wchar_t *szVerbText; - wchar_t *szStatusText; - }; - - // Query the status of the specified commands (test if is it supported etc.) - virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID __RPC_FAR *pguidCmdGroup, ULONG cCmds, OLECMD __RPC_FAR prgCmds[], OLECMDTEXT __RPC_FAR *pCmdText) - { - T* pT = static_cast(this); - - if (prgCmds == NULL) - { - return E_INVALIDARG; - } - - OleCommandInfo *pCommands = pT->GetCommandTable(); - ATLASSERT(pCommands); - - BOOL bCmdGroupFound = FALSE; - BOOL bTextSet = FALSE; - - // Iterate through list of commands and flag them as supported/unsupported - for (ULONG nCmd = 0; nCmd < cCmds; nCmd++) - { - // Unsupported by default - prgCmds[nCmd].cmdf = 0; - - // Search the support command list - for (int nSupported = 0; pCommands[nSupported].pCmdGUID != &GUID_NULL; nSupported++) - { - OleCommandInfo *pCI = &pCommands[nSupported]; - - if (pguidCmdGroup && pCI->pCmdGUID && memcmp(pguidCmdGroup, pCI->pCmdGUID, sizeof(GUID)) == 0) - { - continue; - } - bCmdGroupFound = TRUE; - - if (pCI->nCmdID != prgCmds[nCmd].cmdID) - { - continue; - } - - // Command is supported so flag it and possibly enable it - prgCmds[nCmd].cmdf = OLECMDF_SUPPORTED; - if (pCI->nWindowsCmdID != 0) - { - prgCmds[nCmd].cmdf |= OLECMDF_ENABLED; - } - - // Copy the status/verb text for the first supported command only - if (!bTextSet && pCmdText) - { - // See what text the caller wants - wchar_t *pszTextToCopy = NULL; - if (pCmdText->cmdtextf & OLECMDTEXTF_NAME) - { - pszTextToCopy = pCI->szVerbText; - } - else if (pCmdText->cmdtextf & OLECMDTEXTF_STATUS) - { - pszTextToCopy = pCI->szStatusText; - } - - // Copy the text - pCmdText->cwActual = 0; - memset(pCmdText->rgwz, 0, pCmdText->cwBuf * sizeof(wchar_t)); - if (pszTextToCopy) - { - // Don't exceed the provided buffer size - size_t nTextLen = wcslen(pszTextToCopy); - if (nTextLen > pCmdText->cwBuf) - { - nTextLen = pCmdText->cwBuf; - } - - wcsncpy(pCmdText->rgwz, pszTextToCopy, nTextLen); - pCmdText->cwActual = nTextLen; - } - - bTextSet = TRUE; - } - break; - } - } - - // Was the command group found? - if (!bCmdGroupFound) - { - OLECMDERR_E_UNKNOWNGROUP; - } - - return S_OK; - } - - - // Execute the specified command - virtual HRESULT STDMETHODCALLTYPE Exec(const GUID __RPC_FAR *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT __RPC_FAR *pvaIn, VARIANT __RPC_FAR *pvaOut) - { - T* pT = static_cast(this); - BOOL bCmdGroupFound = FALSE; - - OleCommandInfo *pCommands = pT->GetCommandTable(); - ATLASSERT(pCommands); - - // Search the support command list - for (int nSupported = 0; pCommands[nSupported].pCmdGUID != &GUID_NULL; nSupported++) - { - OleCommandInfo *pCI = &pCommands[nSupported]; - - if (pguidCmdGroup && pCI->pCmdGUID && memcmp(pguidCmdGroup, pCI->pCmdGUID, sizeof(GUID)) == 0) - { - continue; - } - bCmdGroupFound = TRUE; - - if (pCI->nCmdID != nCmdID) - { - continue; - } - - // Send ourselves a WM_COMMAND windows message with the associated - // identifier and exec data - OleExecData cData; - cData.pguidCmdGroup = pguidCmdGroup; - cData.nCmdID = nCmdID; - cData.nCmdexecopt = nCmdexecopt; - cData.pvaIn = pvaIn; - cData.pvaOut = pvaOut; - - if (pCI->pfnCommandProc) - { - pCI->pfnCommandProc(pT, pCI->pCmdGUID, pCI->nCmdID, nCmdexecopt, pvaIn, pvaOut); - } - else if (pCI->nWindowsCmdID != 0 && nCmdexecopt != OLECMDEXECOPT_SHOWHELP) - { - HWND hwndTarget = pT->GetCommandTargetWindow(); - if (hwndTarget) - { - ::SendMessage(hwndTarget, WM_COMMAND, LOWORD(pCI->nWindowsCmdID), (LPARAM) &cData); - } - } - else - { - // Command supported but not implemented - continue; - } - - return S_OK; - } - - // Was the command group found? - if (!bCmdGroupFound) - { - OLECMDERR_E_UNKNOWNGROUP; - } - - return OLECMDERR_E_NOTSUPPORTED; - } -}; - -// Macros to be placed in any class derived from the IOleCommandTargetImpl -// class. These define what commands are exposed from the object. - -#define BEGIN_OLECOMMAND_TABLE() \ - OleCommandInfo *GetCommandTable() \ - { \ - static OleCommandInfo s_aSupportedCommands[] = \ - { - -#define OLECOMMAND_MESSAGE(id, group, cmd, verb, desc) \ - { id, group, cmd, NULL, verb, desc }, - -#define OLECOMMAND_HANDLER(id, group, handler, verb, desc) \ - { id, group, 0, handler, verb, desc }, - -#define END_OLECOMMAND_TABLE() \ - { 0, &GUID_NULL, 0, NULL, NULL, NULL } \ - }; \ - return s_aSupportedCommands; \ - }; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/common/IWebBrowserImpl.h b/embedding/browser/activex/src/common/IWebBrowserImpl.h deleted file mode 100644 index e6227bb97e2..00000000000 --- a/embedding/browser/activex/src/common/IWebBrowserImpl.h +++ /dev/null @@ -1,1189 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Adam Lock - * - * 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 ***** */ - -#ifndef IWEBBROWSERIMPL_H -#define IWEBBROWSERIMPL_H - -#include - -/* this is all kinds of awesome; SHANDLE_PTR is in some basetsd.h but not others */ -typedef long SHANDLE_PTR; - -#include "nsIWebNavigation.h" -#include "nsIPrefBranch.h" -#include "nsIPrefLocalizedString.h" -#include "nsIDOMWindow.h" -#include "nsIBaseWindow.h" -#include "nsIWindowWatcher.h" -#include "nsIInputStream.h" -#include "nsIStringStream.h" -#include "nsIURI.h" -#include "nsComponentManagerUtils.h" -#include "nsServiceManagerUtils.h" - -#include "PropertyList.h" - -// CPMozillaControl.h was autogenerated by the ATL proxy wizard so don't edit it! -#include "CPMozillaControl.h" - -#define ENSURE_BROWSER_IS_VALID() \ - if (!BrowserIsValid()) \ - { \ - NS_ERROR("Browser is not valid"); \ - return SetErrorInfo(E_UNEXPECTED, L"Browser is not in a valid state"); \ - } - -#define ENSURE_GET_WEBNAV() \ - nsCOMPtr webNav; \ - nsresult rv = GetWebNavigation(getter_AddRefs(webNav)); \ - if (NS_FAILED(rv)) \ - { \ - NS_ERROR("Cannot get nsIWebNavigation"); \ - return SetErrorInfo(E_UNEXPECTED, L"Could not obtain nsIWebNavigation interface"); \ - } - -template -class IWebBrowserImpl : - public CStockPropImpl, - public CProxyDWebBrowserEvents, - public CProxyDWebBrowserEvents2 -{ -public: - IWebBrowserImpl() - { - // Ready state of control - mBrowserReadyState = READYSTATE_UNINITIALIZED; - // Flag indicates if the browser is busy - mBusyFlag = PR_FALSE; - } - -public: -// Methods to be implemented by the derived class - // Return the nsIWebNavigation object - virtual nsresult GetWebNavigation(nsIWebNavigation **aWebNav) = 0; - // Return the nsIDOMWindow object - virtual nsresult GetDOMWindow(nsIDOMWindow **aDOMWindow) = 0; - // Return the nsIPrefBranch object - virtual nsresult GetPrefs(nsIPrefBranch **aPrefBranch) = 0; - // Return the valid state of the browser - virtual PRBool BrowserIsValid() = 0; - -public: -// Properties related to this interface - // Post data from last navigate operation - CComVariant mLastPostData; - // Ready status of the browser - READYSTATE mBrowserReadyState; - // Controls starts off unbusy - PRBool mBusyFlag; - // Property list - PropertyList mPropertyList; - -// Helper methods - - // - // Sets error information for VB programmers and the like who want to know why - // some method call failed. - // - virtual HRESULT SetErrorInfo(HRESULT hr, LPCOLESTR lpszDesc = NULL) - { - if (lpszDesc == NULL) - { - // Fill in a few generic descriptions - switch (hr) - { - case E_UNEXPECTED: - lpszDesc = L"Method was called while control was uninitialized"; - break; - case E_INVALIDARG: - lpszDesc = L"Method was called with an invalid parameter"; - break; - } - } - AtlSetErrorInfo(*pclsid, lpszDesc, 0, NULL, GUID_NULL, hr, NULL); - return hr; - } - - -// IWebBrowser implementation - virtual HRESULT STDMETHODCALLTYPE GoBack(void) - { - ATLTRACE(_T("IWebBrowserImpl::GoBack()\n")); - ENSURE_BROWSER_IS_VALID(); - ENSURE_GET_WEBNAV(); - - PRBool aCanGoBack = PR_FALSE; - webNav->GetCanGoBack(&aCanGoBack); - if (aCanGoBack) - { - webNav->GoBack(); - } - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE GoForward(void) - { - ATLTRACE(_T("IWebBrowserImpl::GoBack()\n")); - ENSURE_BROWSER_IS_VALID(); - ENSURE_GET_WEBNAV(); - - PRBool aCanGoForward = PR_FALSE; - webNav->GetCanGoForward(&aCanGoForward); - if (aCanGoForward) - { - webNav->GoForward(); - } - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE GoHome(void) - { - ATLTRACE(_T("IWebBrowserImpl::GoHome()\n")); - ENSURE_BROWSER_IS_VALID(); - - CComBSTR bstrUrl(L"http://home.netscape.com/"); - - // Find the home page stored in prefs - nsCOMPtr prefBranch; - if (NS_SUCCEEDED(GetPrefs(getter_AddRefs(prefBranch)))) - { - nsCOMPtr homePage; - prefBranch->GetComplexValue("browser.startup.homepage", - NS_GET_IID(nsIPrefLocalizedString), - getter_AddRefs(homePage)); - - if (homePage) - { - nsString homePageString; - nsresult rv = homePage->ToString(getter_Copies(homePageString)); - if (NS_SUCCEEDED(rv)) - { - bstrUrl = homePageString.get(); - } - } - } - - // Navigate to the home page - Navigate(bstrUrl, NULL, NULL, NULL, NULL); - - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE GoSearch(void) - { - ATLTRACE(_T("IWebBrowserImpl::GoSearch()\n")); - ENSURE_BROWSER_IS_VALID(); - - CComBSTR bstrUrl(L"http://search.netscape.com/"); - - //NOTE: This code has not been implemented yet -#if 0 - // Find the home page stored in prefs - nsCOMPtr prefBranch; - if (NS_SUCCEEDED(GetPrefs(getter_AddRefs(prefBranch)))) - { - // TODO find and navigate to the search page stored in prefs - // and not this hard coded address - } -#endif - // Navigate to the search page - Navigate(bstrUrl, NULL, NULL, NULL, NULL); - - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE Navigate(BSTR URL, VARIANT __RPC_FAR *Flags, VARIANT __RPC_FAR *TargetFrameName, VARIANT __RPC_FAR *PostData, VARIANT __RPC_FAR *Headers) - { - ATLTRACE(_T("IWebBrowserImpl::Navigate()\n")); - ENSURE_BROWSER_IS_VALID(); - - nsresult rv; - - // Extract the URL parameter - if (URL == NULL) - { - NS_ERROR("No URL supplied"); - return SetErrorInfo(E_INVALIDARG); - } - - PRBool openInNewWindow = PR_FALSE; - PRUint32 loadFlags = nsIWebNavigation::LOAD_FLAGS_NONE; - - // Extract the navigate flags parameter - LONG lFlags = 0; - if (Flags && - Flags->vt != VT_ERROR && - Flags->vt != VT_EMPTY && - Flags->vt != VT_NULL) - { - CComVariant vFlags; - if ( vFlags.ChangeType(VT_I4, Flags) != S_OK ) - { - NS_ERROR("Flags param is invalid"); - return SetErrorInfo(E_INVALIDARG); - } - lFlags = vFlags.lVal; - } - if (lFlags & navOpenInNewWindow) - { - openInNewWindow = PR_TRUE; - } - if (lFlags & navNoHistory) - { - // Disable history - loadFlags |= nsIWebNavigation::LOAD_FLAGS_BYPASS_HISTORY; - } - if (lFlags & navNoReadFromCache) - { - // Disable read from cache - loadFlags |= nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE; - - } - if (lFlags & navNoWriteToCache) - { - // Disable write to cache - loadFlags |= nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE; - } - - // Extract the target frame parameter - nsCOMPtr targetNav; - if (TargetFrameName && - TargetFrameName->vt == VT_BSTR && - TargetFrameName->bstrVal) - { - // Search for the named frame - nsCOMPtr window; - GetDOMWindow(getter_AddRefs(window)); - if (window) - { - nsCOMPtr windowWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID); - if (windowWatcher) - { - nsCOMPtr targetWindow; - windowWatcher->GetWindowByName(TargetFrameName->bstrVal, window, - getter_AddRefs(targetWindow)); - if (targetWindow) - { - targetNav = do_GetInterface(targetWindow); - } - } - } - // No target nav? Open in new window - if (!targetNav) - openInNewWindow = PR_TRUE; - } - - // Open in new window - if (openInNewWindow) - { - CComQIPtr spDispNew; - VARIANT_BOOL bCancel = VARIANT_FALSE; - - // Test if the event sink can give us a new window to navigate into - Fire_NewWindow2(&spDispNew, &bCancel); - - lFlags &= ~(navOpenInNewWindow); - if ((bCancel == VARIANT_FALSE) && spDispNew) - { - CComQIPtr spOther = spDispNew; - if (spOther) - { - CComVariant vURL(URL); - CComVariant vFlags(lFlags); - return spOther->Navigate2(&vURL, &vFlags, TargetFrameName, PostData, Headers); - } - } - - // NOTE: The IE control will launch an instance of iexplore.exe and - // return an interface to that if the client does not respond to - // FireNewWindow2, but the Mozilla control will not. Potentially - // it could also open an instance of IE for such occasions. - // - - // Can't open a new window without client support - return S_OK; - } - - // As documented in MSDN: - // - // The post data specified by PostData is passed as a SAFEARRAY - // structure. The variant should be of type VT_ARRAY and point to - // a SAFEARRAY. The SAFEARRAY should be of element type VT_UI1, - // dimension one, and have an element count equal to the number of - // bytes of post data. - - // Extract the post data parameter - nsCOMPtr postDataStream; - mLastPostData.Clear(); - if (PostData && - PostData->vt == (VT_ARRAY | VT_UI1) && - PostData->parray) - { - mLastPostData.Copy(PostData); - - unsigned long nSizeData = PostData->parray->rgsabound[0].cElements; - if (nSizeData > 0) - { - char szCL[64]; - sprintf(szCL, "Content-Length: %lu\r\n\r\n", nSizeData); - unsigned long nSizeCL = strlen(szCL); - unsigned long nSize = nSizeCL + nSizeData; - - char *tmp = (char *) nsMemory::Alloc(nSize + 1); // byte stream owns this mem - if (tmp) - { - - // Copy the array data into a buffer - SafeArrayLock(PostData->parray); - memcpy(tmp, szCL, nSizeCL); - memcpy(tmp + nSizeCL, PostData->parray->pvData, nSizeData); - tmp[nSize] = '\0'; - SafeArrayUnlock(PostData->parray); - - // Create a byte array input stream object. - nsCOMPtr stream - (do_CreateInstance("@mozilla.org/io/string-input-stream;1")); - rv = stream->AdoptData(tmp, nSize); - if (NS_FAILED(rv) || !stream) - { - NS_ERROR("cannot create byte stream"); - nsMemory::Free(tmp); - return SetErrorInfo(E_UNEXPECTED); - } - - postDataStream = stream; - } - } - } - - // Extract the headers parameter - nsCOMPtr headersStream; - if (Headers && - Headers->vt == VT_BSTR && - Headers->bstrVal) - { - - USES_CONVERSION; - char *headers = OLE2A(Headers->bstrVal); - if (headers) - { - size_t nSize = SysStringLen(Headers->bstrVal) + 1; - char *tmp = (char *) nsMemory::Alloc(nSize); // byteArray stream owns this mem - if (tmp) - { - // Copy BSTR to buffer - WideCharToMultiByte(CP_ACP, 0, Headers->bstrVal, nSize - 1, tmp, nSize, NULL, NULL); - tmp[nSize - 1] = '\0'; - - // Create a byte array input stream object which will own the buffer - headersStream = do_CreateInstance("@mozilla.org/io/string-input-stream;1"); - if (headersStream) - rv = headersStream->AdoptData(tmp, nSize); - - if (NS_FAILED(rv) || !headersStream) - { - NS_ERROR("cannot create byte stream"); - nsMemory::Free(tmp); - } - } - } - } - - // Use the specified target or the top level web navigation - nsCOMPtr webNavToUse; - if (targetNav) - { - webNavToUse = targetNav; - } - else - { - GetWebNavigation(getter_AddRefs(webNavToUse)); - } - - // Load the URL - rv = NS_ERROR_FAILURE; - if (webNavToUse) - { - rv = webNavToUse->LoadURI(URL, - loadFlags, nsnull, postDataStream, headersStream); - } - - return NS_SUCCEEDED(rv) ? S_OK : E_FAIL; - } - - virtual HRESULT STDMETHODCALLTYPE Refresh(void) - { - ATLTRACE(_T("IWebBrowserImpl::Refresh()\n")); - // Reload the page - CComVariant vRefreshType(REFRESH_NORMAL); - return Refresh2(&vRefreshType); - } - - virtual HRESULT STDMETHODCALLTYPE Refresh2(VARIANT __RPC_FAR *Level) - { - ATLTRACE(_T("IWebBrowserImpl::Refresh2()\n")); - - ENSURE_BROWSER_IS_VALID(); - ENSURE_GET_WEBNAV(); - if (Level == NULL) - return E_INVALIDARG; - - // Check the requested refresh type - OLECMDID_REFRESHFLAG iRefreshLevel = OLECMDIDF_REFRESH_NORMAL; - CComVariant vLevelAsInt; - if ( vLevelAsInt.ChangeType(VT_I4, Level) != S_OK ) - { - NS_ERROR("Cannot change refresh type to int"); - return SetErrorInfo(E_UNEXPECTED); - } - iRefreshLevel = (OLECMDID_REFRESHFLAG) vLevelAsInt.iVal; - - // Turn the IE refresh type into the nearest NG equivalent - PRUint32 flags = nsIWebNavigation::LOAD_FLAGS_NONE; - switch (iRefreshLevel & OLECMDIDF_REFRESH_LEVELMASK) - { - case OLECMDIDF_REFRESH_NORMAL: - case OLECMDIDF_REFRESH_IFEXPIRED: - case OLECMDIDF_REFRESH_CONTINUE: - case OLECMDIDF_REFRESH_NO_CACHE: - case OLECMDIDF_REFRESH_RELOAD: - flags = nsIWebNavigation::LOAD_FLAGS_NONE; - break; - case OLECMDIDF_REFRESH_COMPLETELY: - flags = nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE | nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY; - break; - default: - // No idea what refresh type this is supposed to be - NS_ERROR("Unknown refresh type"); - return SetErrorInfo(E_UNEXPECTED); - } - - webNav->Reload(flags); - - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE Stop(void) - { - ATLTRACE(_T("IWebBrowserImpl::Stop()\n")); - ENSURE_BROWSER_IS_VALID(); - ENSURE_GET_WEBNAV(); - webNav->Stop(nsIWebNavigation::STOP_ALL); - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE get_Application(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) - { - ATLTRACE(_T("IWebBrowserImpl::get_Application()\n")); - ENSURE_BROWSER_IS_VALID(); - if (!ppDisp) - { - return SetErrorInfo(E_INVALIDARG); - } - // Return a pointer to this controls dispatch interface - *ppDisp = (IDispatch *) this; - (*ppDisp)->AddRef(); - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE get_Parent(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) - { - // TODO - return E_NOTIMPL; - } - virtual HRESULT STDMETHODCALLTYPE get_Container(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) - { - ATLTRACE(_T("IWebBrowserImpl::get_Container()\n")); - ENSURE_BROWSER_IS_VALID(); - if (!ppDisp) - { - return SetErrorInfo(E_INVALIDARG); - } - //TODO: Implement get_Container: Retrieve a pointer to the IDispatch interface of the container. - *ppDisp = NULL; - return SetErrorInfo(E_UNEXPECTED); - } - virtual HRESULT STDMETHODCALLTYPE get_Document(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) - { - ATLTRACE(_T("IWebBrowserImpl::get_Document()\n")); - ENSURE_BROWSER_IS_VALID(); - if (!ppDisp) - { - return SetErrorInfo(E_INVALIDARG); - } - *ppDisp = NULL; - return E_NOTIMPL; - } - virtual HRESULT STDMETHODCALLTYPE get_TopLevelContainer(VARIANT_BOOL __RPC_FAR *pBool) - { - ATLTRACE(_T("IWebBrowserImpl::get_TopLevelContainer()\n")); - ENSURE_BROWSER_IS_VALID(); - if (!pBool) - { - return SetErrorInfo(E_INVALIDARG); - } - //TODO: Implement get_TopLevelContainer - *pBool = VARIANT_TRUE; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_Type(BSTR __RPC_FAR *Type) - { - ATLTRACE(_T("IWebBrowserImpl::get_Type()\n")); - ENSURE_BROWSER_IS_VALID(); - - //NOTE: This code should work in theory, but can't be verified because GetDoctype - // has not been implemented yet. -#if 0 - nsIDOMDocument *pIDOMDocument = nsnull; - if ( SUCCEEDED(GetDOMDocument(&pIDOMDocument)) ) - { - nsIDOMDocumentType *pIDOMDocumentType = nsnull; - if ( SUCCEEDED(pIDOMDocument->GetDoctype(&pIDOMDocumentType)) ) - { - nsAutoString docName; - pIDOMDocumentType->GetName(docName); - //NG_TRACE("pIDOMDocumentType returns: %s", docName); - //Still need to manipulate docName so that it goes into *Type param of this function. - } - } -#endif - //TODO: Implement get_Type - return SetErrorInfo(E_FAIL, L"get_Type: failed"); - } - - virtual HRESULT STDMETHODCALLTYPE get_Left(long __RPC_FAR *pl) - { - ATLTRACE(_T("IWebBrowserImpl::get_Left()\n")); - ENSURE_BROWSER_IS_VALID(); - if (pl == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - - //TODO: Implement get_Left - Should return the left position of this control. - *pl = 0; - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE put_Left(long Left) - { - ATLTRACE(_T("IWebBrowserImpl::put_Left()\n")); - ENSURE_BROWSER_IS_VALID(); - //TODO: Implement put_Left - Should set the left position of this control. - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE get_Top(long __RPC_FAR *pl) - { - ATLTRACE(_T("IWebBrowserImpl::get_Top()\n")); - ENSURE_BROWSER_IS_VALID(); - if (pl == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - //TODO: Implement get_Top - Should return the top position of this control. - *pl = 0; - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE put_Top(long Top) - { - ATLTRACE(_T("IWebBrowserImpl::put_Top()\n")); - ENSURE_BROWSER_IS_VALID(); - //TODO: Implement set_Top - Should set the top position of this control. - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE get_Width(long __RPC_FAR *pl) - { - ATLTRACE(_T("IWebBrowserImpl::get_Width()\n")); - ENSURE_BROWSER_IS_VALID(); - //TODO: Implement get_Width- Should return the width of this control. - if (pl == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - *pl = 0; - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE put_Width(long Width) - { - ATLTRACE(_T("IWebBrowserImpl::put_Width()\n")); - ENSURE_BROWSER_IS_VALID(); - //TODO: Implement put_Width - Should set the width of this control. - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE get_Height(long __RPC_FAR *pl) - { - ATLTRACE(_T("IWebBrowserImpl::get_Height()\n")); - ENSURE_BROWSER_IS_VALID(); - if (pl == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - - //TODO: Implement get_Height - Should return the hieght of this control. - *pl = 0; - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE put_Height(long Height) - { - ATLTRACE(_T("IWebBrowserImpl::put_Height()\n")); - ENSURE_BROWSER_IS_VALID(); - //TODO: Implement put_Height - Should set the height of this control. - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_LocationName(BSTR __RPC_FAR *LocationName) - { - ATLTRACE(_T("IWebBrowserImpl::get_LocationName()\n")); - ENSURE_BROWSER_IS_VALID(); - if (LocationName == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - // Get the url from the web shell - nsString szLocationName; - ENSURE_GET_WEBNAV(); - nsCOMPtr baseWindow = do_QueryInterface(webNav); - baseWindow->GetTitle(getter_Copies(szLocationName)); - if (!szLocationName.get()) - { - return SetErrorInfo(E_UNEXPECTED); - } - - // Convert the string to a BSTR - USES_CONVERSION; - LPCOLESTR pszConvertedLocationName = W2COLE(szLocationName.get()); - *LocationName = SysAllocString(pszConvertedLocationName); - - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_LocationURL(BSTR __RPC_FAR *LocationURL) - { - ATLTRACE(_T("IWebBrowserImpl::get_LocationURL()\n")); - ENSURE_BROWSER_IS_VALID(); - - if (LocationURL == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - nsCOMPtr uri; - // Get the current url from the browser - nsCOMPtr webNav; - GetWebNavigation(getter_AddRefs(webNav)); - if (webNav) - { - webNav->GetCurrentURI(getter_AddRefs(uri)); - } - if (uri) - { - USES_CONVERSION; - nsCAutoString aURI; - uri->GetAsciiSpec(aURI); - *LocationURL = SysAllocString(A2OLE(aURI.get())); - } - else - { - *LocationURL = NULL; - } - - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_Busy(VARIANT_BOOL __RPC_FAR *pBool) - { - ATLTRACE(_T("IWebBrowserImpl::get_Busy()\n")); - ENSURE_BROWSER_IS_VALID(); - if (!pBool) - { - return SetErrorInfo(E_INVALIDARG); - } - *pBool = (mBusyFlag) ? VARIANT_TRUE : VARIANT_FALSE; - return S_OK; - } - -// IWebBrowserApp implementation - virtual HRESULT STDMETHODCALLTYPE Quit(void) - { - ATLTRACE(_T("IWebBrowserImpl::Quit()\n")); - ENSURE_BROWSER_IS_VALID(); - - //This generates an exception in the IE control. - // TODO fire quit event - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE ClientToWindow(int __RPC_FAR *pcx, int __RPC_FAR *pcy) - { - ATLTRACE(_T("IWebBrowserImpl::ClientToWindow()\n")); - ENSURE_BROWSER_IS_VALID(); - - //This generates an exception in the IE control. - // TODO convert points to be relative to browser - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE PutProperty(BSTR Property, VARIANT vtValue) - { - ATLTRACE(_T("IWebBrowserImpl::PutProperty()\n")); - ENSURE_BROWSER_IS_VALID(); - if (Property == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - mPropertyList.AddOrReplaceNamedProperty(Property, vtValue); - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE GetProperty(BSTR Property, VARIANT __RPC_FAR *pvtValue) - { - ATLTRACE(_T("IWebBrowserImpl::GetProperty()\n")); - ENSURE_BROWSER_IS_VALID(); - if (Property == NULL || pvtValue == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - VariantInit(pvtValue); - for (unsigned long i = 0; i < mPropertyList.GetSize(); i++) - { - if (wcsicmp(mPropertyList.GetNameOf(i), Property) == 0) - { - // Copy the new value - VariantCopy(pvtValue, const_cast(mPropertyList.GetValueOf(i))); - return S_OK; - } - } - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_Name(BSTR __RPC_FAR *Name) - { - ATLTRACE(_T("IWebBrowserImpl::get_Name()\n")); - ENSURE_BROWSER_IS_VALID(); - if (Name == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - - // TODO: Implement get_Name (get Mozilla's executable name) - *Name = SysAllocString(L"Mozilla Web Browser Control"); - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_HWND(SHANDLE_PTR __RPC_FAR *pHWND) - { - ATLTRACE(_T("IWebBrowserImpl::get_HWND()\n")); - ENSURE_BROWSER_IS_VALID(); - if (pHWND == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - - //This is supposed to return a handle to the IE main window. Since that doesn't exist - //in the control's case, this shouldn't do anything. - *pHWND = NULL; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_FullName(BSTR __RPC_FAR *FullName) - { - ATLTRACE(_T("IWebBrowserImpl::get_FullName()\n")); - ENSURE_BROWSER_IS_VALID(); - if (FullName == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - - // TODO: Implement get_FullName (Return the full path of the executable containing this control) - *FullName = SysAllocString(L""); // TODO get Mozilla's executable name - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_Path(BSTR __RPC_FAR *Path) - { - ATLTRACE(_T("IWebBrowserImpl::get_Path()\n")); - ENSURE_BROWSER_IS_VALID(); - - if (Path == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - - // TODO: Implement get_Path (get Mozilla's path) - *Path = SysAllocString(L""); - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_Visible(VARIANT_BOOL __RPC_FAR *pBool) - { - ATLTRACE(_T("IWebBrowserImpl::get_Visible()\n")); - ENSURE_BROWSER_IS_VALID(); - - if (pBool == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - - //TODO: Implement get_Visible? - *pBool = VARIANT_TRUE; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE put_Visible(VARIANT_BOOL Value) - { - ATLTRACE(_T("IWebBrowserImpl::put_Visible()\n")); - ENSURE_BROWSER_IS_VALID(); - - //TODO: Implement put_Visible? - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_StatusBar(VARIANT_BOOL __RPC_FAR *pBool) - { - ATLTRACE(_T("IWebBrowserImpl::get_StatusBar()\n")); - ENSURE_BROWSER_IS_VALID(); - if (pBool == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - //There is no StatusBar in this control. - *pBool = VARIANT_FALSE; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE put_StatusBar(VARIANT_BOOL Value) - { - ATLTRACE(_T("IWebBrowserImpl::put_StatusBar()\n")); - ENSURE_BROWSER_IS_VALID(); - //There is no StatusBar in this control. - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_StatusText(BSTR __RPC_FAR *StatusText) - { - ATLTRACE(_T("IWebBrowserImpl::get_StatusText()\n")); - ENSURE_BROWSER_IS_VALID(); - if (StatusText == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - - //TODO: Implement get_StatusText - //NOTE: This function is related to the MS status bar which doesn't exist in this control. Needs more - // investigation, but probably doesn't apply. - *StatusText = SysAllocString(L""); - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE put_StatusText(BSTR StatusText) - { - ATLTRACE(_T("IWebBrowserImpl::put_StatusText()\n")); - ENSURE_BROWSER_IS_VALID(); - //TODO: Implement put_StatusText - //NOTE: This function is related to the MS status bar which doesn't exist in this control. Needs more - // investigation, but probably doesn't apply. - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_ToolBar(int __RPC_FAR *Value) - { - ATLTRACE(_T("IWebBrowserImpl::get_ToolBar()\n")); - ENSURE_BROWSER_IS_VALID(); - if (Value == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - - //There is no ToolBar in this control. - *Value = FALSE; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE put_ToolBar(int Value) - { - ATLTRACE(_T("IWebBrowserImpl::put_ToolBar()\n")); - ENSURE_BROWSER_IS_VALID(); - //There is no ToolBar in this control. - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_MenuBar(VARIANT_BOOL __RPC_FAR *Value) - { - ATLTRACE(_T("IWebBrowserImpl::get_MenuBar()\n")); - ENSURE_BROWSER_IS_VALID(); - if (Value == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - - //There is no MenuBar in this control. - *Value = VARIANT_FALSE; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE put_MenuBar(VARIANT_BOOL Value) - { - ATLTRACE(_T("IWebBrowserImpl::put_MenuBar()\n")); - ENSURE_BROWSER_IS_VALID(); - //There is no MenuBar in this control. - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_FullScreen(VARIANT_BOOL __RPC_FAR *pbFullScreen) - { - ATLTRACE(_T("IWebBrowserImpl::get_FullScreen()\n")); - ENSURE_BROWSER_IS_VALID(); - if (pbFullScreen == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - - //FullScreen mode doesn't really apply to this control. - *pbFullScreen = VARIANT_FALSE; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE put_FullScreen(VARIANT_BOOL bFullScreen) - { - ATLTRACE(_T("IWebBrowserImpl::put_FullScreen()\n")); - ENSURE_BROWSER_IS_VALID(); - //FullScreen mode doesn't really apply to this control. - return S_OK; - } - -// IWebBrowser2 implementation - virtual HRESULT STDMETHODCALLTYPE Navigate2(VARIANT __RPC_FAR *URL, VARIANT __RPC_FAR *Flags, VARIANT __RPC_FAR *TargetFrameName, VARIANT __RPC_FAR *PostData, VARIANT __RPC_FAR *Headers) - { - ATLTRACE(_T("IWebBrowserImpl::Navigate2()\n")); - CComVariant vURLAsString; - if (vURLAsString.ChangeType(VT_BSTR, URL) != S_OK) - { - return SetErrorInfo(E_INVALIDARG); - } - return Navigate(vURLAsString.bstrVal, Flags, TargetFrameName, PostData, Headers); - } - - virtual HRESULT STDMETHODCALLTYPE QueryStatusWB(OLECMDID cmdID, OLECMDF __RPC_FAR *pcmdf) - { - ATLTRACE(_T("IWebBrowserImpl::QueryStatusWB()\n")); - ENSURE_BROWSER_IS_VALID(); - if (pcmdf == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - // Call through to IOleCommandTarget::QueryStatus - CComQIPtr cmdTarget = this; - if (cmdTarget) - { - OLECMD cmd; - HRESULT hr; - - cmd.cmdID = cmdID; - cmd.cmdf = 0; - hr = cmdTarget->QueryStatus(NULL, 1, &cmd, NULL); - if (SUCCEEDED(hr)) - { - *pcmdf = (OLECMDF) cmd.cmdf; - } - return hr; - } - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt, VARIANT __RPC_FAR *pvaIn, VARIANT __RPC_FAR *pvaOut) - { - ATLTRACE(_T("IWebBrowserImpl::ExecWB()\n")); - ENSURE_BROWSER_IS_VALID(); - // Call through to IOleCommandTarget::Exec - CComQIPtr cmdTarget = this; - if (cmdTarget) - { - return cmdTarget->Exec(NULL, cmdID, cmdexecopt, pvaIn, pvaOut); - } - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE ShowBrowserBar(VARIANT __RPC_FAR *pvaClsid, VARIANT __RPC_FAR *pvarShow, VARIANT __RPC_FAR *pvarSize) - { - ATLTRACE(_T("IWebBrowserImpl::ShowBrowserBar()\n")); - ENSURE_BROWSER_IS_VALID(); - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_ReadyState(READYSTATE __RPC_FAR *plReadyState) - { - ATLTRACE(_T("IWebBrowserImpl::get_ReadyState()\n")); - // Note: may be called when browser is not yet initialized so there - // is no validity check here. - if (plReadyState == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - *plReadyState = mBrowserReadyState; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_Offline(VARIANT_BOOL __RPC_FAR *pbOffline) - { - ATLTRACE(_T("IWebBrowserImpl::get_Offline()\n")); - ENSURE_BROWSER_IS_VALID(); - if (pbOffline == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - //TODO: Implement get_Offline - *pbOffline = VARIANT_FALSE; - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE put_Offline(VARIANT_BOOL bOffline) - { - ATLTRACE(_T("IWebBrowserImpl::put_Offline()\n")); - ENSURE_BROWSER_IS_VALID(); - //TODO: Implement get_Offline - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_Silent(VARIANT_BOOL __RPC_FAR *pbSilent) - { - ATLTRACE(_T("IWebBrowserImpl::get_Silent()\n")); - ENSURE_BROWSER_IS_VALID(); - if (pbSilent == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - //Only really applies to the IE app, not a control - *pbSilent = VARIANT_FALSE; - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE put_Silent(VARIANT_BOOL bSilent) - { - ATLTRACE(_T("IWebBrowserImpl::put_Silent()\n")); - ENSURE_BROWSER_IS_VALID(); - //Only really applies to the IE app, not a control - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_RegisterAsBrowser(VARIANT_BOOL __RPC_FAR *pbRegister) - { - ATLTRACE(_T("IWebBrowserImpl::get_RegisterAsBrowser()\n")); - ENSURE_BROWSER_IS_VALID(); - - if (pbRegister == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - //TODO: Implement get_RegisterAsBrowser - *pbRegister = VARIANT_FALSE; - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE put_RegisterAsBrowser(VARIANT_BOOL bRegister) - { - ATLTRACE(_T("IWebBrowserImpl::put_RegisterAsBrowser()\n")); - ENSURE_BROWSER_IS_VALID(); - //TODO: Implement put_RegisterAsBrowser - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_RegisterAsDropTarget(VARIANT_BOOL __RPC_FAR *pbRegister) - { - // TODO - return E_NOTIMPL; - } - virtual HRESULT STDMETHODCALLTYPE put_RegisterAsDropTarget(VARIANT_BOOL bRegister) - { - // TODO - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE get_TheaterMode(VARIANT_BOOL __RPC_FAR *pbRegister) - { - ATLTRACE(_T("IWebBrowserImpl::get_TheaterMode()\n")); - ENSURE_BROWSER_IS_VALID(); - if (pbRegister == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - // TheaterMode doesn't apply to this control. - *pbRegister = VARIANT_FALSE; - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE put_TheaterMode(VARIANT_BOOL bRegister) - { - ATLTRACE(_T("IWebBrowserImpl::put_TheaterMode()\n")); - ENSURE_BROWSER_IS_VALID(); - //There is no TheaterMode in this control. - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_AddressBar(VARIANT_BOOL __RPC_FAR *Value) - { - ATLTRACE(_T("IWebBrowserImpl::get_AddressBar()\n")); - ENSURE_BROWSER_IS_VALID(); - if (Value == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - //There is no AddressBar in this control. - *Value = VARIANT_FALSE; - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE put_AddressBar(VARIANT_BOOL Value) - { - ATLTRACE(_T("IWebBrowserImpl::put_AddressBar()\n")); - ENSURE_BROWSER_IS_VALID(); - //There is no AddressBar in this control. - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE get_Resizable(VARIANT_BOOL __RPC_FAR *Value) - { - ATLTRACE(_T("IWebBrowserImpl::get_Resizable()\n")); - ENSURE_BROWSER_IS_VALID(); - if (Value == NULL) - { - return SetErrorInfo(E_INVALIDARG); - } - //TODO: Not sure if this should actually be implemented or not. - *Value = VARIANT_TRUE; - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE put_Resizable(VARIANT_BOOL Value) - { - ATLTRACE(_T("IWebBrowserImpl::put_Resizable()\n")); - ENSURE_BROWSER_IS_VALID(); - //TODO: Not sure if this should actually be implemented or not. - return S_OK; - } -}; - -#endif diff --git a/embedding/browser/activex/src/common/ItemContainer.cpp b/embedding/browser/activex/src/common/ItemContainer.cpp deleted file mode 100644 index 4f1f72a98fd..00000000000 --- a/embedding/browser/activex/src/common/ItemContainer.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Adam Lock - * - * 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 "StdAfx.h" - -#include "ItemContainer.h" - -CItemContainer::CItemContainer() -{ -} - -CItemContainer::~CItemContainer() -{ -} - -/////////////////////////////////////////////////////////////////////////////// -// IParseDisplayName implementation - - -HRESULT STDMETHODCALLTYPE CItemContainer::ParseDisplayName(/* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ LPOLESTR pszDisplayName, /* [out] */ ULONG __RPC_FAR *pchEaten, /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmkOut) -{ - // TODO - return E_NOTIMPL; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IOleContainer implementation - - -HRESULT STDMETHODCALLTYPE CItemContainer::EnumObjects(/* [in] */ DWORD grfFlags, /* [out] */ IEnumUnknown __RPC_FAR *__RPC_FAR *ppenum) -{ - HRESULT hr = E_NOTIMPL; -/* - if (ppenum == NULL) - { - return E_POINTER; - } - - *ppenum = NULL; - typedef CComObject, CNamedObjectList > > enumunk; - enumunk* p = NULL; - p = new enumunk; - if(p == NULL) - { - return E_OUTOFMEMORY; - } - - hr = p->Init(); - if (SUCCEEDED(hr)) - { - hr = p->QueryInterface(IID_IEnumUnknown, (void**) ppenum); - } - if (FAILED(hRes)) - { - delete p; - } -*/ - return hr; -} - - -HRESULT STDMETHODCALLTYPE CItemContainer::LockContainer(/* [in] */ BOOL fLock) -{ - // TODO - return S_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IOleItemContainer implementation - - -HRESULT STDMETHODCALLTYPE CItemContainer::GetObject(/* [in] */ LPOLESTR pszItem, /* [in] */ DWORD dwSpeedNeeded, /* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) -{ - if (pszItem == NULL) - { - return E_INVALIDARG; - } - if (ppvObject == NULL) - { - return E_INVALIDARG; - } - - *ppvObject = NULL; - - return MK_E_NOOBJECT; -} - - -HRESULT STDMETHODCALLTYPE CItemContainer::GetObjectStorage(/* [in] */ LPOLESTR pszItem, /* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvStorage) -{ - // TODO - return MK_E_NOOBJECT; -} - - -HRESULT STDMETHODCALLTYPE CItemContainer::IsRunning(/* [in] */ LPOLESTR pszItem) -{ - // TODO - return MK_E_NOOBJECT; -} diff --git a/embedding/browser/activex/src/common/ItemContainer.h b/embedding/browser/activex/src/common/ItemContainer.h deleted file mode 100644 index 424d723fd96..00000000000 --- a/embedding/browser/activex/src/common/ItemContainer.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Adam Lock - * - * 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 ***** */ - -#ifndef ITEMCONTAINER_H -#define ITEMCONTAINER_H - -// typedef std::map CNamedObjectList; - -// Class for managing a list of named objects. - -class CItemContainer : public CComObjectRootEx, - public IOleItemContainer -{ -// CNamedObjectList m_cNamedObjectList; -public: - - CItemContainer(); - virtual ~CItemContainer(); - -BEGIN_COM_MAP(CItemContainer) - COM_INTERFACE_ENTRY_IID(IID_IParseDisplayName, IOleItemContainer) - COM_INTERFACE_ENTRY_IID(IID_IOleContainer, IOleItemContainer) - COM_INTERFACE_ENTRY_IID(IID_IOleItemContainer, IOleItemContainer) -END_COM_MAP() - - // IParseDisplayName implementation - virtual HRESULT STDMETHODCALLTYPE ParseDisplayName(/* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ LPOLESTR pszDisplayName, /* [out] */ ULONG __RPC_FAR *pchEaten, /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmkOut); - - // IOleContainer implementation - virtual HRESULT STDMETHODCALLTYPE EnumObjects(/* [in] */ DWORD grfFlags, /* [out] */ IEnumUnknown __RPC_FAR *__RPC_FAR *ppenum); - virtual HRESULT STDMETHODCALLTYPE LockContainer(/* [in] */ BOOL fLock); - - // IOleItemContainer implementation - virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetObject(/* [in] */ LPOLESTR pszItem, /* [in] */ DWORD dwSpeedNeeded, /* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); - virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetObjectStorage(/* [in] */ LPOLESTR pszItem, /* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvStorage); - virtual HRESULT STDMETHODCALLTYPE IsRunning(/* [in] */ LPOLESTR pszItem); -}; - -typedef CComObject CItemContainerInstance; - - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/common/Makefile.in b/embedding/browser/activex/src/common/Makefile.in deleted file mode 100644 index b5c60bc3d59..00000000000 --- a/embedding/browser/activex/src/common/Makefile.in +++ /dev/null @@ -1,88 +0,0 @@ -# -# ***** 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 browser. -# -# The Initial Developer of the Original Code is -# Christopher Blizzard. -# Portions created by the Initial Developer are Copyright (C) 2001 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Adam Lock -# -# 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 ***** - -DEPTH = ../../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = ax_common -LIBRARY_NAME = ax_common_s -XPIDL_MODULE = ax_common - - -CPPSRCS = \ - IEHtmlNode.cpp \ - IEHtmlElement.cpp \ - IEHtmlElementCollection.cpp \ - ControlSite.cpp \ - ControlSiteIPFrame.cpp \ - ControlEventSink.cpp \ - PropertyBag.cpp \ - ItemContainer.cpp \ - IEHtmlSelectionObject.cpp \ - IEHtmlTxtRange.cpp \ - IEHtmlButtonElement.cpp \ - $(NULL) - -EXPORTS = \ - IEHtmlNode.h \ - IEHtmlElement.h \ - IEHtmlElementCollection.h \ - ControlSite.h \ - ControlSiteIPFrame.h \ - ControlEventSink.h \ - PropertyList.h \ - PropertyBag.h \ - ItemContainer.h \ - IOleCommandTargetImpl.h \ - IWebBrowserImpl.h \ - IHTMLLocationImpl.h \ - CPMozillaControl.h \ - IEHtmlSelectionObject.h \ - IEHtmlTxtRange.h - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -ENABLE_CXX_EXCEPTIONS = 1 - -include $(topsrcdir)/config/rules.mk diff --git a/embedding/browser/activex/src/common/PropertyBag.cpp b/embedding/browser/activex/src/common/PropertyBag.cpp deleted file mode 100644 index 8d751dfe1a6..00000000000 --- a/embedding/browser/activex/src/common/PropertyBag.cpp +++ /dev/null @@ -1,113 +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 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 "StdAfx.h" - -#include "PropertyBag.h" - - -CPropertyBag::CPropertyBag() -{ -} - - -CPropertyBag::~CPropertyBag() -{ -} - - -/////////////////////////////////////////////////////////////////////////////// -// IPropertyBag implementation - -HRESULT STDMETHODCALLTYPE CPropertyBag::Read(/* [in] */ LPCOLESTR pszPropName, /* [out][in] */ VARIANT __RPC_FAR *pVar, /* [in] */ IErrorLog __RPC_FAR *pErrorLog) -{ - if (pszPropName == NULL) - { - return E_INVALIDARG; - } - if (pVar == NULL) - { - return E_INVALIDARG; - } - - VARTYPE vt = pVar->vt; - VariantInit(pVar); - - for (unsigned long i = 0; i < m_PropertyList.GetSize(); i++) - { - if (wcsicmp(m_PropertyList.GetNameOf(i), pszPropName) == 0) - { - const VARIANT *pvSrc = m_PropertyList.GetValueOf(i); - if (!pvSrc) - { - return E_FAIL; - } - CComVariant vNew; - HRESULT hr = (vt == VT_EMPTY) ? - vNew.Copy(pvSrc) : vNew.ChangeType(vt, pvSrc); - if (FAILED(hr)) - { - return E_FAIL; - } - // Copy the new value - vNew.Detach(pVar); - return S_OK; - } - } - - // Property does not exist in the bag - return E_FAIL; -} - - -HRESULT STDMETHODCALLTYPE CPropertyBag::Write(/* [in] */ LPCOLESTR pszPropName, /* [in] */ VARIANT __RPC_FAR *pVar) -{ - if (pszPropName == NULL) - { - return E_INVALIDARG; - } - if (pVar == NULL) - { - return E_INVALIDARG; - } - - CComBSTR bstrName(pszPropName); - m_PropertyList.AddOrReplaceNamedProperty(bstrName, *pVar); - - return S_OK; -} - diff --git a/embedding/browser/activex/src/common/PropertyBag.h b/embedding/browser/activex/src/common/PropertyBag.h deleted file mode 100644 index 6154e7820f2..00000000000 --- a/embedding/browser/activex/src/common/PropertyBag.h +++ /dev/null @@ -1,69 +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): - * Adam Lock - * - * 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 ***** */ -#ifndef PROPERTYBAG_H -#define PROPERTYBAG_H - -#include "PropertyList.h" - -// Object wrapper for property list. This class can be set up with a -// list of properties and used to initialise a control with them - -class CPropertyBag : public CComObjectRootEx, - public IPropertyBag -{ - // List of properties in the bag - PropertyList m_PropertyList; - -public: - // Constructor - CPropertyBag(); - // Destructor - virtual ~CPropertyBag(); - -BEGIN_COM_MAP(CPropertyBag) - COM_INTERFACE_ENTRY(IPropertyBag) -END_COM_MAP() - -// IPropertyBag methods - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read(/* [in] */ LPCOLESTR pszPropName, /* [out][in] */ VARIANT __RPC_FAR *pVar, /* [in] */ IErrorLog __RPC_FAR *pErrorLog); - virtual HRESULT STDMETHODCALLTYPE Write(/* [in] */ LPCOLESTR pszPropName, /* [in] */ VARIANT __RPC_FAR *pVar); -}; - -typedef CComObject CPropertyBagInstance; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/common/PropertyList.h b/embedding/browser/activex/src/common/PropertyList.h deleted file mode 100644 index 4407adb4198..00000000000 --- a/embedding/browser/activex/src/common/PropertyList.h +++ /dev/null @@ -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): - * Adam Lock - * - * 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 ***** */ -#ifndef PROPERTYLIST_H -#define PROPERTYLIST_H - -// A simple array class for managing name/value pairs typically fed to controls -// during initialization by IPersistPropertyBag - -class PropertyList -{ - struct Property { - BSTR bstrName; - VARIANT vValue; - } *mProperties; - unsigned long mListSize; - unsigned long mMaxListSize; - - bool EnsureMoreSpace() - { - // Ensure enough space exists to accomodate a new item - const unsigned long kGrowBy = 10; - if (!mProperties) - { - mProperties = (Property *) malloc(sizeof(Property) * kGrowBy); - if (!mProperties) - return false; - mMaxListSize = kGrowBy; - } - else if (mListSize == mMaxListSize) - { - Property *pNewProperties; - pNewProperties = (Property *) realloc(mProperties, sizeof(Property) * (mMaxListSize + kGrowBy)); - if (!pNewProperties) - return false; - mProperties = pNewProperties; - mMaxListSize += kGrowBy; - } - return true; - } - -public: - PropertyList() : - mProperties(NULL), - mListSize(0), - mMaxListSize(0) - { - } - ~PropertyList() - { - } - void Clear() - { - if (mProperties) - { - for (unsigned long i = 0; i < mListSize; i++) - { - SysFreeString(mProperties[i].bstrName); // Safe even if NULL - VariantClear(&mProperties[i].vValue); - } - free(mProperties); - mProperties = NULL; - } - mListSize = 0; - mMaxListSize = 0; - } - unsigned long GetSize() const - { - return mListSize; - } - const BSTR GetNameOf(unsigned long nIndex) const - { - if (nIndex > mListSize) - { - return NULL; - } - return mProperties[nIndex].bstrName; - } - const VARIANT *GetValueOf(unsigned long nIndex) const - { - if (nIndex > mListSize) - { - return NULL; - } - return &mProperties[nIndex].vValue; - } - bool AddOrReplaceNamedProperty(const BSTR bstrName, const VARIANT &vValue) - { - if (!bstrName) - return false; - for (unsigned long i = 0; i < GetSize(); i++) - { - // Case insensitive - if (wcsicmp(mProperties[i].bstrName, bstrName) == 0) - { - return SUCCEEDED( - VariantCopy(&mProperties[i].vValue, const_cast(&vValue))); - } - } - return AddNamedProperty(bstrName, vValue); - } - bool AddNamedProperty(const BSTR bstrName, const VARIANT &vValue) - { - if (!bstrName || !EnsureMoreSpace()) - return false; - Property *pProp = &mProperties[mListSize]; - pProp->bstrName = ::SysAllocString(bstrName); - if (!pProp->bstrName) - { - return false; - } - VariantInit(&pProp->vValue); - if (FAILED(VariantCopy(&pProp->vValue, const_cast(&vValue)))) - { - SysFreeString(pProp->bstrName); - return false; - } - mListSize++; - return true; - } -}; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/common/StdAfx.h b/embedding/browser/activex/src/common/StdAfx.h deleted file mode 100644 index faaeb456673..00000000000 --- a/embedding/browser/activex/src/common/StdAfx.h +++ /dev/null @@ -1,126 +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): - * Adam Lock - * - * 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 ***** */ - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED_) -#define AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - - // under MSVC shut off copious warnings about debug symbol too long -#ifdef _MSC_VER - #pragma warning( disable: 4786 ) -#endif - -#include "jstypes.h" -#include "prtypes.h" - -// Mozilla headers - -#include "jscompat.h" - -#include "prthread.h" -#include "prprf.h" -#include "nsIComponentManager.h" -#include "nsIServiceManager.h" -#include "nsStringAPI.h" -#include "nsCOMPtr.h" -#include "nsComponentManagerUtils.h" -#include "nsServiceManagerUtils.h" - -#include "nsIDocument.h" -#include "nsIDocumentObserver.h" - -#include "nsIDOMNode.h" -#include "nsIDOMNodeList.h" -#include "nsIDOMDocument.h" -#include "nsIDOMDocumentType.h" -#include "nsIDOMElement.h" - -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0403 -#define _ATL_APARTMENT_THREADED -#define _ATL_STATIC_REGISTRY -// #define _ATL_DEBUG_INTERFACES - -// ATL headers -// The ATL headers that come with the platform SDK have bad for scoping -#if _MSC_VER >= 1400 -#pragma conform(forScope, push, atlhack, off) -#endif - -#include - -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#include -#include - -#if _MSC_VER >= 1400 -#pragma conform(forScope, pop, atlhack) -#endif - -#include -#include -#include - -// New winsock2.h doesn't define this anymore -typedef long int32; - -// Turn off warnings about debug symbols for templates being too long -#pragma warning(disable : 4786) - -#define TRACE_METHOD(fn) \ - { \ - ATLTRACE(_T("0x%04x %s()\n"), (int) GetCurrentThreadId(), _T(#fn)); \ - } -#define TRACE_METHOD_ARGS(fn, pattern, args) \ - { \ - ATLTRACE(_T("0x%04x %s(") _T(pattern) _T(")\n"), (int) GetCurrentThreadId(), _T(#fn), args); \ - } - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED) diff --git a/embedding/browser/activex/src/control/ActiveScriptSite.cpp b/embedding/browser/activex/src/control/ActiveScriptSite.cpp deleted file mode 100644 index 8f5ab6262b8..00000000000 --- a/embedding/browser/activex/src/control/ActiveScriptSite.cpp +++ /dev/null @@ -1,400 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Adam Lock - * - * 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 "stdafx.h" -#include -#include -#include "ActiveScriptSite.h" - - -CActiveScriptSite::CActiveScriptSite() -{ - m_ssScriptState = SCRIPTSTATE_UNINITIALIZED; -} - - -CActiveScriptSite::~CActiveScriptSite() -{ - Detach(); -} - - -HRESULT CActiveScriptSite::Attach(CLSID clsidScriptEngine) -{ - // Detach to anything already attached to - Detach(); - - // Create the new script engine - HRESULT hr = m_spIActiveScript.CoCreateInstance(clsidScriptEngine); - if (FAILED(hr)) - { - return hr; - } - - // Attach the script engine to this site - m_spIActiveScript->SetScriptSite(this); - - // Initialise the script engine - CIPtr(IActiveScriptParse) spActiveScriptParse = m_spIActiveScript; - if (spActiveScriptParse) - { - spActiveScriptParse->InitNew(); - } - else - { - } - - return S_OK; -} - - -HRESULT CActiveScriptSite::Detach() -{ - if (m_spIActiveScript) - { - StopScript(); - m_spIActiveScript->Close(); - m_spIActiveScript.Release(); - } - - return S_OK; -} - - -HRESULT CActiveScriptSite::AttachVBScript() -{ - static const CLSID CLSID_VBScript = - { 0xB54F3741, 0x5B07, 0x11CF, { 0xA4, 0xB0, 0x00, 0xAA, 0x00, 0x4A, 0x55, 0xE8} }; - - return Attach(CLSID_VBScript); -} - - -HRESULT CActiveScriptSite::AttachJScript() -{ - static const CLSID CLSID_JScript = - { 0xF414C260, 0x6AC0, 0x11CF, { 0xB6, 0xD1, 0x00, 0xAA, 0x00, 0xBB, 0xBB, 0x58} }; - - return Attach(CLSID_JScript); -} - - -HRESULT CActiveScriptSite::AddNamedObject(const TCHAR *szName, IUnknown *pObject, BOOL bGlobalMembers) -{ - if (m_spIActiveScript == NULL) - { - return E_UNEXPECTED; - } - - if (pObject == NULL || szName == NULL) - { - return E_INVALIDARG; - } - - // Check for objects of the same name already - CNamedObjectList::iterator i = m_cObjectList.find(szName); - if (i != m_cObjectList.end()) - { - return E_FAIL; - } - - // Add object to the list - m_cObjectList.insert(CNamedObjectList::value_type(szName, pObject)); - - // Tell the script engine about the object - HRESULT hr; - USES_CONVERSION; - DWORD dwFlags = SCRIPTITEM_ISSOURCE | SCRIPTITEM_ISVISIBLE; - if (bGlobalMembers) - { - dwFlags |= SCRIPTITEM_GLOBALMEMBERS; - } - - hr = m_spIActiveScript->AddNamedItem(T2OLE(szName), dwFlags); - - if (FAILED(hr)) - { - m_cObjectList.erase(szName); - return hr; - } - - return S_OK; -} - - -HRESULT CActiveScriptSite::ParseScriptFile(const TCHAR *szFile) -{ - USES_CONVERSION; - const char *pszFileName = T2CA(szFile); - - // Stat the file and get its length; - struct _stat cStat; - _stat(pszFileName, &cStat); - - // Allocate a buffer - size_t nBufSize = cStat.st_size + 1; - char *pBuffer = (char *) malloc(nBufSize); - if (pBuffer == NULL) - { - return E_OUTOFMEMORY; - } - memset(pBuffer, 0, nBufSize); - - // Read the script into the buffer and parse it - HRESULT hr = E_FAIL; - FILE *f = fopen(pszFileName, "rb"); - if (f) - { - fread(pBuffer, 1, nBufSize - 1, f); - hr = ParseScriptText(A2T(pBuffer)); - fclose(f); - } - - free(pBuffer); - - return hr; -} - - -HRESULT CActiveScriptSite::ParseScriptText(const TCHAR *szScript) -{ - if (m_spIActiveScript == NULL) - { - return E_UNEXPECTED; - } - - CIPtr(IActiveScriptParse) spIActiveScriptParse = m_spIActiveScript; - if (spIActiveScriptParse) - { - USES_CONVERSION; - - CComVariant vResult; - DWORD dwCookie = 0; // TODO - DWORD dwFlags = 0; - EXCEPINFO cExcepInfo; - HRESULT hr; - - hr = spIActiveScriptParse->ParseScriptText( - T2OLE(szScript), - NULL, NULL, NULL, dwCookie, 0, dwFlags, - &vResult, &cExcepInfo); - - if (FAILED(hr)) - { - return E_FAIL; - } - } - else - { - CIPtr(IPersistStream) spPersistStream = m_spIActiveScript; - CIPtr(IStream) spStream; - - // Load text into the stream IPersistStream - if (spPersistStream && - SUCCEEDED(CreateStreamOnHGlobal(NULL, TRUE, &spStream))) - { - USES_CONVERSION; - LARGE_INTEGER cPos = { 0, 0 }; - LPOLESTR szText = T2OLE(szScript); - spStream->Write(szText, wcslen(szText) * sizeof(WCHAR), NULL); - spStream->Seek(cPos, STREAM_SEEK_SET, NULL); - spPersistStream->Load(spStream); - } - else - { - return E_UNEXPECTED; - } - } - - return S_OK; -} - - -HRESULT CActiveScriptSite::PlayScript() -{ - if (m_spIActiveScript == NULL) - { - return E_UNEXPECTED; - } - - m_spIActiveScript->SetScriptState(SCRIPTSTATE_CONNECTED); - - return S_OK; -} - - -HRESULT CActiveScriptSite::StopScript() -{ - if (m_spIActiveScript == NULL) - { - return E_UNEXPECTED; - } - - m_spIActiveScript->SetScriptState(SCRIPTSTATE_DISCONNECTED); - - return S_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IActiveScriptSite implementation - -HRESULT STDMETHODCALLTYPE CActiveScriptSite::GetLCID(/* [out] */ LCID __RPC_FAR *plcid) -{ - // Use the system defined locale - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CActiveScriptSite::GetItemInfo(/* [in] */ LPCOLESTR pstrName, /* [in] */ DWORD dwReturnMask, /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppiunkItem, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppti) -{ - if (pstrName == NULL) - { - return E_INVALIDARG; - } - - if (ppiunkItem) - { - *ppiunkItem = NULL; - } - - if (ppti) - { - *ppti = NULL; - } - - USES_CONVERSION; - - // Find object in list - CIUnkPtr spUnkObject; - CNamedObjectList::iterator i = m_cObjectList.find(OLE2T(pstrName)); - if (i != m_cObjectList.end()) - { - spUnkObject = (*i).second; - } - - // Fill in the output values - if (spUnkObject == NULL) - { - return TYPE_E_ELEMENTNOTFOUND; - } - if (dwReturnMask & SCRIPTINFO_IUNKNOWN) - { - spUnkObject->QueryInterface(IID_IUnknown, (void **) ppiunkItem); - } - if (dwReturnMask & SCRIPTINFO_ITYPEINFO) - { - // Return the typeinfo in ptti - CIPtr(IDispatch) spIDispatch = spUnkObject; - if (spIDispatch) - { - HRESULT hr; - hr = spIDispatch->GetTypeInfo(0, GetSystemDefaultLCID(), ppti); - if (FAILED(hr)) - { - *ppti = NULL; - } - } - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CActiveScriptSite::GetDocVersionString(/* [out] */ BSTR __RPC_FAR *pbstrVersion) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CActiveScriptSite::OnScriptTerminate(/* [in] */ const VARIANT __RPC_FAR *pvarResult, /* [in] */ const EXCEPINFO __RPC_FAR *pexcepinfo) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CActiveScriptSite::OnStateChange(/* [in] */ SCRIPTSTATE ssScriptState) -{ - m_ssScriptState = ssScriptState; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CActiveScriptSite::OnScriptError(/* [in] */ IActiveScriptError __RPC_FAR *pscripterror) -{ - BSTR bstrSourceLineText = NULL; - DWORD dwSourceContext = 0; - ULONG pulLineNumber = 0; - LONG ichCharPosition = 0; - EXCEPINFO cExcepInfo; - - memset(&cExcepInfo, 0, sizeof(cExcepInfo)); - - // Get error information - pscripterror->GetSourcePosition(&dwSourceContext, &pulLineNumber, &ichCharPosition); - pscripterror->GetSourceLineText(&bstrSourceLineText); - pscripterror->GetExceptionInfo(&cExcepInfo); - - tstring szDescription(_T("(No description)")); - if (cExcepInfo.bstrDescription) - { - // Dump info - USES_CONVERSION; - szDescription = OLE2T(cExcepInfo.bstrDescription); - } - - ATLTRACE(_T("Script Error: %s, code=0x%08x\n"), szDescription.c_str(), cExcepInfo.scode); - - SysFreeString(bstrSourceLineText); - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CActiveScriptSite::OnEnterScript(void) -{ - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CActiveScriptSite::OnLeaveScript(void) -{ - return S_OK; -} - - diff --git a/embedding/browser/activex/src/control/ActiveScriptSite.h b/embedding/browser/activex/src/control/ActiveScriptSite.h deleted file mode 100644 index 6986fb2973d..00000000000 --- a/embedding/browser/activex/src/control/ActiveScriptSite.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Adam Lock - * - * 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 ***** */ -#ifndef ACTIVESCRIPTSITE_H -#define ACTIVESCRIPTSITE_H - - -class CActiveScriptSite : public CComObjectRootEx, - public IActiveScriptSite -{ - // Pointer to owned script engine - CComQIPtr m_spIActiveScript; - - // List of registered, named objects - CNamedObjectList m_cObjectList; - - // Current script state - SCRIPTSTATE m_ssScriptState; - -public: - CActiveScriptSite(); - virtual ~CActiveScriptSite(); - -BEGIN_COM_MAP(CActiveScriptSite) - COM_INTERFACE_ENTRY(IActiveScriptSite) -END_COM_MAP() - - // Attach to the specified script engine - virtual HRESULT Attach(CLSID clsidScriptEngine); - // Helper to attach to the VBScript engine - virtual HRESULT AttachVBScript(); - // Helper to attach to the JScript engine - virtual HRESULT AttachJScript(); - // Detach from the script engine - virtual HRESULT Detach(); - // Return the current state of the script engine - virtual SCRIPTSTATE GetScriptState() const - { - return m_ssScriptState; - } - - // Parse the specified script - virtual HRESULT ParseScriptText(const TCHAR *szScript); - // Parse the specified script from a file - virtual HRESULT ParseScriptFile(const TCHAR *szFile); - // Add object to script address space - virtual HRESULT AddNamedObject(const TCHAR *szName, IUnknown *pObject, BOOL bGlobalMembers = FALSE); - // Play the script - virtual HRESULT PlayScript(); - // Stop the script - virtual HRESULT StopScript(); - -public: - // IActiveScriptSite - virtual HRESULT STDMETHODCALLTYPE GetLCID(/* [out] */ LCID __RPC_FAR *plcid); - virtual HRESULT STDMETHODCALLTYPE GetItemInfo(/* [in] */ LPCOLESTR pstrName, /* [in] */ DWORD dwReturnMask, /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppiunkItem, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppti); - virtual HRESULT STDMETHODCALLTYPE GetDocVersionString(/* [out] */ BSTR __RPC_FAR *pbstrVersion); - virtual HRESULT STDMETHODCALLTYPE OnScriptTerminate(/* [in] */ const VARIANT __RPC_FAR *pvarResult, /* [in] */ const EXCEPINFO __RPC_FAR *pexcepinfo); - virtual HRESULT STDMETHODCALLTYPE OnStateChange(/* [in] */ SCRIPTSTATE ssScriptState); - virtual HRESULT STDMETHODCALLTYPE OnScriptError(/* [in] */ IActiveScriptError __RPC_FAR *pscripterror); - virtual HRESULT STDMETHODCALLTYPE OnEnterScript(void); - virtual HRESULT STDMETHODCALLTYPE OnLeaveScript(void); -}; - -typedef CComObject CActiveScriptSiteInstance; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/control/ActiveXTypes.h b/embedding/browser/activex/src/control/ActiveXTypes.h deleted file mode 100644 index 3d9927e9f1a..00000000000 --- a/embedding/browser/activex/src/control/ActiveXTypes.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Adam Lock - * - * 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 ***** */ -#ifndef ACTIVEXTYPES_H -#define ACTIVEXTYPES_H - -#include -#include - -// STL based class for handling TCHAR strings -typedef std::basic_string tstring; - -// IUnknown smart pointer -typedef CComPtr CIUnkPtr; - -// Smart pointer macro for CComQIPtr -#define CIPtr(iface) CComQIPtr< iface, &IID_ ## iface > - -typedef std::vector CObjectList; -typedef std::map CNamedObjectList; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/control/BrowserDiagnostics.h b/embedding/browser/activex/src/control/BrowserDiagnostics.h deleted file mode 100644 index 744262fdbf5..00000000000 --- a/embedding/browser/activex/src/control/BrowserDiagnostics.h +++ /dev/null @@ -1,89 +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): - * Adam Lock - * - * 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 ***** */ -#ifndef BROWSER_DIAGNOSTICS_H -#define BROWSER_DIAGNOSTICS_H - -#ifdef _DEBUG -# include -# define NG_TRACE NgTrace -# define NG_TRACE_METHOD(fn) \ - { \ - NG_TRACE(_T("0x%04x %s()\n"), (int) GetCurrentThreadId(), _T(#fn)); \ - } -# define NG_TRACE_METHOD_ARGS(fn, pattern, args) \ - { \ - NG_TRACE(_T("0x%04x %s(") _T(pattern) _T(")\n"), (int) GetCurrentThreadId(), _T(#fn), args); \ - } -# define NG_ASSERT(expr) assert(expr) -# define NG_ASSERT_POINTER(p, type) \ - NG_ASSERT(((p) != NULL) && NgIsValidAddress((p), sizeof(type), FALSE)) -# define NG_ASSERT_NULL_OR_POINTER(p, type) \ - NG_ASSERT(((p) == NULL) || NgIsValidAddress((p), sizeof(type), FALSE)) -#else -# define NG_TRACE 1 ? (void)0 : NgTrace -# define NG_TRACE_METHOD(fn) -# define NG_TRACE_METHOD_ARGS(fn, pattern, args) -# define NG_ASSERT(X) -# define NG_ASSERT_POINTER(p, type) -# define NG_ASSERT_NULL_OR_POINTER(p, type) -#endif - -#define NG_TRACE_ALWAYS AtlTrace - -inline void _cdecl NgTrace(LPCSTR lpszFormat, ...) -{ - va_list args; - va_start(args, lpszFormat); - - int nBuf; - char szBuffer[512]; - - nBuf = _vsnprintf(szBuffer, sizeof(szBuffer), lpszFormat, args); - NG_ASSERT(nBuf < sizeof(szBuffer)); //Output truncated as it was > sizeof(szBuffer) - - OutputDebugStringA(szBuffer); - va_end(args); -} - -inline BOOL NgIsValidAddress(const void* lp, UINT nBytes, BOOL bReadWrite = TRUE) -{ - return (lp != NULL && !IsBadReadPtr(lp, nBytes) && - (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes))); -} - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/control/DHTMLCmdIds.h b/embedding/browser/activex/src/control/DHTMLCmdIds.h deleted file mode 100644 index 6f686a1b664..00000000000 --- a/embedding/browser/activex/src/control/DHTMLCmdIds.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef DHTMLCMDIDS_H -#define DHTMLCMDIDS_H - -#ifndef __mshtmcid_h__ -#define IDM_UNKNOWN 0 -#define IDM_ALIGNBOTTOM 1 -#define IDM_ALIGNHORIZONTALCENTERS 2 -#define IDM_ALIGNLEFT 3 -#define IDM_ALIGNRIGHT 4 -#define IDM_ALIGNTOGRID 5 -#define IDM_ALIGNTOP 6 -#define IDM_ALIGNVERTICALCENTERS 7 -#define IDM_ARRANGEBOTTOM 8 -#define IDM_ARRANGERIGHT 9 -#define IDM_BRINGFORWARD 10 -#define IDM_BRINGTOFRONT 11 -#define IDM_CENTERHORIZONTALLY 12 -#define IDM_CENTERVERTICALLY 13 -#define IDM_CODE 14 -#define IDM_DELETE 17 -#define IDM_FONTNAME 18 -#define IDM_FONTSIZE 19 -#define IDM_GROUP 20 -#define IDM_HORIZSPACECONCATENATE 21 -#define IDM_HORIZSPACEDECREASE 22 -#define IDM_HORIZSPACEINCREASE 23 -#define IDM_HORIZSPACEMAKEEQUAL 24 -#define IDM_INSERTOBJECT 25 -#define IDM_MULTILEVELREDO 30 -#define IDM_SENDBACKWARD 32 -#define IDM_SENDTOBACK 33 -#define IDM_SHOWTABLE 34 -#define IDM_SIZETOCONTROL 35 -#define IDM_SIZETOCONTROLHEIGHT 36 -#define IDM_SIZETOCONTROLWIDTH 37 -#define IDM_SIZETOFIT 38 -#define IDM_SIZETOGRID 39 -#define IDM_SNAPTOGRID 40 -#define IDM_TABORDER 41 -#define IDM_TOOLBOX 42 -#define IDM_MULTILEVELUNDO 44 -#define IDM_UNGROUP 45 -#define IDM_VERTSPACECONCATENATE 46 -#define IDM_VERTSPACEDECREASE 47 -#define IDM_VERTSPACEINCREASE 48 -#define IDM_VERTSPACEMAKEEQUAL 49 -#define IDM_JUSTIFYFULL 50 -#define IDM_BACKCOLOR 51 -#define IDM_BOLD 52 -#define IDM_BORDERCOLOR 53 -#define IDM_FLAT 54 -#define IDM_FORECOLOR 55 -#define IDM_ITALIC 56 -#define IDM_JUSTIFYCENTER 57 -#define IDM_JUSTIFYGENERAL 58 -#define IDM_JUSTIFYLEFT 59 -#define IDM_JUSTIFYRIGHT 60 -#define IDM_RAISED 61 -#define IDM_SUNKEN 62 -#define IDM_UNDERLINE 63 -#define IDM_CHISELED 64 -#define IDM_ETCHED 65 -#define IDM_SHADOWED 66 -#define IDM_FIND 67 -#define IDM_SHOWGRID 69 -#define IDM_OBJECTVERBLIST0 72 -#define IDM_OBJECTVERBLIST1 73 -#define IDM_OBJECTVERBLIST2 74 -#define IDM_OBJECTVERBLIST3 75 -#define IDM_OBJECTVERBLIST4 76 -#define IDM_OBJECTVERBLIST5 77 -#define IDM_OBJECTVERBLIST6 78 -#define IDM_OBJECTVERBLIST7 79 -#define IDM_OBJECTVERBLIST8 80 -#define IDM_OBJECTVERBLIST9 81 -#define IDM_OBJECTVERBLISTLAST IDM_OBJECTVERBLIST9 -#define IDM_CONVERTOBJECT 82 -#define IDM_CUSTOMCONTROL 83 -#define IDM_CUSTOMIZEITEM 84 -#define IDM_RENAME 85 -#define IDM_IMPORT 86 -#define IDM_NEWPAGE 87 -#define IDM_MOVE 88 -#define IDM_CANCEL 89 -#define IDM_FONT 90 -#define IDM_STRIKETHROUGH 91 -#define IDM_DELETEWORD 92 -#define IDM_EXECPRINT 93 -#define IDM_JUSTIFYNONE 94 - -#define IDM_BROWSEMODE 2126 -#define IDM_EDITMODE 2127 - -#endif - - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/control/DropTarget.cpp b/embedding/browser/activex/src/control/DropTarget.cpp deleted file mode 100644 index 49352dfb05a..00000000000 --- a/embedding/browser/activex/src/control/DropTarget.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Adam Lock - * - * 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 "stdafx.h" - -#include -#include - -#include "DropTarget.h" - -#ifndef CFSTR_SHELLURL -#define CFSTR_SHELLURL _T("UniformResourceLocator") -#endif - -#ifndef CFSTR_FILENAME -#define CFSTR_FILENAME _T("FileName") -#endif - -#ifndef CFSTR_FILENAMEW -#define CFSTR_FILENAMEW _T("FileNameW") -#endif - -static const UINT g_cfURL = RegisterClipboardFormat(CFSTR_SHELLURL); -static const UINT g_cfFileName = RegisterClipboardFormat(CFSTR_FILENAME); -static const UINT g_cfFileNameW = RegisterClipboardFormat(CFSTR_FILENAMEW); - -CDropTarget::CDropTarget() -{ - m_pOwner = NULL; -} - - -CDropTarget::~CDropTarget() -{ -} - - -void CDropTarget::SetOwner(CMozillaBrowser *pOwner) -{ - m_pOwner = pOwner; -} - - -HRESULT CDropTarget::GetURLFromFile(const TCHAR *pszFile, tstring &szURL) -{ - USES_CONVERSION; - CIPtr(IUniformResourceLocator) spUrl; - - // Let's see if the file is an Internet Shortcut... - HRESULT hr = CoCreateInstance (CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER, IID_IUniformResourceLocator, (void **) &spUrl); - if (spUrl == NULL) - { - return E_FAIL; - } - - // Get the IPersistFile interface - CIPtr(IPersistFile) spFile = spUrl; - if (spFile == NULL) - { - return E_FAIL; - } - - // Initialise the URL object from the filename - LPSTR lpTemp = NULL; - if (FAILED(spFile->Load(T2OLE(pszFile), STGM_READ)) || - FAILED(spUrl->GetURL(&lpTemp))) - { - return E_FAIL; - } - - // Free the memory - CIPtr(IMalloc) spMalloc; - if (FAILED(SHGetMalloc(&spMalloc))) - { - return E_FAIL; - } - - // Copy the URL & cleanup - szURL = A2T(lpTemp); - spMalloc->Free(lpTemp); - - return S_OK; -} - -/////////////////////////////////////////////////////////////////////////////// -// IDropTarget implementation - -HRESULT STDMETHODCALLTYPE CDropTarget::DragEnter(/* [unique][in] */ IDataObject __RPC_FAR *pDataObj, /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ DWORD __RPC_FAR *pdwEffect) -{ - if (pdwEffect == NULL || pDataObj == NULL) - { - NG_ASSERT(0); - return E_INVALIDARG; - } - - if (m_spDataObject != NULL) - { - NG_ASSERT(0); - return E_UNEXPECTED; - } - - // TODO process Internet Shortcuts (*.URL) files - FORMATETC formatetc; - memset(&formatetc, 0, sizeof(formatetc)); - formatetc.dwAspect = DVASPECT_CONTENT; - formatetc.lindex = -1; - formatetc.tymed = TYMED_HGLOBAL; - - // Test if the data object contains a text URL format - formatetc.cfFormat = g_cfURL; - if (pDataObj->QueryGetData(&formatetc) == S_OK) - { - m_spDataObject = pDataObj; - *pdwEffect = DROPEFFECT_LINK; - return S_OK; - } - - // Test if the data object contains a file name - formatetc.cfFormat = g_cfFileName; - if (pDataObj->QueryGetData(&formatetc) == S_OK) - { - m_spDataObject = pDataObj; - *pdwEffect = DROPEFFECT_LINK; - return S_OK; - } - - // Test if the data object contains a wide character file name - formatetc.cfFormat = g_cfFileName; - if (pDataObj->QueryGetData(&formatetc) == S_OK) - { - m_spDataObject = pDataObj; - *pdwEffect = DROPEFFECT_LINK; - return S_OK; - } - - // If we got here, then the format is not supported - *pdwEffect = DROPEFFECT_NONE; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CDropTarget::DragOver(/* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ DWORD __RPC_FAR *pdwEffect) -{ - if (pdwEffect == NULL) - { - NG_ASSERT(0); - return E_INVALIDARG; - } - *pdwEffect = m_spDataObject ? DROPEFFECT_LINK : DROPEFFECT_NONE; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CDropTarget::DragLeave(void) -{ - if (m_spDataObject) - { - m_spDataObject.Release(); - } - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CDropTarget::Drop(/* [unique][in] */ IDataObject __RPC_FAR *pDataObj, /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ DWORD __RPC_FAR *pdwEffect) -{ - if (pdwEffect == NULL) - { - NG_ASSERT(0); - return E_INVALIDARG; - } - if (m_spDataObject == NULL) - { - *pdwEffect = DROPEFFECT_NONE; - return S_OK; - } - - *pdwEffect = DROPEFFECT_LINK; - - // Get the URL from the data object - BSTR bstrURL = NULL; - FORMATETC formatetc; - STGMEDIUM stgmedium; - memset(&formatetc, 0, sizeof(formatetc)); - memset(&stgmedium, 0, sizeof(formatetc)); - - formatetc.dwAspect = DVASPECT_CONTENT; - formatetc.lindex = -1; - formatetc.tymed = TYMED_HGLOBAL; - - // Does the data object contain a URL? - formatetc.cfFormat = g_cfURL; - if (m_spDataObject->GetData(&formatetc, &stgmedium) == S_OK) - { - NG_ASSERT(stgmedium.tymed == TYMED_HGLOBAL); - NG_ASSERT(stgmedium.hGlobal); - char *pszURL = (char *) GlobalLock(stgmedium.hGlobal); - NG_TRACE("URL \"%s\" dragged over control\n", pszURL); - // Browse to the URL - if (m_pOwner) - { - USES_CONVERSION; - bstrURL = SysAllocString(A2OLE(pszURL)); - } - GlobalUnlock(stgmedium.hGlobal); - goto finish; - } - - // Does the data object point to a file? - formatetc.cfFormat = g_cfFileName; - if (m_spDataObject->GetData(&formatetc, &stgmedium) == S_OK) - { - USES_CONVERSION; - NG_ASSERT(stgmedium.tymed == TYMED_HGLOBAL); - NG_ASSERT(stgmedium.hGlobal); - tstring szURL; - char *pszURLFile = (char *) GlobalLock(stgmedium.hGlobal); - NG_TRACE("File \"%s\" dragged over control\n", pszURLFile); - if (SUCCEEDED(GetURLFromFile(A2T(pszURLFile), szURL))) - { - bstrURL = SysAllocString(T2OLE(szURL.c_str())); - } - GlobalUnlock(stgmedium.hGlobal); - goto finish; - } - - // Does the data object point to a wide character file? - formatetc.cfFormat = g_cfFileNameW; - if (m_spDataObject->GetData(&formatetc, &stgmedium) == S_OK) - { - USES_CONVERSION; - NG_ASSERT(stgmedium.tymed == TYMED_HGLOBAL); - NG_ASSERT(stgmedium.hGlobal); - tstring szURL; - WCHAR *pszURLFile = (WCHAR *) GlobalLock(stgmedium.hGlobal); - NG_TRACE("File \"%s\" dragged over control\n", W2A(pszURLFile)); - if (SUCCEEDED(GetURLFromFile(W2T(pszURLFile), szURL))) - { - USES_CONVERSION; - bstrURL = SysAllocString(T2OLE(szURL.c_str())); - } - GlobalUnlock(stgmedium.hGlobal); - goto finish; - } - -finish: - // If we got a URL, browse there! - if (bstrURL) - { - m_pOwner->Navigate(bstrURL, NULL, NULL, NULL, NULL); - SysFreeString(bstrURL); - } - - ReleaseStgMedium(&stgmedium); - m_spDataObject.Release(); - - return S_OK; -} - diff --git a/embedding/browser/activex/src/control/DropTarget.h b/embedding/browser/activex/src/control/DropTarget.h deleted file mode 100644 index 0f81c53f366..00000000000 --- a/embedding/browser/activex/src/control/DropTarget.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Adam Lock - * - * 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 ***** */ -#ifndef DROPTARGET_H -#define DROPTARGET_H - -#include "MozillaBrowser.h" - -// Simple drop target implementation - -class CDropTarget : public CComObjectRootEx, - public IDropTarget -{ -public: - CDropTarget(); - virtual ~CDropTarget(); - -BEGIN_COM_MAP(CDropTarget) - COM_INTERFACE_ENTRY(IDropTarget) -END_COM_MAP() - - // Data object currently being dragged - CIPtr(IDataObject) m_spDataObject; - - // Owner of this object - CMozillaBrowser *m_pOwner; - - // Sets the owner of this object - void SetOwner(CMozillaBrowser *pOwner); - // Helper method to extract a URL from an internet shortcut file - HRESULT CDropTarget::GetURLFromFile(const TCHAR *pszFile, tstring &szURL); - -// IDropTarget - virtual HRESULT STDMETHODCALLTYPE DragEnter(/* [unique][in] */ IDataObject __RPC_FAR *pDataObj, /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ DWORD __RPC_FAR *pdwEffect); - virtual HRESULT STDMETHODCALLTYPE DragOver(/* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ DWORD __RPC_FAR *pdwEffect); - virtual HRESULT STDMETHODCALLTYPE DragLeave(void); - virtual HRESULT STDMETHODCALLTYPE Drop(/* [unique][in] */ IDataObject __RPC_FAR *pDataObj, /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ DWORD __RPC_FAR *pdwEffect); -}; - -typedef CComObject CDropTargetInstance; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/control/HelperAppDlg.cpp b/embedding/browser/activex/src/control/HelperAppDlg.cpp deleted file mode 100644 index 2573df322e8..00000000000 --- a/embedding/browser/activex/src/control/HelperAppDlg.cpp +++ /dev/null @@ -1,557 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 "stdafx.h" - -#include - -// commdlg.h is needed to build with WIN32_LEAN_AND_MEAN -#include - -#include "HelperAppDlg.h" - -#include "nsCOMPtr.h" -#include "nsIExternalHelperAppService.h" -#include "nsILocalFile.h" -#include "nsIMIMEInfo.h" - -#include "nsIHelperAppLauncherDialog.h" - -#include "nsNetError.h" - - -/////////////////////////////////////////////////////////////////////////////// - -class AppLauncherDlg -{ -public: - AppLauncherDlg(); - virtual ~AppLauncherDlg(); - - int Show(nsIHelperAppLauncher* aLauncher, HWND hwndParent); - - PRPackedBool mSaveToDisk; - nsCAutoString mOpenWith; - -private: - static INT_PTR CALLBACK LaunchProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - - void OnInitDialog(); - void OnOK(); - void OnCancel(); - void OnChooseApp(); - - HWND mHwndDlg; - nsCOMPtr mHelperAppLauncher; -}; - -AppLauncherDlg::AppLauncherDlg() : mHwndDlg(NULL), mSaveToDisk(TRUE) -{ -} - -AppLauncherDlg::~AppLauncherDlg() -{ -} - -int -AppLauncherDlg::Show(nsIHelperAppLauncher* aLauncher, HWND hwndParent) -{ - HINSTANCE hInstResource = _Module.m_hInstResource; - - mHelperAppLauncher = aLauncher; - - INT result = DialogBoxParam(hInstResource, - MAKEINTRESOURCE(IDD_HELPERAPP), hwndParent, LaunchProc, (LPARAM) this); - - return result; -} - -void AppLauncherDlg::OnInitDialog() -{ - USES_CONVERSION; - nsCOMPtr mimeInfo; - nsCAutoString url; - if (mHelperAppLauncher) - { - mHelperAppLauncher->GetMIMEInfo(getter_AddRefs(mimeInfo)); - nsCOMPtr uri; - mHelperAppLauncher->GetSource(getter_AddRefs(uri)); - uri->GetSpec(url); - } - nsHandlerInfoAction prefAction = nsIMIMEInfo::saveToDisk; - nsAutoString appName; - nsCAutoString contentType; - if (mimeInfo) - { - mimeInfo->GetPreferredAction(&prefAction); - nsCOMPtr handlerApp; - mimeInfo->GetPreferredApplicationHandler(getter_AddRefs(handlerApp)); - if (handlerApp) - { - handlerApp->GetName(appName); - } - mimeInfo->GetMIMEType(contentType); - } - if (prefAction == nsIMIMEInfo::saveToDisk) - { - CheckRadioButton(mHwndDlg, IDC_OPENWITHAPP, IDC_SAVETOFILE, IDC_SAVETOFILE); - } - else - { - CheckRadioButton(mHwndDlg, IDC_OPENWITHAPP, IDC_SAVETOFILE, IDC_OPENWITHAPP); - } - SetDlgItemText(mHwndDlg, IDC_URL, - url.IsEmpty() ? _T("") : A2CT(url.get())); - SetDlgItemText(mHwndDlg, IDC_APPLICATION, - appName.IsEmpty() ? _T("") : W2CT(appName.get())); - SetDlgItemText(mHwndDlg, IDC_CONTENTTYPE, - contentType.IsEmpty() ? _T("") : A2CT(contentType.get())); -} - -void AppLauncherDlg::OnOK() -{ - mSaveToDisk = IsDlgButtonChecked(mHwndDlg, IDC_SAVETOFILE) ? TRUE : FALSE; - EndDialog(mHwndDlg, IDOK); -} - -void AppLauncherDlg::OnCancel() -{ - EndDialog(mHwndDlg, IDCANCEL); -} - -void AppLauncherDlg::OnChooseApp() -{ - USES_CONVERSION; - - TCHAR szPath[MAX_PATH + 1]; - memset(szPath, 0, sizeof(szPath)); - - TCHAR *lpszFilter = - _T("EXE Files Only (*.exe)\0*.exe\0" - "All Files (*.*)\0*.*\0\0"); - - OPENFILENAME ofn; - memset(&ofn, 0, sizeof(ofn)); -#if _WIN32_WINNT >= 0x0500 - ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; -#else - ofn.lStructSize = sizeof(ofn); -#endif - ofn.Flags = OFN_FILEMUSTEXIST; - ofn.lpstrFilter = lpszFilter; - ofn.lpstrDefExt = _T("exe"); - ofn.lpstrFile = szPath; - ofn.nMaxFile = MAX_PATH; - - if (GetOpenFileName(&ofn)) - { - USES_CONVERSION; - mOpenWith = T2A(szPath); - SetDlgItemText(mHwndDlg, IDC_APPLICATION, szPath); - CheckRadioButton(mHwndDlg, IDC_OPENWITHAPP, IDC_SAVETOFILE, IDC_OPENWITHAPP); - } -} - -INT_PTR CALLBACK -AppLauncherDlg::LaunchProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - AppLauncherDlg *pThis = NULL; - if (uMsg == WM_INITDIALOG) - { - pThis = (AppLauncherDlg *) lParam; - NS_ASSERTION(pThis, "need a pointer to this!"); - pThis->mHwndDlg = hwndDlg; - SetWindowLongPtr(hwndDlg, DWLP_USER, lParam); - } - else - { - pThis = (AppLauncherDlg *) GetWindowLongPtr(hwndDlg, DWLP_USER); - } - switch (uMsg) - { - case WM_INITDIALOG: - pThis->OnInitDialog(); - return TRUE; - case WM_COMMAND: - if (HIWORD(wParam) == BN_CLICKED) - { - NS_ASSERTION(pThis, "Should be non-null!"); - switch (LOWORD(wParam)) - { - case IDC_CHOOSE: - pThis->OnChooseApp(); - break; - case IDOK: - pThis->OnOK(); - break; - case IDCANCEL: - pThis->OnCancel(); - break; - } - } - return TRUE; - } - return FALSE; -} - -/////////////////////////////////////////////////////////////////////////////// - -//***************************************************************************** -// ProgressDlg -//***************************************************************************** - - -class ProgressDlg : - public nsIWebProgressListener, - public nsSupportsWeakReference -{ -public: - ProgressDlg(); - - void Show(nsIHelperAppLauncher *aHelperAppLauncher, HWND hwndParent); - -protected: - virtual ~ProgressDlg(); - - void OnInitDialog(); - void OnCancel(); - - static INT_PTR CALLBACK ProgressProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - - HWND mHwndDlg; - nsCOMPtr mHelperAppLauncher; - -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIWEBPROGRESSLISTENER -}; - - -ProgressDlg::ProgressDlg() -{ -} - -ProgressDlg::~ProgressDlg() -{ -} - -void -ProgressDlg::Show(nsIHelperAppLauncher *aHelperAppLauncher, HWND hwndParent) -{ - HINSTANCE hInstResource = _Module.m_hInstResource; - - mHelperAppLauncher = aHelperAppLauncher; - mHwndDlg = CreateDialogParam(hInstResource, MAKEINTRESOURCE(IDD_PROGRESS), - hwndParent, ProgressProc, (LPARAM) this); -} - - -NS_IMPL_ISUPPORTS2(ProgressDlg, nsIWebProgressListener, nsISupportsWeakReference) - -NS_IMETHODIMP -ProgressDlg::OnStateChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, PRUint32 aStateFlags, - nsresult aStatus) -{ - if ((aStateFlags & STATE_STOP) && (aStateFlags & STATE_IS_DOCUMENT)) - { - // We've completed the download - close the progress window - if(mHelperAppLauncher) - mHelperAppLauncher->CloseProgressWindow(); - - DestroyWindow(mHwndDlg); - } - - return NS_OK; -} - -NS_IMETHODIMP ProgressDlg::OnProgressChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, - PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, - PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) -{ - // Update the progress control - if (IsWindow(mHwndDlg)) - { - HWND hwndProgress = GetDlgItem(mHwndDlg, IDC_PROGRESS); - SendMessage(hwndProgress, PBM_SETRANGE32, 0, aMaxTotalProgress); - SendMessage(hwndProgress, PBM_SETPOS, aCurTotalProgress, 0); - } - - return NS_OK; -} - -NS_IMETHODIMP ProgressDlg::OnLocationChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, nsIURI *location) -{ - return NS_OK; -} - -NS_IMETHODIMP ProgressDlg::OnStatusChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, nsresult aStatus, - const PRUnichar *aMessage) -{ - return NS_OK; -} - -NS_IMETHODIMP ProgressDlg::OnSecurityChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, PRUint32 state) -{ - return NS_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -INT_PTR CALLBACK -ProgressDlg::ProgressProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - ProgressDlg *pThis = NULL; - if (uMsg == WM_INITDIALOG) - { - pThis = (ProgressDlg *) lParam; - SetWindowLongPtr(hwndDlg, DWLP_USER, lParam); - } - else - { - pThis = (ProgressDlg *) GetWindowLongPtr(hwndDlg, DWLP_USER); - } - switch (uMsg) - { - case WM_INITDIALOG: - NS_ASSERTION(pThis, "Should be non-null!"); - pThis->OnInitDialog(); - return TRUE; - case WM_COMMAND: - if (HIWORD(wParam) == BN_CLICKED) - { - NS_ASSERTION(pThis, "Should be non-null!"); - switch (LOWORD(wParam)) - { - case IDCANCEL: - pThis->OnCancel(); - break; - } - } - return TRUE; - } - - return FALSE; -} - -void ProgressDlg::OnInitDialog() -{ - // Set the "SavingFrom" field - if (mHelperAppLauncher) - { - nsCOMPtr srcUri; - nsresult rv = mHelperAppLauncher->GetSource(getter_AddRefs(srcUri)); - if(NS_SUCCEEDED(rv)) - { - USES_CONVERSION; - nsCAutoString uriString; - srcUri->GetSpec(uriString); - SetDlgItemText(mHwndDlg, IDC_SOURCE, A2CT(uriString.get())); - } - } - - // Set the "Action" field -// if(m_HandleContentOp == CONTENT_SAVE_TO_DISK) -// m_Action.SetWindowText("[Saving file to:] " + m_FileName); -// else if(m_HandleContentOp == CONTENT_LAUNCH_WITH_APP) -// m_Action.SetWindowText("[Opening file with:] " + m_FileName); -} - -void ProgressDlg::OnCancel() -{ - if (mHelperAppLauncher) - mHelperAppLauncher->Cancel(NS_BINDING_ABORTED); - DestroyWindow(mHwndDlg); -} - - - -/////////////////////////////////////////////////////////////////////////////// - -class CHelperAppLauncherDlgFactory : public nsIFactory -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIFACTORY - - CHelperAppLauncherDlgFactory(); - virtual ~CHelperAppLauncherDlgFactory(); -}; - -class CHelperAppLauncherDlg : - public nsIHelperAppLauncherDialog -{ -public: - CHelperAppLauncherDlg(); - -protected: - virtual ~CHelperAppLauncherDlg(); - -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIHELPERAPPLAUNCHERDIALOG - - friend class CHelperAppLauncherDlgFactory; -}; - -NS_IMPL_ISUPPORTS1(CHelperAppLauncherDlg, nsIHelperAppLauncherDialog) - -CHelperAppLauncherDlg::CHelperAppLauncherDlg() -{ -} - -CHelperAppLauncherDlg::~CHelperAppLauncherDlg() -{ -} - -/* void show (in nsIHelperAppLauncher aLauncher, in nsISupports aContext, in unsigned long aReason); */ -NS_IMETHODIMP -CHelperAppLauncherDlg::Show(nsIHelperAppLauncher *aLauncher, nsISupports *aContext, PRUint32 aReason) -{ - NS_ENSURE_ARG_POINTER(aLauncher); - - AppLauncherDlg dlg; - if (dlg.Show(aLauncher, NULL) == IDCANCEL) - { - aLauncher->Cancel(NS_BINDING_ABORTED); - return NS_OK; - } - - if (dlg.mSaveToDisk) - { - return aLauncher->SaveToDisk(nsnull, PR_FALSE); - } - else - { - nsCOMPtr openWith; - nsresult rv = NS_NewNativeLocalFile(dlg.mOpenWith, PR_FALSE, getter_AddRefs(openWith)); - return aLauncher->LaunchWithApplication(openWith, PR_FALSE); - } -} - -/* nsILocalFile promptForSaveToFile (in nsIHelperAppLauncher aLauncher, in nsISupports aWindowContext, in wstring aDefaultFile, in wstring aSuggestedFileExtension); */ -NS_IMETHODIMP -CHelperAppLauncherDlg::PromptForSaveToFile(nsIHelperAppLauncher *aLauncher, - nsISupports *aWindowContext, - const PRUnichar *aDefaultFile, - const PRUnichar *aSuggestedFileExtension, - PRBool aForcePrompt, - nsILocalFile **_retval) -{ - NS_ENSURE_ARG_POINTER(_retval); - USES_CONVERSION; - - TCHAR szPath[MAX_PATH + 1]; - memset(szPath, 0, sizeof(szPath)); - _tcsncpy(szPath, W2T(aDefaultFile), MAX_PATH); - - OPENFILENAME ofn; - memset(&ofn, 0, sizeof(ofn)); -#if _WIN32_WINNT >= 0x0500 - ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; -#else - ofn.lStructSize = sizeof(ofn); -#endif - ofn.Flags = OFN_OVERWRITEPROMPT; - ofn.lpstrFilter = _T("All Files (*.*)\0*.*\0\0"); - ofn.lpstrDefExt = W2T(aSuggestedFileExtension); - ofn.lpstrFile = szPath; - ofn.nMaxFile = MAX_PATH; - - if (GetSaveFileName(&ofn)) - { - return NS_NewNativeLocalFile(nsDependentCString(szPath), PR_FALSE, _retval); - } - - return NS_ERROR_FAILURE; -} - -//***************************************************************************** -// CHelperAppLauncherDlgFactory -//***************************************************************************** - -NS_IMPL_ISUPPORTS1(CHelperAppLauncherDlgFactory, nsIFactory) - -CHelperAppLauncherDlgFactory::CHelperAppLauncherDlgFactory() -{ -} - -CHelperAppLauncherDlgFactory::~CHelperAppLauncherDlgFactory() -{ -} - -NS_IMETHODIMP CHelperAppLauncherDlgFactory::CreateInstance(nsISupports *aOuter, const nsIID & aIID, void **aResult) -{ - NS_ENSURE_ARG_POINTER(aResult); - - *aResult = NULL; - CHelperAppLauncherDlg *inst = new CHelperAppLauncherDlg; - if (!inst) - return NS_ERROR_OUT_OF_MEMORY; - - nsresult rv = inst->QueryInterface(aIID, aResult); - if (rv != NS_OK) { - // We didn't get the right interface, so clean up - delete inst; - } - return rv; -} - -NS_IMETHODIMP CHelperAppLauncherDlgFactory::LockFactory(PRBool lock) -{ - return NS_OK; -} - -nsresult NS_NewHelperAppLauncherDlgFactory(nsIFactory** aFactory) -{ - NS_ENSURE_ARG_POINTER(aFactory); - *aFactory = nsnull; - - CHelperAppLauncherDlgFactory *result = new CHelperAppLauncherDlgFactory; - if (!result) - return NS_ERROR_OUT_OF_MEMORY; - - NS_ADDREF(result); - *aFactory = result; - - return NS_OK; -} diff --git a/embedding/browser/activex/src/control/IEHtmlDocument.cpp b/embedding/browser/activex/src/control/IEHtmlDocument.cpp deleted file mode 100644 index 11c720b5e20..00000000000 --- a/embedding/browser/activex/src/control/IEHtmlDocument.cpp +++ /dev/null @@ -1,1116 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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): - * Adam Lock - * - * 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 "stdafx.h" -#include "IEHtmlDocument.h" -#include "IEHtmlElementCollection.h" -#include "IEHtmlElement.h" - -#include "nsIDOMHTMLDocument.h" -#include "nsIDOMNSHTMLDocument.h" -#include "nsIDOMNSDocument.h" - -#include "MozillaBrowser.h" - -#include "IEHtmlSelectionObject.h" - -CIEHtmlDocument::CIEHtmlDocument() : - mControl(NULL) -{ -} - - -CIEHtmlDocument::~CIEHtmlDocument() -{ -} - - -void CIEHtmlDocument::SetParent(CMozillaBrowser *parent) -{ - mControl = parent; -} - - -void CIEHtmlDocument::SetNative(nsIDOMHTMLDocument *native) -{ - mDOMDocument = native; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IHTMLDocument methods - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_Script(IDispatch __RPC_FAR *__RPC_FAR *p) -{ - return E_NOTIMPL; -} - -/////////////////////////////////////////////////////////////////////////////// -// IHTMLDocument2 methods - -struct HtmlPos -{ - CComQIPtr m_cpCollection; - long m_nPos; - - HtmlPos(IHTMLElementCollection *pCol, long nPos) : - m_cpCollection(pCol), - m_nPos(nPos) - { - } -}; - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_all(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) -{ - // Validate parameters - if (p == NULL) - { - return E_INVALIDARG; - } - - *p = NULL; - - // Get all elements - CIEHtmlElementCollectionInstance *pCollection = NULL; - CIEHtmlElementCollection::CreateFromParentNode(this, TRUE, (CIEHtmlElementCollection **) &pCollection); - if (pCollection) - { - pCollection->QueryInterface(IID_IHTMLElementCollection, (void **) p); - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_body(IHTMLElement __RPC_FAR *__RPC_FAR *p) -{ - // Validate parameters - if (p == NULL) - { - return E_INVALIDARG; - } - *p = NULL; - - nsCOMPtr bodyElement; - - mDOMDocument->GetBody(getter_AddRefs(bodyElement)); - if (bodyElement) - { - nsCOMPtr bodyNode = do_QueryInterface(bodyElement); - - // get or create com object: - CComPtr pNode; - HRESULT hr = CIEHtmlDomNode::FindOrCreateFromDOMNode(bodyNode, &pNode); - if (FAILED(hr)) - return hr; - if (FAILED(pNode->QueryInterface(IID_IHTMLElement, (void **)p))) - return E_UNEXPECTED; - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_activeElement(IHTMLElement __RPC_FAR *__RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_images(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) -{ - // Validate parameters - if (p == NULL) - { - return E_INVALIDARG; - } - - *p = NULL; - - nsCOMPtr nodeList; - mDOMDocument->GetImages(getter_AddRefs(nodeList)); - - // Get all elements - CIEHtmlElementCollectionInstance *pCollection = NULL; - CIEHtmlElementCollection::CreateFromDOMHTMLCollection(this, nodeList, (CIEHtmlElementCollection **) &pCollection); - if (pCollection) - { - pCollection->QueryInterface(IID_IHTMLElementCollection, (void **) p); - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_applets(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) -{ - // Validate parameters - if (p == NULL) - { - return E_INVALIDARG; - } - - *p = NULL; - - nsCOMPtr nodeList; - mDOMDocument->GetApplets(getter_AddRefs(nodeList)); - - // Get all elements - CIEHtmlElementCollectionInstance *pCollection = NULL; - CIEHtmlElementCollection::CreateFromDOMHTMLCollection(this, nodeList, (CIEHtmlElementCollection **) &pCollection); - if (pCollection) - { - pCollection->QueryInterface(IID_IHTMLElementCollection, (void **) p); - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_links(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) -{ - // Validate parameters - if (p == NULL) - { - return E_INVALIDARG; - } - - *p = NULL; - - nsCOMPtr nodeList; - mDOMDocument->GetLinks(getter_AddRefs(nodeList)); - - // Get all elements - CIEHtmlElementCollectionInstance *pCollection = NULL; - CIEHtmlElementCollection::CreateFromDOMHTMLCollection(this, nodeList, (CIEHtmlElementCollection **) &pCollection); - if (pCollection) - { - pCollection->QueryInterface(IID_IHTMLElementCollection, (void **) p); - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_forms(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) -{ - // Validate parameters - if (p == NULL) - { - return E_INVALIDARG; - } - - *p = NULL; - - nsCOMPtr nodeList; - mDOMDocument->GetForms(getter_AddRefs(nodeList)); - - // Get all elements - CIEHtmlElementCollectionInstance *pCollection = NULL; - CIEHtmlElementCollection::CreateFromDOMHTMLCollection(this, nodeList, (CIEHtmlElementCollection **) &pCollection); - if (pCollection) - { - pCollection->QueryInterface(IID_IHTMLElementCollection, (void **) p); - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_anchors(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) -{ - // Validate parameters - if (p == NULL) - { - return E_INVALIDARG; - } - - *p = NULL; - - nsCOMPtr nodeList; - mDOMDocument->GetAnchors(getter_AddRefs(nodeList)); - - // Get all elements - CIEHtmlElementCollectionInstance *pCollection = NULL; - CIEHtmlElementCollection::CreateFromDOMHTMLCollection(this, nodeList, (CIEHtmlElementCollection **) &pCollection); - if (pCollection) - { - pCollection->QueryInterface(IID_IHTMLElementCollection, (void **) p); - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_title(BSTR v) -{ - if (mDOMDocument) - { - nsAutoString newTitle((PRUnichar *) v); - mDOMDocument->SetTitle(newTitle); - } - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_title(BSTR __RPC_FAR *p) -{ - nsAutoString value; - if (mDOMDocument == NULL || mDOMDocument->GetTitle(value)) - { - return E_FAIL; - } - *p = SysAllocString(value.get()); - return p ? S_OK : E_OUTOFMEMORY; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_scripts(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_designMode(BSTR v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_designMode(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_selection(IHTMLSelectionObject __RPC_FAR *__RPC_FAR *p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - *p = NULL; - - // create com object: - CIEHtmlSelectionObjectInstance *pSelectionObject = NULL; - CIEHtmlSelectionObjectInstance::CreateInstance(&pSelectionObject); - if (!pSelectionObject) - return E_FAIL; - // get selection: - nsCOMPtr domWindow; - mControl->GetDOMWindow(getter_AddRefs(domWindow)); - if (!domWindow) - return E_FAIL; - nsCOMPtr selection; - domWindow->GetSelection(getter_AddRefs(selection)); - if (!selection) - return E_FAIL; - // gives the selection to the com object: - pSelectionObject->SetSelection(selection); - nsCOMPtr domDocumentRange = do_QueryInterface(mDOMDocument); - pSelectionObject->SetDOMDocumentRange(domDocumentRange); - // return com object: - pSelectionObject->QueryInterface(IID_IHTMLSelectionObject, (void **)p); - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_readyState(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_frames(IHTMLFramesCollection2 __RPC_FAR *__RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_embeds(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) -{ - // Validate parameters - if (p == NULL) - { - return E_INVALIDARG; - } - *p = NULL; - - nsCOMPtr htmlDoc = do_QueryInterface(mDOMDocument); - if (!htmlDoc) - return E_FAIL; - - nsCOMPtr nodeList; - htmlDoc->GetEmbeds(getter_AddRefs(nodeList)); - - // Get all elements - CIEHtmlElementCollectionInstance *pCollection = NULL; - CIEHtmlElementCollection::CreateFromDOMHTMLCollection(this, nodeList, (CIEHtmlElementCollection **) &pCollection); - if (pCollection) - { - pCollection->QueryInterface(IID_IHTMLElementCollection, (void **) p); - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_plugins(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - -#define IMPL_SET_COLOR(name, v) \ - CComVariant vStr; \ - if (FAILED(::VariantChangeType(&vStr, &v, 0, VT_BSTR))) \ - return E_INVALIDARG; \ - if (!mDOMDocument) \ - return E_UNEXPECTED; \ - nsCOMPtr htmlDoc = do_QueryInterface(mDOMDocument); \ - if (!htmlDoc) \ - return E_FAIL; \ - USES_CONVERSION; \ - nsAutoString val(OLE2W(vStr.bstrVal)); \ - htmlDoc->Set ## name(val); \ - return S_OK; - -#define IMPL_GET_COLOR(name, v) \ - if (p == NULL) return E_INVALIDARG; \ - if (!mDOMDocument) return E_UNEXPECTED; \ - nsCOMPtr htmlDoc = do_QueryInterface(mDOMDocument); \ - if (!htmlDoc) return E_FAIL; \ - USES_CONVERSION; \ - nsAutoString val; \ - htmlDoc->Get ## name(val); \ - p->vt = VT_BSTR; \ - p->bstrVal = ::SysAllocString(W2COLE(val.get())); \ - return S_OK; - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_alinkColor(VARIANT v) -{ - IMPL_SET_COLOR(AlinkColor, v); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_alinkColor(VARIANT __RPC_FAR *p) -{ - IMPL_GET_COLOR(AlinkColor, p); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_bgColor(VARIANT v) -{ - IMPL_SET_COLOR(BgColor, v); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_bgColor(VARIANT __RPC_FAR *p) -{ - IMPL_GET_COLOR(BgColor, p); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_fgColor(VARIANT v) -{ - IMPL_SET_COLOR(FgColor, v); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_fgColor(VARIANT __RPC_FAR *p) -{ - IMPL_GET_COLOR(FgColor, p); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_linkColor(VARIANT v) -{ - IMPL_SET_COLOR(LinkColor, v); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_linkColor(VARIANT __RPC_FAR *p) -{ - IMPL_GET_COLOR(LinkColor, p); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_vlinkColor(VARIANT v) -{ - IMPL_SET_COLOR(VlinkColor, v); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_vlinkColor(VARIANT __RPC_FAR *p) -{ - IMPL_GET_COLOR(VlinkColor, p); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_referrer(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_location(IHTMLLocation __RPC_FAR *__RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_lastModified(BSTR __RPC_FAR *p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - *p = NULL; - if (!mDOMDocument) - { - return E_UNEXPECTED; - } - nsCOMPtr doc = do_QueryInterface(mDOMDocument); - if (!doc) - { - return E_FAIL; - } - USES_CONVERSION; - nsAutoString val; - doc->GetLastModified(val); - *p = ::SysAllocString(W2COLE(val.get())); - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_URL(BSTR v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_URL(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_domain(BSTR v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_domain(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_cookie(BSTR v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_cookie(BSTR __RPC_FAR *p) -{ - if (!p) - return E_INVALIDARG; - *p = NULL; - - nsAutoString strCookie; - nsresult rv = mDOMDocument->GetCookie(strCookie); - NS_ENSURE_SUCCESS(rv,rv); - *p = SysAllocString(strCookie.get()); - return (*p) ? S_OK : E_OUTOFMEMORY; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_expando(VARIANT_BOOL v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_expando(VARIANT_BOOL __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_charset(BSTR v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_charset(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_defaultCharset(BSTR v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_defaultCharset(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_mimeType(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_fileSize(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_fileCreatedDate(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_fileModifiedDate(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_fileUpdatedDate(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_security(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_protocol(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_nameProp(BSTR __RPC_FAR *p) -{ - *p = NULL; - return E_NOTIMPL; -} - - -HRESULT CIEHtmlDocument::WriteCommon(SAFEARRAY __RPC_FAR * psarray, int bLn) -{ - if (psarray->cDims != 1) - { - return E_INVALIDARG; - } - if (!(psarray->fFeatures & (FADF_BSTR | FADF_VARIANT))) - { - return E_INVALIDARG; - } - - HRESULT hr; - - hr = SafeArrayLock(psarray); - if (FAILED(hr)) - { - return hr; - } - - for (DWORD i = 0; i < psarray->rgsabound[0].cElements; i++) - { - nsAutoString str; - if (psarray->fFeatures & FADF_BSTR) - { - USES_CONVERSION; - BSTR *bstrArray = (BSTR *) psarray->pvData; - str = OLE2W(bstrArray[i]); - } - else if (psarray->fFeatures & FADF_VARIANT) - { - USES_CONVERSION; - VARIANT *vArray = (VARIANT *) psarray->pvData; - VARIANT vStr; - VariantInit(&vStr); - hr = VariantChangeType(&vStr, &vArray[i], 0, VT_BSTR); - if (FAILED(hr)) - { - SafeArrayUnlock(psarray); - return hr; - } - str = OLE2W(vStr.bstrVal); - VariantClear(&vStr); - } - - if (bLn && !i) - { - if (mDOMDocument->Writeln(str)) - { - SafeArrayUnlock(psarray); - return E_FAIL; - } - } - else - { - if (mDOMDocument->Write(str)) - { - SafeArrayUnlock(psarray); - return E_FAIL; - } - } - } - - hr = SafeArrayUnlock(psarray); - if (FAILED(hr)) - { - return hr; - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::write(SAFEARRAY __RPC_FAR * psarray) -{ - return WriteCommon(psarray, 0); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::writeln(SAFEARRAY __RPC_FAR * psarray) -{ - return WriteCommon(psarray, 1); -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::open(BSTR url, VARIANT name, VARIANT features, VARIANT replace, IDispatch __RPC_FAR *__RPC_FAR *pomWindowResult) -{ - if (mDOMDocument == NULL || mDOMDocument->Open()) - { - return E_FAIL; - } - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::close(void) -{ - if (mDOMDocument == NULL || mDOMDocument->Close()) - { - return E_FAIL; - } - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::clear(void) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::queryCommandSupported(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::queryCommandEnabled(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::queryCommandState(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::queryCommandIndeterm(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::queryCommandText(BSTR cmdID, BSTR __RPC_FAR *pcmdText) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::queryCommandValue(BSTR cmdID, VARIANT __RPC_FAR *pcmdValue) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::execCommand(BSTR cmdID, VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::execCommandShowHelp(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::createElement(BSTR eTag, IHTMLElement __RPC_FAR *__RPC_FAR *newElem) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onhelp(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onhelp(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onclick(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onclick(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_ondblclick(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_ondblclick(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onkeyup(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onkeyup(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; - -} - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onkeydown(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onkeydown(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onkeypress(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onkeypress(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onmouseup(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onmouseup(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onmousedown(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onmousedown(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onmousemove(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onmousemove(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onmouseout(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onmouseout(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onmouseover(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onmouseover(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onreadystatechange(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onreadystatechange(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onafterupdate(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onafterupdate(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onrowexit(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onrowexit(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onrowenter(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onrowenter(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_ondragstart(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_ondragstart(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onselectstart(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onselectstart(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::elementFromPoint(long x, long y, IHTMLElement __RPC_FAR *__RPC_FAR *elementHit) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_parentWindow(IHTMLWindow2 __RPC_FAR *__RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_styleSheets(IHTMLStyleSheetsCollection __RPC_FAR *__RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onbeforeupdate(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onbeforeupdate(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onerrorupdate(VARIANT v) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onerrorupdate(VARIANT __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::toString(BSTR __RPC_FAR *String) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::createStyleSheet(BSTR bstrHref, long lIndex, IHTMLStyleSheet __RPC_FAR *__RPC_FAR *ppnewStyleSheet) -{ - return E_NOTIMPL; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IOleCommandTarget implementation - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::QueryStatus(const GUID __RPC_FAR *pguidCmdGroup, ULONG cCmds, OLECMD __RPC_FAR prgCmds[], OLECMDTEXT __RPC_FAR *pCmdText) -{ - HRESULT hr = E_NOTIMPL; - if(mControl) - { - hr = mControl->QueryStatus(pguidCmdGroup,cCmds,prgCmds,pCmdText); - } - return hr; -} - - -HRESULT STDMETHODCALLTYPE CIEHtmlDocument::Exec(const GUID __RPC_FAR *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT __RPC_FAR *pvaIn, VARIANT __RPC_FAR *pvaOut) -{ - HRESULT hr = E_NOTIMPL; - if(mControl) - { - hr = mControl->Exec(pguidCmdGroup,nCmdID,nCmdexecopt,pvaIn,pvaOut); - } - return hr; -} - diff --git a/embedding/browser/activex/src/control/IEHtmlDocument.h b/embedding/browser/activex/src/control/IEHtmlDocument.h deleted file mode 100644 index 23c05109ecb..00000000000 --- a/embedding/browser/activex/src/control/IEHtmlDocument.h +++ /dev/null @@ -1,195 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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): - * Adam Lock - * - * 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 ***** */ -#ifndef IEHTMLDOCUMENT_H -#define IEHTMLDOCUMENT_H - -#include "nsIDOMHTMLDocument.h" -#include "nsIDOMHTMLElement.h" - -#include "IEHtmlNode.h" - -class CMozillaBrowser; - -class CIEHtmlDocument : - public CNode, - public IDispatchImpl, - public IOleCommandTarget -{ -public: - CIEHtmlDocument(); -protected: - virtual ~CIEHtmlDocument(); - - // Pointer to browser that owns the document - CMozillaBrowser *mControl; - nsCOMPtr mDOMDocument; - - HRESULT WriteCommon(SAFEARRAY __RPC_FAR * psarray, int bLn); - -public: - virtual void SetParent(CMozillaBrowser *parent); - virtual void SetNative(nsIDOMHTMLDocument *native); - -BEGIN_COM_MAP(CIEHtmlDocument) - COM_INTERFACE_ENTRY_IID(IID_IDispatch, IHTMLDocument2) - COM_INTERFACE_ENTRY_IID(IID_IHTMLDocument, IHTMLDocument2) - COM_INTERFACE_ENTRY_IID(IID_IHTMLDocument2, IHTMLDocument2) - COM_INTERFACE_ENTRY(IOleCommandTarget) -END_COM_MAP() - - // IOleCommandTarget methods - virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID __RPC_FAR *pguidCmdGroup, ULONG cCmds, OLECMD __RPC_FAR prgCmds[], OLECMDTEXT __RPC_FAR *pCmdText); - virtual HRESULT STDMETHODCALLTYPE Exec(const GUID __RPC_FAR *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT __RPC_FAR *pvaIn, VARIANT __RPC_FAR *pvaOut); - - // IHTMLDocument methods - virtual HRESULT STDMETHODCALLTYPE get_Script(IDispatch __RPC_FAR *__RPC_FAR *p); - - // IHTMLDocument2 methods - virtual HRESULT STDMETHODCALLTYPE get_all(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_body(IHTMLElement __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_activeElement(IHTMLElement __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_images(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_applets(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_links(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_forms(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_anchors(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_title(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_title(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_scripts(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_designMode(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_designMode(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_selection(IHTMLSelectionObject __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_readyState(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_frames(IHTMLFramesCollection2 __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_embeds(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_plugins(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_alinkColor(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_alinkColor(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_bgColor(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_bgColor(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_fgColor(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_fgColor(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_linkColor(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_linkColor(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_vlinkColor(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_vlinkColor(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_referrer(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_location(IHTMLLocation __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_lastModified(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_URL(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_URL(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_domain(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_domain(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_cookie(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_cookie(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_expando(VARIANT_BOOL v); - virtual HRESULT STDMETHODCALLTYPE get_expando(VARIANT_BOOL __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_charset(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_charset(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_defaultCharset(BSTR v); - virtual HRESULT STDMETHODCALLTYPE get_defaultCharset(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_mimeType(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_fileSize(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_fileCreatedDate(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_fileModifiedDate(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_fileUpdatedDate(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_security(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_protocol(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_nameProp(BSTR __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE write(SAFEARRAY __RPC_FAR * psarray); - virtual HRESULT STDMETHODCALLTYPE writeln(SAFEARRAY __RPC_FAR * psarray); - virtual HRESULT STDMETHODCALLTYPE open(BSTR url, VARIANT name, VARIANT features, VARIANT replace, IDispatch __RPC_FAR *__RPC_FAR *pomWindowResult); - virtual HRESULT STDMETHODCALLTYPE close(void); - virtual HRESULT STDMETHODCALLTYPE clear(void); - virtual HRESULT STDMETHODCALLTYPE queryCommandSupported(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE queryCommandEnabled(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE queryCommandState(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE queryCommandIndeterm(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE queryCommandText(BSTR cmdID, BSTR __RPC_FAR *pcmdText); - virtual HRESULT STDMETHODCALLTYPE queryCommandValue(BSTR cmdID, VARIANT __RPC_FAR *pcmdValue); - virtual HRESULT STDMETHODCALLTYPE execCommand(BSTR cmdID, VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE execCommandShowHelp(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); - virtual HRESULT STDMETHODCALLTYPE createElement(BSTR eTag, IHTMLElement __RPC_FAR *__RPC_FAR *newElem); - virtual HRESULT STDMETHODCALLTYPE put_onhelp(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onhelp(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onclick(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onclick(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_ondblclick(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_ondblclick(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onkeyup(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onkeyup(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onkeydown(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onkeydown(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onkeypress(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onkeypress(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onmouseup(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onmouseup(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onmousedown(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onmousedown(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onmousemove(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onmousemove(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onmouseout(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onmouseout(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onmouseover(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onmouseover(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onreadystatechange(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onreadystatechange(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onafterupdate(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onafterupdate(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onrowexit(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onrowexit(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onrowenter(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onrowenter(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_ondragstart(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_ondragstart(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onselectstart(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onselectstart(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE elementFromPoint(long x, long y, IHTMLElement __RPC_FAR *__RPC_FAR *elementHit); - virtual HRESULT STDMETHODCALLTYPE get_parentWindow(IHTMLWindow2 __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get_styleSheets(IHTMLStyleSheetsCollection __RPC_FAR *__RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onbeforeupdate(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onbeforeupdate(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE put_onerrorupdate(VARIANT v); - virtual HRESULT STDMETHODCALLTYPE get_onerrorupdate(VARIANT __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE toString(BSTR __RPC_FAR *String); - virtual HRESULT STDMETHODCALLTYPE createStyleSheet(BSTR bstrHref, long lIndex, IHTMLStyleSheet __RPC_FAR *__RPC_FAR *ppnewStyleSheet); -}; - -typedef CComObject CIEHtmlDocumentInstance; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/control/Makefile.in b/embedding/browser/activex/src/control/Makefile.in deleted file mode 100644 index b000d63d68c..00000000000 --- a/embedding/browser/activex/src/control/Makefile.in +++ /dev/null @@ -1,113 +0,0 @@ -# -# ***** 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 browser. -# -# The Initial Developer of the Original Code is -# Netscape Communications, Inc. -# Portions created by the Initial Developer are Copyright (C) 2001 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Adam Lock -# -# 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 ***** - -DEPTH = ../../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -LIBRARY_NAME = mozctl -RESFILE = MozillaControl.res -DEFFILE = L_mozctl.def -FORCE_SHARED_LIB= 1 - - -CPPSRCS = \ - StdAfx.cpp \ - MozillaControl.cpp \ - MozillaBrowser.cpp \ - WebBrowserContainer.cpp \ - IEHtmlDocument.cpp \ - DropTarget.cpp \ - PropertyDlg.cpp \ - PromptService.cpp \ - HelperAppDlg.cpp \ - WindowCreator.cpp \ - $(NULL) - - -EXTRA_DSO_LDOPTS = \ - $(DEPTH)/embedding/base/$(LIB_PREFIX)embed_base_s.$(LIB_SUFFIX) \ - ../common/$(LIB_PREFIX)ax_common_s.$(LIB_SUFFIX) \ - $(MOZ_UNICHARUTIL_LIBS) \ - $(XPCOM_GLUE_LDOPTS) \ - $(XPCOM_FROZEN_LDOPTS) \ - $(NSPR_LIBS) \ - $(NULL) - -OS_LIBS += \ - comdlg32.lib \ - ole32.lib \ - oleaut32.lib \ - uuid.lib \ - shell32.lib \ - $(NULL) - -MIDL_GENERATED_FILES = MozillaControl_i.c MozillaControl.h -GARBAGE += $(DEFFILE) $(MIDL_GENERATED_FILES) done_gen - -ENABLE_CXX_EXCEPTIONS = 1 - -EMBED_MANIFEST_AT = 2 - -include $(topsrcdir)/config/rules.mk - -CXXFLAGS += -D "WIN32" -U "ClientWallet" -LDFLAGS += -SUBSYSTEM:windows -DLL - -ifdef MOZ_NO_DEBUG_RTL -DEFINES += -DMOZ_NO_DEBUG_RTL -endif - -DEFINES += -DMOZ_ACTIVEX_CONTROL_SUPPORT - -LOCAL_INCLUDES += -I. - -export:: $(DEFFILE) done_gen - -$(DEFFILE): mkctldef.sh - $(srcdir)/mkctldef.sh $@ - -done_gen: MozillaControl.idl - $(MIDL) $(MIDL_FLAGS) -Oicf -h MozillaControl.h -iid MozillaControl_i.c $(srcdir)/MozillaControl.idl - touch $@ - -$(MIDL_GENERATED_FILES): done_gen - diff --git a/embedding/browser/activex/src/control/Master.dsp b/embedding/browser/activex/src/control/Master.dsp deleted file mode 100644 index f99a2f56728..00000000000 --- a/embedding/browser/activex/src/control/Master.dsp +++ /dev/null @@ -1,97 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Master" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) External Target" 0x0106 - -CFG=Master - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Master.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Master.mak" CFG="Master - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Master - Win32 Release" (based on "Win32 (x86) External Target") -!MESSAGE "Master - Win32 Debug" (based on "Win32 (x86) External Target") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" - -!IF "$(CFG)" == "Master - Win32 Release" - -# PROP BASE Use_MFC -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Cmd_Line "NMAKE /f Master.mak" -# PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "Master.exe" -# PROP BASE Bsc_Name "Master.bsc" -# PROP BASE Target_Dir "" -# PROP Use_MFC -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Cmd_Line "nmake /f "Master.mak"" -# PROP Rebuild_Opt "/a" -# PROP Target_File "Master.exe" -# PROP Bsc_Name "" -# PROP Target_Dir "" - -!ELSEIF "$(CFG)" == "Master - Win32 Debug" - -# PROP BASE Use_MFC -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Master___Win32_Debug" -# PROP BASE Intermediate_Dir "Master___Win32_Debug" -# PROP BASE Cmd_Line "NMAKE /f Master.mak" -# PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "Master.exe" -# PROP BASE Bsc_Name "Master.bsc" -# PROP BASE Target_Dir "" -# PROP Use_MFC -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Master___Win32_Debug" -# PROP Intermediate_Dir "Master___Win32_Debug" -# PROP Cmd_Line "nmake /f "Master.mak"" -# PROP Rebuild_Opt "/a" -# PROP Target_File "Master.exe" -# PROP Bsc_Name "" -# PROP Target_Dir "" - -!ENDIF - -# Begin Target - -# Name "Master - Win32 Release" -# Name "Master - Win32 Debug" - -!IF "$(CFG)" == "Master - Win32 Release" - -!ELSEIF "$(CFG)" == "Master - Win32 Debug" - -!ENDIF - -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/embedding/browser/activex/src/control/Master.dsw b/embedding/browser/activex/src/control/Master.dsw deleted file mode 100644 index 5b5cb6ebabf..00000000000 --- a/embedding/browser/activex/src/control/Master.dsw +++ /dev/null @@ -1,92 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "IEPatcher"=..\..\tests\IEPatcher\IEPatcher.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "Master"=.\Master.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name cbrowse - End Project Dependency - Begin Project Dependency - Project_Dep_Name MozillaControl - End Project Dependency - Begin Project Dependency - Project_Dep_Name IEPatcher - End Project Dependency - Begin Project Dependency - Project_Dep_Name RegMozCtl - End Project Dependency -}}} - -############################################################################### - -Project: "MozillaControl"=.\MozillaControl.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "RegMozCtl"=..\..\tests\RegMozCtl\RegMozCtl.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "cbrowse"=..\..\tests\cbrowse\cbrowse.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name MozillaControl - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/embedding/browser/activex/src/control/MozillaBrowser.cpp b/embedding/browser/activex/src/control/MozillaBrowser.cpp deleted file mode 100644 index ba86ec16554..00000000000 --- a/embedding/browser/activex/src/control/MozillaBrowser.cpp +++ /dev/null @@ -1,2167 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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 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 "stdafx.h" -#include -#include -#include -//#include -#include - -// commdlg.h is needed to build with WIN32_LEAN_AND_MEAN -#include - -#include "MozillaControl.h" -#include "MozillaBrowser.h" -#include "IEHtmlDocument.h" -#include "PropertyDlg.h" -#include "PageSetupDlg.h" -#include "PromptService.h" -#include "HelperAppDlg.h" -#include "WindowCreator.h" - -#include "nsNetUtil.h" -#include "nsCWebBrowser.h" -#include "nsIAtom.h" -#include "nsILocalFile.h" -#include "nsIWebBrowserPersist.h" -#include "nsIClipboardCommands.h" -#include "nsIProfile.h" -#include "nsIWidget.h" -#include "nsIWebBrowserFocus.h" -#include "nsAppDirectoryServiceDefs.h" -#include "nsIComponentRegistrar.h" - -#ifdef NS_PRINTING -#include "nsIPrintOptions.h" -#include "nsIWebBrowserPrint.h" -#endif - -#include "nsIDOMWindow.h" -#include "nsIDOMHTMLAnchorElement.h" -#include "nsIDOMNSDocument.h" - -#include "nsEmbedAPI.h" -#include "nsEmbedCID.h" - -#define HACK_NON_REENTRANCY -#ifdef HACK_NON_REENTRANCY -static HANDLE s_hHackedNonReentrancy = NULL; -#endif - -#define NS_PROMPTSERVICE_CID \ - {0xa2112d6a, 0x0e28, 0x421f, {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0}} - -#define NS_HELPERAPPLAUNCHERDIALOG_CID \ - {0xf68578eb, 0x6ec2, 0x4169, {0xae, 0x19, 0x8c, 0x62, 0x43, 0xf0, 0xab, 0xe1}} - -static NS_DEFINE_CID(kPromptServiceCID, NS_PROMPTSERVICE_CID); -static NS_DEFINE_CID(kHelperAppLauncherDialogCID, NS_HELPERAPPLAUNCHERDIALOG_CID); - -#ifdef NS_PRINTING -class PrintListener : public nsIWebProgressListener -{ - PRBool mComplete; -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIWEBPROGRESSLISTENER - - PrintListener(); - virtual ~PrintListener(); - - void WaitForComplete(); -}; -#endif - -class SimpleDirectoryProvider : - public nsIDirectoryServiceProvider -{ -public: - SimpleDirectoryProvider(); - BOOL IsValid() const; - - - NS_DECL_ISUPPORTS - NS_DECL_NSIDIRECTORYSERVICEPROVIDER - -protected: - virtual ~SimpleDirectoryProvider(); - - nsCOMPtr mApplicationRegistryDir; - nsCOMPtr mApplicationRegistryFile; - nsCOMPtr mUserProfileDir; -}; - -// Default page in design mode. The data protocol may or may not be supported -// so the scheme is checked before the page is loaded. - -static const char kDesignModeScheme[] = "data"; -static const OLECHAR kDesignModeURL[] = - L"data:text/html,

Mozilla Control

"; - -// Registry keys and values - -static const TCHAR kBrowserHelperObjectRegKey[] = - _T("Software\\Mozilla\\ActiveX Control\\Browser Helper Objects"); - - -// Some recent SDKs define these IOleCommandTarget groups, so they're -// postfixed with _Moz to prevent linker errors. - -GUID CGID_IWebBrowser_Moz = - { 0xED016940L, 0xBD5B, 0x11cf, {0xBA, 0x4E, 0x00, 0xC0, 0x4F, 0xD7, 0x08, 0x16} }; - -GUID CGID_MSHTML_Moz = - { 0xED016940L, 0xBD5B, 0x11cf, {0xBA, 0x4E, 0x00, 0xC0, 0x4F, 0xD7, 0x08, 0x16} }; - -///////////////////////////////////////////////////////////////////////////// -// CMozillaBrowser - - -nsTArray CMozillaBrowser::sBrowserList; - -// -// Constructor -// -CMozillaBrowser::CMozillaBrowser() -{ - NG_TRACE_METHOD(CMozillaBrowser::CMozillaBrowser); - - // ATL flags ensures the control opens with a window - m_bWindowOnly = TRUE; - m_bWndLess = FALSE; - - // Initialize layout interfaces - mWebBrowserAsWin = nsnull; - mValidBrowserFlag = FALSE; - - // Create the container that handles some things for us - mWebBrowserContainer = NULL; - - // Control starts off in non-edit mode - mEditModeFlag = FALSE; - - // Control starts off without being a drop target - mHaveDropTargetFlag = FALSE; - - // the IHTMLDocument, lazy allocation. - mIERootDocument = NULL; - - // Browser helpers - mBrowserHelperList = NULL; - mBrowserHelperListCount = 0; - - // Name of the default profile to use - mProfileName.Assign(NS_LITERAL_STRING("MozillaControl")); - - // Initialise the web browser - Initialize(); -} - - -// -// Destructor -// -CMozillaBrowser::~CMozillaBrowser() -{ - NG_TRACE_METHOD(CMozillaBrowser::~CMozillaBrowser); - - // Close the web browser - Terminate(); -} - -// See bug 127982: -// -// Microsoft's InlineIsEqualGUID global function is multiply defined -// in ATL and/or SDKs with varying namespace requirements. To save the control -// from future grief, this method is used instead. -static inline BOOL _IsEqualGUID(REFGUID rguid1, REFGUID rguid2) -{ - return ( - ((PLONG) &rguid1)[0] == ((PLONG) &rguid2)[0] && - ((PLONG) &rguid1)[1] == ((PLONG) &rguid2)[1] && - ((PLONG) &rguid1)[2] == ((PLONG) &rguid2)[2] && - ((PLONG) &rguid1)[3] == ((PLONG) &rguid2)[3]); -} - -STDMETHODIMP CMozillaBrowser::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_IWebBrowser, - &IID_IWebBrowser2, - &IID_IWebBrowserApp - }; - for (int i = 0; i < (sizeof(arr) / sizeof(arr[0])); i++) - { - if (_IsEqualGUID(*arr[i], riid)) - return S_OK; - } - return S_FALSE; -} - -// -// ShowContextMenu -// -void CMozillaBrowser::ShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode) -{ - POINT pt; - GetCursorPos(&pt); - - // Give the client application the chance to show its own menu - // in place of the one the control is about to show. - - CIPtr(IDocHostUIHandler) spIDocHostUIHandler = m_spClientSite; - if (spIDocHostUIHandler) - { - enum IE4MenuContexts - { - ctxMenuDefault = 0, - ctxMenuImage, - ctxMenuControl, - ctxMenuTable, - ctxMenuDebug, - ctxMenu1DSelect, - ctxMenuAnchor, - ctxMenuImgDynSrc - }; - - DWORD dwID = ctxMenuDefault; - if (aContextFlags & nsIContextMenuListener::CONTEXT_DOCUMENT) - { - dwID = ctxMenuDefault; - } - else if (aContextFlags & nsIContextMenuListener::CONTEXT_LINK) - { - dwID = ctxMenuAnchor; - } - else if (aContextFlags & nsIContextMenuListener::CONTEXT_IMAGE) - { - dwID = ctxMenuImage; - } - else if (aContextFlags & nsIContextMenuListener::CONTEXT_TEXT) - { - dwID = ctxMenu1DSelect; - } - else - { - dwID = ctxMenuDefault; - } - - HRESULT hr = spIDocHostUIHandler->ShowContextMenu(dwID, &pt, NULL, NULL); - if (hr == S_OK) - { - // Client handled menu - return; - } - } - - LPTSTR pszMenuResource = NULL; - if (aContextFlags & nsIContextMenuListener::CONTEXT_DOCUMENT) - { - pszMenuResource = MAKEINTRESOURCE(IDR_POPUP_DOCUMENT); - } - else if (aContextFlags & nsIContextMenuListener::CONTEXT_LINK) - { - pszMenuResource = MAKEINTRESOURCE(IDR_POPUP_LINK); - } - else if (aContextFlags & nsIContextMenuListener::CONTEXT_IMAGE) - { - pszMenuResource = MAKEINTRESOURCE(IDR_POPUP_IMAGE); - } - else if (aContextFlags & nsIContextMenuListener::CONTEXT_TEXT) - { - pszMenuResource = MAKEINTRESOURCE(IDR_POPUP_TEXT); - } - else - { - pszMenuResource = MAKEINTRESOURCE(IDR_POPUP_DOCUMENT); - } - - if (pszMenuResource) - { - HMENU hMenu = LoadMenu(_Module.m_hInstResource, pszMenuResource); - HMENU hPopupMenu = GetSubMenu(hMenu, 0); - mContextNode = do_QueryInterface(aNode); - UINT nCmd = TrackPopupMenu(hPopupMenu, TPM_NONOTIFY | TPM_RETURNCMD, pt.x, pt.y, 0, m_hWnd, NULL); - DestroyMenu(hMenu); - if (nCmd != 0) - { - SendMessage(WM_COMMAND, nCmd); - } - mContextNode = nsnull; - } -} - - -// -// ShowURIPropertyDlg -// -void CMozillaBrowser::ShowURIPropertyDlg(const nsAString &aURI, const nsAString &aContentType) -{ - CPropertyDlg dlg; - CPPageDlg linkDlg; - dlg.AddPage(&linkDlg); - - if (!aURI.IsEmpty()) - { - linkDlg.mType = aContentType; - linkDlg.mURL = aURI; - } - - dlg.DoModal(); -} - - -// -// Displays a message box to the user. If the container provides -// a IDocHostShowUI interface we use that to display messages, otherwise -// a simple message box is shown. -// -int CMozillaBrowser::MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption, UINT nType) -{ - // Let the doc host display its own message box if it can - CIPtr(IDocHostShowUI) spIDocHostShowUI = m_spClientSite; - if (spIDocHostShowUI) - { - USES_CONVERSION; - LRESULT lResult = 0; - HRESULT hr = spIDocHostShowUI->ShowMessage(m_hWnd, - T2OLE(lpszText), T2OLE(lpszCaption), nType, NULL, 0, &lResult); - if (hr == S_OK) - { - return lResult; - } - } - - // Do the default message box - return CWindow::MessageBox(lpszText, lpszCaption, nType); -} - - -// -// Sets the startup error message from a resource string -// -HRESULT CMozillaBrowser::SetStartupErrorMessage(UINT nStringID) -{ - TCHAR szMsg[1024]; - ::LoadString(_Module.m_hInstResource, nStringID, szMsg, sizeof(szMsg) / sizeof(szMsg[0])); - mStartupErrorMessage = szMsg; - return S_OK; -} - -// -// Tells the container to change focus to the next control in the dialog. -// -void CMozillaBrowser::NextDlgControl() -{ - HWND hwndParent = GetParent(); - if (::IsWindow(hwndParent)) - { - ::PostMessage(hwndParent, WM_NEXTDLGCTL, 0, 0); - } -} - - -// -// Tells the container to change focus to the previous control in the dialog. -// -void CMozillaBrowser::PrevDlgControl() -{ - HWND hwndParent = GetParent(); - if (::IsWindow(hwndParent)) - { - ::PostMessage(hwndParent, WM_NEXTDLGCTL, 1, 0); - } -} - - -/////////////////////////////////////////////////////////////////////////////// -// Message handlers - - -// Handle WM_CREATE windows message -LRESULT CMozillaBrowser::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnCreate); - - // Create the web browser - CreateBrowser(); - - // TODO create and register a drop target - - // Control is ready - mBrowserReadyState = READYSTATE_COMPLETE; - FireOnChanged(DISPID_READYSTATE); - - // Load browser helpers - LoadBrowserHelpers(); - - // Browse to a default page - if in design mode - BOOL bUserMode = FALSE; - if (SUCCEEDED(GetAmbientUserMode(bUserMode))) - { - if (!bUserMode) - { - // Load a page in design mode if the specified page is supported - nsCOMPtr ios = do_GetIOService(); - if (ios) - { - // Ensure design page can be loaded by checking for a - // registered protocol handler that supports the scheme - nsCOMPtr ph; - nsCAutoString phScheme; - ios->GetProtocolHandler(kDesignModeScheme, getter_AddRefs(ph)); - if (ph && - NS_SUCCEEDED(ph->GetScheme(phScheme)) && - phScheme.Equals(NS_LITERAL_CSTRING(kDesignModeScheme))) - { - Navigate(const_cast(kDesignModeURL), NULL, NULL, NULL, NULL); - } - } - } - else - { - if (mInitialSrc.Length() > 0) - { - Navigate(mInitialSrc, NULL, NULL, NULL, NULL); - } - } - } - - // Clip the child windows out of paint operations - SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) | WS_CLIPCHILDREN | WS_TABSTOP); - - return 0; -} - - -// Handle WM_DESTROY window message -LRESULT CMozillaBrowser::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnDestroy); - - // Unload browser helpers - UnloadBrowserHelpers(); - - // Clean up the browser - DestroyBrowser(); - - return 0; -} - - -// Handle WM_SIZE windows message -LRESULT CMozillaBrowser::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnSize); - - RECT rc; - rc.top = 0; - rc.left = 0; - rc.right = LOWORD(lParam); - rc.bottom = HIWORD(lParam); - - AdjustWindowRectEx(&rc, GetWindowLong(GWL_STYLE), FALSE, GetWindowLong(GWL_EXSTYLE)); - - rc.right -= rc.left; - rc.bottom -= rc.top; - rc.left = 0; - rc.top = 0; - - // Pass resize information down to the browser... - if (mWebBrowserAsWin) - { - mWebBrowserAsWin->SetPosition(rc.left, rc.top); - mWebBrowserAsWin->SetSize(rc.right - rc.left, rc.bottom - rc.top, PR_TRUE); - } - return 0; -} - -// Handle WM_SETFOCUS -LRESULT CMozillaBrowser::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - ATLTRACE(_T("CMozillaBrowser::OnSetFocus()\n")); - nsCOMPtr browserAsFocus = do_QueryInterface(mWebBrowser); - if (browserAsFocus) - { - browserAsFocus->Activate(); - } - CComQIPtr controlSite = m_spClientSite; - if (controlSite) - { - controlSite->OnFocus(TRUE); - } - return 0; -} - -// Handle WM_KILLFOCUS -LRESULT CMozillaBrowser::OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - ATLTRACE(_T("CMozillaBrowser::OnKillFocus()\n")); - nsCOMPtr browserAsFocus = do_QueryInterface(mWebBrowser); - if (browserAsFocus) - { - browserAsFocus->Deactivate(); - } - CComQIPtr controlSite = m_spClientSite; - if (controlSite) - { - controlSite->OnFocus(FALSE); - } - return 0; -} - -// Handle WM_MOUSEACTIVATE messages -LRESULT CMozillaBrowser::OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - return MA_ACTIVATE; -} - -// Handle WM_GETDLGCODE to receive keyboard presses -LRESULT CMozillaBrowser::OnGetDlgCode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - return DLGC_WANTALLKEYS; -} - -// Handle WM_PAINT windows message (and IViewObject::Draw) -HRESULT CMozillaBrowser::OnDraw(ATL_DRAWINFO& di) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnDraw); - - if (!BrowserIsValid()) - { - RECT& rc = *(RECT*)di.prcBounds; - DrawText(di.hdcDraw, mStartupErrorMessage.c_str(), -1, &rc, DT_TOP | DT_LEFT | DT_WORDBREAK); - } - - return S_OK; -} - -// Handle ID_PAGESETUP command -LRESULT CMozillaBrowser::OnPageSetup(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnPageSetup); - - -#ifdef NS_PRINTING - nsCOMPtr print(do_GetInterface(mWebBrowser)); - nsCOMPtr printSettings; - if(!print || - NS_FAILED(print->GetGlobalPrintSettings(getter_AddRefs(printSettings)))) - { - return 0; - } - - // show the page setup dialog - CPageSetupDlg dlg(printSettings); - dlg.DoModal(); -#endif - - return 0; -} - -// Handle ID_PRINT command -LRESULT CMozillaBrowser::OnPrint(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnPrint); - if (!BrowserIsValid()) - { - return 0; - } - PrintDocument(TRUE); - return 0; -} - -LRESULT CMozillaBrowser::OnSaveAs(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnSaveAs); - - OPENFILENAME SaveFileName; - - char szFile[_MAX_PATH]; - char szFileTitle[256]; - - //TODO: The IE control allows you to also save as "Web Page, complete" - // where all of the page's images are saved in the same directory. - // For the moment, we're not allowing this option. - - memset(&SaveFileName, 0, sizeof(SaveFileName)); - SaveFileName.lStructSize = sizeof(SaveFileName); - SaveFileName.hwndOwner = m_hWnd; - SaveFileName.lpstrFilter = "Web Page, HTML Only (*.htm;*.html)\0*.htm;*.html\0Text File (*.txt)\0*.txt\0"; - SaveFileName.nFilterIndex = 1; - SaveFileName.lpstrFile = szFile; - SaveFileName.nMaxFile = sizeof(szFile); - SaveFileName.lpstrFileTitle = szFileTitle; - SaveFileName.nMaxFileTitle = sizeof(szFileTitle); - SaveFileName.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; - SaveFileName.lpstrDefExt = "htm"; - - //Get the title of the current web page to set as the default filename. - char szTmp[_MAX_FNAME] = "untitled"; - BSTR pageName = NULL; - get_LocationName(&pageName); // Page title - if (pageName) - { - USES_CONVERSION; - strncpy(szTmp, OLE2A(pageName), sizeof(szTmp) - 1); - SysFreeString(pageName); - szTmp[sizeof(szTmp) - 1] = '\0'; - } - - // The SaveAs dialog will fail if szFile contains any "bad" characters. - // This hunk of code attempts to mimick the IE way of replacing "bad" - // characters with "good" characters. - int j = 0; - for (int i=0; szTmp[i]!='\0'; i++) - { - switch(szTmp[i]) - { - case '\\': - case '*': - case '|': - case ':': - case '"': - case '>': - case '<': - case '?': - break; - case '.': - if (szTmp[i+1] != '\0') - { - szFile[j] = '_'; - j++; - } - break; - case '/': - szFile[j] = '-'; - j++; - break; - default: - szFile[j] = szTmp[i]; - j++; - } - } - szFile[j] = '\0'; - - HRESULT hr = S_OK; - if (GetSaveFileName(&SaveFileName)) - { - nsCOMPtr persist(do_QueryInterface(mWebBrowser)); - USES_CONVERSION; - - char szDataFile[_MAX_PATH]; - char szDataPath[_MAX_PATH]; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; - char ext[_MAX_EXT]; - - _splitpath(szFile, drive, dir, fname, ext); - sprintf(szDataFile, "%s_files", fname); - _makepath(szDataPath, drive, dir, szDataFile, ""); - - nsCOMPtr file; - NS_NewNativeLocalFile(nsDependentCString(T2A(szFile)), TRUE, getter_AddRefs(file)); - - nsCOMPtr dataPath; - NS_NewNativeLocalFile(nsDependentCString(szDataPath), TRUE, getter_AddRefs(dataPath)); - - persist->SaveDocument(nsnull, file, dataPath, nsnull, 0, 0); - } - - return hr; -} - -LRESULT CMozillaBrowser::OnProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnProperties); - MessageBox(_T("No Properties Yet!"), _T("Control Message"), MB_OK); - // TODO show the properties dialog - return 0; -} - -LRESULT CMozillaBrowser::OnCut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnCut); - nsCOMPtr clipboard(do_GetInterface(mWebBrowser)); - if (clipboard) - { - clipboard->CutSelection(); - } - return 0; -} - -LRESULT CMozillaBrowser::OnCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnCopy); - nsCOMPtr clipboard(do_GetInterface(mWebBrowser)); - if (clipboard) - { - clipboard->CopySelection(); - } - return 0; -} - -LRESULT CMozillaBrowser::OnPaste(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnPaste); - nsCOMPtr clipboard(do_GetInterface(mWebBrowser)); - if (clipboard) - { - clipboard->Paste(); - } - return 0; -} - -LRESULT CMozillaBrowser::OnSelectAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnSelectAll); - nsCOMPtr clipboard(do_GetInterface(mWebBrowser)); - if (clipboard) - { - clipboard->SelectAll(); - } - return 0; -} - -// Handle ID_VIEWSOURCE command -LRESULT CMozillaBrowser::OnViewSource(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnViewSource); - - if (!mWebBrowser) - { - // No webbrowser to view! - NG_ASSERT(0); - return 0; - } - - nsCOMPtr webNav = do_QueryInterface(mWebBrowser); - if (!webNav) - { - // No webnav! - NG_ASSERT(0); - return 0; - } - - nsCOMPtr uri; - webNav->GetCurrentURI(getter_AddRefs(uri)); - if (!uri) - { - // No URI to view! - NG_ASSERT(0); - return 0; - } - - // Get the current URI - nsCAutoString aURI; - uri->GetSpec(aURI); - - NS_ConvertUTF8toUTF16 strURI(aURI); - strURI.Insert(NS_LITERAL_STRING("view-source:"), 0); - - // Ask the client to create a window to view the source in - CIPtr(IDispatch) spDispNew; - VARIANT_BOOL bCancel = VARIANT_FALSE; - Fire_NewWindow2(&spDispNew, &bCancel); - - // Load the view-source into a new url - if ((bCancel == VARIANT_FALSE) && spDispNew) - { - CIPtr(IWebBrowser2) spOther = spDispNew;; - if (spOther) - { - // tack in the viewsource command - CComBSTR bstrURL(strURI.get()); - CComVariant vURL(bstrURL); - VARIANT vNull; - vNull.vt = VT_NULL; - spOther->Navigate2(&vURL, &vNull, &vNull, &vNull, &vNull); - } - } - - return 0; -} - - -/////////////////////////////////////////////////////////////////////////////// -// Document handlers - - -LRESULT CMozillaBrowser::OnDocumentBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - GoBack(); - return 0; -} - - -LRESULT CMozillaBrowser::OnDocumentForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - GoForward(); - return 0; -} - - -LRESULT CMozillaBrowser::OnDocumentPrint(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - return OnPrint(wNotifyCode, wID, hWndCtl, bHandled); -} - - -LRESULT CMozillaBrowser::OnDocumentRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - Refresh(); - return 0; -} - - -LRESULT CMozillaBrowser::OnDocumentProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - nsCOMPtr ownerDoc; - if (mContextNode) - { - mContextNode->GetOwnerDocument(getter_AddRefs(ownerDoc)); - } - - // Get the document URL - nsAutoString uri; - nsCOMPtr htmlDoc = do_QueryInterface(ownerDoc); - if (htmlDoc) - { - htmlDoc->GetURL(uri); - } - nsAutoString contentType; - nsCOMPtr doc = do_QueryInterface(ownerDoc); - if (doc) - { - doc->GetContentType(contentType); - } - - ShowURIPropertyDlg(uri, contentType); - - return 0; -} - - -/////////////////////////////////////////////////////////////////////////////// -// Link handlers - - -LRESULT CMozillaBrowser::OnLinkOpen(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - nsAutoString uri; - - nsCOMPtr anchorElement = do_QueryInterface(mContextNode); - if (anchorElement) - { - anchorElement->GetHref(uri); - } - - if (!uri.IsEmpty()) - { - CComBSTR bstrURI(uri.get()); - CComVariant vFlags(0); - Navigate(bstrURI, &vFlags, NULL, NULL, NULL); - } - - return 0; -} - - -LRESULT CMozillaBrowser::OnLinkOpenInNewWindow(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - nsAutoString uri; - - nsCOMPtr anchorElement = do_QueryInterface(mContextNode); - if (anchorElement) - { - anchorElement->GetHref(uri); - } - - if (!uri.IsEmpty()) - { - CComBSTR bstrURI(uri.get()); - CComVariant vFlags(navOpenInNewWindow); - Navigate(bstrURI, &vFlags, NULL, NULL, NULL); - } - - return 0; -} - - -LRESULT CMozillaBrowser::OnLinkCopyShortcut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - nsAutoString uri; - - nsCOMPtr anchorElement = do_QueryInterface(mContextNode); - if (anchorElement) - { - anchorElement->GetHref(uri); - } - - if (!uri.IsEmpty() && OpenClipboard()) - { - EmptyClipboard(); - - NS_ConvertUTF16toUTF8 curi(uri); - const char *stringText; - PRUint32 stringLen = NS_CStringGetData(curi, - &stringText); - - // CF_TEXT - HGLOBAL hmemText = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, - stringLen + 1); - char *pszText = (char *) GlobalLock(hmemText); - strncpy(pszText, stringText, stringLen); - pszText[stringLen] = '\0'; - GlobalUnlock(hmemText); - SetClipboardData(CF_TEXT, hmemText); - - // UniformResourceLocator - CFSTR_SHELLURL - const UINT cfShellURL = RegisterClipboardFormat(CFSTR_SHELLURL); - HGLOBAL hmemURL = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, - stringLen + 1); - char *pszURL = (char *) GlobalLock(hmemURL); - strncpy(pszText, stringText, stringLen); - pszText[stringLen] = '\0'; - GlobalUnlock(hmemURL); - SetClipboardData(cfShellURL, hmemURL); - - // TODO - // FileContents - CFSTR_FILECONTENTS - // FileGroupDescriptor - CFSTR_FILEDESCRIPTORA - // FileGroupDescriptorW - CFSTR_FILEDESCRIPTORW - - CloseClipboard(); - } - return 0; -} - - -LRESULT CMozillaBrowser::OnLinkProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - nsAutoString uri; - nsAutoString type; - - nsCOMPtr anchorElement = do_QueryInterface(mContextNode); - if (anchorElement) - { - anchorElement->GetHref(uri); - anchorElement->GetType(type); // How many anchors implement this I wonder - } - - ShowURIPropertyDlg(uri, type); - - return 0; -} - - -/////////////////////////////////////////////////////////////////////////////// - -// Initialises the web browser engine -HRESULT CMozillaBrowser::Initialize() -{ -#ifdef HACK_NON_REENTRANCY - // Attempt to open a named event for this process. If it's not there we - // know this is the first time the control has run in this process, so create - // the named event and do the initialisation. Otherwise do nothing. - TCHAR szHackEvent[255]; - _stprintf(szHackEvent, _T("MozCtlEvent%d"), (int) GetCurrentProcessId()); - s_hHackedNonReentrancy = OpenEvent(EVENT_ALL_ACCESS, FALSE, szHackEvent); - if (s_hHackedNonReentrancy == NULL) - { - s_hHackedNonReentrancy = CreateEvent(NULL, FALSE, FALSE, szHackEvent); -#endif - - // Extract the bin directory path from the control's filename - TCHAR szMozCtlPath[MAX_PATH]; - memset(szMozCtlPath, 0, sizeof(szMozCtlPath)); - GetModuleFileName(_Module.m_hInst, szMozCtlPath, sizeof(szMozCtlPath) / sizeof(szMozCtlPath[0])); - - TCHAR szTmpDrive[_MAX_DRIVE]; - TCHAR szTmpDir[_MAX_DIR]; - TCHAR szTmpFname[_MAX_FNAME]; - TCHAR szTmpExt[_MAX_EXT]; - TCHAR szBinDirPath[MAX_PATH]; - - _tsplitpath(szMozCtlPath, szTmpDrive, szTmpDir, szTmpFname, szTmpExt); - memset(szBinDirPath, 0, sizeof(szBinDirPath)); - _tmakepath(szBinDirPath, szTmpDrive, szTmpDir, NULL, NULL); - if (_tcslen(szBinDirPath) == 0) - { - return E_FAIL; - } - - // Create a simple directory provider. If this fails because the directories are - // invalid or whatever then the control will fallback on the default directory - // provider. - - nsCOMPtr directoryProvider; - SimpleDirectoryProvider *pDirectoryProvider = new SimpleDirectoryProvider; - if (pDirectoryProvider->IsValid()) - directoryProvider = do_QueryInterface(pDirectoryProvider); - - // Create an object to represent the path - nsresult rv; - nsCOMPtr binDir; - USES_CONVERSION; - NS_NewNativeLocalFile(nsDependentCString(T2A(szBinDirPath)), TRUE, getter_AddRefs(binDir)); - rv = NS_InitEmbedding(binDir, directoryProvider); - - // Load preferences service - mPrefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); - if (NS_FAILED(rv)) - { - NG_ASSERT(0); - NG_TRACE_ALWAYS(_T("Could not create preference object rv=%08x\n"), (int) rv); - SetStartupErrorMessage(IDS_CANNOTCREATEPREFS); - return E_FAIL; - } - - // Stuff in here only needs to be done once - static BOOL bRegisterComponents = FALSE; - if (!bRegisterComponents) - { - // Register our own native prompting service for message boxes, login - // prompts etc. - nsCOMPtr promptFactory; - rv = NS_NewPromptServiceFactory(getter_AddRefs(promptFactory)); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr registrar; - rv = NS_GetComponentRegistrar(getter_AddRefs(registrar)); - if (NS_FAILED(rv)) return rv; - - rv = registrar->RegisterFactory(kPromptServiceCID, - "Prompt Service", - NS_PROMPTSERVICE_CONTRACTID, - promptFactory); - if (NS_FAILED(rv)) return rv; - - // Helper app launcher dialog - nsCOMPtr helperAppDlgFactory; - rv = NS_NewHelperAppLauncherDlgFactory(getter_AddRefs(helperAppDlgFactory)); - if (NS_FAILED(rv)) return rv; - - rv = registrar->RegisterFactory(kHelperAppLauncherDialogCID, - "Helper App Launcher Dialog", - "@mozilla.org/helperapplauncherdialog;1", - helperAppDlgFactory); - if (NS_FAILED(rv)) return rv; - - // create our local object - CWindowCreator *creator = new CWindowCreator(); - nsCOMPtr windowCreator; - windowCreator = static_cast(creator); - - // Attach it via the watcher service - nsCOMPtr watcher = - do_GetService(NS_WINDOWWATCHER_CONTRACTID); - if (watcher) - watcher->SetWindowCreator(windowCreator); - } - - // Set the profile which the control will use - nsCOMPtr profileService = - do_GetService(NS_PROFILE_CONTRACTID, &rv); - if (NS_FAILED(rv)) - { - return E_FAIL; - } - - // Make a new default profile - PRBool profileExists = PR_FALSE; - rv = profileService->ProfileExists(mProfileName.get(), &profileExists); - if (NS_FAILED(rv)) - { - return E_FAIL; - } - else if (!profileExists) - { - rv = profileService->CreateNewProfile(mProfileName.get(), nsnull, nsnull, PR_FALSE); - if (NS_FAILED(rv)) - { - return E_FAIL; - } - } - - rv = profileService->SetCurrentProfile(mProfileName.get()); - if (NS_FAILED(rv)) - { - return E_FAIL; - } - -#ifdef HACK_NON_REENTRANCY - } -#endif - - return S_OK; -} - -// Terminates the web browser engine -HRESULT CMozillaBrowser::Terminate() -{ -#ifdef HACK_NON_REENTRANCY - if (0) - { -#endif - - mPrefBranch = nsnull; - NS_TermEmbedding(); - -#ifdef HACK_NON_REENTRANCY - } -#endif - - return S_OK; -} - - -// Create and initialise the web browser -HRESULT CMozillaBrowser::CreateBrowser() -{ - NG_TRACE_METHOD(CMozillaBrowser::CreateBrowser); - - if (mWebBrowser != nsnull) - { - NG_ASSERT(0); - NG_TRACE_ALWAYS(_T("CreateBrowser() called more than once!")); - return SetErrorInfo(E_UNEXPECTED); - } - - RECT rcLocation; - GetClientRect(&rcLocation); - if (IsRectEmpty(&rcLocation)) - { - rcLocation.bottom++; - rcLocation.top++; - } - - nsresult rv; - - // Create the web browser - mWebBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv); - if (NS_FAILED(rv)) - { - NG_ASSERT(0); - NG_TRACE_ALWAYS(_T("Could not create webbrowser object rv=%08x\n"), (int) rv); - SetStartupErrorMessage(IDS_CANNOTCREATEPREFS); - return rv; - } - - // Configure what the web browser can and cannot do - nsCOMPtr webBrowserAsSetup(do_QueryInterface(mWebBrowser)); - - // Allow plugins? - const PRBool kAllowPlugins = PR_TRUE; - webBrowserAsSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS, kAllowPlugins); - - // Host chrome or content? - const PRBool kHostChrome = PR_FALSE; // Hardcoded for now - webBrowserAsSetup->SetProperty(nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER, PR_FALSE); - - // Create the webbrowser window - mWebBrowserAsWin = do_QueryInterface(mWebBrowser); - rv = mWebBrowserAsWin->InitWindow(nsNativeWidget(m_hWnd), nsnull, - 0, 0, rcLocation.right - rcLocation.left, rcLocation.bottom - rcLocation.top); - rv = mWebBrowserAsWin->Create(); - - // Create the container object - mWebBrowserContainer = new CWebBrowserContainer(this); - if (mWebBrowserContainer == NULL) - { - NG_ASSERT(0); - NG_TRACE_ALWAYS(_T("Could not create webbrowsercontainer - out of memory\n")); - return NS_ERROR_OUT_OF_MEMORY; - } - mWebBrowserContainer->AddRef(); - - // Set up the browser with its chrome - mWebBrowser->SetContainerWindow(static_cast(mWebBrowserContainer)); - mWebBrowser->SetParentURIContentListener(mWebBrowserContainer); - - // Subscribe for progress notifications - nsCOMPtr listener( - do_GetWeakReference(static_cast(mWebBrowserContainer))); - mWebBrowser->AddWebBrowserListener(listener, NS_GET_IID(nsIWebProgressListener)); - - // Visible - mWebBrowserAsWin->SetVisibility(PR_TRUE); - - // Activated - nsCOMPtr browserAsFocus = do_QueryInterface(mWebBrowser); - browserAsFocus->Activate(); - - // Get an editor session - mEditingSession = do_GetInterface(mWebBrowser); - mCommandManager = do_GetInterface(mWebBrowser); - - // Append browser to browser list - sBrowserList.AppendElement(this); - - mValidBrowserFlag = TRUE; - - return S_OK; -} - -// Clean up the browser -HRESULT CMozillaBrowser::DestroyBrowser() -{ - // TODO unregister drop target - - mValidBrowserFlag = FALSE; - - // Remove browser from browser list - sBrowserList.RemoveElement(this); - - // Destroy the htmldoc - if (mIERootDocument != NULL) - { - mIERootDocument->Release(); - mIERootDocument = NULL; - } - - // Destroy layout... - if (mWebBrowserAsWin) - { - mWebBrowserAsWin->Destroy(); - mWebBrowserAsWin = nsnull; - } - - if (mWebBrowserContainer) - { - mWebBrowserContainer->Release(); - mWebBrowserContainer = NULL; - } - - mEditingSession = nsnull; - mCommandManager = nsnull; - mWebBrowser = nsnull; - - return S_OK; -} - - -// Turns the editor mode on or off -HRESULT CMozillaBrowser::SetEditorMode(BOOL bEnabled) -{ - NG_TRACE_METHOD(CMozillaBrowser::SetEditorMode); - - if (!mEditingSession || !mCommandManager) - return E_FAIL; - - nsCOMPtr domWindow; - nsresult rv = GetDOMWindow(getter_AddRefs(domWindow)); - if (NS_FAILED(rv)) - return E_FAIL; - - rv = mEditingSession->MakeWindowEditable(domWindow, "html", PR_FALSE, - PR_TRUE, PR_FALSE); - - return S_OK; -} - - -HRESULT CMozillaBrowser::OnEditorCommand(DWORD nCmdID) -{ - NG_TRACE_METHOD(CMozillaBrowser::OnEditorCommand); - - nsCOMPtr domWindow; - GetDOMWindow(getter_AddRefs(domWindow)); - - const char *styleCommand = nsnull; - nsICommandParams *commandParams = nsnull; - - switch (nCmdID) - { - case IDM_BOLD: - styleCommand = "cmd_bold"; - break; - case IDM_ITALIC: - styleCommand = "cmd_italic"; - break; - case IDM_UNDERLINE: - styleCommand = "cmd_underline"; - break; - - // TODO add the rest! - - default: - // DO NOTHING - break; - } - - return mCommandManager ? - mCommandManager->DoCommand(styleCommand, commandParams, domWindow) : - NS_ERROR_FAILURE; -} - - -// Return the root DOM document -HRESULT CMozillaBrowser::GetDOMDocument(nsIDOMDocument **pDocument) -{ - NG_TRACE_METHOD(CMozillaBrowser::GetDOMDocument); - - HRESULT hr = E_FAIL; - - // Test for stupid args - if (pDocument == NULL) - { - NG_ASSERT(0); - return E_INVALIDARG; - } - - *pDocument = nsnull; - - if (!BrowserIsValid()) - { - NG_ASSERT(0); - return E_UNEXPECTED; - } - - // Get the DOM window from the webbrowser - nsCOMPtr window; - mWebBrowser->GetContentDOMWindow(getter_AddRefs(window)); - if (window) - { - if (NS_SUCCEEDED(window->GetDocument(pDocument)) && *pDocument) - { - hr = S_OK; - } - } - - return hr; -} - - -// Load any browser helpers -HRESULT CMozillaBrowser::LoadBrowserHelpers() -{ - NG_TRACE_METHOD(CMozillaBrowser::LoadBrowserHelpers); - - UnloadBrowserHelpers(); - - // IE loads browser helper objects from a branch of the registry - // Search the branch looking for objects to load with the control. - - CRegKey cKey; - if (cKey.Open(HKEY_LOCAL_MACHINE, kBrowserHelperObjectRegKey, KEY_ENUMERATE_SUB_KEYS) != ERROR_SUCCESS) - { - NG_TRACE(_T("No browser helper key found\n")); - return S_FALSE; - } - - // Count the number of browser helper object keys - ULONG nHelperKeys = 0; - LONG nResult = ERROR_SUCCESS; - while (nResult == ERROR_SUCCESS) - { - TCHAR szCLSID[50]; - DWORD dwCLSID = sizeof(szCLSID) / sizeof(TCHAR); - FILETIME cLastWrite; - - // Read next subkey - nResult = RegEnumKeyEx(cKey, nHelperKeys, szCLSID, &dwCLSID, NULL, NULL, NULL, &cLastWrite); - if (nResult != ERROR_SUCCESS) - { - break; - } - nHelperKeys++; - } - if (nHelperKeys == 0) - { - NG_TRACE(_T("No browser helper objects found\n")); - return S_FALSE; - } - - // Get the CLSID for each browser helper object - CLSID *pClassList = new CLSID[nHelperKeys]; - DWORD nHelpers = 0; - DWORD nKey = 0; - nResult = ERROR_SUCCESS; - while (nResult == ERROR_SUCCESS) - { - TCHAR szCLSID[50]; - DWORD dwCLSID = sizeof(szCLSID) / sizeof(TCHAR); - FILETIME cLastWrite; - - // Read next subkey - nResult = RegEnumKeyEx(cKey, nKey++, szCLSID, &dwCLSID, NULL, NULL, NULL, &cLastWrite); - if (nResult != ERROR_SUCCESS) - { - break; - } - - NG_TRACE(_T("Reading helper object entry \"%s\"\n"), szCLSID); - - // Turn the key into a CLSID - USES_CONVERSION; - CLSID clsid; - if (CLSIDFromString(T2OLE(szCLSID), &clsid) != NOERROR) - { - continue; - } - - pClassList[nHelpers++] = clsid; - } - - mBrowserHelperList = new CComUnkPtr[nHelpers]; - - // Create each object in turn - for (ULONG i = 0; i < nHelpers; i++) - { - CLSID clsid = pClassList[i]; - HRESULT hr; - CComQIPtr cpObjectWithSite; - - hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, IID_IObjectWithSite, (LPVOID *) &cpObjectWithSite); - if (FAILED(hr)) - { - NG_TRACE(_T("Registered browser helper object cannot be created\n"));; - } - else - { - // Set the object to point at the browser - cpObjectWithSite->SetSite((IWebBrowser2 *) this); - - // Store in the list - CComUnkPtr cpUnk = cpObjectWithSite; - mBrowserHelperList[mBrowserHelperListCount++] = cpUnk; - } - } - - delete []pClassList; - - return S_OK; -} - -// Release browser helpers -HRESULT CMozillaBrowser::UnloadBrowserHelpers() -{ - NG_TRACE_METHOD(CMozillaBrowser::UnloadBrowserHelpers); - - if (mBrowserHelperList == NULL) - { - return S_OK; - } - - // Destroy each helper - for (ULONG i = 0; i < mBrowserHelperListCount; i++) - { - CComUnkPtr cpUnk = mBrowserHelperList[i]; - if (cpUnk) - { - CComQIPtr cpObjectWithSite = cpUnk; - if (cpObjectWithSite) - { - cpObjectWithSite->SetSite(NULL); - } - } - } - - // Cleanup the array - mBrowserHelperListCount = 0; - delete []mBrowserHelperList; - mBrowserHelperList = NULL; - - return S_OK; -} - -// Print document -HRESULT CMozillaBrowser::PrintDocument(BOOL promptUser) -{ -#ifdef NS_PRINTING - // Print the contents - nsCOMPtr browserAsPrint = do_GetInterface(mWebBrowser); - NS_ASSERTION(browserAsPrint, "No nsIWebBrowserPrint!"); - - PRBool oldPrintSilent = PR_FALSE; - nsCOMPtr printSettings; - browserAsPrint->GetGlobalPrintSettings(getter_AddRefs(printSettings)); - if (printSettings) - { - printSettings->GetPrintSilent(&oldPrintSilent); - printSettings->SetPrintSilent(promptUser ? PR_FALSE : PR_TRUE); - } - - // Disable print progress dialog (XUL) - PRBool oldShowPrintProgress = FALSE; - const char *kShowPrintProgressPref = "print.show_print_progress"; - mPrefBranch->GetBoolPref(kShowPrintProgressPref, &oldShowPrintProgress); - mPrefBranch->SetBoolPref(kShowPrintProgressPref, PR_FALSE); - - // Print - PrintListener *listener = new PrintListener; - nsCOMPtr printListener = do_QueryInterface(listener); - nsresult rv = browserAsPrint->Print(printSettings, printListener); - if (NS_SUCCEEDED(rv)) - { - listener->WaitForComplete(); - } - - // Cleanup - if (printSettings) - { - printSettings->SetPrintSilent(oldPrintSilent); - } - mPrefBranch->SetBoolPref(kShowPrintProgressPref, oldShowPrintProgress); -#endif - return S_OK; -} - -///////////////////////////////////////////////////////////////////////////// -// IOleObject overrides - -// This is an almost verbatim copy of the standard ATL implementation of -// IOleObject::InPlaceActivate but with a few lines commented out. - -HRESULT CMozillaBrowser::InPlaceActivate(LONG iVerb, const RECT* prcPosRect) -{ - NG_TRACE_METHOD(CMozillaBrowser::InPlaceActivate); - - HRESULT hr; - - if (m_spClientSite == NULL) - return S_OK; - - CComPtr pIPO; - ControlQueryInterface(IID_IOleInPlaceObject, (void**)&pIPO); - _ASSERTE(pIPO != NULL); - if (prcPosRect != NULL) - pIPO->SetObjectRects(prcPosRect, prcPosRect); - - if (!m_bNegotiatedWnd) - { - if (!m_bWindowOnly) - // Try for windowless site - hr = m_spClientSite->QueryInterface(IID_IOleInPlaceSiteWindowless, (void **)&m_spInPlaceSite); - - if (m_spInPlaceSite) - { - m_bInPlaceSiteEx = TRUE; - m_bWndLess = SUCCEEDED(m_spInPlaceSite->CanWindowlessActivate()); - m_bWasOnceWindowless = TRUE; - } - else - { - m_spClientSite->QueryInterface(IID_IOleInPlaceSiteEx, (void **)&m_spInPlaceSite); - if (m_spInPlaceSite) - m_bInPlaceSiteEx = TRUE; - else - hr = m_spClientSite->QueryInterface(IID_IOleInPlaceSite, (void **)&m_spInPlaceSite); - } - } - - _ASSERTE(m_spInPlaceSite); - if (!m_spInPlaceSite) - return E_FAIL; - - m_bNegotiatedWnd = TRUE; - - if (!m_bInPlaceActive) - { - - BOOL bNoRedraw = FALSE; - if (m_bWndLess) - m_spInPlaceSite->OnInPlaceActivateEx(&bNoRedraw, ACTIVATE_WINDOWLESS); - else - { - if (m_bInPlaceSiteEx) - m_spInPlaceSite->OnInPlaceActivateEx(&bNoRedraw, 0); - else - { - HRESULT hr = m_spInPlaceSite->CanInPlaceActivate(); - if (FAILED(hr)) - return hr; - m_spInPlaceSite->OnInPlaceActivate(); - } - } - } - - m_bInPlaceActive = TRUE; - - // get location in the parent window, - // as well as some information about the parent - // - OLEINPLACEFRAMEINFO frameInfo; - RECT rcPos, rcClip; - CComPtr spInPlaceFrame; - CComPtr spInPlaceUIWindow; - frameInfo.cb = sizeof(OLEINPLACEFRAMEINFO); - HWND hwndParent; - if (m_spInPlaceSite->GetWindow(&hwndParent) == S_OK) - { - m_spInPlaceSite->GetWindowContext(&spInPlaceFrame, - &spInPlaceUIWindow, &rcPos, &rcClip, &frameInfo); - - if (!m_bWndLess) - { - if (m_hWndCD) - { - ::ShowWindow(m_hWndCD, SW_SHOW); - ::SetFocus(m_hWndCD); - } - else - { - HWND h = CreateControlWindow(hwndParent, rcPos); - _ASSERTE(h == m_hWndCD); - } - } - - pIPO->SetObjectRects(&rcPos, &rcClip); - } - - CComPtr spActiveObject; - ControlQueryInterface(IID_IOleInPlaceActiveObject, (void**)&spActiveObject); - - // Gone active by now, take care of UIACTIVATE - if (DoesVerbUIActivate(iVerb)) - { - if (!m_bUIActive) - { - m_bUIActive = TRUE; - hr = m_spInPlaceSite->OnUIActivate(); - if (FAILED(hr)) - return hr; - - SetControlFocus(TRUE); - // set ourselves up in the host. - // - if (spActiveObject) - { - if (spInPlaceFrame) - spInPlaceFrame->SetActiveObject(spActiveObject, NULL); - if (spInPlaceUIWindow) - spInPlaceUIWindow->SetActiveObject(spActiveObject, NULL); - } - -// These lines are deliberately commented out to demonstrate what breaks certain -// control containers. - -// if (spInPlaceFrame) -// spInPlaceFrame->SetBorderSpace(NULL); -// if (spInPlaceUIWindow) -// spInPlaceUIWindow->SetBorderSpace(NULL); - } - } - - m_spClientSite->ShowObject(); - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CMozillaBrowser::GetClientSite(IOleClientSite **ppClientSite) -{ - NG_TRACE_METHOD(CMozillaBrowser::GetClientSite); - - NG_ASSERT(ppClientSite); - - // This fixes a problem in the base class which asserts if the client - // site has not been set when this method is called. - - HRESULT hRes = E_POINTER; - if (ppClientSite != NULL) - { - *ppClientSite = NULL; - if (m_spClientSite == NULL) - { - return S_OK; - } - } - - return IOleObjectImpl::GetClientSite(ppClientSite); -} - - -///////////////////////////////////////////////////////////////////////////// -// IMozControlBridge - - -HRESULT STDMETHODCALLTYPE CMozillaBrowser::GetWebBrowser(/* [out] */ void __RPC_FAR *__RPC_FAR *aBrowser) -{ - if (!NgIsValidAddress(aBrowser, sizeof(void *))) - { - NG_ASSERT(0); - return SetErrorInfo(E_INVALIDARG); - } - - *aBrowser = NULL; - if (mWebBrowser) - { - nsIWebBrowser *browser = mWebBrowser.get(); - NS_ADDREF(browser); - *aBrowser = (void *) browser; - } - return S_OK; -} - -///////////////////////////////////////////////////////////////////////////// -// IWebBrowserImpl - -nsresult CMozillaBrowser::GetWebNavigation(nsIWebNavigation **aWebNav) -{ - NS_ENSURE_ARG_POINTER(aWebNav); - if (!mWebBrowser) return NS_ERROR_FAILURE; - return mWebBrowser->QueryInterface(NS_GET_IID(nsIWebNavigation), (void **) aWebNav); -} - -nsresult CMozillaBrowser::GetDOMWindow(nsIDOMWindow **aDOMWindow) -{ - NS_ENSURE_ARG_POINTER(aDOMWindow); - if (!mWebBrowser) return NS_ERROR_FAILURE; - return mWebBrowser->GetContentDOMWindow(aDOMWindow); -} - -nsresult CMozillaBrowser::GetPrefs(nsIPrefBranch **aPrefBranch) -{ - if (mPrefBranch) - *aPrefBranch = mPrefBranch; - NS_IF_ADDREF(*aPrefBranch); - return (*aPrefBranch) ? NS_OK : NS_ERROR_FAILURE; -} - -PRBool CMozillaBrowser::BrowserIsValid() -{ - NG_TRACE_METHOD(CMozillaBrowser::BrowserIsValid); - return mValidBrowserFlag ? PR_TRUE : PR_FALSE; -} - -// Overrides of IWebBrowser / IWebBrowserApp / IWebBrowser2 methods - -HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Parent(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) -{ - NG_TRACE_METHOD(CMozillaBrowser::get_Parent); - ENSURE_BROWSER_IS_VALID(); - - if (!NgIsValidAddress(ppDisp, sizeof(IDispatch *))) - { - NG_ASSERT(0); - return SetErrorInfo(E_INVALIDARG); - } - - // Attempt to get the parent object of this control - HRESULT hr = E_FAIL; - if (m_spClientSite) - { - hr = m_spClientSite->QueryInterface(IID_IDispatch, (void **) ppDisp); - } - - return (SUCCEEDED(hr)) ? S_OK : E_NOINTERFACE; -} - -HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Document(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) -{ - NG_TRACE_METHOD(CMozillaBrowser::get_Document); - ENSURE_BROWSER_IS_VALID(); - - if (!NgIsValidAddress(ppDisp, sizeof(IDispatch *))) - { - NG_ASSERT(0); - return SetErrorInfo(E_UNEXPECTED); - } - - *ppDisp = NULL; - - // Get hold of the DOM document - nsIDOMDocument *pIDOMDocument = nsnull; - if (FAILED(GetDOMDocument(&pIDOMDocument)) || pIDOMDocument == nsnull) - { - return S_OK; // return NULL pointer - } - - if (mIERootDocument == NULL) - { - nsCOMPtr pIDOMHTMLDocument = - do_QueryInterface(pIDOMDocument); - - if (!pIDOMDocument) - { - return SetErrorInfo(E_FAIL, L"get_Document: not HTML"); - } - - CIEHtmlDocumentInstance::CreateInstance(&mIERootDocument); - if (mIERootDocument == NULL) - { - return SetErrorInfo(E_OUTOFMEMORY, L"get_Document: can't create IERootDocument"); - } - - // addref it so it doesn't go away on us. - mIERootDocument->AddRef(); - - // give it a pointer to us. note that we shouldn't be addref'd by this call, or it would be - // a circular reference. - mIERootDocument->SetParent(this); - mIERootDocument->SetDOMNode(pIDOMDocument); - mIERootDocument->SetNative(pIDOMHTMLDocument); - } - - mIERootDocument->QueryInterface(IID_IDispatch, (void **) ppDisp); - pIDOMDocument->Release(); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_RegisterAsDropTarget(VARIANT_BOOL __RPC_FAR *pbRegister) -{ - NG_TRACE_METHOD(CMozillaBrowser::get_RegisterAsDropTarget); - ENSURE_BROWSER_IS_VALID(); - - if (pbRegister == NULL) - { - NG_ASSERT(0); - return SetErrorInfo(E_INVALIDARG); - } - - *pbRegister = mHaveDropTargetFlag ? VARIANT_TRUE : VARIANT_FALSE; - return S_OK; -} - - - -static BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) -{ - ::RevokeDragDrop(hwnd); - return TRUE; -} - - -HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_RegisterAsDropTarget(VARIANT_BOOL bRegister) -{ - NG_TRACE_METHOD(CMozillaBrowser::put_RegisterAsDropTarget); - ENSURE_BROWSER_IS_VALID(); - - // Register the window as a drop target - if (bRegister == VARIANT_TRUE) - { - if (!mHaveDropTargetFlag) - { - CDropTargetInstance *pDropTarget = NULL; - CDropTargetInstance::CreateInstance(&pDropTarget); - if (pDropTarget) - { - pDropTarget->AddRef(); - pDropTarget->SetOwner(this); - - - // Ask the site if it wants to replace this drop target for another one - CIPtr(IDropTarget) spDropTarget; - CIPtr(IDocHostUIHandler) spDocHostUIHandler = m_spClientSite; - if (spDocHostUIHandler) - { - //if (spDocHostUIHandler->GetDropTarget(pDropTarget, &spDropTarget) != S_OK) - if (spDocHostUIHandler->GetDropTarget(pDropTarget, &spDropTarget) == S_OK) - { - mHaveDropTargetFlag = TRUE; - ::RegisterDragDrop(m_hWnd, spDropTarget); - //spDropTarget = pDropTarget; - } - } - else - //if (spDropTarget) - { - mHaveDropTargetFlag = TRUE; - ::RegisterDragDrop(m_hWnd, pDropTarget); - //::RegisterDragDrop(m_hWnd, spDropTarget); - } - pDropTarget->Release(); - } - // Now revoke any child window drop targets and pray they aren't - // reset by the layout engine. - ::EnumChildWindows(m_hWnd, EnumChildProc, (LPARAM) this); - } - } - else - { - if (mHaveDropTargetFlag) - { - mHaveDropTargetFlag = FALSE; - ::RevokeDragDrop(m_hWnd); - } - } - - return S_OK; -} - -/////////////////////////////////////////////////////////////////////////////// -// Ole Command Handlers - - -HRESULT _stdcall CMozillaBrowser::PrintHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) -{ - BOOL promptUser = (nCmdexecopt & OLECMDEXECOPT_DONTPROMPTUSER) ? FALSE : TRUE; - pThis->PrintDocument(promptUser); - return S_OK; -} - - -HRESULT _stdcall CMozillaBrowser::EditModeHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) -{ - BOOL bEditorMode = (nCmdID == IDM_EDITMODE) ? TRUE : FALSE; - pThis->SetEditorMode(bEditorMode); - return S_OK; -} - - -HRESULT _stdcall CMozillaBrowser::EditCommandHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) -{ - pThis->OnEditorCommand(nCmdID); - return S_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// SimpleDirectoryProvider implementation - -SimpleDirectoryProvider::SimpleDirectoryProvider() -{ - nsCOMPtr appDataDir; - - // Attempt to fill appDataDir with a meaningful value. Any error in the process - // will cause the constructor to return and IsValid() to return FALSE, - - CComPtr shellMalloc; - SHGetMalloc(&shellMalloc); - if (shellMalloc) - { - LPITEMIDLIST pitemidList = NULL; - SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pitemidList); - if (pitemidList) - { - TCHAR szBuffer[MAX_PATH + 1]; - if (SUCCEEDED(SHGetPathFromIDList(pitemidList, szBuffer))) - { - szBuffer[MAX_PATH] = TCHAR('\0'); - USES_CONVERSION; - NS_NewNativeLocalFile(nsDependentCString(T2A(szBuffer)), TRUE, getter_AddRefs(appDataDir)); - } - shellMalloc->Free(pitemidList); - } - } - if (!appDataDir) - { - return; - } - - // Mozilla control paths are - // App data - {Application Data}/MozillaControl - // App registry - {Application Data}/MozillaControl/registry.dat - // Profiles - {Application Data}/MozillaControl/profiles - - nsresult rv; - - // Create the root directory - PRBool exists; - rv = appDataDir->Exists(&exists); - if (NS_FAILED(rv) || !exists) return; - - // MozillaControl application data - rv = appDataDir->AppendRelativePath(NS_LITERAL_STRING("MozillaControl")); - if (NS_FAILED(rv)) return; - rv = appDataDir->Exists(&exists); - if (NS_SUCCEEDED(rv) && !exists) - rv = appDataDir->Create(nsIFile::DIRECTORY_TYPE, 0775); - if (NS_FAILED(rv)) return; - - // Registry.dat file - nsCOMPtr appDataRegAsFile; - rv = appDataDir->Clone(getter_AddRefs(appDataRegAsFile)); - if (NS_FAILED(rv)) return; - nsCOMPtr appDataRegistry = do_QueryInterface(appDataRegAsFile, &rv); - if (NS_FAILED(rv)) return; - appDataRegistry->AppendRelativePath(NS_LITERAL_STRING("registry.dat")); - - // Profiles directory - nsCOMPtr profileDirAsFile; - rv = appDataDir->Clone(getter_AddRefs(profileDirAsFile)); - if (NS_FAILED(rv)) return; - nsCOMPtr profileDir = do_QueryInterface(profileDirAsFile, &rv); - if (NS_FAILED(rv)) return; - profileDir->AppendRelativePath(NS_LITERAL_STRING("profiles")); - rv = profileDir->Exists(&exists); - if (NS_SUCCEEDED(rv) && !exists) - rv = profileDir->Create(nsIFile::DIRECTORY_TYPE, 0775); - if (NS_FAILED(rv)) return; - - // Store the member values - mApplicationRegistryDir = appDataDir; - mApplicationRegistryFile = appDataRegistry; - mUserProfileDir = profileDir; -} - -SimpleDirectoryProvider::~SimpleDirectoryProvider() -{ -} - -BOOL -SimpleDirectoryProvider::IsValid() const -{ - return (mApplicationRegistryDir && mApplicationRegistryFile && mUserProfileDir) ? - TRUE : FALSE; -} - -NS_IMPL_ISUPPORTS1(SimpleDirectoryProvider, nsIDirectoryServiceProvider) - -/////////////////////////////////////////////////////////////////////////////// -// nsIDirectoryServiceProvider - -/* nsIFile getFile (in string prop, out PRBool persistent); */ -NS_IMETHODIMP SimpleDirectoryProvider::GetFile(const char *prop, PRBool *persistent, nsIFile **_retval) -{ - NS_ENSURE_ARG_POINTER(prop); - NS_ENSURE_ARG_POINTER(persistent); - NS_ENSURE_ARG_POINTER(_retval); - - *_retval = nsnull; - *persistent = PR_TRUE; - - // Only need to support NS_APP_APPLICATION_REGISTRY_DIR, NS_APP_APPLICATION_REGISTRY_FILE, and - // NS_APP_USER_PROFILES_ROOT_DIR. Unsupported keys fallback to the default service provider - - nsCOMPtr localFile; - nsresult rv = NS_ERROR_FAILURE; - - if (strcmp(prop, NS_APP_APPLICATION_REGISTRY_DIR) == 0) - { - localFile = mApplicationRegistryDir; - } - else if (strcmp(prop, NS_APP_APPLICATION_REGISTRY_FILE) == 0) - { - localFile = mApplicationRegistryFile; - } - else if (strcmp(prop, NS_APP_USER_PROFILES_ROOT_DIR) == 0) - { - localFile = mUserProfileDir; - } - - if (localFile) - return CallQueryInterface(localFile, _retval); - - return rv; -} - - -/////////////////////////////////////////////////////////////////////////////// -// PrintListener implementation - - -#ifdef NS_PRINTING - -NS_IMPL_ISUPPORTS1(PrintListener, nsIWebProgressListener) - -PrintListener::PrintListener() : mComplete(PR_FALSE) -{ - /* member initializers and constructor code */ -} - -PrintListener::~PrintListener() -{ - /* destructor code */ -} - -void PrintListener::WaitForComplete() -{ - MSG msg; - HANDLE hFakeEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL); - - while (!mComplete) - { - // Process pending messages - while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) - { - if (!::GetMessage(&msg, NULL, 0, 0)) - { - ::CloseHandle(hFakeEvent); - return; - } - - PRBool wasHandled = PR_FALSE; - ::NS_HandleEmbeddingEvent(msg, wasHandled); - if (wasHandled) - continue; - - ::TranslateMessage(&msg); - ::DispatchMessage(&msg); - } - - if (mComplete) - break; - - // Do idle stuff - ::MsgWaitForMultipleObjects(1, &hFakeEvent, FALSE, 500, QS_ALLEVENTS); - } - - ::CloseHandle(hFakeEvent); -} - -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ -NS_IMETHODIMP PrintListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) -{ - if (aStateFlags & nsIWebProgressListener::STATE_STOP && - aStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT) - { - mComplete = PR_TRUE; - } - return NS_OK; -} - -/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */ -NS_IMETHODIMP PrintListener::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) -{ - return NS_OK; -} - -/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */ -NS_IMETHODIMP PrintListener::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) -{ - return NS_OK; -} - -/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ -NS_IMETHODIMP PrintListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) -{ - return NS_OK; -} - -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ -NS_IMETHODIMP PrintListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) -{ - return NS_OK; -} -#endif diff --git a/embedding/browser/activex/src/control/MozillaBrowser.h b/embedding/browser/activex/src/control/MozillaBrowser.h deleted file mode 100644 index 3b00d5dcdc1..00000000000 --- a/embedding/browser/activex/src/control/MozillaBrowser.h +++ /dev/null @@ -1,448 +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): - * Adam Lock - * - * 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 ***** */ -// MozillaBrowser.h : Declaration of the CMozillaBrowser - -#ifndef __MOZILLABROWSER_H_ -#define __MOZILLABROWSER_H_ - -#include "IWebBrowserImpl.h" - -// Commands sent via WM_COMMAND -enum { - ID_PRINT = 1, - ID_PAGESETUP, - ID_VIEWSOURCE, - ID_SAVEAS, - ID_PROPERTIES, - ID_CUT, - ID_COPY, - ID_PASTE, - ID_SELECTALL -}; - -// Command group and IDs exposed through IOleCommandTarget -extern GUID CGID_IWebBrowser_Moz; -extern GUID CGID_MSHTML_Moz; - -enum { - HTMLID_FIND = 1, - HTMLID_VIEWSOURCE, - HTMLID_OPTIONS -}; - -// A list of objects -typedef CComPtr CComUnkPtr; - -class CWebBrowserContainer; -class CPromptService; - -///////////////////////////////////////////////////////////////////////////// -// CMozillaBrowser -class ATL_NO_VTABLE CMozillaBrowser : - public CComObjectRootEx, - public CComCoClass, - public CComControl, - public IPropertyNotifySinkCP, - public IWebBrowserImpl, - public IProvideClassInfo2Impl<&CLSID_MozillaBrowser, &DIID_DWebBrowserEvents2, &LIBID_MOZILLACONTROLLib>, - public IPersistStreamInitImpl, - public IPersistStorageImpl, - public IPersistPropertyBagImpl, - public IQuickActivateImpl, - public IOleControlImpl, - public IOleObjectImpl, - public IOleInPlaceActiveObjectImpl, - public IViewObjectExImpl, - public IOleInPlaceObjectWindowlessImpl, - public IDataObjectImpl, - public ISupportErrorInfo, - public IOleCommandTargetImpl, - public IConnectionPointContainerImpl, - public ISpecifyPropertyPagesImpl, - public IObjectSafetyImpl, - public IMozControlBridge -{ - friend CWebBrowserContainer; - friend CPromptService; - -public: - CMozillaBrowser(); - virtual ~CMozillaBrowser(); - -DECLARE_REGISTRY_RESOURCEID(IDR_MOZILLABROWSER) - -BEGIN_COM_MAP(CMozillaBrowser) - // Mozilla control interfaces - COM_INTERFACE_ENTRY(IMozControlBridge) - // IE web browser interface - COM_INTERFACE_ENTRY(IWebBrowser2) - COM_INTERFACE_ENTRY_IID(IID_IDispatch, IWebBrowser2) - COM_INTERFACE_ENTRY_IID(IID_IWebBrowser, IWebBrowser2) - COM_INTERFACE_ENTRY_IID(IID_IWebBrowserApp, IWebBrowser2) - // Outgoing IE event interfaces - COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents, - CProxyDWebBrowserEvents) - COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents2, - CProxyDWebBrowserEvents2) - // Other ActiveX/OLE interfaces - COM_INTERFACE_ENTRY(IViewObjectEx) - COM_INTERFACE_ENTRY_IID(IID_IViewObject2, IViewObjectEx) - COM_INTERFACE_ENTRY_IID(IID_IViewObject, IViewObjectEx) - COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) - COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceObject, IOleInPlaceObjectWindowless) - COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) - COM_INTERFACE_ENTRY(IOleControl) - COM_INTERFACE_ENTRY(IOleObject) - COM_INTERFACE_ENTRY(IQuickActivate) // This causes size assertion in ATL - COM_INTERFACE_ENTRY2(IPersist, IPersistPropertyBag) - COM_INTERFACE_ENTRY(IPersistPropertyBag) - COM_INTERFACE_ENTRY(IPersistStreamInit) - COM_INTERFACE_ENTRY(IPersistStorage) - COM_INTERFACE_ENTRY(ISpecifyPropertyPages) - COM_INTERFACE_ENTRY(IDataObject) - COM_INTERFACE_ENTRY(IOleCommandTarget) - COM_INTERFACE_ENTRY(IProvideClassInfo) - COM_INTERFACE_ENTRY(IProvideClassInfo2) - COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY(IConnectionPointContainer) - COM_INTERFACE_ENTRY(IObjectSafety) -END_COM_MAP() - -// Properties supported by the control that map onto property -// pages that the user may be able to configure from tools like VB. - -BEGIN_PROPERTY_MAP(CMozillaBrowser) - // Example entries - // PROP_ENTRY("Property Description", dispid, clsid) - PROP_PAGE(CLSID_StockColorPage) - PROP_DATA_ENTRY("SRC", mInitialSrc, VT_BSTR) -END_PROPERTY_MAP() - -// Table of outgoing connection points. Anyone subscribing -// to events from the control should do so through one of these -// connect points. - -BEGIN_CONNECTION_POINT_MAP(CMozillaBrowser) - CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink) - // Fires IE events - CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents2) - CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents) -END_CONNECTION_POINT_MAP() - -// Table of window messages and their associate handlers - -BEGIN_MSG_MAP(CMozillaBrowser) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) - MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus) - MESSAGE_HANDLER(WM_GETDLGCODE, OnGetDlgCode) - MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) - COMMAND_ID_HANDLER(ID_PRINT, OnPrint) - COMMAND_ID_HANDLER(ID_PAGESETUP, OnPageSetup) - COMMAND_ID_HANDLER(ID_SAVEAS, OnSaveAs) - COMMAND_ID_HANDLER(ID_PROPERTIES, OnProperties) - COMMAND_ID_HANDLER(ID_CUT, OnCut) - COMMAND_ID_HANDLER(ID_COPY, OnCopy) - COMMAND_ID_HANDLER(ID_PASTE, OnPaste) - COMMAND_ID_HANDLER(ID_SELECTALL, OnSelectAll) - COMMAND_ID_HANDLER(ID_DOCUMENT_BACK, OnDocumentBack) - COMMAND_ID_HANDLER(ID_DOCUMENT_FORWARD, OnDocumentForward) - COMMAND_ID_HANDLER(ID_DOCUMENT_PRINT, OnDocumentPrint) - COMMAND_ID_HANDLER(ID_DOCUMENT_REFRESH, OnDocumentRefresh) - COMMAND_ID_HANDLER(ID_DOCUMENT_PROPERTIES, OnDocumentProperties) - COMMAND_ID_HANDLER(ID_DOCUMENT_VIEWSOURCE, OnViewSource) - COMMAND_ID_HANDLER(ID_LINK_OPEN, OnLinkOpen) - COMMAND_ID_HANDLER(ID_LINK_OPENINNEWWINDOW, OnLinkOpenInNewWindow) - COMMAND_ID_HANDLER(ID_LINK_COPYSHORTCUT, OnLinkCopyShortcut) - COMMAND_ID_HANDLER(ID_LINK_PROPERTIES, OnLinkProperties) -END_MSG_MAP() - - static HRESULT _stdcall PrintHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); - static HRESULT _stdcall EditModeHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); - static HRESULT _stdcall EditCommandHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); - -// Table of OLE commands (invoked through IOleCommandTarget and their -// associated command groups and command handlers. - -BEGIN_OLECOMMAND_TABLE() - // Standard "common" commands - OLECOMMAND_HANDLER(OLECMDID_PRINT, NULL, PrintHandler, L"Print", L"Print the page") - OLECOMMAND_MESSAGE(OLECMDID_PAGESETUP, NULL, ID_PAGESETUP, L"Page Setup", L"Page Setup") - OLECOMMAND_MESSAGE(OLECMDID_UNDO, NULL, 0, L"Undo", L"Undo") - OLECOMMAND_MESSAGE(OLECMDID_REDO, NULL, 0, L"Redo", L"Redo") - OLECOMMAND_MESSAGE(OLECMDID_REFRESH, NULL, 0, L"Refresh", L"Refresh") - OLECOMMAND_MESSAGE(OLECMDID_STOP, NULL, 0, L"Stop", L"Stop") - OLECOMMAND_MESSAGE(OLECMDID_ONUNLOAD, NULL, 0, L"OnUnload", L"OnUnload") - OLECOMMAND_MESSAGE(OLECMDID_SAVEAS, NULL, ID_SAVEAS, L"SaveAs", L"Save the page") - OLECOMMAND_MESSAGE(OLECMDID_CUT, NULL, ID_CUT, L"Cut", L"Cut selection") - OLECOMMAND_MESSAGE(OLECMDID_COPY, NULL, ID_COPY, L"Copy", L"Copy selection") - OLECOMMAND_MESSAGE(OLECMDID_PASTE, NULL, ID_PASTE, L"Paste", L"Paste as selection") - OLECOMMAND_MESSAGE(OLECMDID_SELECTALL, NULL, ID_SELECTALL, L"SelectAll", L"Select all") - OLECOMMAND_MESSAGE(OLECMDID_PROPERTIES, NULL, ID_PROPERTIES, L"Properties", L"Show page properties") - // Unsupported IE 4.x command group - OLECOMMAND_MESSAGE(HTMLID_FIND, &CGID_IWebBrowser_Moz, 0, L"Find", L"Find") - OLECOMMAND_MESSAGE(HTMLID_VIEWSOURCE, &CGID_IWebBrowser_Moz, ID_VIEWSOURCE, L"ViewSource", L"View Source") - OLECOMMAND_MESSAGE(HTMLID_OPTIONS, &CGID_IWebBrowser_Moz, 0, L"Options", L"Options") - // DHTML editor command group - OLECOMMAND_HANDLER(IDM_EDITMODE, &CGID_MSHTML_Moz, EditModeHandler, L"EditMode", L"Switch to edit mode") - OLECOMMAND_HANDLER(IDM_BROWSEMODE, &CGID_MSHTML_Moz, EditModeHandler, L"UserMode", L"Switch to user mode") - OLECOMMAND_HANDLER(IDM_BOLD, &CGID_MSHTML_Moz, EditCommandHandler, L"Bold", L"Toggle Bold") - OLECOMMAND_HANDLER(IDM_ITALIC, &CGID_MSHTML_Moz, EditCommandHandler, L"Italic", L"Toggle Italic") - OLECOMMAND_HANDLER(IDM_UNDERLINE, &CGID_MSHTML_Moz, EditCommandHandler, L"Underline", L"Toggle Underline") - OLECOMMAND_HANDLER(IDM_UNKNOWN, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_ALIGNBOTTOM, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_ALIGNHORIZONTALCENTERS, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_ALIGNLEFT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_ALIGNRIGHT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_ALIGNTOGRID, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_ALIGNTOP, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_ALIGNVERTICALCENTERS, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_ARRANGEBOTTOM, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_ARRANGERIGHT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_BRINGFORWARD, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_BRINGTOFRONT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_CENTERHORIZONTALLY, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_CENTERVERTICALLY, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_CODE, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_DELETE, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_FONTNAME, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_FONTSIZE, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_GROUP, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_HORIZSPACECONCATENATE, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_HORIZSPACEDECREASE, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_HORIZSPACEINCREASE, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_HORIZSPACEMAKEEQUAL, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_INSERTOBJECT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_MULTILEVELREDO, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_SENDBACKWARD, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_SENDTOBACK, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_SHOWTABLE, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_SIZETOCONTROL, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_SIZETOCONTROLHEIGHT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_SIZETOCONTROLWIDTH, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_SIZETOFIT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_SIZETOGRID, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_SNAPTOGRID, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_TABORDER, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_TOOLBOX, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_MULTILEVELUNDO, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_UNGROUP, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_VERTSPACECONCATENATE, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_VERTSPACEDECREASE, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_VERTSPACEINCREASE, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_VERTSPACEMAKEEQUAL, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_JUSTIFYFULL, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_BACKCOLOR, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_BORDERCOLOR, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_FLAT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_FORECOLOR, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_JUSTIFYCENTER, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_JUSTIFYGENERAL, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_JUSTIFYLEFT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_JUSTIFYRIGHT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_RAISED, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_SUNKEN, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_CHISELED, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_ETCHED, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_SHADOWED, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_FIND, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_SHOWGRID, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST0, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST1, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST2, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST3, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST4, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST5, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST6, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST7, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST8, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST9, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_OBJECTVERBLISTLAST, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_CONVERTOBJECT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_CUSTOMCONTROL, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_CUSTOMIZEITEM, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_RENAME, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_IMPORT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_NEWPAGE, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_MOVE, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_CANCEL, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_FONT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_STRIKETHROUGH, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_DELETEWORD, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_EXECPRINT, &CGID_MSHTML_Moz, NULL, L"", L"") - OLECOMMAND_HANDLER(IDM_JUSTIFYNONE, &CGID_MSHTML_Moz, NULL, L"", L"") -END_OLECOMMAND_TABLE() - - HWND GetCommandTargetWindow() const - { - return m_hWnd; - } - -// Windows message handlers - LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - LRESULT OnGetDlgCode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - - LRESULT OnPrint(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnPageSetup(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnViewSource(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - - LRESULT OnSaveAs(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnCut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnPaste(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnSelectAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - - LRESULT OnDocumentBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnDocumentForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnDocumentPrint(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnDocumentRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnDocumentProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - - LRESULT OnLinkOpen(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnLinkOpenInNewWindow(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnLinkCopyShortcut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnLinkProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// IViewObjectEx - STDMETHOD(GetViewStatus)(DWORD* pdwStatus) - { - ATLTRACE(_T("IViewObjectExImpl::GetViewStatus\n")); - *pdwStatus = VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE; - return S_OK; - } - -// Protected members -protected: - - // List of browsers - static nsTArray sBrowserList; - - // Name of profile to use - nsString mProfileName; - - // Pointer to web browser manager - CWebBrowserContainer * mWebBrowserContainer; - // CComObject to IHTMLDocument implementer - CIEHtmlDocumentInstance * mIERootDocument; - - // Mozilla interfaces - nsCOMPtr mWebBrowser; - nsCOMPtr mWebBrowserAsWin; - nsCOMPtr mEditingSession; - nsCOMPtr mCommandManager; - - // Context menu - nsCOMPtr mContextNode; - - // Prefs service - nsCOMPtr mPrefBranch; - - // Flag to indicate if browser is created or not - BOOL mValidBrowserFlag; - // Flag to indicate if browser is in edit mode or not - BOOL mEditModeFlag; - // Flag to indicate if the browser has a drop target - BOOL mHaveDropTargetFlag; - // Contains an error message if startup went wrong - tstring mStartupErrorMessage; - // Initial source url passed in via the container - CComBSTR mInitialSrc; - // List of registered browser helper objects - CComUnkPtr *mBrowserHelperList; - ULONG mBrowserHelperListCount; - - virtual HRESULT Initialize(); - virtual HRESULT Terminate(); - virtual HRESULT CreateBrowser(); - virtual HRESULT DestroyBrowser(); - virtual HRESULT SetStartupErrorMessage(UINT nStringID); - virtual HRESULT GetDOMDocument(nsIDOMDocument **pDocument); - virtual HRESULT SetEditorMode(BOOL bEnabled); - virtual HRESULT OnEditorCommand(DWORD nCmdID); - virtual HRESULT PrintDocument(BOOL promptUser); - - virtual HRESULT LoadBrowserHelpers(); - virtual HRESULT UnloadBrowserHelpers(); - - // User interface methods - virtual int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption = _T(""), UINT nType = MB_OK); - virtual void ShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode); - virtual void ShowURIPropertyDlg(const nsAString &aURI, const nsAString &aContentType); - virtual void NextDlgControl(); - virtual void PrevDlgControl(); - -public: -// IOleObjectImpl overrides - HRESULT InPlaceActivate(LONG iVerb, const RECT* prcPosRect); - -// IOleObject overrides - virtual HRESULT STDMETHODCALLTYPE CMozillaBrowser::GetClientSite(IOleClientSite **ppClientSite); - -// IMozControlBridge implementation - virtual HRESULT STDMETHODCALLTYPE GetWebBrowser(/* [out] */ void __RPC_FAR *__RPC_FAR *aBrowser); - -// IWebBrowserImpl overrides - virtual nsresult GetWebNavigation(nsIWebNavigation **aWebNav); - virtual nsresult GetDOMWindow(nsIDOMWindow **aDOMWindow); - virtual nsresult GetPrefs(nsIPrefBranch **aPrefBranch); - virtual PRBool BrowserIsValid(); - -// IWebBrowser - virtual HRESULT STDMETHODCALLTYPE get_Parent(IDispatch __RPC_FAR *__RPC_FAR *ppDisp); - virtual HRESULT STDMETHODCALLTYPE get_Document(IDispatch __RPC_FAR *__RPC_FAR *ppDisp); - virtual HRESULT STDMETHODCALLTYPE get_RegisterAsDropTarget(VARIANT_BOOL __RPC_FAR *pbRegister); - virtual HRESULT STDMETHODCALLTYPE put_RegisterAsDropTarget(VARIANT_BOOL bRegister); - -public: - HRESULT OnDraw(ATL_DRAWINFO& di); - -}; - -#endif //__MOZILLABROWSER_H_ diff --git a/embedding/browser/activex/src/control/MozillaBrowser.ico b/embedding/browser/activex/src/control/MozillaBrowser.ico deleted file mode 100644 index 01c6f785d3e..00000000000 Binary files a/embedding/browser/activex/src/control/MozillaBrowser.ico and /dev/null differ diff --git a/embedding/browser/activex/src/control/MozillaBrowser.rgs b/embedding/browser/activex/src/control/MozillaBrowser.rgs deleted file mode 100644 index deec131285f..00000000000 --- a/embedding/browser/activex/src/control/MozillaBrowser.rgs +++ /dev/null @@ -1,66 +0,0 @@ -HKCR -{ - Mozilla.Browser.1 = s 'Mozilla Web Browser' - { - CLSID = s '{1339B54C-3453-11D2-93B9-000000000000}' - } - Mozilla.Browser = s 'Mozilla Web Browser' - { - CurVer = s 'Mozilla.Browser.1' - } - NoRemove CLSID - { - ForceRemove {1339B54C-3453-11D2-93B9-000000000000} = s 'MozillaBrowser Class' - { - ProgID = s 'Mozilla.Browser.1' - VersionIndependentProgID = s 'Mozilla.Browser' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - ForceRemove 'Control' - ForceRemove 'Programmable' - ForceRemove 'Insertable' - ForceRemove 'ToolboxBitmap32' = s '%MODULE%, 1' - 'MiscStatus' = s '0' - { - '1' = s '131473' - } - 'TypeLib' = s '{1339B53E-3453-11D2-93B9-000000000000}' - 'Version' = s '1.0' - ForceRemove 'EnableFullPage' - { - ForceRemove .xul - ForceRemove .svg - } - } - } - NoRemove MIME - { - NoRemove Database - { - NoRemove 'Content Type' - { - ForceRemove 'application/vnd.mozilla.xul+xml' - { - val Extension = s '.xul' - val CLSID = s '{1339B54C-3453-11D2-93B9-000000000000}' - } - ForceRemove 'image/svg+xml' - { - val Extension = s '.svg' - val CLSID = s '{1339B54C-3453-11D2-93B9-000000000000}' - } - } - } - } - ForceRemove .xul = s 'Mozilla.Browser' - { - ForceRemove val 'Content Type' = s 'application/vnd.mozilla.xul+xml' - } - ForceRemove .svg = s 'Mozilla.Browser' - { - ForceRemove val 'Content Type' = s 'image/svg+xml' - } -} diff --git a/embedding/browser/activex/src/control/MozillaControl.cpp b/embedding/browser/activex/src/control/MozillaControl.cpp deleted file mode 100644 index 7d274ca6763..00000000000 --- a/embedding/browser/activex/src/control/MozillaControl.cpp +++ /dev/null @@ -1,117 +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): - * Adam Lock - * - * 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 ***** */ - -// MozillaControl.cpp : Implementation of DLL Exports. - - -// Note: Proxy/Stub Information -// To build a separate proxy/stub DLL, -// run nmake -f MozillaControlps.mk in the project directory. - -#include "stdafx.h" -#include "resource.h" -#include "initguid.h" -#include "MozillaControl.h" - -#include "MozillaControl_i.c" -#include "MozillaBrowser.h" - -CComModule _Module; - -BEGIN_OBJECT_MAP(ObjectMap) - OBJECT_ENTRY(CLSID_MozillaBrowser, CMozillaBrowser) -END_OBJECT_MAP() - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - NG_TRACE_METHOD(DllMain); - - if (dwReason == DLL_PROCESS_ATTACH) - { - NG_TRACE(_T("Mozilla ActiveX - DLL_PROCESS_ATTACH\n")); - _Module.Init(ObjectMap, hInstance); - DisableThreadLibraryCalls(hInstance); - } - else if (dwReason == DLL_PROCESS_DETACH) - { - NG_TRACE(_T("Mozilla ActiveX - DLL_PROCESS_DETACH\n")); - _Module.Term(); - } - - return TRUE; // ok -} - -///////////////////////////////////////////////////////////////////////////// -// Used to determine whether the DLL can be unloaded by OLE - -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ - return _Module.GetClassObject(rclsid, riid, ppv); -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -STDAPI DllRegisterServer(void) -{ - // registers object, typelib and all interfaces in typelib - return _Module.RegisterServer(TRUE); -} - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry - -STDAPI DllUnregisterServer(void) -{ - _Module.UnregisterServer(); - return S_OK; -} - - diff --git a/embedding/browser/activex/src/control/MozillaControl.dsp b/embedding/browser/activex/src/control/MozillaControl.dsp deleted file mode 100644 index ed4fb74b30f..00000000000 --- a/embedding/browser/activex/src/control/MozillaControl.dsp +++ /dev/null @@ -1,335 +0,0 @@ -# Microsoft Developer Studio Project File - Name="MozillaControl" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) External Target" 0x0106 - -CFG=MozillaControl - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "MozillaControl.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "MozillaControl.mak" CFG="MozillaControl - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "MozillaControl - Win32 Release" (based on "Win32 (x86) External Target") -!MESSAGE "MozillaControl - Win32 Debug" (based on "Win32 (x86) External Target") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" - -!IF "$(CFG)" == "MozillaControl - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Cmd_Line "NMAKE /f MozillaControl.mak" -# PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "MozillaControl.exe" -# PROP BASE Bsc_Name "MozillaControl.bsc" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Cmd_Line "nmake /f makefile.win" -# PROP Rebuild_Opt "/a" -# PROP Target_File "win32_o.obj\mozctl.dll" -# PROP Bsc_Name "" -# PROP Target_Dir "" - -!ELSEIF "$(CFG)" == "MozillaControl - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Cmd_Line "NMAKE /f MozillaControl.mak" -# PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "MozillaControl.exe" -# PROP BASE Bsc_Name "MozillaControl.bsc" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Cmd_Line "nmake /f makefile.win" -# PROP Rebuild_Opt "/a" -# PROP Target_File "M:\source\mozilla\dist\WIN32_D.OBJ\bin\mozctl.dll" -# PROP Bsc_Name "" -# PROP Target_Dir "" - -!ENDIF - -# Begin Target - -# Name "MozillaControl - Win32 Release" -# Name "MozillaControl - Win32 Debug" - -!IF "$(CFG)" == "MozillaControl - Win32 Release" - -!ELSEIF "$(CFG)" == "MozillaControl - Win32 Debug" - -!ENDIF - -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\ActiveScriptSite.cpp -# End Source File -# Begin Source File - -SOURCE=.\DropTarget.cpp -# End Source File -# Begin Source File - -SOURCE=.\HelperAppDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\IEHtmlDocument.cpp -# End Source File -# Begin Source File - -SOURCE=.\MozillaBrowser.cpp -# End Source File -# Begin Source File - -SOURCE=.\MozillaControl.cpp -# End Source File -# Begin Source File - -SOURCE=.\MozillaControl.idl -# End Source File -# Begin Source File - -SOURCE=.\PromptService.cpp -# End Source File -# Begin Source File - -SOURCE=.\PropertyDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# End Source File -# Begin Source File - -SOURCE=.\WebBrowserContainer.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowCreator.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ActiveScriptSite.h -# End Source File -# Begin Source File - -SOURCE=.\ActiveXTypes.h -# End Source File -# Begin Source File - -SOURCE=.\BrowserDiagnostics.h -# End Source File -# Begin Source File - -SOURCE=.\DHTMLCmdIds.h -# End Source File -# Begin Source File - -SOURCE=.\DropTarget.h -# End Source File -# Begin Source File - -SOURCE=.\HelperAppDlg.h -# End Source File -# Begin Source File - -SOURCE=.\IEHtmlDocument.h -# End Source File -# Begin Source File - -SOURCE=.\MozillaBrowser.h -# End Source File -# Begin Source File - -SOURCE=.\PromptService.h -# End Source File -# Begin Source File - -SOURCE=.\PropertyDlg.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\WebBrowserContainer.h -# End Source File -# Begin Source File - -SOURCE=.\WindowCreator.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\MozillaBrowser.ico -# End Source File -# Begin Source File - -SOURCE=.\MozillaBrowser.rgs -# End Source File -# Begin Source File - -SOURCE=.\MozillaControl.rc -# End Source File -# End Group -# Begin Group "Common Source Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\common\ControlEventSink.cpp -# End Source File -# Begin Source File - -SOURCE=..\common\ControlSite.cpp -# End Source File -# Begin Source File - -SOURCE=..\common\ControlSiteIPFrame.cpp -# End Source File -# Begin Source File - -SOURCE=..\common\IEHtmlButtonElement.cpp -# End Source File -# Begin Source File -SOURCE=..\common\IEHtmlElement.cpp -# End Source File -# Begin Source File - -SOURCE=..\common\IEHtmlElementCollection.cpp -# End Source File -# Begin Source File - -SOURCE=..\common\IEHtmlNode.cpp -# End Source File -# Begin Source File - -SOURCE=..\common\IEHtmlSelectionObject.cpp -# End Source File -# Begin Source File - -SOURCE=..\common\IEHtmlTxtRange.cpp -# End Source File -# Begin Source File - -SOURCE=..\common\ItemContainer.cpp -# End Source File -# Begin Source File - -SOURCE=..\common\PropertyBag.cpp -# End Source File -# End Group -# Begin Group "Common Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\common\ControlEventSink.h -# End Source File -# Begin Source File - -SOURCE=..\common\ControlSite.h -# End Source File -# Begin Source File - -SOURCE=..\common\ControlSiteIPFrame.h -# End Source File -# Begin Source File - -SOURCE=..\common\CPMozillaControl.h -# End Source File -# Begin Source File - -SOURCE=..\common\IEHtmlButtonElement.h -# End Source File -# Begin Source File -SOURCE=..\common\IEHtmlElement.h -# End Source File -# Begin Source File - -SOURCE=..\common\IEHtmlElementCollection.h -# End Source File -# Begin Source File - -SOURCE=..\common\IEHtmlNode.h -# End Source File -# Begin Source File - -SOURCE=..\common\IEHtmlSelectionObject.h -# End Source File -# Begin Source File - -SOURCE=..\common\IEHtmlTxtRange.h -# End Source File -# Begin Source File - -SOURCE=..\common\IHTMLLocationImpl.h -# End Source File -# Begin Source File - -SOURCE=..\common\IOleCommandTargetImpl.h -# End Source File -# Begin Source File - -SOURCE=..\common\ItemContainer.h -# End Source File -# Begin Source File - -SOURCE=..\common\IWebBrowserImpl.h -# End Source File -# Begin Source File - -SOURCE=..\common\PropertyBag.h -# End Source File -# Begin Source File - -SOURCE=..\common\PropertyList.h -# End Source File -# Begin Source File - -SOURCE=..\common\StdAfx.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\Makefile.in -# End Source File -# End Target -# End Project diff --git a/embedding/browser/activex/src/control/MozillaControl.idl b/embedding/browser/activex/src/control/MozillaControl.idl deleted file mode 100644 index 6675aeaa6a1..00000000000 --- a/embedding/browser/activex/src/control/MozillaControl.idl +++ /dev/null @@ -1,483 +0,0 @@ -/* -*- Mode: IDL; tab-width: 4; 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 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 - -// This file will be processed by the MIDL tool to -// produce the type library (MozillaControl.tlb) and marshalling code. - -import "oaidl.idl"; -import "ocidl.idl"; -import "docobj.idl"; - -// See note below for why IWebBrowser is not imported this way -// import "exdisp.idl"; - -#include - -[ - uuid(1339B53E-3453-11D2-93B9-000000000000), - version(1.0), - helpstring("MozillaControl 1.0 Type Library") -] -library MOZILLACONTROLLib -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - - // Stop interfaces and other bits from being redefined by the IE header file - - cpp_quote("#ifndef __exdisp_h__") - cpp_quote("#define __exdisp_h__") - - // NOTE: There is a very specific reason for repeating the IWebBrowser - // and other bits verbatim rather than import'ing exdisp.idl - - // MIDL fails with a MIDL2020 error if we try that! - - [ - uuid(EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B), // IID_IWebBrowser - helpstring("Web Browser interface"), - helpcontext(0x0000), - hidden, - dual, - oleautomation, - odl - ] - interface IWebBrowser : IDispatch - { - [id(100), helpstring("Navigates to the previous item in the history list."), helpcontext(0x0000)] - HRESULT GoBack(); - [id(101), helpstring("Navigates to the next item in the history list."), helpcontext(0x0000)] - HRESULT GoForward(); - [id(102), helpstring("Go home/start page."), helpcontext(0x0000)] - HRESULT GoHome(); - [id(103), helpstring("Go Search Page."), helpcontext(0x0000)] - HRESULT GoSearch(); - - [id(104), helpstring("Navigates to a URL or file."), helpcontext(0x0000)] - HRESULT Navigate([in] BSTR URL, - [in, optional] VARIANT * Flags, - [in, optional] VARIANT * TargetFrameName, - [in, optional] VARIANT * PostData, - [in, optional] VARIANT * Headers); - typedef - [ - uuid(14EE5380-A378-11cf-A731-00A0C9082637), - helpstring("Constants for WebBrowser navigation flags") - ] - enum BrowserNavConstants { - [helpstring("Open in new window")] navOpenInNewWindow = 0x0001, - [helpstring("Exclude from history list")] navNoHistory = 0x0002, - [helpstring("Don't read from cache")] navNoReadFromCache = 0x0004, - [helpstring("Don't write from cache")] navNoWriteToCache = 0x0008, - [helpstring("Try other sites on failure")] navAllowAutosearch = 0x0010, - [helpstring("OpenBrowserBar")] navBrowserBar = 0x0020, - } BrowserNavConstants; - - [id(DISPID_REFRESH), helpstring("Refresh the currently viewed page."), helpcontext(0x0000)] - HRESULT Refresh(); - - // The standard Refresh takes no parameters and we need some... use a new name - [id(105), helpstring("Refresh the currently viewed page."), helpcontext(0x0000)] - HRESULT Refresh2([in,optional] VARIANT * Level); - - typedef - [ - uuid(C317C261-A991-11cf-A731-00A0C9082637), - helpstring("Constants for Refresh") - ] - enum RefreshConstants { // must map to these in sdk\inc\docobj.h - [helpstring("Refresh normal")] REFRESH_NORMAL = 0, //== OLECMDIDF_REFRESH_NORMAL - [helpstring("Refresh if expired")] REFRESH_IFEXPIRED = 1, //== OLECMDIDF_REFRESH_IFEXPIRED - [helpstring("Refresh completely")] REFRESH_COMPLETELY = 3 //== OLECMDIDF_REFRESH_COMPLETELY - } RefreshConstants; - - [id(106), helpstring("Stops opening a file."), helpcontext(0x0000)] - HRESULT Stop(); - - // Automation hierarchy... - [id(200), propget, helpstring("Returns the application automation object if accessible, this automation object otherwise.."), helpcontext(0x0000)] - HRESULT Application([out,retval] IDispatch** ppDisp); - - [id(201), propget, helpstring("Returns the automation object of the container/parent if one exists or this automation object."), helpcontext(0x0000)] - HRESULT Parent([out,retval] IDispatch** ppDisp); - - [id(202), propget, helpstring("Returns the container/parent automation object, if any."), helpcontext(0x0000)] - HRESULT Container([out,retval] IDispatch** ppDisp); - - [id(203), propget, helpstring("Returns the active Document automation object, if any."), helpcontext(0x0000)] - HRESULT Document([out,retval] IDispatch** ppDisp); - - [id(204), propget, helpstring("Returns True if this is the top level object."), helpcontext(0x0000)] - HRESULT TopLevelContainer([out, retval] VARIANT_BOOL* pBool); - - [id(205), propget, helpstring("Returns the type of the contained document object."), helpcontext(0x0000)] - HRESULT Type([out,retval] BSTR* Type); - - // Window stuff... - [id(206), propget, helpstring("The horizontal position (pixels) of the frame window relative to the screen/container."), helpcontext(0x0000)] - HRESULT Left([out, retval] long *pl); - [id(206), propput] - HRESULT Left([in] long Left); - [id(207), propget, helpstring("The vertical position (pixels) of the frame window relative to the screen/container."), helpcontext(0x0000)] - HRESULT Top([out, retval] long *pl); - [id(207), propput] - HRESULT Top([in] long Top); - [id(208), propget, helpstring("The horizontal dimension (pixels) of the frame window/object."), helpcontext(0x0000)] - HRESULT Width([out, retval] long *pl); - [id(208), propput] - HRESULT Width([in] long Width); - [id(209), propget, helpstring("The vertical dimension (pixels) of the frame window/object."), helpcontext(0x0000)] - HRESULT Height([out, retval] long *pl); - [id(209), propput] - HRESULT Height([in] long Height); - - // WebBrowser stuff... - [id(210), propget, helpstring("Gets the short (UI-friendly) name of the URL/file currently viewed."), helpcontext(0x0000)] - HRESULT LocationName([out,retval] BSTR *LocationName); - - [id(211), propget, helpstring("Gets the full URL/path currently viewed."), helpcontext(0x0000)] - HRESULT LocationURL([out,retval] BSTR * LocationURL); - - // Added a property to see if the viewer is currenly busy or not... - [id(212), propget, helpstring("Query to see if something is still in progress."), helpcontext(0x0000)] - HRESULT Busy([out,retval] VARIANT_BOOL *pBool); - } - - [ - uuid(0002DF05-0000-0000-C000-000000000046), // IID_IWebBrowserApp - helpstring("Web Browser Application Interface."), - helpcontext(0x0000), - hidden, - oleautomation, - dual - ] - interface IWebBrowserApp : IWebBrowser - { - [id(300), helpstring("Exits application and closes the open document."), helpcontext(0x0000)] - HRESULT Quit(); - - [id(301), helpstring("Converts client sizes into window sizes."), helpcontext(0x0000)] - HRESULT ClientToWindow([in,out] int* pcx, [in,out] int* pcy); - - [id(302), helpstring("Associates vtValue with the name szProperty in the context of the object."), helpcontext(0x0000)] - HRESULT PutProperty([in] BSTR Property, [in] VARIANT vtValue); - - [id(303), helpstring("Retrieve the Associated value for the property vtValue in the context of the object."), helpcontext(0x0000)] - HRESULT GetProperty([in] BSTR Property, [out, retval] VARIANT *pvtValue); - - [id(0), propget, helpstring("Returns name of the application."), helpcontext(0x0000)] - HRESULT Name([out,retval] BSTR* Name); - - [id(DISPID_HWND), propget, helpstring("Returns the HWND of the current IE window."), helpcontext(0x0000)] - HRESULT HWND([out,retval] SHANDLE_PTR *pHWND); - - [id(400), propget, helpstring("Returns file specification of the application, including path."), helpcontext(0x0000)] - HRESULT FullName([out,retval] BSTR* FullName); - - [id(401), propget, helpstring("Returns the path to the application."), helpcontext(0x0000)] - HRESULT Path([out,retval] BSTR* Path); - - [id(402), propget, helpstring("Determines whether the application is visible or hidden."), helpcontext(0x0000)] - HRESULT Visible([out, retval] VARIANT_BOOL* pBool); - [id(402), propput, helpstring("Determines whether the application is visible or hidden."), helpcontext(0x0000)] - HRESULT Visible([in] VARIANT_BOOL Value); - - [id(403), propget, helpstring("Turn on or off the statusbar."), helpcontext(0x0000)] - HRESULT StatusBar([out, retval] VARIANT_BOOL* pBool); - [id(403), propput, helpstring("Turn on or off the statusbar."), helpcontext(0x0000)] - HRESULT StatusBar([in] VARIANT_BOOL Value); - - [id(404), propget, helpstring("Text of Status window."), helpcontext(0x0000)] - HRESULT StatusText([out, retval] BSTR *StatusText); - [id(404), propput, helpstring("Text of Status window."), helpcontext(0x0000)] - HRESULT StatusText([in] BSTR StatusText); - - [id(405), propget, helpstring("Controls which toolbar is shown."), helpcontext(0x0000)] - HRESULT ToolBar([out, retval] int * Value); - [id(405), propput, helpstring("Controls which toolbar is shown."), helpcontext(0x0000)] - HRESULT ToolBar([in] int Value); - - [id(406), propget, helpstring("Controls whether menubar is shown."), helpcontext(0x0000)] - HRESULT MenuBar([out, retval] VARIANT_BOOL * Value); - [id(406), propput, helpstring("Controls whether menubar is shown."), helpcontext(0x0000)] - HRESULT MenuBar([in] VARIANT_BOOL Value); - - [id(407), propget, helpstring("Maximizes window and turns off statusbar, toolbar, menubar, and titlebar."), helpcontext(0x0000)] - HRESULT FullScreen([out, retval] VARIANT_BOOL * pbFullScreen); - [id(407), propput, helpstring("Maximizes window and turns off statusbar, toolbar, menubar, and titlebar."), helpcontext(0x0000)] - HRESULT FullScreen([in] VARIANT_BOOL bFullScreen); - } - - [ - uuid(D30C1661-CDAF-11d0-8A3E-00C04FC9E26E), // IID_IWebBrowser2 - helpstring("Web Browser Interface for IE4."), - helpcontext(0x0000), - hidden, - oleautomation, - dual - ] - interface IWebBrowser2 : IWebBrowserApp - { - [id(500), helpstring("Navigates to a URL or file or pidl."), helpcontext(0x0000)] - HRESULT Navigate2([in] VARIANT * URL, - [in, optional] VARIANT * Flags, - [in, optional] VARIANT * TargetFrameName, - [in, optional] VARIANT * PostData, - [in, optional] VARIANT * Headers); - - - [id(501), helpstring("IOleCommandTarget::QueryStatus"), helpcontext(0x0000)] - HRESULT QueryStatusWB([in] OLECMDID cmdID, [out, retval] OLECMDF * pcmdf); - [id(502), helpstring("IOleCommandTarget::Exec"), helpcontext(0x0000)] - HRESULT ExecWB([in] OLECMDID cmdID, [in] OLECMDEXECOPT cmdexecopt, [in, optional] VARIANT * pvaIn, [out, in, optional] VARIANT * pvaOut); - [id(503), helpstring("Set BrowserBar to Clsid"), helpcontext(0x0000)] - HRESULT ShowBrowserBar( [in] VARIANT * pvaClsid, - [in, optional] VARIANT * pvarShow, - [in, optional] VARIANT * pvarSize ); - - [id(DISPID_READYSTATE), propget, bindable] - HRESULT ReadyState([retval, out] READYSTATE * plReadyState); - - [id(550), propget, helpstring("Controls if the frame is offline (read from cache)"), helpcontext(0x0000)] - HRESULT Offline([out, retval] VARIANT_BOOL * pbOffline); - [id(550), propput, helpstring("Controls if the frame is offline (read from cache)"), helpcontext(0x0000)] - HRESULT Offline([in] VARIANT_BOOL bOffline); - - [id(551), propget, helpstring("Controls if any dialog boxes can be shown"), helpcontext(0x0000)] - HRESULT Silent([out, retval] VARIANT_BOOL * pbSilent); - [id(551), propput, helpstring("Controls if any dialog boxes can be shown"), helpcontext(0x0000)] - HRESULT Silent([in] VARIANT_BOOL bSilent); - - [id(552), propget, helpstring("Registers OC as a top-level browser (for target name resolution)"), helpcontext(0x0000)] - HRESULT RegisterAsBrowser([out, retval] VARIANT_BOOL * pbRegister); - [id(552), propput, helpstring("Registers OC as a top-level browser (for target name resolution)"), helpcontext(0x0000)] - HRESULT RegisterAsBrowser([in] VARIANT_BOOL bRegister); - - [id(553), propget, helpstring("Registers OC as a drop target for navigation"), helpcontext(0x0000)] - HRESULT RegisterAsDropTarget([out, retval] VARIANT_BOOL * pbRegister); - [id(553), propput, helpstring("Registers OC as a drop target for navigation"), helpcontext(0x0000)] - HRESULT RegisterAsDropTarget([in] VARIANT_BOOL bRegister); - - [id(554), propget, helpstring("Controls if the browser is in theater mode"), helpcontext(0x0000)] - HRESULT TheaterMode([out, retval] VARIANT_BOOL * pbRegister); - [id(554), propput, helpstring("Controls if the browser is in theater mode"), helpcontext(0x0000)] - HRESULT TheaterMode([in] VARIANT_BOOL bRegister); - - [id(555), propget, helpstring("Controls whether address bar is shown"), helpcontext(0x0000)] - HRESULT AddressBar([out, retval] VARIANT_BOOL * Value); - [id(555), propput, helpstring("Controls whether address bar is shown"), helpcontext(0x0000)] - HRESULT AddressBar([in] VARIANT_BOOL Value); - - [id(556), propget, helpstring("Controls whether the window is resizable"), helpcontext(0x0000)] - HRESULT Resizable([out, retval] VARIANT_BOOL * Value); - [id(556), propput, helpstring("Controls whether the window is resizable"), helpcontext(0x0000)] - HRESULT Resizable([in] VARIANT_BOOL Value); - } - - [ - uuid(EAB22AC2-30C1-11CF-A7EB-0000C05BAE0B), // DIID_DWebBrowserEvents - helpstring("Web Browser Control Events (old)"), - hidden - ] - dispinterface DWebBrowserEvents - { - properties: - methods: - [id(DISPID_BEFORENAVIGATE), helpstring("Fired when a new hyperlink is being navigated to."), helpcontext(0x0000)] - void BeforeNavigate([in] BSTR URL, long Flags, BSTR TargetFrameName, VARIANT * PostData, BSTR Headers, [in, out]VARIANT_BOOL * Cancel); - - [id(DISPID_NAVIGATECOMPLETE), helpstring("Fired when the document being navigated to becomes visible and enters the navigation stack."), helpcontext(0x0000)] - void NavigateComplete([in] BSTR URL ); - - [id(DISPID_STATUSTEXTCHANGE), helpstring("Statusbar text changed."), helpcontext(0x0000)] - void StatusTextChange([in]BSTR Text); - - [id(DISPID_PROGRESSCHANGE), helpstring("Fired when download progress is updated."), helpcontext(0x0000)] - void ProgressChange([in] long Progress, [in] long ProgressMax); - - [id(DISPID_DOWNLOADCOMPLETE), helpstring("Download of page complete."), helpcontext(0x0000)] - void DownloadComplete(); - - [id(DISPID_COMMANDSTATECHANGE), helpstring("The enabled state of a command changed"), helpcontext(0x0000)] - void CommandStateChange([in] long Command, [in] VARIANT_BOOL Enable); - - [id(DISPID_DOWNLOADBEGIN), helpstring("Download of a page started."), helpcontext(0x000)] - void DownloadBegin(); - - [id(DISPID_NEWWINDOW), helpstring("Fired when a new window should be created."), helpcontext(0x0000)] - void NewWindow([in] BSTR URL, [in] long Flags, [in] BSTR TargetFrameName, [in] VARIANT * PostData, [in] BSTR Headers, [in,out] VARIANT_BOOL * Processed); - - [id(DISPID_TITLECHANGE), helpstring("Document title changed."), helpcontext(0x0000)] - void TitleChange([in]BSTR Text); - - [id(DISPID_FRAMEBEFORENAVIGATE), helpstring("Fired when a new hyperlink is being navigated to in a frame."), helpcontext(0x0000)] - void FrameBeforeNavigate([in] BSTR URL, long Flags, BSTR TargetFrameName, VARIANT * PostData, BSTR Headers, [in, out]VARIANT_BOOL * Cancel); - - [id(DISPID_FRAMENAVIGATECOMPLETE), helpstring("Fired when a new hyperlink is being navigated to in a frame."), helpcontext(0x0000)] - void FrameNavigateComplete([in] BSTR URL ); - - [id(DISPID_FRAMENEWWINDOW), helpstring("Fired when a new window should be created."), helpcontext(0x0000)] - void FrameNewWindow([in] BSTR URL, [in] long Flags, [in] BSTR TargetFrameName, [in] VARIANT * PostData, [in] BSTR Headers, [in,out] VARIANT_BOOL * Processed); - - // The following are IWebBrowserApp specific: - // - [id(DISPID_QUIT), helpstring("Fired when application is quiting."), helpcontext(0x0000)] - void Quit([in, out] VARIANT_BOOL * Cancel); - - [id(DISPID_WINDOWMOVE), helpstring("Fired when window has been moved."), helpcontext(0x0000)] - void WindowMove(); - - [id(DISPID_WINDOWRESIZE), helpstring("Fired when window has been sized."), helpcontext(0x0000)] - void WindowResize(); - - [id(DISPID_WINDOWACTIVATE), helpstring("Fired when window has been activated."), helpcontext(0x0000)] - void WindowActivate(); - - [id(DISPID_PROPERTYCHANGE), helpstring("Fired when the PutProperty method has been called."), helpcontext(0x0000)] - void PropertyChange([in] BSTR Property); - } - - [ - uuid(34A715A0-6587-11D0-924A-0020AFC7AC4D), // IID_DWebBrowserEvents2 - helpstring("Web Browser Control events interface"), - hidden - ] - dispinterface DWebBrowserEvents2 - { - properties: - methods: - [id(DISPID_STATUSTEXTCHANGE), helpstring("Statusbar text changed."), helpcontext(0x0000)] - void StatusTextChange([in]BSTR Text); - - [id(DISPID_PROGRESSCHANGE), helpstring("Fired when download progress is updated."), helpcontext(0x0000)] - void ProgressChange([in] long Progress, [in] long ProgressMax); - - [id(DISPID_COMMANDSTATECHANGE), helpstring("The enabled state of a command changed."), helpcontext(0x0000)] - void CommandStateChange([in] long Command, [in] VARIANT_BOOL Enable); - - [id(DISPID_DOWNLOADBEGIN), helpstring("Download of a page started."), helpcontext(0x000)] - void DownloadBegin(); - - [id(DISPID_DOWNLOADCOMPLETE), helpstring("Download of page complete."), helpcontext(0x0000)] - void DownloadComplete(); - - [id(DISPID_TITLECHANGE), helpstring("Document title changed."), helpcontext(0x0000)] - void TitleChange([in] BSTR Text); - - [id(DISPID_PROPERTYCHANGE), helpstring("Fired when the PutProperty method has been called."), helpcontext(0x0000)] - void PropertyChange([in] BSTR szProperty); - - // New events for IE40: - // - [id(DISPID_BEFORENAVIGATE2), helpstring("Fired before navigate occurs in the given WebBrowser (window or frameset element). The processing of this navigation may be modified."), helpcontext(0x0000)] - void BeforeNavigate2([in] IDispatch* pDisp, - [in] VARIANT * URL, [in] VARIANT * Flags, [in] VARIANT * TargetFrameName, [in] VARIANT * PostData, [in] VARIANT * Headers, - [in,out] VARIANT_BOOL * Cancel); - - [id(DISPID_NEWWINDOW2), helpstring("A new, hidden, non-navigated WebBrowser window is needed."), helpcontext(0x0000)] - void NewWindow2([in, out] IDispatch** ppDisp, [in, out] VARIANT_BOOL * Cancel); - - [id(DISPID_NAVIGATECOMPLETE2), helpstring("Fired when the document being navigated to becomes visible and enters the navigation stack."), helpcontext(0x0000)] - void NavigateComplete2([in] IDispatch* pDisp, [in] VARIANT * URL ); - - [id(DISPID_DOCUMENTCOMPLETE), helpstring("Fired when the document being navigated to reaches ReadyState_Complete."), helpcontext(0x0000)] - void DocumentComplete([in] IDispatch* pDisp, [in] VARIANT * URL ); - - [id(DISPID_ONQUIT), helpstring("Fired when application is quiting."), helpcontext(0x0000)] - void OnQuit(); - - [id(DISPID_ONVISIBLE), helpstring("Fired when the window should be shown/hidden"), helpcontext(0x0000)] - void OnVisible([in] VARIANT_BOOL Visible); - - [id(DISPID_ONTOOLBAR), helpstring("Fired when the toolbar should be shown/hidden"), helpcontext(0x0000)] - void OnToolBar([in] VARIANT_BOOL ToolBar); - - [id(DISPID_ONMENUBAR), helpstring("Fired when the menubar should be shown/hidden"), helpcontext(0x0000)] - void OnMenuBar([in] VARIANT_BOOL MenuBar); - - [id(DISPID_ONSTATUSBAR), helpstring("Fired when the statusbar should be shown/hidden"), helpcontext(0x0000)] - void OnStatusBar([in] VARIANT_BOOL StatusBar); - - [id(DISPID_ONFULLSCREEN), helpstring("Fired when fullscreen mode should be on/off"), helpcontext(0x0000)] - void OnFullScreen([in] VARIANT_BOOL FullScreen); - - [id(DISPID_ONTHEATERMODE), helpstring("Fired when theater mode should be on/off"), helpcontext(0x0000)] - void OnTheaterMode([in] VARIANT_BOOL TheaterMode); - } - - // Now a private interface for those ActiveX programmers who want to get - // their hands on the Mozilla internal interfaces. Note that XPCOM - // interfaces are cast into void * parameters but they follow - // the normal COM refcounting rules for in, in-out & out parameters. - - [ - uuid(D6131E69-4A89-4ab5-B916-5A581D66C84F), - ] - interface IMozControlBridge : IUnknown - { - // Method to get the nsIWebBrowser interface (refcounted but cast into a void) - HRESULT GetWebBrowser([out] void **aBrowser); - } - - typedef - [ - uuid(34A226E0-DF30-11CF-89A9-00A0C9054129), - helpstring("Constants for WebBrowser CommandStateChange") - ] - enum CommandStateChangeConstants { - [helpstring("Command Change")] CSC_UPDATECOMMANDS = 0xFFFFFFFF, - [helpstring("Navigate Forward")] CSC_NAVIGATEFORWARD = 0x00000001, - [helpstring("Navigate Back")] CSC_NAVIGATEBACK = 0x00000002, - } CommandStateChangeConstants; - - [ - uuid(1339B54C-3453-11D2-93B9-000000000000), - helpstring("MozillaBrowser Class") - ] - coclass MozillaBrowser - { - [default] interface IWebBrowser2; - interface IWebBrowser; - interface IWebBrowserApp; - interface IDispatch; - [source] dispinterface DWebBrowserEvents; - [default, source] dispinterface DWebBrowserEvents2; - }; - - cpp_quote("#endif") -}; diff --git a/embedding/browser/activex/src/control/MozillaControl.rc b/embedding/browser/activex/src/control/MozillaControl.rc deleted file mode 100644 index 47bcdab2fd9..00000000000 --- a/embedding/browser/activex/src/control/MozillaControl.rc +++ /dev/null @@ -1,553 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "1 TYPELIB ""MozillaControl.tlb""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "FileDescription", "Mozilla ActiveX control and plugin module" - VALUE "FileExtents", "*|*|*.axs" - VALUE "FileOpenName", "ActiveX (*.*)|ActiveX (*.*)|ActiveScript(*.axs)" - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "MOZCTL" - VALUE "LegalCopyright", "Copyright 1999" - VALUE "MIMEType", "application/x-oleobject|application/oleobject|text/x-activescript" - VALUE "OriginalFilename", "MOZCTL.DLL" - VALUE "ProductName", "Mozilla ActiveX control and plugin support" - VALUE "ProductVersion", "1, 0, 0, 1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_MOZILLABROWSER REGISTRY "MozillaBrowser.rgs" - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_MOZILLABROWSER ICON "MozillaBrowser.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_POPUP_DOCUMENT MENU -BEGIN - POPUP "Page Popup" - BEGIN - MENUITEM "&Back", ID_DOCUMENT_BACK - MENUITEM "&Forward", ID_DOCUMENT_FORWARD - MENUITEM SEPARATOR - MENUITEM "Select &All", ID_DOCUMENT_SELECTALL - MENUITEM "&Paste", ID_DOCUMENT_PASTE - MENUITEM SEPARATOR - MENUITEM "&View Source", ID_DOCUMENT_VIEWSOURCE - , GRAYED - MENUITEM SEPARATOR - MENUITEM "Pr&int", ID_DOCUMENT_PRINT - MENUITEM "&Refresh", ID_DOCUMENT_REFRESH - MENUITEM SEPARATOR - MENUITEM "&Properties", ID_DOCUMENT_PROPERTIES - END -END - -IDR_POPUP_LINK MENU -BEGIN - POPUP "Link Popup" - BEGIN - MENUITEM "&Open", ID_LINK_OPEN - MENUITEM "Open in &New Window", ID_LINK_OPENINNEWWINDOW - MENUITEM SEPARATOR - MENUITEM "Copy Shor&tcut", ID_LINK_COPYSHORTCUT - MENUITEM SEPARATOR - MENUITEM "&Properties", ID_LINK_PROPERTIES - END -END - -IDR_POPUP_TEXT MENU -BEGIN - POPUP "Selection Popup" - BEGIN - MENUITEM "Cu&t", ID_TEXT_CUT, GRAYED - MENUITEM "&Copy", ID_TEXT_COPY - MENUITEM "&Paste", ID_TEXT_PASTE, GRAYED - MENUITEM "Select &All", ID_TEXT_SELECTALL - MENUITEM "Print", ID_TEXT_PRINT - END -END - -IDR_POPUP_IMAGE MENU -BEGIN - POPUP "Image Popup" - BEGIN - MENUITEM "Cu&t", ID_EDIT_CUT, GRAYED - MENUITEM "&Copy", ID_EDIT_COPY, GRAYED - MENUITEM "&Paste", ID_EDIT_PASTE, GRAYED - MENUITEM "Select &All", ID_EDIT_SELECTALL - MENUITEM "Print", ID_SELECTIONPOPUP_PRINT - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_PROMPT DIALOG 0, 0, 263, 113 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Enter Value" -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "Value:",IDC_STATIC,7,71,21,8 - EDITTEXT IDC_VALUE,32,71,224,14,ES_AUTOHSCROLL - CONTROL "Check msg",IDC_CHECKMSG,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,50,249,19 - DEFPUSHBUTTON "OK",IDOK,152,92,50,14 - PUSHBUTTON "Cancel",IDCANCEL,206,92,50,14 - LTEXT "Message",IDC_MESSAGE,36,7,220,41 - ICON IDI_MOZILLABROWSER,IDC_QUESTION,7,7,20,20 -END - -IDD_PROMPTUSERPASS DIALOG 0, 0, 263, 135 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Authentication Required" -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "Username:",IDC_STATIC,7,71,35,8 - EDITTEXT IDC_USERNAME,44,71,212,14,ES_AUTOHSCROLL - LTEXT "Password:",IDC_STATIC,7,92,34,8 - EDITTEXT IDC_PASSWORD,44,92,212,14,ES_PASSWORD | ES_AUTOHSCROLL - CONTROL "CheckMsg",IDC_CHECKMSG,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,50,249,19 - PUSHBUTTON "OK",IDOK,153,114,50,14 - PUSHBUTTON "Cancel",IDCANCEL,206,114,50,14 - LTEXT "Message",IDC_MESSAGE,36,7,220,41 - ICON IDI_MOZILLABROWSER,IDC_QUESTION,7,7,20,20 -END - -IDD_CONFIRMEX DIALOG 0, 0, 263, 95 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Confirmation" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "0",IDC_BUTTON0,195,75,65,14 - PUSHBUTTON "2",IDC_BUTTON2,55,75,65,14 - PUSHBUTTON "1",IDC_BUTTON1,125,75,65,14 - ICON IDI_MOZILLABROWSER,IDC_QUESTION,7,7,20,20 - LTEXT "Message",IDC_MESSAGE,36,7,220,41 - CONTROL "Check Msg",IDC_CHECKMSG,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,52,249,19 -END - -IDD_PPAGE_LINK DIALOG 0, 0, 185, 170 -STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "Address: (URL)",IDC_STATIC,0,68,27,20 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,32,185,1 - LTEXT "type",IDC_TYPE,35,53,149,8 - LTEXT "Type:",IDC_STATIC,0,38,19,8 - LTEXT "protocol",IDC_PROTOCOL,35,38,149,8 - EDITTEXT IDC_ADDRESS,35,68,149,61,ES_MULTILINE | ES_AUTOVSCROLL | - ES_READONLY - ICON IDI_MOZILLABROWSER,IDC_STATIC,5,6,20,20 -END - -IDD_PAGESETUP DIALOGEX 0, 0, 276, 221 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | - WS_SYSMENU -CAPTION "Page Setup" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,167,200,50,14 - PUSHBUTTON "Cancel",IDCANCEL,219,200,50,14 - CONTROL "",IDC_TAB,"SysTabControl32",TCS_TOOLTIPS,7,7,262,191 - CONTROL "",IDC_PAGE_MARKER,"Static",SS_BLACKFRAME | NOT - WS_VISIBLE,10,23,255,170 -END - -IDD_PPAGE_MARGINS DIALOGEX 0, 0, 255, 170 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - GROUPBOX "Margins (in millimeters)",IDC_STATIC,0,0,255,104 - GROUPBOX "Headers && Footers",IDC_STATIC,0,105,255,59 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,101,30,51,51 - RTEXT "Top:",IDC_STATIC,84,16,16,8 - EDITTEXT IDC_MARGIN_TOP,107,13,40,14,ES_AUTOHSCROLL - LTEXT "Left:",IDC_STATIC,56,36,16,8 - EDITTEXT IDC_MARGIN_LEFT,56,48,40,14,ES_AUTOHSCROLL - EDITTEXT IDC_MARGIN_BOTTOM,107,84,40,14,ES_AUTOHSCROLL - RTEXT "Bottom:",IDC_STATIC,74,87,26,8 - LTEXT "Right:",IDC_STATIC,157,36,20,8 - EDITTEXT IDC_MARGIN_RIGHT,157,48,40,14,ES_AUTOHSCROLL - COMBOBOX IDC_HDR_LEFT,26,117,61,126,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - COMBOBOX IDC_HDR_MIDDLE,96,117,61,155,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_HDR_RIGHT,164,117,61,157,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_FTR_LEFT,26,144,61,99,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - COMBOBOX IDC_FTR_MIDDLE,96,144,61,104,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_FTR_RIGHT,164,144,61,138,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - LTEXT "Left:",IDC_STATIC,48,133,16,8 - LTEXT "Center:",IDC_STATIC,113,133,26,8 - LTEXT "Right:",IDC_STATIC,184,133,20,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_PROMPT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 256 - TOPMARGIN, 7 - BOTTOMMARGIN, 106 - END - - IDD_PROMPTUSERPASS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 256 - TOPMARGIN, 7 - BOTTOMMARGIN, 128 - END - - IDD_CONFIRMEX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 256 - TOPMARGIN, 7 - BOTTOMMARGIN, 88 - END - - IDD_PAGESETUP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 269 - TOPMARGIN, 7 - BOTTOMMARGIN, 214 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_PROJNAME "MozillaControl" - IDS_HEADERFOOTER_OPTIONS - "-- Blank --|Title|URL|Date/Time|Page #|Page # of #||Custom..." -END - -STRINGTABLE -BEGIN - IDS_LOCATEMOZILLA "The browser control does not know where Mozilla is installed and may not function correctly.\nDo you want to locate Mozilla now?" - IDS_LOCATEMOZILLATITLE "Cannot locate Mozilla bin directory" - IDS_CANNOTCREATEPREFS "The Mozilla control cannot create a critical component. This prevents the control from functioning correctly. Possible reasons for the problem are:\n\n1. The PATH environment variable does not point to the Mozilla bin directory.\n2. The registry key HKEY_LOCAL_MACHINE\\Software\\Mozilla\\BinDirectoryPath registry key has not been set or is incorrect\n3. The file component.reg has not been generated or is empty.\n\nPlease refer to http://www.iol.ie/~locka/mozilla/mozilla.htm for guidance on how to resolve these problems." -END - -STRINGTABLE -BEGIN - IDS_CONFIRMEX_OK "OK" - IDS_CONFIRMEX_CANCEL "Cancel" - IDS_CONFIRMEX_YES "Yes" - IDS_CONFIRMEX_NO "No" - IDS_CONFIRMEX_SAVE "Save" - IDS_CONFIRMEX_DONTSAVE "Don't Save" - IDS_CONFIRMEX_REVERT "Revert" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.K.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_PROPERTIES DIALOG 0, 0, 199, 204 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Properties" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,88,183,50,14 - PUSHBUTTON "Close",IDCLOSE,142,183,50,14 - CONTROL "",IDC_PPAGE_MARKER,"Static",SS_BLACKFRAME | NOT - WS_VISIBLE,7,7,185,170 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_PROPERTIES, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 192 - TOPMARGIN, 7 - BOTTOMMARGIN, 197 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.K.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (Ireland) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENI) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_EIRE -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_HELPERAPP DIALOG 0, 0, 285, 161 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Downloading" -FONT 8, "MS Sans Serif" -BEGIN - ICON IDI_MOZILLABROWSER,IDC_STATIC,7,7,21,20 - LTEXT "You have chosen to download a file that requires special handling. What would you like to do with this file?", - IDC_MESSAGE,34,7,244,21 - CONTROL "Open with the specified application",IDC_OPENWITHAPP, - "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,40, - 219,10 - PUSHBUTTON "&Choose...",IDC_CHOOSE,228,38,50,14 - CONTROL "Save to file",IDC_SAVETOFILE,"Button", - BS_AUTORADIOBUTTON,7,53,51,10 - GROUPBOX "Details",IDC_STATIC,7,68,271,67 - DEFPUSHBUTTON "OK",IDOK,173,139,50,14 - PUSHBUTTON "Cancel",IDCANCEL,228,139,50,14 - LTEXT "Location:",IDC_STATIC,13,82,30,8 - EDITTEXT IDC_URL,63,79,208,14,ES_AUTOHSCROLL | ES_READONLY - LTEXT "Content Type:",IDC_STATIC,13,99,46,8 - EDITTEXT IDC_CONTENTTYPE,63,96,208,14,ES_AUTOHSCROLL | - ES_READONLY - LTEXT "Application:",IDC_STATIC,13,116,38,8 - EDITTEXT IDC_APPLICATION,63,113,208,14,ES_AUTOHSCROLL | - ES_READONLY -END - -IDD_PROGRESS DIALOG 0, 0, 244, 102 -STYLE DS_SETFONT | DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | - WS_CAPTION | WS_SYSMENU -CAPTION "Dialog" -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "Download progress:",IDC_STATIC,7,7,150,8 - CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7, - 23,230,10 - LTEXT "Source:",IDC_STATIC,7,44,26,8 - EDITTEXT IDC_SOURCE,50,42,187,14,ES_AUTOHSCROLL | ES_READONLY - LTEXT "Destination:",IDC_STATIC,7,64,38,8 - EDITTEXT IDC_DESTINATION,50,62,187,14,ES_AUTOHSCROLL | - ES_READONLY - PUSHBUTTON "Cancel",IDCANCEL,96,81,50,14 -END - -IDD_PPAGE_FORMAT DIALOGEX 0, 0, 255, 170 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_SYSMENU -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - GROUPBOX "Format",IDC_STATIC,0,0,255,91 - GROUPBOX "Options",IDC_STATIC,0,95,255,35 - CONTROL "Print Background (colors && images)", - IDC_PRINTBACKGROUND,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,109,127,10 - LTEXT "Orientation:",IDC_STATIC,7,13,40,8 - CONTROL "Portrait",IDC_PORTRAIT,"Button",BS_AUTORADIOBUTTON,91, - 13,40,10 - CONTROL "Landscape",IDC_LANDSCAPE,"Button",BS_AUTORADIOBUTTON,91, - 30,50,10 - LTEXT "Scale:",IDC_STATIC,7,67,20,8 - EDITTEXT IDC_SCALE,37,64,30,14,ES_AUTOHSCROLL - LTEXT "%",IDC_STATIC,73,67,8,8 - CONTROL "Shrink to fit page width",IDC_SHRINKTOFIT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,87,67,90,10 -END - -IDD_CUSTOM_FIELD DIALOGEX 0, 0, 262, 96 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | - WS_SYSMENU -CAPTION "Custom Value" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - LTEXT "Value:",IDC_STATIC,7,37,21,8 - EDITTEXT IDC_VALUE,7,48,248,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",IDOK,151,75,50,14 - PUSHBUTTON "Cancel",IDCANCEL,205,75,50,14 - LTEXT "Type the value you wish to show in the page.", - IDC_MESSAGE,35,7,220,35 - ICON IDI_MOZILLABROWSER,IDC_QUESTION,7,7,21,20 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_HELPERAPP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 278 - TOPMARGIN, 7 - BOTTOMMARGIN, 153 - END - - IDD_PROGRESS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 237 - TOPMARGIN, 7 - BOTTOMMARGIN, 95 - END - - IDD_CUSTOM_FIELD, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 255 - TOPMARGIN, 7 - BOTTOMMARGIN, 89 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (Ireland) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "MozillaControl.tlb" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/embedding/browser/activex/src/control/PageSetupDlg.h b/embedding/browser/activex/src/control/PageSetupDlg.h deleted file mode 100644 index 2c12930d375..00000000000 --- a/embedding/browser/activex/src/control/PageSetupDlg.h +++ /dev/null @@ -1,503 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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): - * Adam Lock - * - * 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 ***** */ - -#ifndef PAGESETUPDLG_H -#define PAGESETUPDLG_H - -#include "resource.h" - -#include "nsIPrintSettings.h" - -/* VC98 doesn't define _tstof() */ -#if defined(_MSC_VER) && _MSC_VER < 1300 -#ifndef UNICODE -#define _tstof atof -#else -inline double _wtof(const wchar_t *string) -{ - USES_CONVERSION; - return atof(W2CA(string)); -} -#define _tstof _wtof -#endif -#endif - -class CCustomFieldDlg : public CDialogImpl -{ -public: - enum { IDD = IDD_CUSTOM_FIELD }; - - BEGIN_MSG_MAP(CCustomFieldDlg) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_ID_HANDLER(IDOK, OnOK) - COMMAND_ID_HANDLER(IDCANCEL, OnCancel) - END_MSG_MAP() - - nsString m_field; - - CCustomFieldDlg(const nsAString &str) : - m_field(str) - { - } - - LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - USES_CONVERSION; - SetDlgItemText(IDC_VALUE, W2CT(m_field.get())); - return 0; - } - - LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) - { - TCHAR szBuf[128]; - GetDlgItemText(IDC_VALUE, szBuf, sizeof(szBuf) / sizeof(szBuf[0])); - USES_CONVERSION; - m_field = T2CW(szBuf); - EndDialog(IDOK); - return 0; - } - - LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) - { - EndDialog(IDCANCEL); - return 0; - } -}; - -class CPageSetupFormatDlg : public CDialogImpl -{ -public: - enum { IDD = IDD_PPAGE_FORMAT }; - - BEGIN_MSG_MAP(CPageSetupFormatDlg) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_ID_HANDLER(IDC_SHRINKTOFIT, OnClickShrinkToFit) - END_MSG_MAP() - - CPageSetupFormatDlg() - { - } - - void Init(nsIPrintSettings *aPrintSettings) - { - // Set landscape / portrait mode - PRInt32 orientation = nsIPrintSettings::kPortraitOrientation; - aPrintSettings->GetOrientation(&orientation); - SendDlgItemMessage( - (orientation == nsIPrintSettings::kPortraitOrientation) - ? IDC_PORTRAIT : IDC_LANDSCAPE, - BM_SETCHECK, - BST_CHECKED, 0); - - // Set scaling - TCHAR szBuf[10]; - double scaling = 1.0; - aPrintSettings->GetScaling(&scaling); - _stprintf(szBuf, _T("%.1f"), scaling * 100.0); - SetDlgItemText(IDC_SCALE, szBuf); - - // Set shrink to fit (& disable scale field) - PRBool shrinkToFit = PR_FALSE; - aPrintSettings->GetShrinkToFit(&shrinkToFit); - CheckDlgButton(IDC_SHRINKTOFIT, shrinkToFit ? BST_CHECKED : BST_UNCHECKED); - ::EnableWindow(GetDlgItem(IDC_SCALE), shrinkToFit ? FALSE : TRUE); - - // Print background - we use PrintBGColors to control both images & colours - PRBool printBGColors = PR_TRUE; - aPrintSettings->GetPrintBGColors(&printBGColors); - CheckDlgButton(IDC_PRINTBACKGROUND, printBGColors ? BST_CHECKED : BST_UNCHECKED); - } - - void Apply(nsIPrintSettings *aPrintSettings) - { - - // Background options are tied to a single checkbox - PRBool boolVal = - (SendDlgItemMessage(IDC_PRINTBACKGROUND, BM_GETCHECK) == BST_CHECKED) ? - PR_TRUE : PR_FALSE; - aPrintSettings->SetPrintBGColors(boolVal); - aPrintSettings->SetPrintBGImages(boolVal); - - // Print scale - TCHAR szBuf[128]; - GetDlgItemText(IDC_SCALE, szBuf, sizeof(szBuf) / sizeof(szBuf[0])); - double scale = _tstof(szBuf) / 100.0; - aPrintSettings->SetScaling(scale); - - // Shrink to fit - PRBool shrinkToFit = - (IsDlgButtonChecked(IDC_SHRINKTOFIT) == BST_CHECKED) ? PR_TRUE : PR_FALSE; - aPrintSettings->SetShrinkToFit(shrinkToFit); - - // Landscape or portrait - PRInt32 orientation = nsIPrintSettings::kLandscapeOrientation; - if (SendDlgItemMessage(IDC_PORTRAIT, BM_GETCHECK) == BST_CHECKED) - { - orientation = nsIPrintSettings::kPortraitOrientation; - } - aPrintSettings->SetOrientation(orientation); - } - - LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return 0; - } - - LRESULT OnClickShrinkToFit(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) - { - BOOL bEnableScale = TRUE; - if (IsDlgButtonChecked(IDC_SHRINKTOFIT) == BST_CHECKED) - bEnableScale = FALSE; - ::EnableWindow(GetDlgItem(IDC_SCALE), bEnableScale); - return 0; - } -}; - -class CPageSetupMarginsDlg : public CDialogImpl -{ -public: - nsString mHdrLeft; - nsString mHdrCenter; - nsString mHdrRight; - nsString mFtrLeft; - nsString mFtrCenter; - nsString mFtrRight; - - enum { IDD = IDD_PPAGE_MARGINS }; - - BEGIN_MSG_MAP(CPageSetupMarginsDlg) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDC_HDR_LEFT, IDC_FTR_RIGHT, OnHeaderFooterChange) - END_MSG_MAP() - - CPageSetupMarginsDlg() - { - } - - const wchar_t * const * GetHeaderFooterValues(size_t &aNumValues) const - { - static const wchar_t *szValues[] = { - L"", - L"&T", - L"&U", - L"&D", - L"&P", - L"&PT" - }; - aNumValues = sizeof(szValues) / sizeof(szValues[0]); - return szValues; - } - - const TCHAR * const * GetHeaderFooterOptions(size_t &aNumOptions) const - { - static const TCHAR *szOptions[] = - { - _T("-- Blank --"), - _T("Title"), - _T("URL"), - _T("Date/Time"), - _T("Page #"), - _T("Page # of #"), - _T("Custom...") - }; - aNumOptions = sizeof(szOptions) / sizeof(szOptions[0]); - return szOptions; - } - - void Init(nsIPrintSettings *aPrintSettings) - { - double top = 0.0; - double left = 0.0; - double right = 0.0; - double bottom = 0.0; - aPrintSettings->GetMarginTop(&top); - aPrintSettings->GetMarginLeft(&left); - aPrintSettings->GetMarginRight(&right); - aPrintSettings->GetMarginBottom(&bottom); - - // Get the margins - TCHAR szBuf[16]; - _stprintf(szBuf, _T("%5.2f"), top); - SetDlgItemText(IDC_MARGIN_TOP, szBuf); - _stprintf(szBuf, _T("%5.2f"), left); - SetDlgItemText(IDC_MARGIN_LEFT, szBuf); - _stprintf(szBuf, _T("%5.2f"), right); - SetDlgItemText(IDC_MARGIN_RIGHT, szBuf); - _stprintf(szBuf, _T("%5.2f"), bottom); - SetDlgItemText(IDC_MARGIN_BOTTOM, szBuf); - - // Get the header & footer settings - PRUnichar* uStr = nsnull; - aPrintSettings->GetHeaderStrLeft(&uStr); - mHdrLeft = uStr; - SetComboIndex(IDC_HDR_LEFT, uStr); - if (uStr != nsnull) nsMemory::Free(uStr); - - aPrintSettings->GetHeaderStrCenter(&uStr); - mHdrCenter = uStr; - SetComboIndex(IDC_HDR_MIDDLE, uStr); - if (uStr != nsnull) nsMemory::Free(uStr); - - aPrintSettings->GetHeaderStrRight(&uStr); - mHdrRight = uStr; - SetComboIndex(IDC_HDR_RIGHT, uStr); - if (uStr != nsnull) nsMemory::Free(uStr); - - aPrintSettings->GetFooterStrLeft(&uStr); - mFtrLeft = uStr; - SetComboIndex(IDC_FTR_LEFT, uStr); - if (uStr != nsnull) nsMemory::Free(uStr); - - aPrintSettings->GetFooterStrCenter(&uStr); - mFtrCenter = uStr; - SetComboIndex(IDC_FTR_MIDDLE, uStr); - if (uStr != nsnull) nsMemory::Free(uStr); - - aPrintSettings->GetFooterStrRight(&uStr); - mFtrRight = uStr; - SetComboIndex(IDC_FTR_RIGHT, uStr); - if (uStr != nsnull) nsMemory::Free(uStr); - } - - void SetComboIndex(int aID, const wchar_t *szValue) - { - size_t nValues; - const wchar_t * const * szValues = GetHeaderFooterValues(nValues); - - int nCurSel = 0; - if (szValue[0] != L'\0') - { - while (nCurSel < nValues) - { - if (wcscmp(szValue, szValues[nCurSel]) == 0) - { - break; - } - ++nCurSel; - } - // nCurSel might contain nValues but that just means the - // Custom... field gets selected. - } - SendDlgItemMessage(aID, CB_SETCURSEL, nCurSel); - } - - void Apply(nsIPrintSettings *aPrintSettings) - { - TCHAR szBuf[128]; - const size_t kBufSize = sizeof(szBuf) / sizeof(szBuf[0]); - - GetDlgItemText(IDC_MARGIN_TOP, szBuf, kBufSize); - aPrintSettings->SetMarginTop(_tstof(szBuf)); - GetDlgItemText(IDC_MARGIN_LEFT, szBuf, kBufSize); - aPrintSettings->SetMarginLeft(_tstof(szBuf)); - GetDlgItemText(IDC_MARGIN_BOTTOM, szBuf, kBufSize); - aPrintSettings->SetMarginBottom(_tstof(szBuf)); - GetDlgItemText(IDC_MARGIN_RIGHT, szBuf, kBufSize); - aPrintSettings->SetMarginRight(_tstof(szBuf)); - - aPrintSettings->SetHeaderStrLeft(mHdrLeft.get()); - aPrintSettings->SetHeaderStrCenter(mHdrCenter.get()); - aPrintSettings->SetHeaderStrRight(mHdrRight.get()); - aPrintSettings->SetFooterStrLeft(mFtrLeft.get()); - aPrintSettings->SetFooterStrCenter(mFtrCenter.get()); - aPrintSettings->SetFooterStrRight(mFtrRight.get()); - } - - LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - size_t nOptions; - const TCHAR * const *szOptions = GetHeaderFooterOptions(nOptions); - - // Fill out the drop down choices - for (size_t i = 0; i < nOptions; ++i) - { - const TCHAR *szOption = szOptions[i]; - SendDlgItemMessage(IDC_HDR_LEFT, CB_ADDSTRING, 0, LPARAM(szOption)); - SendDlgItemMessage(IDC_HDR_MIDDLE, CB_ADDSTRING, 0, LPARAM(szOption)); - SendDlgItemMessage(IDC_HDR_RIGHT, CB_ADDSTRING, 0, LPARAM(szOption)); - SendDlgItemMessage(IDC_FTR_LEFT, CB_ADDSTRING, 0, LPARAM(szOption)); - SendDlgItemMessage(IDC_FTR_MIDDLE, CB_ADDSTRING, 0, LPARAM(szOption)); - SendDlgItemMessage(IDC_FTR_RIGHT, CB_ADDSTRING, 0, LPARAM(szOption)); - } - return 0; - } - - LRESULT OnHeaderFooterChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) - { - if (wNotifyCode != CBN_SELCHANGE) - { - bHandled = FALSE; - return 0; - } - - // One of the header / footer combos has changed, so set the string - // to the updated value. - - nsString *pStr = nsnull; - switch (wID) - { - case IDC_HDR_LEFT: pStr = &mHdrLeft; break; - case IDC_HDR_MIDDLE: pStr = &mHdrCenter; break; - case IDC_HDR_RIGHT: pStr = &mHdrRight; break; - case IDC_FTR_LEFT: pStr = &mFtrLeft; break; - case IDC_FTR_MIDDLE: pStr = &mFtrCenter; break; - case IDC_FTR_RIGHT: pStr = &mFtrRight; break; - } - if (!pStr) - { - return 0; - } - - size_t nValues; - const wchar_t * const * szValues = GetHeaderFooterValues(nValues); - - int nCurSel = SendDlgItemMessage(wID, CB_GETCURSEL); - if (nCurSel == nValues) // Custom... - { - CCustomFieldDlg dlg(*pStr); - if (dlg.DoModal() == IDOK) - { - *pStr = dlg.m_field; - } - // Update combo in case their custom value is not custom at all - // For example, if someone opens the custom dlg and types "&P" - // (i.e. "Page #"), we should select that since it is already a - // choice in the combo. - SetComboIndex(wID, pStr->get()); - } - else - { - *pStr = szValues[nCurSel]; - } - - return 0; - } - -}; -class CPageSetupDlg : public CDialogImpl -{ -public: - enum { IDD = IDD_PAGESETUP }; - - CPPageDlg *mPPage; - - BEGIN_MSG_MAP(CPageSetupDlg) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - NOTIFY_HANDLER(IDC_TAB, TCN_SELCHANGE, OnTabSelChange) - COMMAND_ID_HANDLER(IDOK, OnOK) - COMMAND_ID_HANDLER(IDCANCEL, OnCancel) - END_MSG_MAP() - - nsCOMPtr mPrintSettings; - CPageSetupFormatDlg mFormatDlg; - CPageSetupMarginsDlg mMarginsDlg; - - CPageSetupDlg(nsIPrintSettings *aPrintSettings) : - mPrintSettings(aPrintSettings) - { - } - - LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - // The marker tells us where to stick the pages - RECT rcMarker; - ::GetWindowRect(GetDlgItem(IDC_PAGE_MARKER), &rcMarker); - ScreenToClient(&rcMarker); - - // Create the two pages, the first is shown, the second is not - mFormatDlg.Create(m_hWnd); - mFormatDlg.Init(mPrintSettings); - mFormatDlg.SetWindowPos(HWND_TOP, &rcMarker, SWP_SHOWWINDOW); - - mMarginsDlg.Create(m_hWnd); - mMarginsDlg.Init(mPrintSettings); - mMarginsDlg.SetWindowPos(HWND_TOP, &rcMarker, SWP_HIDEWINDOW); - - // Get the tab control - HWND hwndTab = GetDlgItem(IDC_TAB); - - TCITEM tcItem; - - memset(&tcItem, 0, sizeof(tcItem)); - tcItem.mask = TCIF_TEXT; - - tcItem.pszText = _T("Format && Options"); - TabCtrl_InsertItem(hwndTab, 0, &tcItem); - - tcItem.pszText = _T("Margins && Header / Footer"); - TabCtrl_InsertItem(hwndTab, 1, &tcItem); - - TabCtrl_SetCurSel(hwndTab, 0); - - return 0; - } - - LRESULT OnTabSelChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) - { - HWND hwndTab = GetDlgItem(IDC_TAB); - if (TabCtrl_GetCurSel(hwndTab) == 0) - { - mFormatDlg.SetWindowPos(HWND_TOP, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); - mMarginsDlg.ShowWindow(SW_HIDE); - } - else - { - mMarginsDlg.SetWindowPos(HWND_TOP, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); - mFormatDlg.ShowWindow(SW_HIDE); - } - return 0; - } - - LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) - { - mFormatDlg.Apply(mPrintSettings); - mMarginsDlg.Apply(mPrintSettings); - EndDialog(IDOK); - return 0; - } - - LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) - { - EndDialog(IDCANCEL); - return 0; - } -}; - -#endif diff --git a/embedding/browser/activex/src/control/PromptService.cpp b/embedding/browser/activex/src/control/PromptService.cpp deleted file mode 100644 index 64247188626..00000000000 --- a/embedding/browser/activex/src/control/PromptService.cpp +++ /dev/null @@ -1,899 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * ***** 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): - * Adam Lock - * - * 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 "StdAfx.h" - -#include "MozillaBrowser.h" -#include "PromptService.h" - -#include "nsCOMPtr.h" - -#include "nsIPromptService.h" -#include "nsIFactory.h" -#include "nsIDOMWindow.h" - -class PromptDlg -{ -public: - PromptDlg(); - virtual ~PromptDlg(); - - nsresult ConfirmCheck( - HWND hwndParent, - const PRUnichar *dialogTitle, - const PRUnichar *text, - const PRUnichar *checkMsg, PRBool *checkValue, - PRBool *_retval); - - nsresult ConfirmEx( - HWND hwndParent, - const PRUnichar *dialogTitle, - const PRUnichar *text, - PRUint32 buttonFlags, - const PRUnichar *button0Title, - const PRUnichar *button1Title, - const PRUnichar *button2Title, - const PRUnichar *checkMsg, PRBool *checkValue, - PRInt32 *buttonPressed); - - nsresult Prompt(HWND hwndParent, const PRUnichar *dialogTitle, - const PRUnichar *text, PRUnichar **value, - const PRUnichar *checkMsg, PRBool *checkValue, - PRBool *_retval); - - nsresult PromptUsernameAndPassword(HWND hwndParent, - const PRUnichar *dialogTitle, - const PRUnichar *text, - PRUnichar **username, PRUnichar **password, - const PRUnichar *checkMsg, PRBool *checkValue, - PRBool *_retval); - - nsresult PromptPassword(HWND hwndParent, - const PRUnichar *dialogTitle, - const PRUnichar *text, - PRUnichar **password, - const PRUnichar *checkMsg, PRBool *checkValue, - PRBool *_retval); - -protected: - static INT_PTR CALLBACK ConfirmProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - static INT_PTR CALLBACK PromptProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - - TCHAR *mTitle; - TCHAR *mMessage; - TCHAR *mCheckMessage; - BOOL mCheckValue; - TCHAR *mButtonTitles[3]; - TCHAR *mUsername; - TCHAR *mPassword; - TCHAR *mValue; - - enum { - PROMPT_USERPASS, - PROMPT_PASS, - PROMPT_VALUE - } mPromptMode; -}; - -PromptDlg::PromptDlg() : - mMessage(NULL), - mCheckMessage(NULL), - mCheckValue(FALSE), - mUsername(NULL), - mPassword(NULL), - mValue(NULL), - mTitle(NULL), - mPromptMode(PROMPT_USERPASS) -{ - for (int i = 0; i < 3; i++) - { - mButtonTitles[i] = NULL; - } -} - -PromptDlg::~PromptDlg() -{ - if (mTitle) - free(mTitle); - if (mMessage) - free(mMessage); - if (mCheckMessage) - free(mCheckMessage); - if (mUsername) - free(mUsername); - if (mPassword) - free(mPassword); - if (mValue) - free(mValue); - for (int i = 0; i < 3; i++) - { - if (mButtonTitles[i]) - { - free(mButtonTitles[i]); - } - } -} - -nsresult PromptDlg::ConfirmCheck( - HWND hwndParent, - const PRUnichar *dialogTitle, - const PRUnichar *text, - const PRUnichar *checkMsg, PRBool *checkValue, - PRBool *_retval) -{ - NS_ENSURE_ARG_POINTER(_retval); - - PRInt32 buttonPressed = 0; - PRUint32 buttonFlags = nsIPromptService::BUTTON_TITLE_YES + - (nsIPromptService::BUTTON_TITLE_NO << 8); - - // Use the extended confirmation dialog with Yes & No buttons - nsresult rv = ConfirmEx(hwndParent, dialogTitle, text, - buttonFlags, NULL, NULL, NULL, - checkMsg, checkValue, &buttonPressed); - - if (NS_SUCCEEDED(rv)) - { - *_retval = (buttonPressed == 0) ? PR_TRUE : PR_FALSE; - } - - return rv; -} - -nsresult PromptDlg::ConfirmEx( - HWND hwndParent, - const PRUnichar *dialogTitle, - const PRUnichar *text, - PRUint32 buttonFlags, - const PRUnichar *button0Title, - const PRUnichar *button1Title, - const PRUnichar *button2Title, - const PRUnichar *checkMsg, PRBool *checkValue, - PRInt32 *buttonPressed) -{ - NS_ENSURE_ARG_POINTER(dialogTitle); - NS_ENSURE_ARG_POINTER(text); - NS_ENSURE_ARG_POINTER(buttonPressed); - - HINSTANCE hInstResource = _Module.m_hInstResource; - - USES_CONVERSION; - - // Duplicate all strings, turning them into TCHARs - - mTitle = _tcsdup(W2T(dialogTitle)); - mMessage = _tcsdup(W2T(text)); - if (checkMsg) - { - NS_ENSURE_ARG_POINTER(checkValue); - mCheckMessage = _tcsdup(W2T(checkMsg)); - mCheckValue = *checkValue ? TRUE : FALSE; - } - - // Turn the button flags into strings. The nsIPromptService flags - // are scary bit shifted values which explains the masks and bit - // shifting happening in this loop. - - for (int i = 0; i < 3; i++) - { - PRUint32 titleId = buttonFlags & 255; - TCHAR **title = &mButtonTitles[i]; - switch (titleId) - { - case nsIPromptService::BUTTON_TITLE_OK: - case nsIPromptService::BUTTON_TITLE_CANCEL: - case nsIPromptService::BUTTON_TITLE_YES: - case nsIPromptService::BUTTON_TITLE_NO: - case nsIPromptService::BUTTON_TITLE_SAVE: - case nsIPromptService::BUTTON_TITLE_DONT_SAVE: - case nsIPromptService::BUTTON_TITLE_REVERT: - { - const int kTitleSize = 256; - int stringId = IDS_CONFIRMEX_OK + titleId - nsIPromptService::BUTTON_TITLE_OK; - *title = (TCHAR *) malloc(sizeof(TCHAR) * kTitleSize); - ::LoadString(hInstResource, stringId, *title, kTitleSize - 1); - break; - } - case nsIPromptService::BUTTON_TITLE_IS_STRING: - { - const PRUnichar *srcTitle = - (i == 0) ? button0Title : - (i == 1) ? button1Title : button2Title; - if (srcTitle) - { - *title = _tcsdup(W2T(srcTitle)); - } - break; - } - default: - // ANYTHING ELSE GETS IGNORED - break; - } - buttonFlags >>= 8; - } - - // Must have at least one button the user can click on! - NS_ENSURE_ARG_POINTER(mButtonTitles[0]); - - INT result = DialogBoxParam(hInstResource, - MAKEINTRESOURCE(IDD_CONFIRMEX), hwndParent, ConfirmProc, (LPARAM) this); - - if (checkValue) - *checkValue = mCheckValue; - - if (buttonPressed) - *buttonPressed = result; - - return NS_OK; -} - -nsresult -PromptDlg::Prompt(HWND hwndParent, const PRUnichar *dialogTitle, - const PRUnichar *text, PRUnichar **value, - const PRUnichar *checkMsg, PRBool *checkValue, - PRBool *_retval) -{ - NS_ENSURE_ARG_POINTER(text); - NS_ENSURE_ARG_POINTER(_retval); - - HINSTANCE hInstResource = _Module.m_hInstResource; - - USES_CONVERSION; - - // Duplicate all strings, turning them into TCHARs - - if (dialogTitle) - mTitle = _tcsdup(W2T(dialogTitle)); - mMessage = _tcsdup(W2T(text)); - if (checkMsg) - { - NS_ENSURE_ARG_POINTER(checkValue); - mCheckMessage = _tcsdup(W2T(checkMsg)); - mCheckValue = *checkValue ? TRUE : FALSE; - } - if (value) - { - mValue = _tcsdup(W2T(*value)); - } - - mPromptMode = PROMPT_VALUE; - INT result = DialogBoxParam(hInstResource, - MAKEINTRESOURCE(IDD_PROMPT), hwndParent, PromptProc, (LPARAM) this); - - if (result == IDOK) - { - if (value) - { - if (*value) - nsMemory::Free(*value); - nsAutoString v(T2W(mValue)); - *value = ToNewUnicode(v); - } - - if (checkValue) - *checkValue = mCheckValue; - - *_retval = TRUE; - } - else - { - *_retval = FALSE; - } - - return NS_OK; -} - -nsresult -PromptDlg::PromptUsernameAndPassword(HWND hwndParent, - const PRUnichar *dialogTitle, - const PRUnichar *text, - PRUnichar **username, PRUnichar **password, - const PRUnichar *checkMsg, PRBool *checkValue, - PRBool *_retval) -{ - NS_ENSURE_ARG_POINTER(text); - NS_ENSURE_ARG_POINTER(_retval); - - HINSTANCE hInstResource = _Module.m_hInstResource; - - USES_CONVERSION; - - // Duplicate all strings, turning them into TCHARs - - if (dialogTitle) - mTitle = _tcsdup(W2T(dialogTitle)); - mMessage = _tcsdup(W2T(text)); - if (checkMsg) - { - NS_ENSURE_ARG_POINTER(checkValue); - mCheckMessage = _tcsdup(W2T(checkMsg)); - mCheckValue = *checkValue ? TRUE : FALSE; - } - if (username) - { - mUsername = _tcsdup(W2T(*username)); - } - if (password) - { - mPassword = _tcsdup(W2T(*password)); - } - - mPromptMode = PROMPT_USERPASS; - INT result = DialogBoxParam(hInstResource, - MAKEINTRESOURCE(IDD_PROMPTUSERPASS), hwndParent, PromptProc, (LPARAM) this); - - if (result == IDOK) - { - if (username) - { - if (*username) - nsMemory::Free(*username); - nsAutoString user(T2W(mUsername)); - *username = ToNewUnicode(user); - } - if (password) - { - if (*password) - nsMemory::Free(*password); - nsAutoString pass(T2W(mPassword)); - *password = ToNewUnicode(pass); - } - - if (checkValue) - *checkValue = mCheckValue; - - *_retval = TRUE; - } - else - { - *_retval = FALSE; - } - - return NS_OK; -} - -nsresult -PromptDlg::PromptPassword(HWND hwndParent, - const PRUnichar *dialogTitle, - const PRUnichar *text, - PRUnichar **password, - const PRUnichar *checkMsg, PRBool *checkValue, - PRBool *_retval) -{ - NS_ENSURE_ARG_POINTER(text); - NS_ENSURE_ARG_POINTER(_retval); - - HINSTANCE hInstResource = _Module.m_hInstResource; - - USES_CONVERSION; - - // Duplicate all strings, turning them into TCHARs - - if (dialogTitle) - mTitle = _tcsdup(W2T(dialogTitle)); - mMessage = _tcsdup(W2T(text)); - if (checkMsg) - { - NS_ENSURE_ARG_POINTER(checkValue); - mCheckMessage = _tcsdup(W2T(checkMsg)); - mCheckValue = *checkValue ? TRUE : FALSE; - } - if (password) - { - mPassword = _tcsdup(W2T(*password)); - } - - mPromptMode = PROMPT_PASS; - INT result = DialogBoxParam(hInstResource, - MAKEINTRESOURCE(IDD_PROMPTUSERPASS), hwndParent, PromptProc, (LPARAM) this); - - if (result == IDOK) - { - if (password) - { - if (*password) - nsMemory::Free(*password); - nsAutoString pass(T2W(mPassword)); - *password = ToNewUnicode(pass); - } - - if (checkValue) - *checkValue = mCheckValue; - - *_retval = TRUE; - } - else - { - *_retval = FALSE; - } - - return NS_OK; -} - - -INT_PTR CALLBACK -PromptDlg::PromptProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - PromptDlg *pThis = (PromptDlg *) GetWindowLongPtr(hwndDlg, DWLP_USER); - switch (uMsg) - { - case WM_INITDIALOG: - // Initialise pThis - SetWindowLongPtr(hwndDlg, DWLP_USER, lParam); - pThis = (PromptDlg *) lParam; - - // Set dialog title & message text - if (pThis->mTitle) - SetWindowText(hwndDlg, pThis->mTitle); - - SetDlgItemText(hwndDlg, IDC_MESSAGE, pThis->mMessage); - - // Set check message text - if (pThis->mCheckMessage) - { - SetDlgItemText(hwndDlg, IDC_CHECKMSG, pThis->mCheckMessage); - CheckDlgButton(hwndDlg, IDC_CHECKMSG, pThis->mCheckValue ? BST_CHECKED : BST_UNCHECKED); - } - else - { - ShowWindow(GetDlgItem(hwndDlg, IDC_CHECKMSG), SW_HIDE); - } - - switch (pThis->mPromptMode) - { - case PROMPT_PASS: - EnableWindow(GetDlgItem(hwndDlg, IDC_USERNAME), FALSE); - if (pThis->mPassword) - { - SetDlgItemText(hwndDlg, IDC_PASSWORD, pThis->mPassword); - } - break; - case PROMPT_USERPASS: - if (pThis->mUsername) - { - SetDlgItemText(hwndDlg, IDC_USERNAME, pThis->mUsername); - } - if (pThis->mPassword) - { - SetDlgItemText(hwndDlg, IDC_PASSWORD, pThis->mPassword); - } - break; - case PROMPT_VALUE: - if (pThis->mValue) - { - SetDlgItemText(hwndDlg, IDC_VALUE, pThis->mValue); - } - break; - } - - return TRUE; - - case WM_COMMAND: - if (HIWORD(wParam) == BN_CLICKED) - { - int id = LOWORD(wParam); - if (id == IDOK) - { - if (pThis->mCheckMessage) - { - pThis->mCheckValue = - (IsDlgButtonChecked(hwndDlg, IDC_CHECKMSG) == BST_CHECKED) ? - TRUE : FALSE; - } - - const int bufferSize = 256; - TCHAR buffer[bufferSize]; - - switch (pThis->mPromptMode) - { - case PROMPT_USERPASS: - if (pThis->mUsername) - { - free(pThis->mUsername); - } - memset(buffer, 0, sizeof(buffer)); - GetDlgItemText(hwndDlg, IDC_USERNAME, buffer, bufferSize); - pThis->mUsername = _tcsdup(buffer); - - // DROP THROUGH !!!! - - case PROMPT_PASS: - if (pThis->mPassword) - { - free(pThis->mPassword); - } - memset(buffer, 0, sizeof(buffer)); - GetDlgItemText(hwndDlg, IDC_PASSWORD, buffer, bufferSize); - pThis->mPassword = _tcsdup(buffer); - break; - - case PROMPT_VALUE: - if (pThis->mValue) - { - free(pThis->mValue); - } - memset(buffer, 0, sizeof(buffer)); - GetDlgItemText(hwndDlg, IDC_VALUE, buffer, bufferSize); - pThis->mValue = _tcsdup(buffer); - break; - } - EndDialog(hwndDlg, IDOK); - } - else if (id == IDCANCEL) - { - EndDialog(hwndDlg, IDCANCEL); - } - } - return TRUE; - } - return FALSE; -} - -INT_PTR CALLBACK -PromptDlg::ConfirmProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - PromptDlg *pThis = (PromptDlg *) GetWindowLongPtr(hwndDlg, DWLP_USER); - int i; - - switch (uMsg) - { - case WM_INITDIALOG: - - // Initialise pThis - SetWindowLongPtr(hwndDlg, DWLP_USER, lParam); - pThis = (PromptDlg *) lParam; - - // Set dialog title & message text - SetWindowText(hwndDlg, pThis->mTitle); - SetDlgItemText(hwndDlg, IDC_MESSAGE, pThis->mMessage); - - // Set check message text - if (pThis->mCheckMessage) - { - SetDlgItemText(hwndDlg, IDC_CHECKMSG, pThis->mCheckMessage); - CheckDlgButton(hwndDlg, IDC_CHECKMSG, pThis->mCheckValue ? BST_CHECKED : BST_UNCHECKED); - } - else - { - ShowWindow(GetDlgItem(hwndDlg, IDC_CHECKMSG), SW_HIDE); - } - - // Set the button text or hide them - for (i = 0; i < 3; i++) - { - int id = IDC_BUTTON0 + i; - if (pThis->mButtonTitles[i]) - { - SetDlgItemText(hwndDlg, id, pThis->mButtonTitles[i]); - } - else - { - ShowWindow(GetDlgItem(hwndDlg, id), SW_HIDE); - } - } - return TRUE; - - case WM_COMMAND: - if (HIWORD(wParam) == BN_CLICKED) - { - int id = LOWORD(wParam); - if (id == IDC_BUTTON0 || - id == IDC_BUTTON1 || - id == IDC_BUTTON2) - { - if (pThis->mCheckMessage) - { - pThis->mCheckValue = - (IsDlgButtonChecked(hwndDlg, IDC_CHECKMSG) == BST_CHECKED) ? - TRUE : FALSE; - } - EndDialog(hwndDlg, id - IDC_BUTTON0); - } - } - return FALSE; - } - - return FALSE; -} - - -//***************************************************************************** -// CPromptService -//***************************************************************************** - -class CPromptService: public nsIPromptService -{ -public: - CPromptService(); - virtual ~CPromptService(); - - CMozillaBrowser *GetOwningBrowser(nsIDOMWindow *parent); - - NS_DECL_ISUPPORTS - NS_DECL_NSIPROMPTSERVICE -}; - -//***************************************************************************** - -NS_IMPL_ISUPPORTS1(CPromptService, nsIPromptService) - -CPromptService::CPromptService() -{ -} - -CPromptService::~CPromptService() -{ -} - - -CMozillaBrowser *CPromptService::GetOwningBrowser(nsIDOMWindow *parent) -{ - if (parent == nsnull) - { - // return the first element from the list if there is one - if (CMozillaBrowser::sBrowserList.Length() > 0) - { - return CMozillaBrowser::sBrowserList[0]; - } - return NULL; - } - - // Search for the browser with a content window matching the one provided - PRUint32 i; - for (i = 0; i < CMozillaBrowser::sBrowserList.Length(); i++) - { - CMozillaBrowser *p = CMozillaBrowser::sBrowserList[i]; - if (p->mWebBrowser) - { - nsCOMPtr domWindow; - p->mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow)); - if (domWindow.get() == parent) - { - return p; - } - } - } - - return NULL; -} - -/////////////////////////////////////////////////////////////////////////////// -// nsIPrompt - -NS_IMETHODIMP CPromptService::Alert(nsIDOMWindow *parent, const PRUnichar *dialogTitle, - const PRUnichar *text) -{ - CMozillaBrowser *pOwner = GetOwningBrowser(parent); - if (pOwner) - { - USES_CONVERSION; - pOwner->MessageBox(W2T(text), W2T(dialogTitle), MB_OK | MB_ICONEXCLAMATION); - } - return NS_OK; -} - -NS_IMETHODIMP CPromptService::AlertCheck(nsIDOMWindow *parent, const PRUnichar *dialogTitle, - const PRUnichar *text, - const PRUnichar *checkMsg, PRBool *checkValue) -{ - CMozillaBrowser *pOwner = GetOwningBrowser(parent); - if (pOwner) - { - // TODO show dialog with check box - USES_CONVERSION; - pOwner->MessageBox(W2T(text), W2T(dialogTitle), MB_OK | MB_ICONEXCLAMATION); - } - return NS_OK; -} - -NS_IMETHODIMP CPromptService::Confirm(nsIDOMWindow *parent, const PRUnichar *dialogTitle, - const PRUnichar *text, - PRBool *_retval) -{ - CMozillaBrowser *pOwner = GetOwningBrowser(parent); - if (pOwner) - { - USES_CONVERSION; - int nAnswer = pOwner->MessageBox(W2T(text), W2T(dialogTitle), - MB_YESNO | MB_ICONQUESTION); - *_retval = (nAnswer == IDYES) ? PR_TRUE : PR_FALSE; - } - return NS_OK; -} - - -NS_IMETHODIMP CPromptService::ConfirmCheck(nsIDOMWindow *parent, const PRUnichar *dialogTitle, - const PRUnichar *text, - const PRUnichar *checkMsg, PRBool *checkValue, - PRBool *_retval) -{ - CMozillaBrowser *pOwner = GetOwningBrowser(parent); - if (pOwner) - { - PromptDlg dlg; - return dlg.ConfirmCheck(pOwner->m_hWnd, dialogTitle, - text, checkMsg, checkValue, _retval); - } - return NS_OK; -} - - -NS_IMETHODIMP CPromptService::ConfirmEx(nsIDOMWindow *parent, const PRUnichar *dialogTitle, - const PRUnichar *text, - PRUint32 buttonFlags, - const PRUnichar *button0Title, - const PRUnichar *button1Title, - const PRUnichar *button2Title, - const PRUnichar *checkMsg, PRBool *checkValue, - PRInt32 *buttonPressed) -{ - CMozillaBrowser *pOwner = GetOwningBrowser(parent); - if (pOwner) - { - PromptDlg dlg; - return dlg.ConfirmEx(pOwner->m_hWnd, dialogTitle, - text, buttonFlags, button0Title, button1Title, button2Title, - checkMsg, checkValue, buttonPressed); - } - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP CPromptService::Prompt(nsIDOMWindow *parent, const PRUnichar *dialogTitle, - const PRUnichar *text, PRUnichar **value, - const PRUnichar *checkMsg, PRBool *checkValue, - PRBool *_retval) -{ - CMozillaBrowser *pOwner = GetOwningBrowser(parent); - if (pOwner) - { - PromptDlg dlg; - return dlg.Prompt(pOwner->m_hWnd, - dialogTitle, text, value, checkMsg, checkValue, _retval); - } - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP CPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent, - const PRUnichar *dialogTitle, - const PRUnichar *text, - PRUnichar **username, PRUnichar **password, - const PRUnichar *checkMsg, PRBool *checkValue, - PRBool *_retval) -{ - CMozillaBrowser *pOwner = GetOwningBrowser(parent); - if (pOwner) - { - PromptDlg dlg; - return dlg.PromptUsernameAndPassword(pOwner->m_hWnd, - dialogTitle, text, username, password, checkMsg, checkValue, _retval); - } - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP CPromptService::PromptPassword(nsIDOMWindow *parent, - const PRUnichar *dialogTitle, - const PRUnichar *text, - PRUnichar **password, - const PRUnichar *checkMsg, PRBool *checkValue, - PRBool *_retval) -{ - CMozillaBrowser *pOwner = GetOwningBrowser(parent); - if (pOwner) - { - PromptDlg dlg; - return dlg.PromptPassword(pOwner->m_hWnd, - dialogTitle, text, password, checkMsg, checkValue, _retval); - } - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP CPromptService::Select(nsIDOMWindow *parent, - const PRUnichar *dialogTitle, - const PRUnichar *text, PRUint32 count, - const PRUnichar **selectList, PRInt32 *outSelection, - PRBool *_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - - -//***************************************************************************** -// CPromptServiceFactory -//***************************************************************************** - -class CPromptServiceFactory : public nsIFactory -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIFACTORY - - CPromptServiceFactory(); - virtual ~CPromptServiceFactory(); -}; - -//***************************************************************************** - -NS_IMPL_ISUPPORTS1(CPromptServiceFactory, nsIFactory) - -CPromptServiceFactory::CPromptServiceFactory() -{ -} - -CPromptServiceFactory::~CPromptServiceFactory() -{ -} - -NS_IMETHODIMP CPromptServiceFactory::CreateInstance(nsISupports *aOuter, const nsIID & aIID, void **aResult) -{ - NS_ENSURE_ARG_POINTER(aResult); - - *aResult = NULL; - CPromptService *inst = new CPromptService; - if (!inst) - return NS_ERROR_OUT_OF_MEMORY; - - nsresult rv = inst->QueryInterface(aIID, aResult); - if (rv != NS_OK) { - // We didn't get the right interface, so clean up - delete inst; - } - - return rv; -} - -NS_IMETHODIMP CPromptServiceFactory::LockFactory(PRBool lock) -{ - return NS_OK; -} - -//***************************************************************************** - -nsresult NS_NewPromptServiceFactory(nsIFactory** aFactory) -{ - NS_ENSURE_ARG_POINTER(aFactory); - *aFactory = nsnull; - - CPromptServiceFactory *result = new CPromptServiceFactory; - if (!result) - return NS_ERROR_OUT_OF_MEMORY; - - NS_ADDREF(result); - *aFactory = result; - - return NS_OK; -} diff --git a/embedding/browser/activex/src/control/PromptService.h b/embedding/browser/activex/src/control/PromptService.h deleted file mode 100644 index cc67bd56bd2..00000000000 --- a/embedding/browser/activex/src/control/PromptService.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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 Communicator client 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 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 __PromptService_h -#define __PromptService_h - -#include "nsError.h" - -class nsIFactory; - -extern nsresult NS_NewPromptServiceFactory(nsIFactory** aFactory); - -#endif diff --git a/embedding/browser/activex/src/control/PropertyDlg.cpp b/embedding/browser/activex/src/control/PropertyDlg.cpp deleted file mode 100644 index d06b977cb38..00000000000 --- a/embedding/browser/activex/src/control/PropertyDlg.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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 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 "stdafx.h" - -#include "PropertyDlg.h" -#include "resource.h" - -#include "nsIMIMEInfo.h" -#include "nsIMIMEService.h" - -CPropertyDlg::CPropertyDlg() : - mPPage(NULL) -{ -} - -HRESULT CPropertyDlg::AddPage(CPPageDlg *pPage) -{ - mPPage = pPage; - return S_OK; -} - - -LRESULT CPropertyDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - if (mPPage) - { - // Create property page over the marker - RECT rc; - ::GetWindowRect(GetDlgItem(IDC_PPAGE_MARKER), &rc); - ScreenToClient(&rc); - mPPage->Create(m_hWnd, rc); - mPPage->SetWindowPos(HWND_TOP, &rc, SWP_SHOWWINDOW); - } - return 1; -} - - -LRESULT CPropertyDlg::OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - if (mPPage) - { - mPPage->DestroyWindow(); - } - EndDialog(IDOK); - return 1; -} - - -LRESULT CPropertyDlg::OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ - if (mPPage) - { - mPPage->DestroyWindow(); - } - EndDialog(IDCLOSE); - return 1; -} - - -/////////////////////////////////////////////////////////////////////////////// - - -LRESULT CPPageDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - nsAutoString desc; - if (!mType.IsEmpty()) - { - nsresult rv; - nsCOMPtr mimeService; - mimeService = do_GetService("@mozilla.org/mime;1", &rv); - NS_ENSURE_TRUE(mimeService, NS_ERROR_FAILURE); - - nsCOMPtr mimeInfo; - nsCAutoString contentType; - // MIME Types are ASCII. - LossyCopyUTF16toASCII(mType, contentType); - mimeService->GetFromTypeAndExtension(contentType, EmptyCString(), getter_AddRefs(mimeInfo)); - if (mimeInfo) - { - mimeInfo->GetDescription(desc); - } - } - - USES_CONVERSION; - SetDlgItemText(IDC_PROTOCOL, W2T(desc.get())); - SetDlgItemText(IDC_TYPE, W2T(mType.get())); - SetDlgItemText(IDC_ADDRESS, W2T(mURL.get())); - - return 1; -} diff --git a/embedding/browser/activex/src/control/PropertyDlg.h b/embedding/browser/activex/src/control/PropertyDlg.h deleted file mode 100644 index 4862e8a6fae..00000000000 --- a/embedding/browser/activex/src/control/PropertyDlg.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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): - * Adam Lock - * - * 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 ***** */ - -#ifndef PROPERTYDLG_H -#define PROPERTYDLG_H - -class CPPageDlg : public CDialogImpl -{ -public: - enum { IDD = IDD_PPAGE_LINK }; - - nsString mType; - nsString mURL; - - BEGIN_MSG_MAP(CPPageLinkDlg) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); -}; - - -class CPropertyDlg : public CDialogImpl -{ -public: - enum { IDD = IDD_PROPERTIES }; - - CPPageDlg *mPPage; - - BEGIN_MSG_MAP(CPropertyDlg) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_ID_HANDLER(IDOK, OnOK) - COMMAND_ID_HANDLER(IDCLOSE, OnClose) - END_MSG_MAP() - - CPropertyDlg(); - - LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - LRESULT OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - - HRESULT AddPage(CPPageDlg *pPage); -}; - - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/control/StdAfx.cpp b/embedding/browser/activex/src/control/StdAfx.cpp deleted file mode 100644 index 45e15bee5bf..00000000000 --- a/embedding/browser/activex/src/control/StdAfx.cpp +++ /dev/null @@ -1,52 +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): - * Adam Lock - * - * 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 ***** */ - -// stdafx.cpp : source file that includes just the standard includes -// stdafx.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -#ifdef _ATL_STATIC_REGISTRY -#include -#include -#endif - -#include -#include -#include diff --git a/embedding/browser/activex/src/control/StdAfx.h b/embedding/browser/activex/src/control/StdAfx.h deleted file mode 100644 index 7900ef8cc87..00000000000 --- a/embedding/browser/activex/src/control/StdAfx.h +++ /dev/null @@ -1,166 +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): - * Adam Lock - * - * 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 ***** */ - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED_) -#define AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - - // under MSVC shut off copious warnings about debug symbol too long -#ifdef _MSC_VER - #pragma warning( disable: 4786 ) -#endif - -#include "jstypes.h" -#include "prtypes.h" - -// Mozilla headers - -#include "jscompat.h" - -#include "prthread.h" -#include "prprf.h" -#include "nsIComponentManager.h" -#include "nsIServiceManager.h" -#include "nsWidgetsCID.h" -#include "nsGfxCIID.h" -#include "nsViewsCID.h" -#include "nsStringAPI.h" -#include "nsCOMPtr.h" - -#include "nsIHTTPChannel.h" - -#include "nsIPrefBranch.h" -#include "nsIPrefService.h" -#include "nsIURL.h" -#include "nsIBaseWindow.h" -#include "nsIWebBrowser.h" -#include "nsIEmbeddingSiteWindow.h" -#include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" -#include "nsIDocShellTreeOwner.h" -#include "nsIWebBrowserChrome.h" -#include "nsIWebBrowserSetup.h" -#include "nsIWebNavigation.h" -#include "nsIWebProgress.h" -#include "nsIWebProgressListener.h" -#include "nsIDocumentLoader.h" -#include "nsIContentViewer.h" -#include "nsIContentViewerEdit.h" -#include "nsIInterfaceRequestor.h" -#include "nsIInterfaceRequestorUtils.h" -#include "nsCOMPtr.h" -#include "nsISelection.h" -#include "nsIPrompt.h" -#include "nsIEditor.h" -#include "nsIEditingSession.h" -#include "nsICommandManager.h" - -#include "nsIDocument.h" -#include "nsIDocumentObserver.h" -#include "nsIStreamListener.h" -#include "nsTArray.h" - -#include "nsIDocumentViewer.h" -#include "nsIDOMNode.h" -#include "nsIDOMNodeList.h" -#include "nsIDOMDocument.h" -#include "nsIDOMDocumentType.h" -#include "nsIDOMElement.h" -#include "nsIDOMEvent.h" -#include "nsIDOMMouseEvent.h" -#include "nsIDOMEventTarget.h" - -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0403 -#define _ATL_APARTMENT_THREADED -#define _ATL_STATIC_REGISTRY -// #define _ATL_DEBUG_INTERFACES - -// ATL headers -#include -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#include -#include -#include -#include -#include - -// STL headers -#include -#include -#include - -// New winsock2.h doesn't define this anymore -typedef long int32; - -// Turn off warnings about debug symbols for templates being too long -#pragma warning(disable : 4786) - -// Mozilla control headers -#include "resource.h" - -#include "ActiveXTypes.h" -#include "BrowserDiagnostics.h" -#include "IOleCommandTargetImpl.h" -#include "DHTMLCmdIds.h" - -#include "MozillaControl.h" -#include "PropertyList.h" -#include "PropertyBag.h" -#include "ItemContainer.h" - -#include "IEHtmlDocument.h" -#include "CPMozillaControl.h" -#include "MozillaBrowser.h" -#include "WindowCreator.h" -#include "WebBrowserContainer.h" -#include "DropTarget.h" - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED) diff --git a/embedding/browser/activex/src/control/WebBrowserContainer.cpp b/embedding/browser/activex/src/control/WebBrowserContainer.cpp deleted file mode 100644 index dd3c82ad601..00000000000 --- a/embedding/browser/activex/src/control/WebBrowserContainer.cpp +++ /dev/null @@ -1,710 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Adam Lock - * - * 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 "stdafx.h" - -#include -#include - -#include "WebBrowserContainer.h" - -#include "nsServiceManagerUtils.h" -#include "nsIWebNavigationInfo.h" - -CWebBrowserContainer::CWebBrowserContainer(CMozillaBrowser *pOwner) : - mOwner(pOwner), - mEvents1(mOwner), - mEvents2(mOwner), - mVisible(PR_TRUE) -{ -} - - -CWebBrowserContainer::~CWebBrowserContainer() -{ -} - - -/////////////////////////////////////////////////////////////////////////////// -// nsISupports implementation - -NS_IMPL_ADDREF(CWebBrowserContainer) -NS_IMPL_RELEASE(CWebBrowserContainer) - -NS_INTERFACE_MAP_BEGIN(CWebBrowserContainer) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome) - NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor) - NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome) - NS_INTERFACE_MAP_ENTRY(nsIURIContentListener) - NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow) - NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow2) - NS_INTERFACE_MAP_ENTRY(nsIRequestObserver) - NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) - NS_INTERFACE_MAP_ENTRY(nsIContextMenuListener) - NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus) -// NS_INTERFACE_MAP_ENTRY(nsICommandHandler) - NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) -NS_INTERFACE_MAP_END - - -/////////////////////////////////////////////////////////////////////////////// -// nsIInterfaceRequestor - -NS_IMETHODIMP CWebBrowserContainer::GetInterface(const nsIID & aIID, void * *result) -{ - *result = 0; - if (aIID.Equals(NS_GET_IID(nsIDOMWindow))) - { - if (mOwner && mOwner->mWebBrowser) - { - return mOwner->mWebBrowser->GetContentDOMWindow((nsIDOMWindow **) result); - } - return NS_ERROR_NOT_INITIALIZED; - } - return QueryInterface(aIID, result); -} - - -/////////////////////////////////////////////////////////////////////////////// -// nsIContextMenuListener - -NS_IMETHODIMP CWebBrowserContainer::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode) -{ - mOwner->ShowContextMenu(aContextFlags, aEvent, aNode); - return NS_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// nsIWebProgressListener - -/* void onProgressChange (in nsIWebProgress aProgress, in nsIRequest aRequest, in long curSelfProgress, in long maxSelfProgress, in long curTotalProgress, in long maxTotalProgress); */ -NS_IMETHODIMP CWebBrowserContainer::OnProgressChange(nsIWebProgress *aProgress, nsIRequest *aRequest, PRInt32 curSelfProgress, PRInt32 maxSelfProgress, PRInt32 curTotalProgress, PRInt32 maxTotalProgress) -{ - NG_TRACE(_T("CWebBrowserContainer::OnProgressChange(...)\n")); - - long nProgress = curTotalProgress; - long nProgressMax = maxTotalProgress; - - if (nProgress == 0) - { - } - if (nProgressMax == 0) - { - nProgressMax = LONG_MAX; - } - if (nProgress > nProgressMax) - { - nProgress = nProgressMax; // Progress complete - } - - mEvents1->Fire_ProgressChange(nProgress, nProgressMax); - mEvents2->Fire_ProgressChange(nProgress, nProgressMax); - - return NS_OK; -} - -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest request, in unsigned long progressStateFlags, in unsinged long aStatus); */ -NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, PRUint32 progressStateFlags, nsresult aStatus) -{ - nsresult rv = NS_OK; - - NG_TRACE(_T("CWebBrowserContainer::OnStateChange(...)\n")); - - BOOL doFireCommandStateChange = FALSE; - - // determine whether or not the document load has started or stopped. - if (progressStateFlags & STATE_IS_DOCUMENT) - { - if (progressStateFlags & STATE_START) - { - NG_TRACE(_T("CWebBrowserContainer::OnStateChange->Doc Start(..., \"\")\n")); - - nsCOMPtr channel(do_QueryInterface(aRequest)); - if (channel) - { - nsCOMPtr uri; - rv = channel->GetURI(getter_AddRefs(uri)); - if (NS_SUCCEEDED(rv)) - { - nsCAutoString aURI; - uri->GetAsciiSpec(aURI); - NG_TRACE(_T("CWebBrowserContainer::OnStateChange->Doc Start(..., %s, \"\")\n"), A2CT(aURI.get())); - } - } - - //Fire a DownloadBegin - mEvents1->Fire_DownloadBegin(); - mEvents2->Fire_DownloadBegin(); - } - else if (progressStateFlags & STATE_STOP) - { - NG_TRACE(_T("CWebBrowserContainer::OnStateChange->Doc Stop(..., \"\")\n")); - - if (mOwner->mIERootDocument) - { - // allow to keep old document around - mOwner->mIERootDocument->Release(); - mOwner->mIERootDocument = NULL; - } - - //Fire a DownloadComplete - mEvents1->Fire_DownloadComplete(); - mEvents2->Fire_DownloadComplete(); - - nsCOMPtr pURI; - - nsCOMPtr aChannel = do_QueryInterface(aRequest); - if (!aChannel) return NS_ERROR_NULL_POINTER; - - rv = aChannel->GetURI(getter_AddRefs(pURI)); - if (NS_FAILED(rv)) return NS_OK; - - nsCAutoString aURI; - rv = pURI->GetAsciiSpec(aURI); - if (NS_FAILED(rv)) return NS_OK; - - USES_CONVERSION; - BSTR bstrURI = SysAllocString(A2OLE(aURI.get())); - - // Fire a DocumentComplete event - CComVariant vURI(bstrURI); - mEvents2->Fire_DocumentComplete(mOwner, &vURI); - SysFreeString(bstrURI); - - //Fire a StatusTextChange event - BSTR bstrStatus = SysAllocString(A2OLE((CHAR *) "Done")); - mEvents1->Fire_StatusTextChange(bstrStatus); - mEvents2->Fire_StatusTextChange(bstrStatus); - SysFreeString(bstrStatus); - } - - // state change notifications - doFireCommandStateChange = TRUE; - } - - if (progressStateFlags & STATE_IS_NETWORK) - { - if (progressStateFlags & STATE_START) - { - } - - if (progressStateFlags & STATE_STOP) - { - nsCAutoString aURI; - if (mCurrentURI) - { - mCurrentURI->GetAsciiSpec(aURI); - } - - // Fire a NavigateComplete event - USES_CONVERSION; - BSTR bstrURI = SysAllocString(A2OLE(aURI.get())); - mEvents1->Fire_NavigateComplete(bstrURI); - - // Fire a NavigateComplete2 event - CComVariant vURI(bstrURI); - mEvents2->Fire_NavigateComplete2(mOwner, &vURI); - - // Cleanup - SysFreeString(bstrURI); - mOwner->mBusyFlag = FALSE; - mCurrentURI = nsnull; - } - } - - if (doFireCommandStateChange) - { - nsCOMPtr webNav(do_QueryInterface(mOwner->mWebBrowser)); - - // Fire the new NavigateForward state - VARIANT_BOOL bEnableForward = VARIANT_FALSE; - PRBool aCanGoForward = PR_FALSE; - webNav->GetCanGoForward(&aCanGoForward); - if (aCanGoForward) - { - bEnableForward = VARIANT_TRUE; - } - mEvents2->Fire_CommandStateChange(CSC_NAVIGATEFORWARD, bEnableForward); - - // Fire the new NavigateBack state - VARIANT_BOOL bEnableBack = VARIANT_FALSE; - PRBool aCanGoBack = PR_FALSE; - webNav->GetCanGoBack(&aCanGoBack); - if (aCanGoBack) - { - bEnableBack = VARIANT_TRUE; - } - mEvents2->Fire_CommandStateChange(CSC_NAVIGATEBACK, bEnableBack); - } - - return NS_OK; -} - - -/* void onLocationChange (in nsIURI location); */ -NS_IMETHODIMP CWebBrowserContainer::OnLocationChange(nsIWebProgress* aWebProgress, - nsIRequest* aRequest, - nsIURI *location) -{ -// nsCString aPath; -// location->GetPath(getter_Copies(aPath)); - return NS_OK; -} - -NS_IMETHODIMP -CWebBrowserContainer::OnStatusChange(nsIWebProgress* aWebProgress, - nsIRequest* aRequest, - nsresult aStatus, - const PRUnichar* aMessage) -{ - NG_TRACE(_T("CWebBrowserContainer::OnStatusChange(..., \"\")\n")); - - BSTR bstrStatus = SysAllocString(W2OLE((PRUnichar *) aMessage)); - mEvents1->Fire_StatusTextChange(bstrStatus); - mEvents2->Fire_StatusTextChange(bstrStatus); - SysFreeString(bstrStatus); - - return NS_OK; -} - -NS_IMETHODIMP -CWebBrowserContainer::OnSecurityChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, - PRUint32 state) -{ - return NS_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// nsIURIContentListener - -/* void onStartURIOpen (in nsIURI aURI, out boolean aAbortOpen); */ -NS_IMETHODIMP CWebBrowserContainer::OnStartURIOpen(nsIURI *pURI, PRBool *aAbortOpen) -{ - USES_CONVERSION; - NG_TRACE(_T("CWebBrowserContainer::OnStartURIOpen(...)\n")); - - mCurrentURI = pURI; - NG_ASSERT(mCurrentURI); - - nsCAutoString aURI; - mCurrentURI->GetSpec(aURI); - - // Setup the post data - CComVariant vPostDataRef; - CComVariant vPostData; - vPostDataRef.vt = VT_BYREF | VT_VARIANT; - vPostDataRef.pvarVal = &vPostData; - // TODO get the post data passed in via the original call to Navigate() - - - // Fire a BeforeNavigate event - BSTR bstrURI = SysAllocString(A2OLE(aURI.get())); - BSTR bstrTargetFrameName = NULL; - BSTR bstrHeaders = NULL; - VARIANT_BOOL bCancel = VARIANT_FALSE; - long lFlags = 0; - - mEvents1->Fire_BeforeNavigate(bstrURI, lFlags, bstrTargetFrameName, &vPostDataRef, bstrHeaders, &bCancel); - - // Fire a BeforeNavigate2 event - CComVariant vURI(bstrURI); - CComVariant vFlags(lFlags); - CComVariant vTargetFrameName(bstrTargetFrameName); - CComVariant vHeaders(bstrHeaders); - - mEvents2->Fire_BeforeNavigate2(mOwner, &vURI, &vFlags, &vTargetFrameName, &vPostDataRef, &vHeaders, &bCancel); - - // Cleanup - SysFreeString(bstrURI); - SysFreeString(bstrTargetFrameName); - SysFreeString(bstrHeaders); - - if (bCancel != VARIANT_FALSE) - { - *aAbortOpen = PR_TRUE; - return NS_ERROR_ABORT; - } - else - { - mOwner->mBusyFlag = TRUE; - } - - //NOTE: The IE control fires a DownloadBegin after the first BeforeNavigate. - // It then fires a DownloadComplete after the engine has made its - // initial connection to the server. It then fires a second - // DownloadBegin/DownloadComplete pair around the loading of - // everything on the page. These events get fired out of - // CWebBrowserContainer::StartDocumentLoad() and - // CWebBrowserContainer::EndDocumentLoad(). - // We don't appear to distinguish between the initial connection to - // the server and the actual transfer of data. Firing these events - // here simulates, appeasing applications that are expecting that - // initial pair. - - mEvents1->Fire_DownloadBegin(); - mEvents2->Fire_DownloadBegin(); - mEvents1->Fire_DownloadComplete(); - mEvents2->Fire_DownloadComplete(); - - return NS_OK; -} - -/* void doContent (in string aContentType, in boolean aIsContentPreferred, in nsIRequest request, out nsIStreamListener aContentHandler, out boolean aAbortProcess); */ -NS_IMETHODIMP CWebBrowserContainer::DoContent(const char *aContentType, PRBool aIsContentPreferred, nsIRequest *request, nsIStreamListener **aContentHandler, PRBool *aAbortProcess) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - - -/* boolean isPreferred (in string aContentType, out string aDesiredContentType); */ -NS_IMETHODIMP CWebBrowserContainer::IsPreferred(const char *aContentType, char **aDesiredContentType, PRBool *_retval) -{ - return CanHandleContent(aContentType, PR_TRUE, aDesiredContentType, _retval); -} - - -/* boolean canHandleContent (in string aContentType, in PRBool aIsContentPreferred, out string aDesiredContentType); */ -NS_IMETHODIMP CWebBrowserContainer::CanHandleContent(const char *aContentType, PRBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval) -{ - *_retval = PR_FALSE; - *aDesiredContentType = nsnull; - - if (aContentType) - { - nsCOMPtr webNav(do_QueryInterface(mOwner->mWebBrowser)); - nsCOMPtr webNavInfo( - do_GetService("@mozilla.org/webnavigation-info;1")); - if (webNavInfo) - { - PRUint32 canHandle; - nsresult rv = - webNavInfo->IsTypeSupported(nsDependentCString(aContentType), - webNav, - &canHandle); - NS_ENSURE_SUCCESS(rv, rv); - *_retval = (canHandle != nsIWebNavigationInfo::UNSUPPORTED); - } - } - - return NS_OK; -} - - -/* attribute nsISupports loadCookie; */ -NS_IMETHODIMP CWebBrowserContainer::GetLoadCookie(nsISupports * *aLoadCookie) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP CWebBrowserContainer::SetLoadCookie(nsISupports * aLoadCookie) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - - -/* attribute nsIURIContentListener parentContentListener; */ -NS_IMETHODIMP CWebBrowserContainer::GetParentContentListener(nsIURIContentListener * *aParentContentListener) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP CWebBrowserContainer::SetParentContentListener(nsIURIContentListener * aParentContentListener) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - - -/////////////////////////////////////////////////////////////////////////////// -// nsIEmbeddingSiteWindow - -NS_IMETHODIMP -CWebBrowserContainer::GetDimensions(PRUint32 aFlags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy) -{ - RECT rc = { 0, 0, 1, 1 }; - mOwner->GetClientRect(&rc); - if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) - { - if (*x) - *x = rc.left; - if (*y) - *y = rc.top; - } - if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER || - aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) - { - if (*cx) - *cx = rc.right - rc.left; - if (*cy) - *cy = rc.bottom - rc.top; - } - return NS_OK; -} - - -NS_IMETHODIMP -CWebBrowserContainer::SetDimensions(PRUint32 aFlags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy) -{ - // Ignore - return NS_OK; -} - - -NS_IMETHODIMP -CWebBrowserContainer::GetSiteWindow(void **aParentNativeWindow) -{ - NS_ENSURE_ARG_POINTER(aParentNativeWindow); - HWND *hwndDest = (HWND *) aParentNativeWindow; - *hwndDest = mOwner->m_hWnd; - return NS_OK; -} - - -NS_IMETHODIMP -CWebBrowserContainer::SetFocus(void) -{ - return NS_OK; -} - - -NS_IMETHODIMP -CWebBrowserContainer::GetTitle(PRUnichar * *aTitle) -{ - NG_ASSERT_POINTER(aTitle, PRUnichar **); - if (!aTitle) - return E_INVALIDARG; - - *aTitle = ToNewUnicode(mTitle); - - return NS_OK; -} - - -NS_IMETHODIMP -CWebBrowserContainer::SetTitle(const PRUnichar * aTitle) -{ - NG_ASSERT_POINTER(aTitle, PRUnichar *); - if (!aTitle) - return E_INVALIDARG; - - mTitle = aTitle; - // Fire a TitleChange event - BSTR bstrTitle = SysAllocString(aTitle); - mEvents1->Fire_TitleChange(bstrTitle); - mEvents2->Fire_TitleChange(bstrTitle); - SysFreeString(bstrTitle); - - return NS_OK; -} - - -NS_IMETHODIMP -CWebBrowserContainer::GetVisibility(PRBool *aVisibility) -{ - NS_ENSURE_ARG_POINTER(aVisibility); - *aVisibility = PR_TRUE; - return NS_OK; -} - - -NS_IMETHODIMP -CWebBrowserContainer::SetVisibility(PRBool aVisibility) -{ - VARIANT_BOOL visible = aVisibility ? VARIANT_TRUE : VARIANT_FALSE; - mVisible = aVisibility; - // Fire an OnVisible event - mEvents2->Fire_OnVisible(visible); - return NS_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// nsIEmbeddingSiteWindow2 - - -NS_IMETHODIMP -CWebBrowserContainer::Blur() -{ - return NS_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// nsIWebBrowserChromeFocus implementation - -NS_IMETHODIMP -CWebBrowserContainer::FocusNextElement() -{ - ATLTRACE(_T("CWebBrowserContainer::FocusNextElement()\n")); - mOwner->NextDlgControl(); - return NS_OK; -} - - -NS_IMETHODIMP -CWebBrowserContainer::FocusPrevElement() -{ - ATLTRACE(_T("CWebBrowserContainer::FocusPrevElement()\n")); - mOwner->PrevDlgControl(); - return NS_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// nsIWebBrowserChrome implementation - -NS_IMETHODIMP -CWebBrowserContainer::SetStatus(PRUint32 statusType, const PRUnichar *status) -{ - //Fire a StatusTextChange event - BSTR bstrStatus = SysAllocString(status); - mEvents1->Fire_StatusTextChange(bstrStatus); - mEvents2->Fire_StatusTextChange(bstrStatus); - SysFreeString(bstrStatus); - return NS_OK; -} - - -NS_IMETHODIMP -CWebBrowserContainer::GetWebBrowser(nsIWebBrowser * *aWebBrowser) -{ - return NS_ERROR_FAILURE; -} - - -NS_IMETHODIMP -CWebBrowserContainer::SetWebBrowser(nsIWebBrowser * aWebBrowser) -{ - return NS_ERROR_FAILURE; -} - - -NS_IMETHODIMP -CWebBrowserContainer::GetChromeFlags(PRUint32 *aChromeFlags) -{ - return NS_ERROR_FAILURE; -} - - -NS_IMETHODIMP -CWebBrowserContainer::SetChromeFlags(PRUint32 aChromeFlags) -{ - return NS_ERROR_FAILURE; -} - - -NS_IMETHODIMP -CWebBrowserContainer::DestroyBrowserWindow(void) -{ - return NS_ERROR_FAILURE; -} - - -NS_IMETHODIMP -CWebBrowserContainer::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY) -{ - return NS_ERROR_FAILURE; -} - - -NS_IMETHODIMP -CWebBrowserContainer::ShowAsModal(void) -{ - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP -CWebBrowserContainer::IsWindowModal(PRBool *_retval) -{ - // we're not - *_retval = PR_FALSE; - return NS_OK; -} - -NS_IMETHODIMP -CWebBrowserContainer::ExitModalEventLoop(nsresult aStatus) -{ - // Ignore request to exit modal loop - return NS_OK; -} - -/////////////////////////////////////////////////////////////////////////////// -// nsIRequestObserver implementation - - -NS_IMETHODIMP -CWebBrowserContainer::OnStartRequest(nsIRequest *request, nsISupports* aContext) -{ - USES_CONVERSION; - NG_TRACE(_T("CWebBrowserContainer::OnStartRequest(...)\n")); - - return NS_OK; -} - - -NS_IMETHODIMP -CWebBrowserContainer::OnStopRequest(nsIRequest *request, nsISupports* aContext, nsresult aStatus) -{ - USES_CONVERSION; - NG_TRACE(_T("CWebBrowserContainer::OnStopRequest(..., %d)\n"), (int) aStatus); - - // Fire a DownloadComplete event - mEvents1->Fire_DownloadComplete(); - mEvents2->Fire_DownloadComplete(); - - return NS_OK; -} - -/////////////////////////////////////////////////////////////////////////////// -// nsICommandHandler implementation - -/* void do (in string aCommand, in string aStatus); */ -NS_IMETHODIMP CWebBrowserContainer::Exec(const char *aCommand, const char *aStatus, char **aResult) -{ - return NS_OK; -} - -/* void query (in string aCommand, in string aStatus); */ -NS_IMETHODIMP CWebBrowserContainer::Query(const char *aCommand, const char *aStatus, char **aResult) -{ - return NS_OK; -} diff --git a/embedding/browser/activex/src/control/WebBrowserContainer.h b/embedding/browser/activex/src/control/WebBrowserContainer.h deleted file mode 100644 index 54d2cacb439..00000000000 --- a/embedding/browser/activex/src/control/WebBrowserContainer.h +++ /dev/null @@ -1,98 +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): - * Adam Lock - * - * 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 ***** */ -#ifndef WEBBROWSERCONTAINER_H -#define WEBBROWSERCONTAINER_H - -#include "nsIContextMenuListener.h" -#include "nsITooltipListener.h" -#include "nsICommandHandler.h" -#include "nsIEmbeddingSiteWindow.h" -#include "nsIEmbeddingSiteWindow2.h" -#include "nsIURIContentListener.h" -#include "nsIWebBrowserChromeFocus.h" -#include "nsWeakReference.h" - -// This is the class that handles the XPCOM side of things, callback -// interfaces into the web shell and so forth. - -class CWebBrowserContainer : - public nsIEmbeddingSiteWindow2, - public nsIWebBrowserChrome, - public nsIWebProgressListener, - public nsIRequestObserver, - public nsIURIContentListener, - public nsIInterfaceRequestor, - public nsIContextMenuListener, - public nsICommandHandler, - public nsIWebBrowserChromeFocus, - public nsSupportsWeakReference -{ -public: - CWebBrowserContainer(CMozillaBrowser *pOwner); - - friend CMozillaBrowser; - friend CWindowCreator; - -protected: - virtual ~CWebBrowserContainer(); - -// Protected members -protected: - CMozillaBrowser *mOwner; - nsCOMPtr mCurrentURI; - CProxyDWebBrowserEvents *mEvents1; - CProxyDWebBrowserEvents2 *mEvents2; - nsString mTitle; - PRPackedBool mVisible; - -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIEMBEDDINGSITEWINDOW - NS_DECL_NSIEMBEDDINGSITEWINDOW2 - NS_DECL_NSIWEBBROWSERCHROME - NS_DECL_NSIURICONTENTLISTENER - NS_DECL_NSIREQUESTOBSERVER - NS_DECL_NSIINTERFACEREQUESTOR - NS_DECL_NSIWEBPROGRESSLISTENER - NS_DECL_NSICONTEXTMENULISTENER - NS_DECL_NSIWEBBROWSERCHROMEFOCUS - NS_DECL_NSICOMMANDHANDLER -}; - -#endif - diff --git a/embedding/browser/activex/src/control/WindowCreator.cpp b/embedding/browser/activex/src/control/WindowCreator.cpp deleted file mode 100644 index 62d7cbbcfc4..00000000000 --- a/embedding/browser/activex/src/control/WindowCreator.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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): - * Adam Lock - * - * 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 "stdafx.h" - -#include "WindowCreator.h" - -NS_IMPL_ISUPPORTS1(CWindowCreator, nsIWindowCreator) - -CWindowCreator::CWindowCreator(void) -{ -} - -CWindowCreator::~CWindowCreator() -{ -} - -NS_IMETHODIMP -CWindowCreator::CreateChromeWindow(nsIWebBrowserChrome *aParent, PRUint32 aChromeFlags, nsIWebBrowserChrome **_retval) -{ - NS_ENSURE_ARG_POINTER(_retval); - *_retval = nsnull; - - // NOTE: - // - // The nsIWindowCreator::CreateChromeWindow is REQUIRED to handle a nsnull - // parent window but this implementation must have one in order to fire - // events to the ActiveX container. Therefore we treat a nsnull aParent - // as an error and return. - - if (aParent == nsnull) - { - return NS_ERROR_FAILURE; - } - - CWebBrowserContainer *pContainer = static_cast(aParent); - - CComQIPtr dispNew; - VARIANT_BOOL bCancel = VARIANT_FALSE; - - // Test if the event sink can give us a new window to navigate into - if (pContainer->mEvents2) - { - pContainer->mEvents2->Fire_NewWindow2(&dispNew, &bCancel); - if ((bCancel == VARIANT_FALSE) && dispNew) - { - CComQIPtr cpBridge = dispNew; - if (cpBridge) - { - nsIWebBrowser *browser = nsnull; - cpBridge->GetWebBrowser((void **) &browser); - if (browser) - { - nsresult rv = browser->GetContainerWindow(_retval); - NS_RELEASE(browser); - return rv; - } - } - } - } - - return NS_ERROR_FAILURE; -} - diff --git a/embedding/browser/activex/src/control/mkctldef.bat b/embedding/browser/activex/src/control/mkctldef.bat deleted file mode 100755 index 9b4302a3f26..00000000000 --- a/embedding/browser/activex/src/control/mkctldef.bat +++ /dev/null @@ -1,16 +0,0 @@ -@echo off - -REM This script generates the DEF file for the control DLL depending on -REM what has been set to go into it - -echo ; mozctl.def : Declares the module parameters. > %1 -echo ; This file was autogenerated by mkctldef.bat! >> %1 -echo. >> %1 -echo LIBRARY "mozctl.DLL" >> %1 -echo EXPORTS >> %1 -echo ; ActiveX exports >> %1 -echo DllCanUnloadNow @100 PRIVATE >> %1 -echo DllGetClassObject @101 PRIVATE >> %1 -echo DllRegisterServer @102 PRIVATE >> %1 -echo DllUnregisterServer @103 PRIVATE >> %1 -echo. >> %1 diff --git a/embedding/browser/activex/src/control/mkctldef.sh b/embedding/browser/activex/src/control/mkctldef.sh deleted file mode 100755 index 517c0c49647..00000000000 --- a/embedding/browser/activex/src/control/mkctldef.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# This script generates the DEF file for the control DLL depending on -# what has been set to go into it - -echo '; mozctl.def : Declares the module parameters.' > $1 -echo '; This file was autogenerated by mkctldef.sh! ' >> $1 -echo '' >> $1 -echo 'LIBRARY "mozctl.DLL"' >> $1 -echo 'EXPORTS' >> $1 -echo ' ; ActiveX exports' >> $1 -echo ' DllCanUnloadNow @100 PRIVATE' >> $1 -echo ' DllGetClassObject @101 PRIVATE' >> $1 -echo ' DllRegisterServer @102 PRIVATE' >> $1 -echo ' DllUnregisterServer @103 PRIVATE' >> $1 -echo '' >> $1 diff --git a/embedding/browser/activex/src/control/resource.h b/embedding/browser/activex/src/control/resource.h deleted file mode 100644 index 4340c46dee5..00000000000 --- a/embedding/browser/activex/src/control/resource.h +++ /dev/null @@ -1,119 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by MozillaControl.rc -// -#define IDS_PROJNAME 100 -#define IDR_MOZILLABROWSER 101 -#define IDS_HEADERFOOTER_OPTIONS 101 -#define IDI_MOZILLABROWSER 201 -#define IDC_CHECKMSG 201 -#define IDR_POPUP_PAGE 202 -#define IDR_POPUP_DOCUMENT 202 -#define IDR_POPUP_LINK 203 -#define IDR_POPUP_CLIPBOARD 204 -#define IDC_QUESTION 204 -#define IDR_POPUP_TEXT 204 -#define IDD_CONFIRMCHECK 205 -#define IDC_MESSAGE 205 -#define IDD_PROMPT 206 -#define IDR_POPUP_IMAGE 206 -#define IDC_PPAGE_MARKER 206 -#define IDD_PROMPTUSERNAMEANDPASSWORD 207 -#define IDD_PROMPTUSERPASS 207 -#define IDD_PROMPTPASSWORD 208 -#define IDC_TYPE 208 -#define IDD_PROPERTIES 209 -#define IDC_PROTOCOL 209 -#define IDD_PPAGE_LINK 210 -#define IDC_ADDRESS 210 -#define IDD_CONFIRMEX 211 -#define IDD_HELPERAPP 212 -#define IDC_VALUE 213 -#define IDD_PROGRESS 213 -#define IDC_USERNAME 214 -#define IDD_PAGESETUP 214 -#define IDC_PASSWORD 215 -#define IDD_PPAGE_FORMAT 215 -#define IDD_PPAGE_MARGINS 216 -#define IDD_CUSTOM_FIELD 217 -#define IDC_CHOOSE 218 -#define IDC_URL 222 -#define IDC_CONTENTTYPE 223 -#define IDC_APPLICATION 224 -#define IDC_SOURCE 225 -#define IDC_DESTINATION 226 -#define IDC_PROGRESS 227 -#define IDC_TAB 229 -#define IDC_PAGE_MARKER 230 -#define IDC_PRINTBACKGROUND 231 -#define IDC_PORTRAIT 232 -#define IDC_LANDSCAPE 233 -#define IDC_SCALE 234 -#define IDC_SHRINKTOFIT 235 -#define IDC_MARGIN_TOP 236 -#define IDC_MARGIN_LEFT 237 -#define IDC_MARGIN_BOTTOM 238 -#define IDC_MARGIN_RIGHT 239 -#define IDC_HDR_LEFT 240 -#define IDC_HDR_MIDDLE 241 -#define IDC_HDR_RIGHT 242 -#define IDC_FTR_LEFT 243 -#define IDC_FTR_MIDDLE 244 -#define IDC_FTR_RIGHT 245 -#define IDC_OPENWITHAPP 300 -#define IDC_SAVETOFILE 301 -#define IDS_LOCATEMOZILLA 1000 -#define IDS_LOCATEMOZILLATITLE 1001 -#define IDS_CANNOTCREATEPREFS 1002 -#define IDS_CONFIRMEX_OK 2000 -#define IDS_CONFIRMEX_CANCEL 2001 -#define IDS_CONFIRMEX_YES 2002 -#define IDS_CONFIRMEX_NO 2003 -#define IDS_CONFIRMEX_SAVE 2004 -#define IDS_CONFIRMEX_DONTSAVE 2005 -#define IDS_CONFIRMEX_REVERT 2006 -#define IDC_BUTTON0 2200 -#define IDC_BUTTON1 2201 -#define IDC_BUTTON2 2202 -#define ID_BROWSE_BACK 32768 -#define ID_DOCUMENT_BACK 32768 -#define ID_BROWSE_FORWARD 32769 -#define ID_DOCUMENT_FORWARD 32769 -#define ID_FILE_REFRESH 32772 -#define ID_DOCUMENT_REFRESH 32772 -#define ID_FILE_PRINT 32773 -#define ID_DOCUMENT_PRINT 32773 -#define ID_PAGE_PROPERTIES 32774 -#define ID_DOCUMENT_PROPERTIES 32774 -#define ID_FILE_VIEWSOURCE 32775 -#define ID_DOCUMENT_VIEWSOURCE 32775 -#define ID_FILE_OPEN 32776 -#define ID_LINK_OPEN 32776 -#define ID_FILE_OPENINNEWWINDOW 32777 -#define ID_LINK_OPENINNEWWINDOW 32777 -#define ID_EDIT_COPYSHORTCUT 32778 -#define ID_LINK_COPYSHORTCUT 32778 -#define ID_LINK_PROPERTIES 32779 -#define ID_EDIT_CUT 32780 -#define ID_EDIT_COPY 32781 -#define ID_EDIT_PASTE 32782 -#define ID_EDIT_SELECTALL 32783 -#define ID_SELECTIONPOPUP_PRINT 32784 -#define ID_DOCUMENT_SELECTALL 32785 -#define ID_DOCUMENT_PASTE 32786 -#define ID_TEXT_CUT 32787 -#define ID_TEXT_COPY 32788 -#define ID_TEXT_PASTE 32789 -#define ID_TEXT_SELECTALL 32790 -#define ID_TEXT_PRINT 32791 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 218 -#define _APS_NEXT_COMMAND_VALUE 32792 -#define _APS_NEXT_CONTROL_VALUE 246 -#define _APS_NEXT_SYMED_VALUE 102 -#endif -#endif diff --git a/embedding/browser/activex/src/control_kicker/ReadMe.txt b/embedding/browser/activex/src/control_kicker/ReadMe.txt deleted file mode 100644 index ed3ace6b813..00000000000 --- a/embedding/browser/activex/src/control_kicker/ReadMe.txt +++ /dev/null @@ -1,37 +0,0 @@ -======================================================================== - DYNAMIC LINK LIBRARY : control_kicker -======================================================================== - - -AppWizard has created this control_kicker DLL for you. - -This file contains a summary of what you will find in each of the files that -make up your control_kicker application. - -control_kicker.dsp - This file (the project file) contains information at the project level and - is used to build a single project or subproject. Other users can share the - project (.dsp) file, but they should export the makefiles locally. - -control_kicker.cpp - This is the main DLL source file. - -control_kicker.h - This file contains your DLL exports. - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named control_kicker.pch and a precompiled types file named StdAfx.obj. - - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" to indicate parts of the source code you -should add to or customize. - - -///////////////////////////////////////////////////////////////////////////// diff --git a/embedding/browser/activex/src/control_kicker/StdAfx.cpp b/embedding/browser/activex/src/control_kicker/StdAfx.cpp deleted file mode 100644 index 5d8ce5720ae..00000000000 --- a/embedding/browser/activex/src/control_kicker/StdAfx.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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 browser. - * - * The Initial Developer of the Original Code is - * Netscape Communications, Inc. - * Portions created by the Initial Developer are Copyright (C) 1999 - * 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 ***** */ - -// stdafx.cpp : source file that includes just the standard includes -// control_kicker.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/embedding/browser/activex/src/control_kicker/StdAfx.h b/embedding/browser/activex/src/control_kicker/StdAfx.h deleted file mode 100644 index e2acde75c91..00000000000 --- a/embedding/browser/activex/src/control_kicker/StdAfx.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: IDL; tab-width: 4; 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 browser. - * - * The Initial Developer of the Original Code is - * Netscape Communications, Inc. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 ***** */ - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__7F2751C5_DFC7_4E43_BE16_785116B26B4A__INCLUDED_) -#define AFX_STDAFX_H__7F2751C5_DFC7_4E43_BE16_785116B26B4A__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - - -// Insert your headers here -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#include -#include -#include - -// TODO: reference additional headers your program requires here - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__7F2751C5_DFC7_4E43_BE16_785116B26B4A__INCLUDED_) diff --git a/embedding/browser/activex/src/control_kicker/control_kicker.cpp b/embedding/browser/activex/src/control_kicker/control_kicker.cpp deleted file mode 100644 index c35e0bd29a7..00000000000 --- a/embedding/browser/activex/src/control_kicker/control_kicker.cpp +++ /dev/null @@ -1,415 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; 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 browser. - * - * The Initial Developer of the Original Code is - * Netscape Communications, Inc. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 "stdafx.h" - -#include -#include - -#include "shlobj.h" - -static BOOL LoadMozLibraryFromCurrentDir(); -static BOOL LoadMozLibraryFromRegistry(BOOL bAskUserToSetPath); -static BOOL LoadLibraryWithPATHFixup(const TCHAR *szBinDirPath); - - -static HMODULE ghMozCtlX = NULL; -static HMODULE ghMozCtl = NULL; - -static LPCTSTR c_szMozCtlDll = _T("mozctl.dll"); -static LPCTSTR c_szMozillaControlKey = _T("Software\\Mozilla\\"); -static LPCTSTR c_szMozillaBinDirPathValue = _T("BinDirectoryPath"); -static LPCTSTR c_szMozCtlInProcServerKey = - _T("CLSID\\{1339B54C-3453-11D2-93B9-000000000000}\\InProcServer32"); - -// Message strings - should come from a resource file -static LPCTSTR c_szWarningTitle = - _T("Mozilla Control Warning"); -static LPCTSTR c_szErrorTitle = - _T("Mozilla Control Error"); -static LPCTSTR c_szPrePickFolderMsg = - _T("The Mozilla control was unable to detect where your Mozilla " - "layout libraries may be found. You will now be shown a directory " - "picker for you to locate them."); -static LPCTSTR c_szPickFolderDlgTitle = - _T("Pick where the Mozilla bin directory is located, " - "e.g. (c:\\mozilla\\bin)"); -static LPCTSTR c_szRegistryErrorMsg = - _T("The Mozilla control was unable to store the location of the Mozilla" - "layout libraries in the registry. This may be due to the host " - "program running with insufficient permissions to write there.\n\n" - "You should consider running the control once as Administrator " - "to enable this entry to added or alternatively move the " - "control files mozctlx.dll and mozctl.dll into the same folder as " - "the other libraries."); -static LPCTSTR c_szLoadErrorMsg = - _T("The Mozilla control could not be loaded correctly. This is could " - "be due to an invalid location being specified for the Mozilla " - "layout libraries or missing files from your installation.\n\n" - "Visit http://www.iol.ie/~locka/mozilla/mozilla.htm for in-depth" - "troubleshooting advice."); - -BOOL APIENTRY DllMain( HANDLE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - ghMozCtlX = (HMODULE) hModule; - break; - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - break; - case DLL_PROCESS_DETACH: - if (ghMozCtl) - { - FreeLibrary(ghMozCtl); - ghMozCtl = NULL; - } - break; - } - return TRUE; -} - -static BOOL LoadMozLibrary(BOOL bAskUserToSetPath = TRUE) -{ - if (ghMozCtl) - { - return TRUE; - } - - ghMozCtl = LoadLibrary(c_szMozCtlDll); - if (ghMozCtl) - { - return TRUE; - } - - if (LoadMozLibraryFromCurrentDir()) - { - return TRUE; - } - - if (LoadMozLibraryFromRegistry(bAskUserToSetPath)) - { - return TRUE; - } - - ::MessageBox(NULL, c_szLoadErrorMsg, c_szErrorTitle, MB_OK); - - return FALSE; -} - -static BOOL LoadMozLibraryFromCurrentDir() -{ - TCHAR szMozCtlXPath[MAX_PATH + 1]; - - // Get this module's path - ZeroMemory(szMozCtlXPath, sizeof(szMozCtlXPath)); - GetModuleFileName(ghMozCtlX, szMozCtlXPath, - sizeof(szMozCtlXPath) / sizeof(szMozCtlXPath[0])); - - // Make the control path - TCHAR szTmpDrive[_MAX_DRIVE]; - TCHAR szTmpDir[_MAX_DIR]; - TCHAR szTmpFname[_MAX_FNAME]; - TCHAR szTmpExt[_MAX_EXT]; - _tsplitpath(szMozCtlXPath, szTmpDrive, szTmpDir, szTmpFname, szTmpExt); - - TCHAR szMozCtlPath[MAX_PATH + 1]; - ZeroMemory(szMozCtlPath, sizeof(szMozCtlPath)); - _tmakepath(szMozCtlPath, szTmpDrive, szTmpDir, c_szMozCtlDll, NULL); - - // Stat to see if the control exists - struct _stat dirStat; - if (_tstat(szMozCtlPath, &dirStat) == 0) - { - TCHAR szBinDirPath[MAX_PATH + 1]; - ZeroMemory(szBinDirPath, sizeof(szBinDirPath)); - _tmakepath(szBinDirPath, szTmpDrive, szTmpDir, NULL, NULL); - if (LoadLibraryWithPATHFixup(szBinDirPath)) - { - return TRUE; - } - } - - return FALSE; -} - -static BOOL LoadMozLibraryFromRegistry(BOOL bAskUserToSetPath) -{ - // - HKEY hkey = NULL; - - TCHAR szBinDirPath[MAX_PATH + 1]; - DWORD dwBufSize = sizeof(szBinDirPath); - - ZeroMemory(szBinDirPath, dwBufSize); - - // First try and read the path from the registry - RegOpenKeyEx(HKEY_LOCAL_MACHINE, c_szMozillaControlKey, 0, KEY_READ, &hkey); - if (hkey) - { - DWORD dwType = REG_SZ; - RegQueryValueEx(hkey, c_szMozillaBinDirPathValue, NULL, &dwType, - (LPBYTE) szBinDirPath, &dwBufSize); - RegCloseKey(hkey); - hkey = NULL; - - if (lstrlen(szBinDirPath) > 0 && LoadLibraryWithPATHFixup(szBinDirPath)) - { - return TRUE; - } - - // NOTE: We will drop through here if the registry key existed - // but didn't lead to the control being loaded. - } - - // Ask the user to pick to pick the path? - if (bAskUserToSetPath) - { - // Tell the user that they have to pick the bin dir path - ::MessageBox(NULL, c_szPrePickFolderMsg, c_szWarningTitle, MB_OK); - - // Show a folder picker for the user to choose the bin directory - BROWSEINFO bi; - ZeroMemory(&bi, sizeof(bi)); - bi.hwndOwner = NULL; - bi.pidlRoot = NULL; - bi.pszDisplayName = szBinDirPath; - bi.lpszTitle = c_szPickFolderDlgTitle; - LPITEMIDLIST pItemList = SHBrowseForFolder(&bi); - if (pItemList) - { - // Get the path from the user selection - IMalloc *pShellAllocator = NULL; - SHGetMalloc(&pShellAllocator); - if (pShellAllocator) - { - char szPath[MAX_PATH + 1]; - - if (SHGetPathFromIDList(pItemList, szPath)) - { - // Chop off the end path separator - int nPathSize = strlen(szPath); - if (nPathSize > 0) - { - if (szPath[nPathSize - 1] == '\\') - { - szPath[nPathSize - 1] = '\0'; - } - } - - // Form the file pattern -#ifdef UNICODE - MultiByteToWideChar(CP_ACP, 0, szPath, szBinDirPath, -1, - sizeof(szBinDirPath) / sizeof(TCHAR)); -#else - lstrcpy(szBinDirPath, szPath); -#endif - } - pShellAllocator->Free(pItemList); - pShellAllocator->Release(); - } - } - - // Store the new path if we can - if (lstrlen(szBinDirPath) > 0) - { - RegCreateKeyEx(HKEY_LOCAL_MACHINE, c_szMozillaControlKey, 0, NULL, - REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL); - if (hkey) - { - RegSetValueEx(hkey, c_szMozillaBinDirPathValue, 0, REG_SZ, - (LPBYTE) szBinDirPath, lstrlen(szBinDirPath) * sizeof(TCHAR)); - RegCloseKey(hkey); - } - else - { - // Tell the user the key can't be stored but the path they - // chose will be used for this session - ::MessageBox(NULL, c_szRegistryErrorMsg, c_szErrorTitle, MB_OK); - } - } - } - - if (lstrlen(szBinDirPath) > 0 && LoadLibraryWithPATHFixup(szBinDirPath)) - { - return TRUE; - } - - return FALSE; -} - -static BOOL LoadLibraryWithPATHFixup(const TCHAR *szBinDirPath) -{ - TCHAR szOldPath[8192]; - TCHAR szNewPath[8192]; - - ZeroMemory(szOldPath, sizeof(szOldPath)); - ZeroMemory(szNewPath, sizeof(szNewPath)); - - // Append path to front of PATH - GetEnvironmentVariable("PATH", szOldPath, sizeof(szOldPath) / sizeof(TCHAR)); - lstrcat(szNewPath, szBinDirPath); - lstrcat(szNewPath, _T(";")); - lstrcat(szNewPath, szOldPath); - SetEnvironmentVariable("PATH", szNewPath); - - // Attempt load - ghMozCtl = LoadLibrary(c_szMozCtlDll); - if (ghMozCtl) - { - return TRUE; - } - - // Restore old PATH - SetEnvironmentVariable("PATH", szOldPath); - - return FALSE; -} - - -static BOOL FixupInProcRegistryEntry() -{ - TCHAR szMozCtlXLongPath[MAX_PATH+1]; - ZeroMemory(szMozCtlXLongPath, sizeof(szMozCtlXLongPath)); - GetModuleFileName(ghMozCtlX, szMozCtlXLongPath, - sizeof(szMozCtlXLongPath) * sizeof(TCHAR)); - - TCHAR szMozCtlXPath[MAX_PATH+1]; - ZeroMemory(szMozCtlXPath, sizeof(szMozCtlXPath)); - GetShortPathName(szMozCtlXLongPath, szMozCtlXPath, - sizeof(szMozCtlXPath) * sizeof(TCHAR)); - - HKEY hkey = NULL; - RegOpenKeyEx(HKEY_CLASSES_ROOT, c_szMozCtlInProcServerKey, 0, KEY_ALL_ACCESS, &hkey); - if (hkey) - { - RegSetValueEx(hkey, NULL, 0, REG_SZ, (LPBYTE) szMozCtlXPath, - lstrlen(szMozCtlXPath) * sizeof(TCHAR)); - RegCloseKey(hkey); - return TRUE; - } - - return FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// Used to determine whether the DLL can be unloaded by OLE - -typedef HRESULT (STDAPICALLTYPE *DllCanUnloadNowFn)(void); - -STDAPI DllCanUnloadNow(void) -{ - if (LoadMozLibrary()) - { - DllCanUnloadNowFn pfn = (DllCanUnloadNowFn) - GetProcAddress(ghMozCtl, _T("DllCanUnloadNow")); - if (pfn) - { - return pfn(); - } - } - return S_OK; -} - -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - -typedef HRESULT (STDAPICALLTYPE *DllGetClassObjectFn)(REFCLSID rclsid, REFIID riid, LPVOID* ppv); - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ - if (LoadMozLibrary()) - { - DllGetClassObjectFn pfn = (DllGetClassObjectFn) - GetProcAddress(ghMozCtl, _T("DllGetClassObject")); - if (pfn) - { - return pfn(rclsid, riid, ppv); - } - } - return E_FAIL; -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -typedef HRESULT (STDAPICALLTYPE *DllRegisterServerFn)(void); - -STDAPI DllRegisterServer(void) -{ - if (LoadMozLibrary()) - { - DllRegisterServerFn pfn = (DllRegisterServerFn) - GetProcAddress(ghMozCtl, _T("DllRegisterServer")); - if (pfn) - { - HRESULT hr = pfn(); - if (SUCCEEDED(hr)) - { - FixupInProcRegistryEntry(); - } - return hr; - } - } - return E_FAIL; -} - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry - -typedef HRESULT (STDAPICALLTYPE *DllUnregisterServerFn)(void); - -STDAPI DllUnregisterServer(void) -{ - if (LoadMozLibrary()) - { - DllUnregisterServerFn pfn = (DllUnregisterServerFn) - GetProcAddress(ghMozCtl, _T("DllUnregisterServer")); - if (pfn) - { - return pfn(); - } - } - return E_FAIL; -} diff --git a/embedding/browser/activex/src/control_kicker/control_kicker.dsp b/embedding/browser/activex/src/control_kicker/control_kicker.dsp deleted file mode 100644 index 86859450bd2..00000000000 --- a/embedding/browser/activex/src/control_kicker/control_kicker.dsp +++ /dev/null @@ -1,109 +0,0 @@ -# Microsoft Developer Studio Project File - Name="control_kicker" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) External Target" 0x0106 - -CFG=control_kicker - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "control_kicker.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "control_kicker.mak" CFG="control_kicker - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "control_kicker - Win32 Release" (based on "Win32 (x86) External Target") -!MESSAGE "control_kicker - Win32 Debug" (based on "Win32 (x86) External Target") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" - -!IF "$(CFG)" == "control_kicker - Win32 Release" - -# PROP BASE Use_MFC -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Cmd_Line "NMAKE /f control_kicker.mak" -# PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "control_kicker.exe" -# PROP BASE Bsc_Name "control_kicker.bsc" -# PROP BASE Target_Dir "" -# PROP Use_MFC -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Cmd_Line "nmake /f makefile.win" -# PROP Rebuild_Opt "/a" -# PROP Target_File "WIN32_O.OBJ\mozctlx.dll" -# PROP Bsc_Name "" -# PROP Target_Dir "" - -!ELSEIF "$(CFG)" == "control_kicker - Win32 Debug" - -# PROP BASE Use_MFC -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Cmd_Line "NMAKE /f control_kicker.mak" -# PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "control_kicker.exe" -# PROP BASE Bsc_Name "control_kicker.bsc" -# PROP BASE Target_Dir "" -# PROP Use_MFC -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Cmd_Line "nmake /f makefile.win" -# PROP Rebuild_Opt "/a" -# PROP Target_File "WIN32_D.OBJ\mozctlx.dll" -# PROP Bsc_Name "" -# PROP Target_Dir "" - -!ENDIF - -# Begin Target - -# Name "control_kicker - Win32 Release" -# Name "control_kicker - Win32 Debug" - -!IF "$(CFG)" == "control_kicker - Win32 Release" - -!ELSEIF "$(CFG)" == "control_kicker - Win32 Debug" - -!ENDIF - -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\control_kicker.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\control_kicker.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# End Target -# End Project diff --git a/embedding/browser/activex/src/control_kicker/control_kicker.h b/embedding/browser/activex/src/control_kicker/control_kicker.h deleted file mode 100644 index cabad3129a8..00000000000 --- a/embedding/browser/activex/src/control_kicker/control_kicker.h +++ /dev/null @@ -1,35 +0,0 @@ - -#ifde -///////////////////////////////////////////////////////////////////////////// -// Used to determine whether the DLL can be unloaded by OLE - -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ - return _Module.GetClassObject(rclsid, riid, ppv); -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -STDAPI DllRegisterServer(void) -{ - // registers object, typelib and all interfaces in typelib - return _Module.RegisterServer(TRUE); -} - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry - -STDAPI DllUnregisterServer(void) -{ - _Module.UnregisterServer(); - return S_OK; -} diff --git a/embedding/browser/activex/src/control_kicker/mozctlx.def b/embedding/browser/activex/src/control_kicker/mozctlx.def deleted file mode 100644 index ff3d02029e4..00000000000 --- a/embedding/browser/activex/src/control_kicker/mozctlx.def +++ /dev/null @@ -1,10 +0,0 @@ -; mozctlx.def : Declares the module parameters. - -LIBRARY "mozctlx.dll" -EXPORTS - ; ActiveX exports - DllCanUnloadNow @100 PRIVATE - DllGetClassObject @101 PRIVATE - DllRegisterServer @102 PRIVATE - DllUnregisterServer @103 PRIVATE - diff --git a/embedding/browser/activex/src/plugin/LegacyPlugin.cpp b/embedding/browser/activex/src/plugin/LegacyPlugin.cpp deleted file mode 100644 index dc360a4bdcd..00000000000 --- a/embedding/browser/activex/src/plugin/LegacyPlugin.cpp +++ /dev/null @@ -1,1270 +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): - * Adam Lock - * - * 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 "stdafx.h" - -#include "npapi.h" - -#include "jsapi.h" -#include "jscntxt.h" - -#include "nsISupports.h" - -#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT -#include "XPConnect.h" -#endif - -#include "LegacyPlugin.h" - -#ifdef XPC_IDISPATCH_SUPPORT -#include "nsCOMPtr.h" -#include "nsStringAPI.h" -#include "nsIDocument.h" -#include "nsIDOMElement.h" -#include "nsIDOMDocument.h" -#include "nsIDOMWindow.h" -#include "nsIScriptGlobalObject.h" -#include "nsIScriptContext.h" -#include "nsIURI.h" -#include "nsIJSContextStack.h" -#include "nsIScriptSecurityManager.h" -#endif - -/////////////////////////////////////////////////////////////////////////////// -// These are constants to control certain default behaviours - -#ifndef MOZ_ACTIVEX_PLUGIN_XPCONNECT -// Flag determines if controls should be created if they are not marked -// safe for scripting. -const BOOL kHostSafeControlsOnly = FALSE; -// Flag determines if controls should be downloaded and installed if there is a -// codebase specified -const BOOL kDownloadControlsIfMissing = FALSE; -#endif - -// Flag determines whether the plugin will complain to the user if a page -// contains a control it cannot load -const BOOL kDisplayErrorMessages = FALSE; - -/////////////////////////////////////////////////////////////////////////////// -// CInstallControlProgress - -class CInstallControlProgress : - public CComObjectRootEx, - public IBindStatusCallback, - public IWindowForBindingUI -{ -public: - CInstallControlProgress() - { - } - - BOOL mBindingInProgress; - HRESULT mResult; - NPP mNPP; - -protected: - virtual ~CInstallControlProgress() - { - } -public: -BEGIN_COM_MAP(CInstallControlProgress) - COM_INTERFACE_ENTRY(IBindStatusCallback) - COM_INTERFACE_ENTRY(IWindowForBindingUI) -END_COM_MAP() - -// IBindStatusCallback - HRESULT STDMETHODCALLTYPE OnStartBinding(DWORD dwReserved, - IBinding __RPC_FAR *pib) - { - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetPriority(LONG __RPC_FAR *pnPriority) - { - return S_OK; - } - - HRESULT STDMETHODCALLTYPE OnLowResource(DWORD reserved) - { - return S_OK; - } - - HRESULT STDMETHODCALLTYPE OnProgress(ULONG ulProgress, - ULONG ulProgressMax, - ULONG ulStatusCode, - LPCWSTR szStatusText) - { - switch (ulStatusCode) - { - case BINDSTATUS_BEGINDOWNLOADDATA: - case BINDSTATUS_DOWNLOADINGDATA: - case BINDSTATUS_ENDDOWNLOADDATA: - { - char szMsg[100]; - _snprintf(szMsg, sizeof(szMsg) - 1, "Downloading control (%lu of %lu)", ulProgress, ulProgressMax); - szMsg[sizeof(szMsg) - 1] = '\0'; - NPN_Status(mNPP, szMsg); - } - break; - case BINDSTATUS_FINDINGRESOURCE: - case BINDSTATUS_CONNECTING: - case BINDSTATUS_REDIRECTING: - case BINDSTATUS_BEGINDOWNLOADCOMPONENTS: - case BINDSTATUS_INSTALLINGCOMPONENTS: - case BINDSTATUS_ENDDOWNLOADCOMPONENTS: - case BINDSTATUS_USINGCACHEDCOPY: - case BINDSTATUS_SENDINGREQUEST: - case BINDSTATUS_CLASSIDAVAILABLE: - case BINDSTATUS_MIMETYPEAVAILABLE: - case BINDSTATUS_CACHEFILENAMEAVAILABLE: - case BINDSTATUS_BEGINSYNCOPERATION: - case BINDSTATUS_ENDSYNCOPERATION: - case BINDSTATUS_BEGINUPLOADDATA: - case BINDSTATUS_UPLOADINGDATA: - case BINDSTATUS_ENDUPLOADDATA: - case BINDSTATUS_PROTOCOLCLASSID: - case BINDSTATUS_ENCODING: - case BINDSTATUS_CLASSINSTALLLOCATION: - case BINDSTATUS_DECODING: - case BINDSTATUS_LOADINGMIMEHANDLER: - default: - /* do nothing */ - break; - } - return S_OK; - } - - HRESULT STDMETHODCALLTYPE OnStopBinding(HRESULT hresult, LPCWSTR szError) - { - mBindingInProgress = FALSE; - mResult = hresult; - NPN_Status(mNPP, ""); - return S_OK; - } - - HRESULT STDMETHODCALLTYPE GetBindInfo(DWORD __RPC_FAR *pgrfBINDF, - BINDINFO __RPC_FAR *pbindInfo) - { - *pgrfBINDF = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | - BINDF_GETNEWESTVERSION | BINDF_NOWRITECACHE; - pbindInfo->cbSize = sizeof(BINDINFO); - pbindInfo->szExtraInfo = NULL; - memset(&pbindInfo->stgmedData, 0, sizeof(STGMEDIUM)); - pbindInfo->grfBindInfoF = 0; - pbindInfo->dwBindVerb = 0; - pbindInfo->szCustomVerb = NULL; - return S_OK; - } - - HRESULT STDMETHODCALLTYPE OnDataAvailable(DWORD grfBSCF, - DWORD dwSize, - FORMATETC __RPC_FAR *pformatetc, - STGMEDIUM __RPC_FAR *pstgmed) - { - return E_NOTIMPL; - } - - HRESULT STDMETHODCALLTYPE OnObjectAvailable(REFIID riid, - IUnknown __RPC_FAR *punk) - { - return S_OK; - } - -// IWindowForBindingUI - virtual HRESULT STDMETHODCALLTYPE GetWindow( - /* [in] */ REFGUID rguidReason, - /* [out] */ HWND *phwnd) - { - HWND hwnd = NULL; - NPN_GetValue(mNPP, NPNVnetscapeWindow, &hwnd); - *phwnd = hwnd; - return S_OK; - } -}; - -/////////////////////////////////////////////////////////////////////////////// - - -// NPP_Initialize -// -// Initialize the plugin library. Your DLL global initialization -// should be here -// -NPError NPP_Initialize(void) -{ - ATLTRACE(_T("NPP_Initialize()\n")); - _Module.Lock(); - return NPERR_NO_ERROR; -} - - -// NPP_Shutdown -// -// shutdown the plugin library. Revert initializition -// -void NPP_Shutdown(void) -{ - ATLTRACE(_T("NPP_Shutdown()\n")); - _Module.Unlock(); -} - - -#define MIME_OLEOBJECT1 "application/x-oleobject" -#define MIME_OLEOBJECT2 "application/oleobject" - -enum MozAxPluginErrors -{ - MozAxErrorControlIsNotSafeForScripting, - MozAxErrorCouldNotCreateControl, -}; - -static void -ShowError(MozAxPluginErrors errorCode, const CLSID &clsid) -{ - if (!kDisplayErrorMessages) - return; - - const TCHAR *szMsg = NULL; - const unsigned long kBufSize = 256; - TCHAR szBuffer[kBufSize]; - - // TODO errors are hardcoded for now - switch (errorCode) - { - case MozAxErrorControlIsNotSafeForScripting: - { - USES_CONVERSION; - LPOLESTR szClsid; - StringFromCLSID(clsid, &szClsid); - _sntprintf(szBuffer, kBufSize - 1, - _T("Could not create the control %s because it is not marked safe for scripting."), OLE2T(szClsid)); - CoTaskMemFree(szClsid); - szMsg = szBuffer; - } - break; - case MozAxErrorCouldNotCreateControl: - { - USES_CONVERSION; - LPOLESTR szClsid; - StringFromCLSID(clsid, &szClsid); - _sntprintf(szBuffer, kBufSize - 1, - _T("Could not create the control %s. Check that it has been installed on your computer and that this page correctly references it."), OLE2T(szClsid)); - CoTaskMemFree(szClsid); - szMsg = szBuffer; - } - break; - } - szBuffer[kBufSize - 1] = TCHAR('\0'); - if (szMsg) - MessageBox(NULL, szMsg, _T("ActiveX Error"), MB_OK | MB_ICONWARNING); -} - -#if defined(MOZ_ACTIVEX_PLUGIN_XPCONNECT) && defined(XPC_IDISPATCH_SUPPORT) - -static nsresult -CreatePrincipal(nsIURI * origin, - nsIPrincipal ** outPrincipal) -{ - nsresult rv; - nsCOMPtr secMan( - do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv)); - if (NS_FAILED(rv)) return rv; - - return secMan->GetCodebasePrincipal(origin, outPrincipal); -} - -/***************************************************************************/ -// A class to put on the stack to manage JS contexts when we are entering JS. -// This pushes and pops the given context -// with the nsThreadJSContextStack service as this object goes into and out -// of scope. It is optimized to not push/pop the cx if it is already on top -// of the stack. We need to push the JSContext when we enter JS because the -// JS security manager looks on the context stack for permissions information. - -class MozAxAutoPushJSContext -{ -public: - MozAxAutoPushJSContext(JSContext *cx, nsIURI * aURI); - - ~MozAxAutoPushJSContext(); - - nsresult ResultOfPush() { return mPushResult; }; - -private: - nsCOMPtr mContextStack; - JSContext* mContext; - JSStackFrame mFrame; - nsresult mPushResult; -}; - - -MozAxAutoPushJSContext::MozAxAutoPushJSContext(JSContext *cx, - nsIURI * aURI) - : mContext(cx), mPushResult(NS_OK) -{ - nsCOMPtr contextStack = - do_GetService("@mozilla.org/js/xpc/ContextStack;1"); - - JSContext* currentCX; - if(contextStack && - // Don't push if the current context is already on the stack. - (NS_FAILED(contextStack->Peek(¤tCX)) || - cx != currentCX) ) - { - if (NS_SUCCEEDED(contextStack->Push(cx))) - { - // Leave the reference in mContextStack to - // indicate that we need to pop it in our dtor. - mContextStack.swap(contextStack); - } - } - - memset(&mFrame, 0, sizeof(mFrame)); - - // See if there are any scripts on the stack. - // If not, we need to add a dummy frame with a principal. - PRBool hasScript = PR_FALSE; - JSStackFrame* tempFP = cx->fp(); - while (tempFP) - { - if (tempFP->script) - { - hasScript = PR_TRUE; - break; - } - tempFP = tempFP->down; - }; - - if (!hasScript) - { - nsCOMPtr principal; - mPushResult = CreatePrincipal(aURI, getter_AddRefs(principal)); - - if (NS_SUCCEEDED(mPushResult)) - { - JSPrincipals* jsprinc; - principal->GetJSPrincipals(cx, &jsprinc); - - mFrame.script = JS_CompileScriptForPrincipals(cx, JS_GetGlobalObject(cx), - jsprinc, "", 0, "", 1); - JSPRINCIPALS_DROP(cx, jsprinc); - - if (mFrame.script) - { - mFrame.down = cx->fp; - cx->fp = &mFrame; - } - else - mPushResult = NS_ERROR_OUT_OF_MEMORY; - } - } -} - -MozAxAutoPushJSContext::~MozAxAutoPushJSContext() -{ - if (mContextStack) - mContextStack->Pop(nsnull); - - if (mFrame.script) - mContext->fp = mFrame.down; - -} - - -static JSContext* -GetPluginsContext(PluginInstanceData *pData) -{ - nsCOMPtr window; - NPN_GetValue(pData->pPluginInstance, NPNVDOMWindow, - static_cast(getter_AddRefs(window))); - - nsCOMPtr globalObject(do_QueryInterface(window)); - if (!globalObject) - return nsnull; - - nsIScriptContext *scriptContext = globalObject->GetContext(); - - if (!scriptContext) - return nsnull; - - return reinterpret_cast(scriptContext->GetNativeContext()); -} - -#endif - -static BOOL -WillHandleCLSID(const CLSID &clsid, PluginInstanceData *pData) -{ -#if defined(MOZ_ACTIVEX_PLUGIN_XPCONNECT) && defined(XPC_IDISPATCH_SUPPORT) - // Ensure the control is safe for scripting - nsCOMPtr dispSupport = do_GetService(NS_IDISPATCH_SUPPORT_CONTRACTID); - if (!dispSupport) - return FALSE; - JSContext * cx = GetPluginsContext(pData); - if (!cx) - return FALSE; - nsCID cid; - memcpy(&cid, &clsid, sizeof(nsCID)); - PRBool isSafe = PR_FALSE; - PRBool classExists = PR_FALSE; - nsCOMPtr uri; - MozAxPlugin::GetCurrentLocation(pData->pPluginInstance, getter_AddRefs(uri)); - - JSAutoRequest req(cx); - MozAxAutoPushJSContext autoContext(cx, uri); - dispSupport->IsClassSafeToHost(cx, cid, PR_TRUE, &classExists, &isSafe); - if (classExists && !isSafe) - return FALSE; - return TRUE; -#else - if (::IsEqualCLSID(clsid, CLSID_NULL)) - { - return FALSE; - } - - // Check the Internet Explorer list of vulnerable controls - CRegKey keyExplorer; - if (keyExplorer.Open(HKEY_LOCAL_MACHINE, - _T("SOFTWARE\\Microsoft\\Internet Explorer\\ActiveX Compatibility"), KEY_READ) == ERROR_SUCCESS) - { - LPOLESTR szCLSID = NULL; - ::StringFromCLSID(clsid, &szCLSID); - if (szCLSID) - { - CRegKey keyCLSID; - USES_CONVERSION; - if (keyCLSID.Open(keyExplorer, W2T(szCLSID), KEY_READ) == ERROR_SUCCESS) - { - DWORD dwType = REG_DWORD; - DWORD dwFlags = 0; - DWORD dwBufSize = sizeof(dwFlags); - if (::RegQueryValueEx(keyCLSID, _T("Compatibility Flags"), - NULL, &dwType, (LPBYTE) &dwFlags, &dwBufSize) == ERROR_SUCCESS) - { - // Flags for this reg key - const DWORD kKillBit = 0x00000400; - if (dwFlags & kKillBit) - { - ::CoTaskMemFree(szCLSID); - return FALSE; - } - } - } - ::CoTaskMemFree(szCLSID); - } - } - - // Check if the CLSID belongs to a list that the plugin does not support - CRegKey keyDeny; - if (keyDeny.Open(HKEY_LOCAL_MACHINE, kControlsToDenyKey, KEY_READ) == ERROR_SUCCESS) - { - // Enumerate CLSIDs looking for this one - int i = 0; - do { - USES_CONVERSION; - TCHAR szCLSID[64]; - const DWORD nLength = sizeof(szCLSID) / sizeof(szCLSID[0]); - if (::RegEnumKey(keyDeny, i++, szCLSID, nLength) != ERROR_SUCCESS) - { - break; - } - szCLSID[nLength - 1] = TCHAR('\0'); - CLSID clsidToCompare = GUID_NULL; - if (SUCCEEDED(::CLSIDFromString(T2OLE(szCLSID), &clsidToCompare)) && - ::IsEqualCLSID(clsid, clsidToCompare)) - { - return FALSE; - } - } while (1); - keyDeny.Close(); - } - - // Check if the CLSID belongs to a list that the plugin only supports - CRegKey keyAllow; - if (keyAllow.Open(HKEY_LOCAL_MACHINE, kControlsToAllowKey, KEY_READ) == ERROR_SUCCESS) - { - // Enumerate CLSIDs looking for this one - int i = 0; - do { - USES_CONVERSION; - TCHAR szCLSID[64]; - const DWORD nLength = sizeof(szCLSID) / sizeof(szCLSID[0]); - if (::RegEnumKey(keyAllow, i, szCLSID, nLength) != ERROR_SUCCESS) - { - // An empty list means all controls are allowed. - return (i == 0) ? TRUE : FALSE; - } - ++i; - szCLSID[nLength - 1] = TCHAR('\0'); - CLSID clsidToCompare = GUID_NULL; - if (SUCCEEDED(::CLSIDFromString(T2OLE(szCLSID), &clsidToCompare)) && - ::IsEqualCLSID(clsid, clsidToCompare)) - { - return TRUE; - } - } while (1); - } - - return TRUE; -#endif -} - -static NPError -CreateControl(const CLSID &clsid, PluginInstanceData *pData, PropertyList &pl, LPCOLESTR szCodebase) -{ - // Make sure we got a CLSID we can handle - if (!WillHandleCLSID(clsid, pData)) - { - return NPERR_GENERIC_ERROR; - } - - pData->clsid = clsid; - - // Set flags to specify if it is allowed to host safe or unsafe controls - // and download them. - PRBool hostSafeControlsOnly; - PRBool downloadControlsIfMissing; -#if defined(MOZ_ACTIVEX_PLUGIN_XPCONNECT) && defined(XPC_IDISPATCH_SUPPORT) - PRUint32 hostingFlags = MozAxPlugin::PrefGetHostingFlags(); - if (hostingFlags & nsIActiveXSecurityPolicy::HOSTING_FLAGS_HOST_SAFE_OBJECTS && - !(hostingFlags & nsIActiveXSecurityPolicy::HOSTING_FLAGS_HOST_ALL_OBJECTS)) - { - hostSafeControlsOnly = TRUE; - } - else if (hostingFlags & nsIActiveXSecurityPolicy::HOSTING_FLAGS_HOST_ALL_OBJECTS) - { - hostSafeControlsOnly = FALSE; - } - else - { - // Plugin can host neither safe nor unsafe controls, so just return - // without creating anything. - return NPERR_GENERIC_ERROR; - } - if (hostingFlags & nsIActiveXSecurityPolicy::HOSTING_FLAGS_DOWNLOAD_CONTROLS) - { - downloadControlsIfMissing = PR_TRUE; - } - else - { - downloadControlsIfMissing = PR_FALSE; - } - // Ensure we can obtain the nsIDispatchSupport service - nsCOMPtr dispSupport = do_GetService(NS_IDISPATCH_SUPPORT_CONTRACTID); - if (!dispSupport) - { - return NPERR_GENERIC_ERROR; - } - // Now test if the CLSID is safe for scripting - PRBool classIsMarkedSafeForScripting = PR_FALSE; - if (hostSafeControlsOnly) - { - PRBool classExists = PR_FALSE; - PRBool isClassSafeForScripting = PR_FALSE; - nsCID cid; - memcpy(&cid, &clsid, sizeof(cid)); - if (NS_SUCCEEDED(dispSupport->IsClassMarkedSafeForScripting(cid, &classExists, &isClassSafeForScripting)) && - classExists && isClassSafeForScripting) - { - classIsMarkedSafeForScripting = PR_TRUE; - } - } -#else - hostSafeControlsOnly = kHostSafeControlsOnly; - downloadControlsIfMissing = kDownloadControlsIfMissing; -#endif - - // Create the control site - CControlSiteInstance *pSite = NULL; - CControlSiteInstance::CreateInstance(&pSite); - if (pSite == NULL) - { - return NPERR_GENERIC_ERROR; - } - - pSite->m_bSupportWindowlessActivation = FALSE; -#if defined(MOZ_ACTIVEX_PLUGIN_XPCONNECT) && defined(XPC_IDISPATCH_SUPPORT) - // We handle our own security further down - pSite->SetSecurityPolicy(NULL); - pSite->m_bSafeForScriptingObjectsOnly = FALSE; -#else - pSite->m_bSafeForScriptingObjectsOnly = hostSafeControlsOnly; -#endif - - pSite->AddRef(); - -#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT - // Set up the service provider and container so the control can get hold - // of the IE DOM and other interfaces - CComPtr sp; - MozAxPlugin::GetServiceProvider(pData, &sp); - if (sp) - pSite->SetServiceProvider(sp); - CComQIPtr container = sp; - if (container) - pSite->SetContainer(container); -#endif - - // TODO check the object is installed and at least as recent as - // that specified in szCodebase - - // Create the object - HRESULT hr; - if (!downloadControlsIfMissing || !szCodebase) - { - hr = pSite->Create(clsid, pl); - } - else if (szCodebase) - { - CComObject *pProgress = NULL; - CComPtr spBindCtx; - CComPtr spOldBSC; - CComObject::CreateInstance(&pProgress); - pProgress->AddRef(); - CreateBindCtx(0, &spBindCtx); - RegisterBindStatusCallback(spBindCtx, dynamic_cast(pProgress), &spOldBSC, 0); - - hr = pSite->Create(clsid, pl, szCodebase, spBindCtx); - if (hr == MK_S_ASYNCHRONOUS) - { - pProgress->mNPP = pData->pPluginInstance; - pProgress->mBindingInProgress = TRUE; - pProgress->mResult = E_FAIL; - - // Spin around waiting for binding to complete - HANDLE hFakeEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL); - while (pProgress->mBindingInProgress) - { - MSG msg; - // Process pending messages - while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) - { - if (!::GetMessage(&msg, NULL, 0, 0)) - { - pProgress->mBindingInProgress = FALSE; - break; - } - ::TranslateMessage(&msg); - ::DispatchMessage(&msg); - } - if (!pProgress->mBindingInProgress) - break; - // Sleep for a bit or the next msg to appear - ::MsgWaitForMultipleObjects(1, &hFakeEvent, FALSE, 500, QS_ALLEVENTS); - } - ::CloseHandle(hFakeEvent); - - hr = pProgress->mResult; - if (SUCCEEDED(hr)) - { - hr = pSite->Create(clsid, pl); - } - } - if (pProgress) - { - RevokeBindStatusCallback(spBindCtx, dynamic_cast(pProgress)); - pProgress->Release(); - } - } - if (FAILED(hr)) - { - ShowError(MozAxErrorCouldNotCreateControl, clsid); - } -#if defined(MOZ_ACTIVEX_PLUGIN_XPCONNECT) && defined(XPC_IDISPATCH_SUPPORT) - if (SUCCEEDED(hr) && hostSafeControlsOnly && !classIsMarkedSafeForScripting) - { - CComPtr cpUnk; - pSite->GetControlUnknown(&cpUnk); - nsIID iidDispatch; - memcpy(&iidDispatch, &__uuidof(IDispatch), sizeof(nsIID)); - PRBool isObjectSafe = PR_FALSE; - if (!cpUnk || - NS_FAILED(dispSupport->IsObjectSafeForScripting( - reinterpret_cast(cpUnk.p), iidDispatch, &isObjectSafe)) || - !isObjectSafe) - { - pSite->Detach(); - hr = E_FAIL; - ShowError(MozAxErrorControlIsNotSafeForScripting, clsid); - // DROP THROUGH - } - } -#endif - - // Clean up if the control could not be created - if (FAILED(hr)) - { - pSite->Release(); - return NPERR_GENERIC_ERROR; - } - -#if defined(MOZ_ACTIVEX_PLUGIN_XPCONNECT) && defined(XPC_IDISPATCH_SUPPORT) - // Hook up the event sink - nsEventSinkInstance *pSink = NULL; - nsEventSinkInstance::CreateInstance(&pSink); - if (pSink) - { - pSink->AddRef(); - pSink->mPlugin = pData; - CComPtr control; - pSite->GetControlUnknown(&control); - pSink->SubscribeToEvents(control); - } - pData->pControlEventSink = pSink; -#endif - pData->nType = itControl; - pData->pControlSite = pSite; - - return NPERR_NO_ERROR; -} - -static NPError -NewControl(const char *pluginType, - PluginInstanceData *pData, - uint16_t mode, - int16_t argc, - char *argn[], - char *argv[]) -{ - // Read the parameters - CLSID clsid = CLSID_NULL; - CComBSTR codebase; - PropertyList pl; - - if (strcmp(pluginType, MIME_OLEOBJECT1) != 0 && - strcmp(pluginType, MIME_OLEOBJECT2) != 0) - { - clsid = MozAxPlugin::GetCLSIDForType(pluginType); - } - - for (int16_t i = 0; i < argc; i++) - { - if (stricmp(argn[i], "CLSID") == 0 || - stricmp(argn[i], "CLASSID") == 0) - { - // Accept CLSIDs specified in various ways - // e.g: - // "CLSID:C16DF970-D1BA-11d2-A252-000000000000" - // "C16DF970-D1BA-11d2-A252-000000000000" - // "{C16DF970-D1BA-11d2-A252-000000000000}" - // - // The first example is the proper way - - const int kCLSIDLen = 256; - char szCLSID[kCLSIDLen]; - if (strlen(argv[i]) < sizeof(szCLSID)) - { - if (_strnicmp(argv[i], "CLSID:", 6) == 0) - { - _snprintf(szCLSID, kCLSIDLen - 1, "{%s}", argv[i]+6); - } - else if(argv[i][0] != '{') - { - _snprintf(szCLSID, kCLSIDLen - 1, "{%s}", argv[i]); - } - else - { - strncpy(szCLSID, argv[i], kCLSIDLen - 1); - } - szCLSID[kCLSIDLen - 1] = '\0'; - USES_CONVERSION; - CLSIDFromString(A2OLE(szCLSID), &clsid); - } - } - else if (stricmp(argn[i], "CODEBASE") == 0) - { - codebase = argv[i]; - -#ifdef XPC_IDISPATCH_SUPPORT - // resolve relative URLs on CODEBASE - if (argv[i]) - { - nsCOMPtr element; - NPN_GetValue(pData->pPluginInstance, NPNVDOMElement, - static_cast(getter_AddRefs(element))); - if (element) - { - nsCOMPtr tagAsNode (do_QueryInterface(element)); - if (tagAsNode) - { - nsCOMPtr DOMdocument; - tagAsNode->GetOwnerDocument(getter_AddRefs(DOMdocument)); - // XXX nsIDocument is not frozen!!! - nsCOMPtr doc(do_QueryInterface(DOMdocument)); - if (doc) - { - nsIURI *baseURI = doc->GetBaseURI(); - if (baseURI) - { - nsCAutoString newURL; - if (NS_SUCCEEDED(baseURI->Resolve(nsDependentCString(argv[i]), newURL))) - { - codebase = newURL.get(); - } - } - } - } - } - } -#endif - - } - else - { - CComBSTR paramName; - if (_strnicmp(argn[i], "PARAM_", 6) == 0) - { - paramName = argn[i] + 6; - } - else if (stricmp(argn[i], "PARAM") == 0) - { - // The next argn and argv values after this symbol - // will be tag names and values - continue; - } - else - { - paramName = argn[i]; - } - - // Empty parameters are ignored - if (!paramName.m_str || paramName.Length() == 0) - { - continue; - } - - USES_CONVERSION; - CComBSTR paramValue(A2W(argv[i])); - - // Check for existing params with the same name - BOOL bFound = FALSE; - for (unsigned long j = 0; j < pl.GetSize(); j++) - { - if (wcscmp(pl.GetNameOf(j), (BSTR) paramName) == 0) - { - bFound = TRUE; - break; - } - } - // If the parameter already exists, don't add it to the - // list again. - if (bFound) - { - continue; - } - - // Add named parameter to list - CComVariant v(paramValue); - pl.AddNamedProperty(paramName, v); - } - } - - return CreateControl(clsid, pData, pl, codebase.m_str); -} - - -// NPP_New -// -// create a new plugin instance -// handle any instance specific code initialization here -// -NPError NPP_New(NPMIMEType pluginType, - NPP instance, - uint16_t mode, - int16_t argc, - char* argn[], - char* argv[], - NPSavedData* saved) -{ - ATLTRACE(_T("NPP_New()\n")); - - // trap duff args - if (instance == NULL) - { - return NPERR_INVALID_INSTANCE_ERROR; - } - - PluginInstanceData *pData = new PluginInstanceData; - if (pData == NULL) - { - return NPERR_GENERIC_ERROR; - } - pData->pPluginInstance = instance; - pData->szUrl = NULL; - pData->szContentType = (pluginType) ? strdup(pluginType) : NULL; -#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT - pData->pScriptingPeer = NULL; -#endif - - // Create a plugin according to the mime type -#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT - MozAxPlugin::AddRef(); -#endif - - CoInitializeEx(NULL, COINIT_MULTITHREADED); - - NPError rv = NPERR_GENERIC_ERROR; - /* if (strcmp(pluginType, MIME_OLEOBJECT1) == 0 || - strcmp(pluginType, MIME_OLEOBJECT2) == 0) */ - { - rv = NewControl(pluginType, pData, mode, argc, argn, argv); - } - - // Test if plugin creation has succeeded and cleanup if it hasn't - if (rv != NPERR_NO_ERROR) - { - if (pData->szContentType) - free(pData->szContentType); - if (pData->szUrl) - free(pData->szUrl); - delete pData; -#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT - MozAxPlugin::Release(); -#endif - CoUninitialize(); - return rv; - } - - instance->pdata = pData; - - return NPERR_NO_ERROR; -} - - -// NPP_Destroy -// -// Deletes a plug-in instance and releases all of its resources. -// -NPError -NPP_Destroy(NPP instance, NPSavedData** save) -{ - ATLTRACE(_T("NPP_Destroy()\n")); - - PluginInstanceData *pData = (PluginInstanceData *) instance->pdata; - if (pData == NULL) - { - return NPERR_INVALID_INSTANCE_ERROR; - } - - if (pData->nType == itControl) - { - // Destroy the site - CControlSiteInstance *pSite = pData->pControlSite; - if (pSite) - { - pSite->Detach(); - pSite->Release(); - } -#if defined(MOZ_ACTIVEX_PLUGIN_XPCONNECT) && defined(XPC_IDISPATCH_SUPPORT) - if (pData->pControlEventSink) - { - pData->pControlEventSink->UnsubscribeFromEvents(); - pData->pControlEventSink->Release(); - } -#endif -#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT - if (pData->pScriptingPeer) - { - pData->pScriptingPeer->Release(); - } -#endif - } - else if (pData->nType == itScript) - { - // TODO - } - - if (pData->szUrl) - free(pData->szUrl); - if (pData->szContentType) - free(pData->szContentType); - delete pData; -#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT - MozAxPlugin::Release(); -#endif - - instance->pdata = 0; - - CoUninitialize(); - - return NPERR_NO_ERROR; - -} - - -// NPP_SetWindow -// -// Associates a platform specific window handle with a plug-in instance. -// Called multiple times while, e.g., scrolling. Can be called for three -// reasons: -// -// 1. A new window has been created -// 2. A window has been moved or resized -// 3. A window has been destroyed -// -// There is also the degenerate case; that it was called spuriously, and -// the window handle and or coords may have or have not changed, or -// the window handle and or coords may be ZERO. State information -// must be maintained by the plug-in to correctly handle the degenerate -// case. -// -NPError -NPP_SetWindow(NPP instance, NPWindow* window) -{ - ATLTRACE(_T("NPP_SetWindow()\n")); - - // Reject silly parameters - if (!window) - { - return NPERR_GENERIC_ERROR; - } - - PluginInstanceData *pData = (PluginInstanceData *) instance->pdata; - if (pData == NULL) - { - return NPERR_INVALID_INSTANCE_ERROR; - } - - if (pData->nType == itControl) - { - CControlSiteInstance *pSite = pData->pControlSite; - if (pSite == NULL) - { - return NPERR_GENERIC_ERROR; - } - - HWND hwndParent = (HWND) window->window; - if (hwndParent) - { - RECT rcPos; - GetClientRect(hwndParent, &rcPos); - - if (pSite->GetParentWindow() == NULL) - { - pSite->Attach(hwndParent, rcPos, NULL); - } - else - { - pSite->SetPosition(rcPos); - } - - // Ensure clipping on parent to keep child controls happy - ::SetWindowLong(hwndParent, GWL_STYLE, - ::GetWindowLong(hwndParent, GWL_STYLE) | WS_CLIPCHILDREN); - } - } - - return NPERR_NO_ERROR; -} - - -// NPP_NewStream -// -// Notifies the plugin of a new data stream. -// The data type of the stream (a MIME name) is provided. -// The stream object indicates whether it is seekable. -// The plugin specifies how it wants to handle the stream. -// -// In this case, I set the streamtype to be NPAsFile. This tells the Navigator -// that the plugin doesn't handle streaming and can only deal with the object as -// a complete disk file. It will still call the write functions but it will also -// pass the filename of the cached file in a later NPE_StreamAsFile call when it -// is done transferring the file. -// -// If a plugin handles the data in a streaming manner, it should set streamtype to -// NPNormal (e.g. *streamtype = NPNormal)...the NPE_StreamAsFile function will -// never be called in this case -// -NPError -NPP_NewStream(NPP instance, - NPMIMEType type, - NPStream *stream, - NPBool seekable, - uint16_t *stype) -{ - ATLTRACE(_T("NPP_NewStream()\n")); - - if(!instance) - { - return NPERR_INVALID_INSTANCE_ERROR; - } - - // save the plugin instance object in the stream instance - stream->pdata = instance->pdata; - *stype = NP_ASFILE; - return NPERR_NO_ERROR; -} - - -// NPP_StreamAsFile -// -// The stream is done transferring and here is a pointer to the file in the cache -// This function is only called if the streamtype was set to NPAsFile. -// -void -NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) -{ - ATLTRACE(_T("NPP_StreamAsFile()\n")); - - if(fname == NULL || fname[0] == NULL) - { - return; - } -} - - -// -// These next 2 functions are really only directly relevant -// in a plug-in which handles the data in a streaming manner. -// For a NPAsFile stream, they are still called but can safely -// be ignored. -// -// In a streaming plugin, all data handling would take place here... -// -////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//. -//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\. - -int32_t STREAMBUFSIZE = 0X0FFFFFFF; // we are reading from a file in NPAsFile mode - // so we can take any size stream in our write - // call (since we ignore it) - - -// NPP_WriteReady -// -// The number of bytes that a plug-in is willing to accept in a subsequent -// NPO_Write call. -// -int32_t -NPP_WriteReady(NPP instance, NPStream *stream) -{ - return STREAMBUFSIZE; -} - - -// NPP_Write -// -// Provides len bytes of data. -// -int32_t -NPP_Write(NPP instance, NPStream *stream, int32_t offset, int32_t len, void *buffer) -{ - return len; -} - - -// NPP_DestroyStream -// -// Closes a stream object. -// reason indicates why the stream was closed. Possible reasons are -// that it was complete, because there was some error, or because -// the user aborted it. -// -NPError -NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason) -{ - // because I am handling the stream as a file, I don't do anything here... - // If I was streaming, I would know that I was done and do anything appropriate - // to the end of the stream... - return NPERR_NO_ERROR; -} - - -// NPP_Print -// -// Printing the plugin (to be continued...) -// -void -NPP_Print(NPP instance, NPPrint* printInfo) -{ - if(printInfo == NULL) // trap invalid parm - { - return; - } - -// if (instance != NULL) { -// CPluginWindow* pluginData = (CPluginWindow*) instance->pdata; -// pluginData->Print(printInfo); -// } -} - -/******************************************************************************* -// NPP_URLNotify: -// Notifies the instance of the completion of a URL request. -// -// NPP_URLNotify is called when Netscape completes a NPN_GetURLNotify or -// NPN_PostURLNotify request, to inform the plug-in that the request, -// identified by url, has completed for the reason specified by reason. The most -// common reason code is NPRES_DONE, indicating simply that the request -// completed normally. Other possible reason codes are NPRES_USER_BREAK, -// indicating that the request was halted due to a user action (for example, -// clicking the "Stop" button), and NPRES_NETWORK_ERR, indicating that the -// request could not be completed (for example, because the URL could not be -// found). The complete list of reason codes is found in npapi.h. -// -// The parameter notifyData is the same plug-in-private value passed as an -// argument to the corresponding NPN_GetURLNotify or NPN_PostURLNotify -// call, and can be used by your plug-in to uniquely identify the request. - ******************************************************************************/ - -void -NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData) -{ - PluginInstanceData *pData = (PluginInstanceData *) instance->pdata; - if (pData) - { - if (pData->szUrl) - free(pData->szUrl); - pData->szUrl = strdup(url); - } -} - -NPError -NPP_GetValue(NPP instance, NPPVariable variable, void *value) -{ - NPError rv = NPERR_GENERIC_ERROR; -#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT - rv = MozAxPlugin::GetValue(instance, variable, value); -#endif - return rv; -} - -NPError -NPP_SetValue(NPP instance, NPNVariable variable, void *value) -{ - return NPERR_GENERIC_ERROR; -} diff --git a/embedding/browser/activex/src/plugin/LegacyPlugin.h b/embedding/browser/activex/src/plugin/LegacyPlugin.h deleted file mode 100644 index 731a38959b6..00000000000 --- a/embedding/browser/activex/src/plugin/LegacyPlugin.h +++ /dev/null @@ -1,73 +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): - * Adam Lock - * Paul Oswald - * - * 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 ***** */ - -#ifndef LEGACYPLUGIN_H -#define LEGACYPLUGIN_H - -#include "npapi.h" -#include "nsISupports.h" - -#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT -#include "XPConnect.h" -#endif - -// Plugin types supported -enum PluginInstanceType -{ - itScript, - itControl -}; - -// Data associated with a plugin instance -struct PluginInstanceData { - NPP pPluginInstance; - PluginInstanceType nType; - CControlSiteInstance *pControlSite; -#ifdef XPC_IDISPATCH_SUPPORT - nsEventSinkInstance *pControlEventSink; -#endif - char *szUrl; - char *szContentType; - CLSID clsid; -#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT - nsISupports *pScriptingPeer; -#endif -}; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/plugin/Makefile.in b/embedding/browser/activex/src/plugin/Makefile.in deleted file mode 100644 index f429f491a00..00000000000 --- a/embedding/browser/activex/src/plugin/Makefile.in +++ /dev/null @@ -1,241 +0,0 @@ -# ***** 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): -# Adam Lock -# -# 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 ***** - -############################################################################### -# CUSTOMISE SETTINGS IN THIS SECTION AS APPROPRIATE FOR YOUR BUILD SYSTEM! - -DEPTH = ../../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = npmozax -LIBRARY_NAME = npmozax - -RESFILE = MozActiveX.res -DEFFILE = npmozax.def -GRE_MODULE = 1 - - -XPIFILE = mozactivex.xpi - -FORCE_SHARED_LIB = 1 -NO_DIST_INSTALL = 1 -NO_INSTALL = 1 - -# Path to the Mozilla ActiveX common dir (some files are copied from there) -AXCOMMONSRC=$(srcdir)/../common - -############ -# XPConnect settings - -MOZ_ACTIVEX_PLUGIN_XPCONNECT = 1 - -# XPConnect support in (Netscape 6.1+/Mozilla) - -# Uncomment this line to install the plugin & policy -MOZ_USE_ACTIVEX_PLUGIN = 1 - -# Settings will also be read from this supplemental file if it exists --include $(srcdir)/plugin.mk - -############################################################################### - -ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT -XPIDLSRCS = \ - ./nsIMozAxPlugin.idl \ - $(NULL) -endif - -GARBAGE += $(DEFFILE) - -CPPSRCS = \ - StdAfx.cpp \ - LegacyPlugin.cpp \ - MozActiveX.cpp \ - npwin.cpp \ - $(NULL) - -ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT -CPPSRCS += XPConnect.cpp XPCDocument.cpp XPCBrowser.cpp -endif - -ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT -_AXCOMMON_CPPSRCS = \ - ActiveScriptSite.cpp \ - ControlEventSink.cpp \ - ControlSite.cpp \ - ControlSiteIPFrame.cpp \ - ItemContainer.cpp \ - PropertyBag.cpp \ - $(NULL) -CPPSRCS += $(_AXCOMMON_CPPSRCS) -CSRCS += javastubs.c -endif - -ifdef XPC_IDISPATCH_SUPPORT -CPPSRCS += PrefObserver.cpp -endif - -LOCAL_INCLUDES = -I$(srcdir) -I$(AXCOMMONSRC) - -ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT -LOCAL_INCLUDES += -I./_java -endif - -ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT -LOCAL_INCLUDES += -I$(XPIDL_GEN_DIR) -endif - -OS_LIBS += \ - comdlg32.lib \ - ole32.lib \ - oleaut32.lib \ - uuid.lib \ - shell32.lib \ - $(NULL) - -ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT -DEFINES += -DMOZ_ACTIVEX_PLUGIN_LIVECONNECT -DXPCOM_GLUE -endif - -ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT -DEFINES += -DMOZ_ACTIVEX_PLUGIN_XPCONNECT -endif - -ifdef XPC_IDISPATCH_SUPPORT -DEFINES += -DXPC_IDISPATCH_SUPPORT -endif - -EXTRA_DSO_LDOPTS = \ - $(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \ - $(MOZ_COMPONENT_LIBS) \ - $(NSPR_LIBS) \ - $(NULL) - -LIBS = \ - $(NSPR_LIBS) \ - $(NULL) - -# XPConnect links to XPCOM and the shared activex lib -ifdef XPC_IDISPATCH_SUPPORT -EXTRA_DSO_LDOPTS += \ - ../common/$(LIB_PREFIX)ax_common_s.$(LIB_SUFFIX) \ - $(MOZ_JS_LIBS) \ - $(XPCOM_LIBS) \ - $(NULL) -endif - -SRCS_IN_OBJDIR = 1 - -ENABLE_CXX_EXCEPTIONS = 1 - -include $(topsrcdir)/config/rules.mk - -ifdef MOZ_ACTIVEX_PLUGIN_LIVCONNECT -copy-sources: $(addprefix $(MOZCTLSRC)/,$(_CONTROL_CPPSRCS)) - $(INSTALL) $^ . - -export:: copy-sources -endif - -install-plugin: $(SHARED_LIBRARY) -ifdef SHARED_LIBRARY - $(INSTALL) $< $(DIST)/bin/plugins -endif - -install-class: MozAxPlugin.class - $(INSTALL) $< $(DIST)/bin/plugins - -install-typelib: $(XPIDL_GEN_DIR)/nsIMozAxPlugin.xpt - $(INSTALL) $< $(DIST)/bin/plugins - -install-securitypolicy: nsAxSecurityPolicy.js - $(INSTALL) $< $(DIST)/bin/components - -install-prefs: activex.js $(FLASHLITE_PREFS_JS) - $(INSTALL) $^ $(DIST)/bin/defaults/pref - -ifdef MOZ_USE_ACTIVEX_PLUGIN -libs:: install-plugin install-prefs - -ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT -libs:: install-class -endif - -ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT -libs:: install-typelib -endif - -ifdef XPC_IDISPATCH_SUPPORT -libs:: install-securitypolicy -endif -endif - -## Note: Ensure you create the redist dir containing the correct runtime dlls - -xpi:: install.js $(SHARED_LIBRARY) - $(ZIP) -9 -j $(DIST)/bin/$(XPIFILE) $< - $(ZIP) -9 -j $(DIST)/bin/$(XPIFILE) $(SHARED_LIBRARY) - $(ZIP) -9 -j $(DIST)/bin/$(XPIFILE) $(topsrcdir)/../redist/microsoft/system/msvcrt.dll - $(ZIP) -9 -j $(DIST)/bin/$(XPIFILE) $(topsrcdir)/../redist/microsoft/system/msvcp60.dll -ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT - $(ZIP) -9 -j $(DIST)/bin/$(XPIFILE) MozAxPlugin.class -endif -ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT - $(ZIP) -9 -j $(DIST)/bin/$(XPIFILE) $(XPIDL_GEN_DIR)/nsIMozAxPlugin.xpt -endif -ifdef XPC_IDISPATCH_SUPPORT - $(ZIP) -9 -j $(DIST)/bin/$(XPIFILE) activex.js - $(ZIP) -9 -j $(DIST)/bin/$(XPIFILE) nsAxSecurityPolicy.js -endif - -$(SHARED_LIBRARY) : $(DEFFILE) - -$(DEFFILE): - -rm -f $@ - @echo "; npmozax.def : Declares the module parameters." >> $@ - @echo "; This file was autogenerated by mkctldef.bat!" >> $@ - @echo "" >> $@ - @echo "LIBRARY "npmozax.DLL"" >> $@ - @echo "EXPORTS" >> $@ - @echo "; Plugin exports" >> $@ - @echo "NP_GetEntryPoints @1" >> $@ - @echo "NP_Initialize @2" >> $@ - @echo "NP_Shutdown @3" >> $@ diff --git a/embedding/browser/activex/src/plugin/MozActiveX.rc b/embedding/browser/activex/src/plugin/MozActiveX.rc deleted file mode 100644 index e0f562e7de3..00000000000 --- a/embedding/browser/activex/src/plugin/MozActiveX.rc +++ /dev/null @@ -1,124 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" -#include "winresrc.h" - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,4 - PRODUCTVERSION 1,0,0,4 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "Comments", "\0" - VALUE "CompanyName", "\0" - VALUE "FileDescription", "Mozilla ActiveX control and plugin module\0" - VALUE "FileExtents", "*.ocx|*.ocx\0" - VALUE "FileOpenName", "ActiveX (*.ocx)|ActiveX (*.ocx)|Adobe Flash Movie (*.swf)|Adobe Flash Movie (*.swf)\0" - VALUE "FileVersion", "1, 0, 0, 4\0" - VALUE "InternalName", "NPMOZAX\0" - VALUE "LegalCopyright", "Copyright 1999\0" - VALUE "LegalTrademarks", "\0" - VALUE "MIMEType", "application/x-oleobject|application/oleobject|application/x-shockwave-flash|application/x-shockwave-flash\0" - VALUE "OriginalFilename", "NPMOZAX.DLL\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Mozilla ActiveX control and plugin support\0" - VALUE "ProductVersion", "1, 0, 0, 4\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - -#endif // !_MAC - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.K.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.K.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/embedding/browser/activex/src/plugin/MozAxPlugin.java b/embedding/browser/activex/src/plugin/MozAxPlugin.java deleted file mode 100644 index 507a4d5c8fc..00000000000 --- a/embedding/browser/activex/src/plugin/MozAxPlugin.java +++ /dev/null @@ -1,62 +0,0 @@ -import netscape.plugin.Plugin; - -public class MozAxPlugin extends Plugin -{ - /////////////////////////////////////////////////////////////////////////// - // Public methods that are exposed through LiveConnect - - public Object getProperty(String dispid) - { - return xgetProperty(dispid); - } - public void setProperty(String dispid, String property) - { - xsetProperty1(dispid, property); - } - public void setProperty(String dispid, Object property) - { - xsetProperty2(dispid, property); - } - - public Object invoke(String dispid) - { - return xinvoke(dispid); - } - - public Object invoke(String dispid, Object p1) - { - return xinvoke1(dispid, p1); - } - public Object invoke(String dispid, Object p1, Object p2) - { - return xinvoke2(dispid, p1, p2); - } - public Object invoke(String dispid, Object p1, Object p2, Object p3) - { - return xinvoke3(dispid, p1, p2, p3); - } - public Object invoke(String dispid, Object p1, Object p2, Object p3, Object p4) - { - return xinvoke4(dispid, p1, p2, p3, p4); - } - public Object invoke(String dispid, Object params[]) - { - return xinvokeX(dispid, params); - } - - /////////////////////////////////////////////////////////////////////////// - // Native implementations of the above methods. - // - // Note: These methods are not overloaded like the public versions above - // because javah generates bad code which doesn't compile if you try. - - private native Object xgetProperty(String dispid); - private native void xsetProperty1(String dispid, String property); - private native void xsetProperty2(String dispid, Object property); - private native Object xinvoke(String dispid); - private native Object xinvoke1(String dispid, Object p1); - private native Object xinvoke2(String dispid, Object p1, Object p2); - private native Object xinvoke3(String dispid, Object p1, Object p2, Object p3); - private native Object xinvoke4(String dispid, Object p1, Object p2, Object p3, Object p4); - private native Object xinvokeX(String dispid, Object params[]); -}; diff --git a/embedding/browser/activex/src/plugin/PrefObserver.cpp b/embedding/browser/activex/src/plugin/PrefObserver.cpp deleted file mode 100644 index 810d7a13774..00000000000 --- a/embedding/browser/activex/src/plugin/PrefObserver.cpp +++ /dev/null @@ -1,218 +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 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 "StdAfx.h" - -#include - -#include "npapi.h" -#include "nsServiceManagerUtils.h" -#include "nsISupportsUtils.h" -#include "nsIPrefService.h" -#include "nsIPrefBranch2.h" -#include "nsWeakReference.h" -#include "nsIObserver.h" -#include "nsStringAPI.h" - -#include "XPConnect.h" - -// These are the default hosting flags in the absence of a pref. - -const PRUint32 kDefaultHostingFlags = -#ifdef XPC_IDISPATCH_SUPPORT - nsIActiveXSecurityPolicy::HOSTING_FLAGS_HOST_NOTHING; -#else - nsIActiveXSecurityPolicy::HOSTING_FLAGS_HOST_SAFE_OBJECTS | - nsIActiveXSecurityPolicy::HOSTING_FLAGS_DOWNLOAD_CONTROLS | - nsIActiveXSecurityPolicy::HOSTING_FLAGS_SCRIPT_SAFE_OBJECTS; -#endif - -class PrefObserver : - public nsSupportsWeakReference, - public nsIObserver -{ -public: - PrefObserver(); - -protected: - virtual ~PrefObserver(); - - void Sync(nsIPrefBranch *aPrefBranch); - - PRUint32 mHostingFlags; - nsCOMPtr mPrefBranch; -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIOBSERVER - - static PrefObserver *sPrefObserver; - - nsresult Subscribe(); - nsresult Unsubscribe(); - PRUint32 GetHostingFlags() const; -}; - -const char *kActiveXHostingFlags = "security.xpconnect.activex."; -const char *kUserAgentPref = "general.useragent."; -const char *kProxyPref = "network.http."; - -PrefObserver *PrefObserver::sPrefObserver = nsnull; - -PrefObserver::PrefObserver() : - mHostingFlags(kDefaultHostingFlags) -{ - nsresult rv = NS_OK; - mPrefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); - NS_ASSERTION(mPrefBranch, "where is the pref service?"); -} - -PrefObserver::~PrefObserver() -{ -} - -NS_IMPL_ADDREF(PrefObserver) -NS_IMPL_RELEASE(PrefObserver) - -NS_INTERFACE_MAP_BEGIN(PrefObserver) - NS_INTERFACE_MAP_ENTRY(nsIObserver) - NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) -NS_INTERFACE_MAP_END - -/* void observe (in nsISupports aSubject, in string aTopic, in wstring aData); */ -NS_IMETHODIMP PrefObserver::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) -{ - if (strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic) != 0) - { - return S_OK; - } - - nsresult rv; - nsCOMPtr prefBranch = do_QueryInterface(aSubject, &rv); - if (NS_FAILED(rv)) - return rv; - - NS_ConvertUTF16toUTF8 pref(aData); - if (strcmp(kActiveXHostingFlags, pref.get()) == 0 || - strcmp(kUserAgentPref, pref.get()) == 0 || - strcmp(kProxyPref, pref.get()) == 0) - { - Sync(prefBranch); - } - return NS_OK; -} - -void PrefObserver::Sync(nsIPrefBranch *aPrefBranch) -{ - NS_ASSERTION(aPrefBranch, "no pref branch"); - if (!aPrefBranch) - { - return; - } - - // TODO - // const char *userAgent = NPN_UserAgent(mData->pPluginInstance); - // ::UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, userAgent, strlen(userAgent), 0); - - // TODO - // INTERNET_PROXY_INFO ipi; - // ::UrlMkSetSessionOption(INTERNET_OPTION_PROXY, ....); - - nsCOMPtr dispSupport = do_GetService(NS_IDISPATCH_SUPPORT_CONTRACTID); - if (!dispSupport) - mHostingFlags = kDefaultHostingFlags; - else - dispSupport->GetHostingFlags(nsnull, &mHostingFlags); -} - -nsresult -PrefObserver::Subscribe() -{ - NS_ENSURE_TRUE(mPrefBranch, NS_ERROR_FAILURE); - - mPrefBranch->AddObserver(kProxyPref, this, PR_TRUE); - mPrefBranch->AddObserver(kUserAgentPref, this, PR_TRUE); - mPrefBranch->AddObserver(kActiveXHostingFlags, this, PR_TRUE); - - Sync(mPrefBranch); - - return S_OK; -} - -nsresult -PrefObserver::Unsubscribe() -{ - NS_ENSURE_TRUE(mPrefBranch, NS_ERROR_FAILURE); - - mPrefBranch->RemoveObserver(kProxyPref, this); - mPrefBranch->RemoveObserver(kUserAgentPref, this); - mPrefBranch->RemoveObserver(kActiveXHostingFlags, this); - - return NS_OK; -} - -PRUint32 PrefObserver::GetHostingFlags() const -{ - return mHostingFlags; -} - -/////////////////////////////////////////////////////////////////////////////// - -PRUint32 MozAxPlugin::PrefGetHostingFlags() -{ - if (!PrefObserver::sPrefObserver) - { - PrefObserver::sPrefObserver = new PrefObserver(); - if (!PrefObserver::sPrefObserver) - { - return nsIActiveXSecurityPolicy::HOSTING_FLAGS_HOST_NOTHING; - } - PrefObserver::sPrefObserver->AddRef(); - PrefObserver::sPrefObserver->Subscribe(); - } - return PrefObserver::sPrefObserver->GetHostingFlags(); -} - -void MozAxPlugin::ReleasePrefObserver() -{ - if (PrefObserver::sPrefObserver) - { - PrefObserver::sPrefObserver->Unsubscribe(); - PrefObserver::sPrefObserver->Release(); - PrefObserver::sPrefObserver = nsnull; - } -} - diff --git a/embedding/browser/activex/src/plugin/StdAfx.cpp b/embedding/browser/activex/src/plugin/StdAfx.cpp deleted file mode 100644 index e717491dfaa..00000000000 --- a/embedding/browser/activex/src/plugin/StdAfx.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "StdAfx.h" diff --git a/embedding/browser/activex/src/plugin/StdAfx.h b/embedding/browser/activex/src/plugin/StdAfx.h deleted file mode 100644 index b44681c0540..00000000000 --- a/embedding/browser/activex/src/plugin/StdAfx.h +++ /dev/null @@ -1,109 +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): - * Adam Lock - * - * 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 ***** */ - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED_) -#define AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#define STRICT - -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0403 -#define _ATL_APARTMENT_THREADED -#define _ATL_STATIC_REGISTRY - -#define USE_PLUGIN - -// Uncomment if you want to say what is QI'ing for what -//#define _ATL_DEBUG_QI - -// ATL headers -// The ATL headers that come with the platform SDK have bad for scoping -#if _MSC_VER >= 1400 -#pragma conform(forScope, push, atlhack, off) -#endif - -#include -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#include -#include - -#if _MSC_VER >= 1400 -#pragma conform(forScope, pop, atlhack) -#endif - -#include -#include -#include -#include -#include - -#ifdef USE_PLUGIN -#include -#endif - -// STL headers -#include -#include -#include - -// New winsock2.h doesn't define this anymore -typedef long int32; - -#include "PropertyList.h" -#include "PropertyBag.h" -#include "ItemContainer.h" -#include "ControlSite.h" -#include "ControlSiteIPFrame.h" -#include "ControlEventSink.h" - -#include "npapi.h" - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED) diff --git a/embedding/browser/activex/src/plugin/XPCBrowser.cpp b/embedding/browser/activex/src/plugin/XPCBrowser.cpp deleted file mode 100644 index 269b50bd716..00000000000 --- a/embedding/browser/activex/src/plugin/XPCBrowser.cpp +++ /dev/null @@ -1,105 +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): - * Adam Lock - * - * 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 "StdAfx.h" - -#include "npapi.h" - -#include "nsCOMPtr.h" -#include "nsIInterfaceRequestorUtils.h" -#include "nsServiceManagerUtils.h" -#include "nsStringAPI.h" -#include "nsIPrefBranch.h" -#include "nsIPrefService.h" -#include "nsMemory.h" - - -#include "XPCBrowser.h" - - -IEBrowser::IEBrowser() -{ -} - -IEBrowser::~IEBrowser() -{ -} - -HRESULT IEBrowser::Init(PluginInstanceData *pData) -{ - mData = pData; - // Get the location URL - NPN_GetValue(mData->pPluginInstance, NPNVDOMWindow, - static_cast(getter_AddRefs(mDOMWindow))); - if (mDOMWindow) - { - mWebNavigation = do_GetInterface(mDOMWindow); - } - return S_OK; -} - - -nsresult IEBrowser::GetWebNavigation(nsIWebNavigation **aWebNav) -{ - NS_ENSURE_ARG_POINTER(aWebNav); - *aWebNav = mWebNavigation; - NS_IF_ADDREF(*aWebNav); - return (*aWebNav) ? NS_OK : NS_ERROR_FAILURE; -} - -// Return the nsIDOMWindow object -nsresult IEBrowser::GetDOMWindow(nsIDOMWindow **aDOMWindow) -{ - NS_ENSURE_ARG_POINTER(aDOMWindow); - *aDOMWindow = mDOMWindow; - NS_IF_ADDREF(*aDOMWindow); - return (*aDOMWindow) ? NS_OK : NS_ERROR_FAILURE; -} - -// Return the nsIPrefBranch object -nsresult IEBrowser::GetPrefs(nsIPrefBranch **aPrefBranch) -{ - return CallGetService(NS_PREFSERVICE_CONTRACTID, aPrefBranch); -} - -// Return the valid state of the browser -PRBool IEBrowser::BrowserIsValid() -{ - return mWebNavigation ? PR_TRUE : PR_FALSE; -} - diff --git a/embedding/browser/activex/src/plugin/XPCBrowser.h b/embedding/browser/activex/src/plugin/XPCBrowser.h deleted file mode 100644 index 9133538198d..00000000000 --- a/embedding/browser/activex/src/plugin/XPCBrowser.h +++ /dev/null @@ -1,86 +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): - * Adam Lock - * - * 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 ***** */ - -#ifndef IEBrowser_H -#define IEBrowser_H - -#include -#include - -#include "nsCOMPtr.h" -#include "nsIWebNavigation.h" - -#include "LegacyPlugin.h" - -#include "IWebBrowserImpl.h" - -class IEBrowser : - public CComObjectRootEx, - public IWebBrowserImpl -{ -public: -BEGIN_COM_MAP(IEBrowser) - COM_INTERFACE_ENTRY(IWebBrowser) - COM_INTERFACE_ENTRY(IWebBrowser2) - COM_INTERFACE_ENTRY(IWebBrowserApp) -END_COM_MAP() - - PluginInstanceData *mData; - nsCOMPtr mWebNavigation; - nsCOMPtr mDOMWindow; - - IEBrowser(); - HRESULT Init(PluginInstanceData *pData); - -protected: - virtual ~IEBrowser(); - -public: -// IWebBrowserImpl overrides - // Return the nsIWebNavigation object - virtual nsresult GetWebNavigation(nsIWebNavigation **aWebNav); - // Return the nsIDOMWindow object - virtual nsresult GetDOMWindow(nsIDOMWindow **aDOMWindow); - // Return the nsIPrefBranch object - virtual nsresult GetPrefs(nsIPrefBranch **aPrefBranch); - // Return the valid state of the browser - virtual PRBool BrowserIsValid(); -}; - - -#endif diff --git a/embedding/browser/activex/src/plugin/XPCDocument.cpp b/embedding/browser/activex/src/plugin/XPCDocument.cpp deleted file mode 100644 index 2302a1757f9..00000000000 --- a/embedding/browser/activex/src/plugin/XPCDocument.cpp +++ /dev/null @@ -1,2106 +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): - * Adam Lock - * - * 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 "StdAfx.h" - -#include -#include - -// A barely documented interface called ITargetFrame from IE -// This is needed for targeted Hlink* calls (e.g. HlinkNavigateString) to -// work. During the call, the Hlink API QIs and calls ITargetFrame::FindFrame -// to determine the named target frame before calling IHlinkFrame::Navigate. -// -// MS mentions the methods at the url below: -// -// http://msdn.microsoft.com/workshop/browser/browser/Reference/IFaces/ITargetFrame/ITargetFrame.asp -// -// The interface is defined in very recent versions of Internet SDK part of -// the PlatformSDK, from Dec 2002 onwards. -// -// http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ -// -// Neither Visual C++ 6.0 or 7.0 ship with this interface. -// -#ifndef __ITargetFrame_INTERFACE_DEFINED__ -// No ITargetFrame so make a binary compatible one -MIDL_INTERFACE("d5f78c80-5252-11cf-90fa-00AA0042106e") -IMozTargetFrame : public IUnknown -{ -public: - virtual HRESULT STDMETHODCALLTYPE SetFrameName( - /* [in] */ LPCWSTR pszFrameName) = 0; - virtual HRESULT STDMETHODCALLTYPE GetFrameName( - /* [out] */ LPWSTR *ppszFrameName) = 0; - virtual HRESULT STDMETHODCALLTYPE GetParentFrame( - /* [out] */ IUnknown **ppunkParent) = 0; - virtual HRESULT STDMETHODCALLTYPE FindFrame( - /* [in] */ LPCWSTR pszTargetName, - /* [in] */ IUnknown *ppunkContextFrame, - /* [in] */ DWORD dwFlags, - /* [out] */ IUnknown **ppunkTargetFrame) = 0; - virtual HRESULT STDMETHODCALLTYPE SetFrameSrc( - /* [in] */ LPCWSTR pszFrameSrc) = 0; - virtual HRESULT STDMETHODCALLTYPE GetFrameSrc( - /* [out] */ LPWSTR *ppszFrameSrc) = 0; - virtual HRESULT STDMETHODCALLTYPE GetFramesContainer( - /* [out] */ IOleContainer **ppContainer) = 0; - virtual HRESULT STDMETHODCALLTYPE SetFrameOptions( - /* [in] */ DWORD dwFlags) = 0; - virtual HRESULT STDMETHODCALLTYPE GetFrameOptions( - /* [out] */ DWORD *pdwFlags) = 0; - virtual HRESULT STDMETHODCALLTYPE SetFrameMargins( - /* [in] */ DWORD dwWidth, - /* [in] */ DWORD dwHeight) = 0; - virtual HRESULT STDMETHODCALLTYPE GetFrameMargins( - /* [out] */ DWORD *pdwWidth, - /* [out] */ DWORD *pdwHeight) = 0; - virtual HRESULT STDMETHODCALLTYPE RemoteNavigate( - /* [in] */ ULONG cLength, - /* [size_is][in] */ ULONG *pulData) = 0; - virtual HRESULT STDMETHODCALLTYPE OnChildFrameActivate( - /* [in] */ IUnknown *pUnkChildFrame) = 0; - virtual HRESULT STDMETHODCALLTYPE OnChildFrameDeactivate( - /* [in] */ IUnknown *pUnkChildFrame) = 0; -}; -#define __ITargetFrame_INTERFACE_DEFINED__ -#define ITargetFrame IMozTargetFrame -#endif - -#include "npapi.h" - -#include "nsCOMPtr.h" -#include "nsIInterfaceRequestorUtils.h" -#include "nsStringAPI.h" -#include "nsNetUtil.h" - -#include "nsIContent.h" -#include "nsIURI.h" -#include "nsIDocument.h" -#include "nsIScriptObjectPrincipal.h" -#include "nsIDOMWindow.h" -#include "nsIDOMElement.h" -#include "nsIDOMDocument.h" -#include "nsIDOMWindowInternal.h" -#include "nsIDOMLocation.h" -#include "nsIWebNavigation.h" -#include "nsILinkHandler.h" -#include "nsIScriptGlobalObject.h" -#include "nsIScriptContext.h" -#include "nsIPrincipal.h" -#include "nsPIDOMWindow.h" - -#include "XPConnect.h" -#include "XPCBrowser.h" -#include "LegacyPlugin.h" - -#include "IEHtmlElementCollection.h" -#include "IHTMLLocationImpl.h" - -/* - * This file contains partial implementations of various IE objects and - * interfaces that many ActiveX controls expect to be able to obtain and - * call from their control site. Typically controls will use these methods - * in order to integrate themselves with the browser, e.g. a control - * might want to initiate a load, or obtain the user agent. - */ - -class IELocation : - public CComObjectRootEx, - public IHTMLLocationImpl -{ -public: -BEGIN_COM_MAP(IELocation) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IHTMLLocation) -END_COM_MAP() - - PluginInstanceData *mData; - nsCOMPtr mDOMLocation; - - IELocation() : mData(NULL) - { - } - - HRESULT Init(PluginInstanceData *pData) - { - NS_PRECONDITION(pData != nsnull, "null ptr"); - - mData = pData; - - // Get the DOM window - nsCOMPtr domWindow; - NPN_GetValue(mData->pPluginInstance, NPNVDOMWindow, - static_cast(getter_AddRefs(domWindow))); - if (!domWindow) - { - return E_FAIL; - } - nsCOMPtr windowInternal = do_QueryInterface(domWindow); - if (windowInternal) - { - windowInternal->GetLocation(getter_AddRefs(mDOMLocation)); - } - if (!mDOMLocation) - return E_FAIL; - - return S_OK; - } - - virtual nsresult GetDOMLocation(nsIDOMLocation **aLocation) - { - *aLocation = mDOMLocation; - NS_IF_ADDREF(*aLocation); - return NS_OK; - } -}; - -// Note: corresponds to the window.navigator property in the IE DOM -class IENavigator : - public CComObjectRootEx, - public IDispatchImpl -{ -public: -BEGIN_COM_MAP(IENavigator) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IOmNavigator) -END_COM_MAP() - - PluginInstanceData *mData; - CComBSTR mUserAgent; - - HRESULT Init(PluginInstanceData *pData) - { - mData = pData; - USES_CONVERSION; - const char *userAgent = NPN_UserAgent(mData->pPluginInstance); - mUserAgent.Attach(::SysAllocString(A2CW(userAgent))); - return S_OK; - } - -// IOmNavigator - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_appCodeName( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_appName( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_appVersion( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_userAgent( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - *p = mUserAgent.Copy(); - return S_OK; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE javaEnabled( - /* [out][retval] */ VARIANT_BOOL __RPC_FAR *enabled) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE taintEnabled( - /* [out][retval] */ VARIANT_BOOL __RPC_FAR *enabled) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mimeTypes( - /* [out][retval] */ IHTMLMimeTypesCollection __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_plugins( - /* [out][retval] */ IHTMLPluginsCollection __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_cookieEnabled( - /* [out][retval] */ VARIANT_BOOL __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_opsProfile( - /* [out][retval] */ IHTMLOpsProfile __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE toString( - /* [out][retval] */ BSTR __RPC_FAR *string) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_cpuClass( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_systemLanguage( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [hidden][id][propget] */ HRESULT STDMETHODCALLTYPE get_browserLanguage( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_userLanguage( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_platform( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_appMinorVersion( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [hidden][id][propget] */ HRESULT STDMETHODCALLTYPE get_connectionSpeed( - /* [out][retval] */ long __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_onLine( - /* [out][retval] */ VARIANT_BOOL __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_userProfile( - /* [out][retval] */ IHTMLOpsProfile __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } -}; - - -// Note: Corresponds to the window object in the IE DOM -class IEWindow : - public CComObjectRootEx, - public IDispatchImpl -{ -public: - PluginInstanceData *mData; - CComObject *mNavigator; - CComObject *mLocation; - - IEWindow() : mNavigator(NULL), mLocation(NULL), mData(NULL) - { - } - - HRESULT Init(PluginInstanceData *pData) - { - mData = pData; - - CComObject::CreateInstance(&mNavigator); - if (!mNavigator) - { - return E_UNEXPECTED; - } - mNavigator->AddRef(); - mNavigator->Init(mData); - - CComObject::CreateInstance(&mLocation); - if (!mLocation) - { - return E_UNEXPECTED; - } - mLocation->AddRef(); - mLocation->Init(mData); - - return S_OK; - } - -protected: - virtual ~IEWindow() - { - if (mNavigator) - { - mNavigator->Release(); - } - if (mLocation) - { - mLocation->Release(); - } - } - -public: - -BEGIN_COM_MAP(IEWindow) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IHTMLWindow2) - COM_INTERFACE_ENTRY(IHTMLFramesCollection2) - COM_INTERFACE_ENTRY_BREAK(IHlinkFrame) -END_COM_MAP() - -//IHTMLFramesCollection2 - virtual /* [id] */ HRESULT STDMETHODCALLTYPE item( - /* [in] */ VARIANT __RPC_FAR *pvarIndex, - /* [out][retval] */ VARIANT __RPC_FAR *pvarResult) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_length( - /* [out][retval] */ long __RPC_FAR *p) - { - return E_NOTIMPL; - } - -// IHTMLWindow2 - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_frames( - /* [out][retval] */ IHTMLFramesCollection2 __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_defaultStatus( - /* [in] */ BSTR v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_defaultStatus( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_status( - /* [in] */ BSTR v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_status( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE setTimeout( - /* [in] */ BSTR expression, - /* [in] */ long msec, - /* [in][optional] */ VARIANT __RPC_FAR *language, - /* [out][retval] */ long __RPC_FAR *timerID) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE clearTimeout( - /* [in] */ long timerID) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE alert( - /* [in][defaultvalue] */ BSTR message) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE confirm( - /* [in][defaultvalue] */ BSTR message, - /* [out][retval] */ VARIANT_BOOL __RPC_FAR *confirmed) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE prompt( - /* [in][defaultvalue] */ BSTR message, - /* [in][defaultvalue] */ BSTR defstr, - /* [out][retval] */ VARIANT __RPC_FAR *textdata) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Image( - /* [out][retval] */ IHTMLImageElementFactory __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_location( - /* [out][retval] */ IHTMLLocation __RPC_FAR *__RPC_FAR *p) - { - if (mLocation) - return mLocation->QueryInterface(__uuidof(IHTMLLocation), (void **) p); - return E_FAIL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_history( - /* [out][retval] */ IOmHistory __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE close( void) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_opener( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_opener( - /* [out][retval] */ VARIANT __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_navigator( - /* [out][retval] */ IOmNavigator __RPC_FAR *__RPC_FAR *p) - { - if (mNavigator) - return mNavigator->QueryInterface(__uuidof(IOmNavigator), (void **) p); - return E_FAIL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_name( - /* [in] */ BSTR v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_name( - /* [out][retval] */ BSTR __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_parent( - /* [out][retval] */ IHTMLWindow2 __RPC_FAR *__RPC_FAR *p) - { - *p = NULL; - return S_OK; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE open( - /* [in][defaultvalue] */ BSTR url, - /* [in][defaultvalue] */ BSTR name, - /* [in][defaultvalue] */ BSTR features, - /* [in][defaultvalue] */ VARIANT_BOOL replace, - /* [out][retval] */ IHTMLWindow2 __RPC_FAR *__RPC_FAR *pomWindowResult) - { - *pomWindowResult = NULL; - return E_FAIL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_self( - /* [out][retval] */ IHTMLWindow2 __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_top( - /* [out][retval] */ IHTMLWindow2 __RPC_FAR *__RPC_FAR *p) - { - *p = NULL; - return S_OK; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_window( - /* [out][retval] */ IHTMLWindow2 __RPC_FAR *__RPC_FAR *p) - { - *p = NULL; - return S_OK; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE navigate( - /* [in] */ BSTR url) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onfocus( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onfocus( - /* [out][retval] */ VARIANT __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onblur( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onblur( - /* [out][retval] */ VARIANT __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onload( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onload( - /* [out][retval] */ VARIANT __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onbeforeunload( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onbeforeunload( - /* [out][retval] */ VARIANT __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onunload( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onunload( - /* [out][retval] */ VARIANT __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onhelp( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onhelp( - /* [out][retval] */ VARIANT __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onerror( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onerror( - /* [out][retval] */ VARIANT __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onresize( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onresize( - /* [out][retval] */ VARIANT __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onscroll( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onscroll( - /* [out][retval] */ VARIANT __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [source][id][propget] */ HRESULT STDMETHODCALLTYPE get_document( - /* [out][retval] */ IHTMLDocument2 __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_event( - /* [out][retval] */ IHTMLEventObj __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [restricted][hidden][id][propget] */ HRESULT STDMETHODCALLTYPE get__newEnum( - /* [out][retval] */ IUnknown __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE showModalDialog( - /* [in] */ BSTR dialog, - /* [in][optional] */ VARIANT __RPC_FAR *varArgIn, - /* [in][optional] */ VARIANT __RPC_FAR *varOptions, - /* [out][retval] */ VARIANT __RPC_FAR *varArgOut) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE showHelp( - /* [in] */ BSTR helpURL, - /* [in][optional] */ VARIANT helpArg, - /* [in][defaultvalue] */ BSTR features) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_screen( - /* [out][retval] */ IHTMLScreen __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Option( - /* [out][retval] */ IHTMLOptionElementFactory __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE focus( void) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_closed( - /* [out][retval] */ VARIANT_BOOL __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE blur( void) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE scroll( - /* [in] */ long x, - /* [in] */ long y) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_clientInformation( - /* [out][retval] */ IOmNavigator __RPC_FAR *__RPC_FAR *p) - { - return get_navigator(p); - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE setInterval( - /* [in] */ BSTR expression, - /* [in] */ long msec, - /* [in][optional] */ VARIANT __RPC_FAR *language, - /* [out][retval] */ long __RPC_FAR *timerID) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE clearInterval( - /* [in] */ long timerID) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_offscreenBuffering( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_offscreenBuffering( - /* [out][retval] */ VARIANT __RPC_FAR *p) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE execScript( - /* [in] */ BSTR code, - /* [in][defaultvalue] */ BSTR language, - /* [out][retval] */ VARIANT __RPC_FAR *pvarRet) - { - nsresult rv; - - nsCOMPtr domWindow; - NPN_GetValue(mData->pPluginInstance, NPNVDOMWindow, - static_cast(getter_AddRefs(domWindow))); - if (!domWindow) - { - return E_UNEXPECTED; - } - - // Now get the DOM Document. Accessing the document will create one - // if necessary. So, basically, this call ensures that a document gets - // created -- if necessary. - nsCOMPtr domDocument; - rv = domWindow->GetDocument(getter_AddRefs(domDocument)); - NS_ASSERTION(domDocument, "No DOMDocument!"); - if (NS_FAILED(rv)) { - return E_UNEXPECTED; - } - - nsCOMPtr globalObject(do_QueryInterface(domWindow)); - if (!globalObject) - return E_UNEXPECTED; - - nsCOMPtr scriptContext = globalObject->GetContext(); - if (!scriptContext) - return E_UNEXPECTED; - - nsCOMPtr doc(do_QueryInterface(domDocument)); - if (!doc) - return E_UNEXPECTED; - - nsIPrincipal *principal = doc->GetPrincipal(); - if (!principal) - return E_UNEXPECTED; - - // Execute the script. - // - // Note: The script context takes care of the JS stack and of ensuring - // nothing is executed when JS is disabled. - // - nsAutoString scriptString(code); - NS_NAMED_LITERAL_CSTRING(url, "javascript:axplugin"); - rv = scriptContext->EvaluateString(scriptString, - nsnull, // obj - principal, - url.get(), // url - 1, // line no - nsnull, - nsnull, - nsnull); - - if (NS_FAILED(rv)) - return NS_ERROR_FAILURE; - - return S_OK; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE toString( - /* [out][retval] */ BSTR __RPC_FAR *String) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE scrollBy( - /* [in] */ long x, - /* [in] */ long y) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE scrollTo( - /* [in] */ long x, - /* [in] */ long y) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE moveTo( - /* [in] */ long x, - /* [in] */ long y) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE moveBy( - /* [in] */ long x, - /* [in] */ long y) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE resizeTo( - /* [in] */ long x, - /* [in] */ long y) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE resizeBy( - /* [in] */ long x, - /* [in] */ long y) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_external( - /* [out][retval] */ IDispatch __RPC_FAR *__RPC_FAR *p) - { - return E_NOTIMPL; - } - -}; - - -// Note: Corresponds to the document object in the IE DOM -class IEDocument : - public CComObjectRootEx, - public IDispatchImpl, - public IServiceProvider, - public IOleContainer, - public IBindHost, - public IHlinkFrame, - public ITargetFrame -{ -public: - PluginInstanceData *mData; - - nsCOMPtr mDOMWindow; - nsCOMPtr mDOMDocument; - nsCOMPtr mDOMElement; - CComObject *mWindow; - CComObject *mBrowser; - CComBSTR mURL; - BSTR mUseTarget; - - IEDocument() : - mWindow(NULL), - mBrowser(NULL), - mData(NULL), - mUseTarget(NULL) - { - MozAxPlugin::AddRef(); - } - - HRESULT Init(PluginInstanceData *pData) - { - mData = pData; - - // Get the DOM document - NPN_GetValue(mData->pPluginInstance, NPNVDOMElement, - static_cast(getter_AddRefs(mDOMElement))); - if (mDOMElement) - { - mDOMElement->GetOwnerDocument(getter_AddRefs(mDOMDocument)); - } - - // Get the DOM window - NPN_GetValue(mData->pPluginInstance, NPNVDOMWindow, - static_cast(getter_AddRefs(mDOMWindow))); - if (mDOMWindow) - { - nsCOMPtr windowInternal = do_QueryInterface(mDOMWindow); - if (windowInternal) - { - nsCOMPtr location; - nsAutoString href; - windowInternal->GetLocation(getter_AddRefs(location)); - if (location && - NS_SUCCEEDED(location->GetHref(href))) - { - const PRUnichar *s = href.get(); - mURL.Attach(::SysAllocString(s)); - } - } - } - - CComObject::CreateInstance(&mWindow); - ATLASSERT(mWindow); - if (!mWindow) - { - return E_OUTOFMEMORY; - } - mWindow->AddRef(); - mWindow->Init(mData); - - CComObject::CreateInstance(&mBrowser); - ATLASSERT(mBrowser); - if (!mBrowser) - { - return E_OUTOFMEMORY; - } - mBrowser->AddRef(); - mBrowser->Init(mData); - - return S_OK; - } - - virtual ~IEDocument() - { - if (mUseTarget) - { - SysFreeString(mUseTarget); - } - if (mBrowser) - { - mBrowser->Release(); - } - if (mWindow) - { - mWindow->Release(); - } - MozAxPlugin::Release(); - } - -BEGIN_COM_MAP(IEDocument) - COM_INTERFACE_ENTRY(IServiceProvider) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IHTMLDocument) - COM_INTERFACE_ENTRY(IHTMLDocument2) - COM_INTERFACE_ENTRY(IParseDisplayName) - COM_INTERFACE_ENTRY(IOleContainer) - COM_INTERFACE_ENTRY(IBindHost) - COM_INTERFACE_ENTRY_BREAK(IHlinkTarget) - COM_INTERFACE_ENTRY(IHlinkFrame) - COM_INTERFACE_ENTRY(ITargetFrame) -END_COM_MAP() - -// IServiceProvider - virtual /* [local] */ HRESULT STDMETHODCALLTYPE QueryService( - /* [in] */ REFGUID guidService, - /* [in] */ REFIID riid, - /* [out] */ void **ppvObject) - { -#ifdef DEBUG - ATLTRACE(_T("IEDocument::QueryService\n")); - if (IsEqualIID(riid, __uuidof(IWebBrowser)) || - IsEqualIID(riid, __uuidof(IWebBrowser2)) || - IsEqualIID(riid, __uuidof(IWebBrowserApp))) - { - ATLTRACE(_T(" IWebBrowserApp\n")); - if (mBrowser) - { - return mBrowser->QueryInterface(riid, ppvObject); - } - } - else if (IsEqualIID(riid, __uuidof(IHTMLWindow2))) - { - ATLTRACE(_T(" IHTMLWindow2\n")); - if (mWindow) - { - return mWindow->QueryInterface(riid, ppvObject); - } - } - else if (IsEqualIID(riid, __uuidof(IHTMLDocument2))) - { - ATLTRACE(_T(" IHTMLDocument2\n")); - } - else if (IsEqualIID(riid, __uuidof(IBindHost))) - { - ATLTRACE(_T(" IBindHost\n")); - } - else - { - USES_CONVERSION; - LPOLESTR szClsid = NULL; - StringFromIID(riid, &szClsid); - ATLTRACE(_T(" Unknown interface %s\n"), OLE2T(szClsid)); - CoTaskMemFree(szClsid); - } -#endif - return QueryInterface(riid, ppvObject); - } - -// IHTMLDocument - virtual /* [nonbrowsable][hidden][id][propget] */ HRESULT STDMETHODCALLTYPE get_Script( - /* [out][retval] */ IDispatch **p) - { - *p = NULL; - return S_OK; - } - -// IHTMLDocument2 - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_all( - /* [out][retval] */ IHTMLElementCollection **p) - { - // Validate parameters - if (p == NULL) - { - return E_INVALIDARG; - } - - *p = NULL; - - // Create a collection object - CIEHtmlElementCollectionInstance *pCollection = NULL; - CIEHtmlElementCollectionInstance::CreateInstance(&pCollection); - if (pCollection == NULL) - { - return E_OUTOFMEMORY; - } - - // Initialise and populate the collection - nsCOMPtr docNode = do_QueryInterface(mDOMDocument); - pCollection->PopulateFromDOMNode(docNode, PR_TRUE); - pCollection->QueryInterface(IID_IHTMLElementCollection, (void **) p); - - return *p ? S_OK : E_UNEXPECTED; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_body( - /* [out][retval] */ IHTMLElement **p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_activeElement( - /* [out][retval] */ IHTMLElement **p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_images( - /* [out][retval] */ IHTMLElementCollection **p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_applets( - /* [out][retval] */ IHTMLElementCollection **p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_links( - /* [out][retval] */ IHTMLElementCollection **p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_forms( - /* [out][retval] */ IHTMLElementCollection **p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_anchors( - /* [out][retval] */ IHTMLElementCollection **p) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_title( - /* [in] */ BSTR v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_title( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_scripts( - /* [out][retval] */ IHTMLElementCollection **p) - { - return E_NOTIMPL; - } - - virtual /* [hidden][id][propput] */ HRESULT STDMETHODCALLTYPE put_designMode( - /* [in] */ BSTR v) - { - return E_NOTIMPL; - } - - virtual /* [hidden][id][propget] */ HRESULT STDMETHODCALLTYPE get_designMode( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_selection( - /* [out][retval] */ IHTMLSelectionObject **p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][id][propget] */ HRESULT STDMETHODCALLTYPE get_readyState( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_frames( - /* [out][retval] */ IHTMLFramesCollection2 **p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_embeds( - /* [out][retval] */ IHTMLElementCollection **p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_plugins( - /* [out][retval] */ IHTMLElementCollection **p) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_alinkColor( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_alinkColor( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_bgColor( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_bgColor( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_fgColor( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fgColor( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_linkColor( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_linkColor( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_vlinkColor( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_vlinkColor( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_referrer( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_location( - /* [out][retval] */ IHTMLLocation **p) - { - if (mWindow) - return mWindow->get_location(p); - return E_FAIL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_lastModified( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_URL( - /* [in] */ BSTR v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_URL( - /* [out][retval] */ BSTR *p) - { - *p = mURL.Copy(); - return S_OK; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_domain( - /* [in] */ BSTR v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_domain( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_cookie( - /* [in] */ BSTR v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_cookie( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [hidden][bindable][id][propput] */ HRESULT STDMETHODCALLTYPE put_expando( - /* [in] */ VARIANT_BOOL v) - { - return E_NOTIMPL; - } - - virtual /* [hidden][bindable][id][propget] */ HRESULT STDMETHODCALLTYPE get_expando( - /* [out][retval] */ VARIANT_BOOL *p) - { - return E_NOTIMPL; - } - - virtual /* [hidden][id][propput] */ HRESULT STDMETHODCALLTYPE put_charset( - /* [in] */ BSTR v) - { - return E_NOTIMPL; - } - - virtual /* [hidden][id][propget] */ HRESULT STDMETHODCALLTYPE get_charset( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_defaultCharset( - /* [in] */ BSTR v) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_defaultCharset( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mimeType( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fileSize( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fileCreatedDate( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fileModifiedDate( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fileUpdatedDate( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_security( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_protocol( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nameProp( - /* [out][retval] */ BSTR *p) - { - return E_NOTIMPL; - } - - virtual /* [id][vararg] */ HRESULT STDMETHODCALLTYPE write( - /* [in] */ SAFEARRAY * psarray) - { - return E_NOTIMPL; - } - - virtual /* [id][vararg] */ HRESULT STDMETHODCALLTYPE writeln( - /* [in] */ SAFEARRAY * psarray) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE open( - /* [in][defaultvalue] */ BSTR url, - /* [in][optional] */ VARIANT name, - /* [in][optional] */ VARIANT features, - /* [in][optional] */ VARIANT replace, - /* [out][retval] */ IDispatch **pomWindowResult) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE close( void) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE clear( void) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE queryCommandSupported( - /* [in] */ BSTR cmdID, - /* [out][retval] */ VARIANT_BOOL *pfRet) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE queryCommandEnabled( - /* [in] */ BSTR cmdID, - /* [out][retval] */ VARIANT_BOOL *pfRet) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE queryCommandState( - /* [in] */ BSTR cmdID, - /* [out][retval] */ VARIANT_BOOL *pfRet) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE queryCommandIndeterm( - /* [in] */ BSTR cmdID, - /* [out][retval] */ VARIANT_BOOL *pfRet) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE queryCommandText( - /* [in] */ BSTR cmdID, - /* [out][retval] */ BSTR *pcmdText) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE queryCommandValue( - /* [in] */ BSTR cmdID, - /* [out][retval] */ VARIANT *pcmdValue) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE execCommand( - /* [in] */ BSTR cmdID, - /* [in][defaultvalue] */ VARIANT_BOOL showUI, - /* [in][optional] */ VARIANT value, - /* [out][retval] */ VARIANT_BOOL *pfRet) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE execCommandShowHelp( - /* [in] */ BSTR cmdID, - /* [out][retval] */ VARIANT_BOOL *pfRet) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE createElement( - /* [in] */ BSTR eTag, - /* [out][retval] */ IHTMLElement **newElem) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onhelp( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onhelp( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onclick( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onclick( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_ondblclick( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_ondblclick( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onkeyup( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onkeyup( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onkeydown( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onkeydown( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onkeypress( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onkeypress( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onmouseup( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onmouseup( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onmousedown( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onmousedown( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onmousemove( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onmousemove( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onmouseout( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onmouseout( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onmouseover( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onmouseover( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onreadystatechange( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onreadystatechange( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onafterupdate( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onafterupdate( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onrowexit( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onrowexit( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onrowenter( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onrowenter( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_ondragstart( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_ondragstart( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onselectstart( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onselectstart( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE elementFromPoint( - /* [in] */ long x, - /* [in] */ long y, - /* [out][retval] */ IHTMLElement **elementHit) - { - return E_NOTIMPL; - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_parentWindow( - /* [out][retval] */ IHTMLWindow2 **p) - { - return mWindow->QueryInterface(_uuidof(IHTMLWindow2), (void **) p); - } - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_styleSheets( - /* [out][retval] */ IHTMLStyleSheetsCollection **p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onbeforeupdate( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onbeforeupdate( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onerrorupdate( - /* [in] */ VARIANT v) - { - return E_NOTIMPL; - } - - virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onerrorupdate( - /* [out][retval] */ VARIANT *p) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE toString( - /* [out][retval] */ BSTR *String) - { - return E_NOTIMPL; - } - - virtual /* [id] */ HRESULT STDMETHODCALLTYPE createStyleSheet( - /* [in][defaultvalue] */ BSTR bstrHref, - /* [in][defaultvalue] */ long lIndex, - /* [out][retval] */ IHTMLStyleSheet **ppnewStyleSheet) - { - return E_NOTIMPL; - } - -// IParseDisplayName - virtual HRESULT STDMETHODCALLTYPE ParseDisplayName( - /* [unique][in] */ IBindCtx *pbc, - /* [in] */ LPOLESTR pszDisplayName, - /* [out] */ ULONG *pchEaten, - /* [out] */ IMoniker **ppmkOut) - { - return E_NOTIMPL; - } - -// IOleContainer - virtual HRESULT STDMETHODCALLTYPE EnumObjects( - /* [in] */ DWORD grfFlags, - /* [out] */ IEnumUnknown **ppenum) - { - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE LockContainer( - /* [in] */ BOOL fLock) - { - return E_NOTIMPL; - } - - -// IHlinkFrame - virtual HRESULT STDMETHODCALLTYPE SetBrowseContext( - /* [unique][in] */ IHlinkBrowseContext *pihlbc) - { - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE GetBrowseContext( - /* [out] */ IHlinkBrowseContext **ppihlbc) - { - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE Navigate( - /* [in] */ DWORD grfHLNF, - /* [unique][in] */ LPBC pbc, - /* [unique][in] */ IBindStatusCallback *pibsc, - /* [unique][in] */ IHlink *pihlNavigate) - { - if (!pihlNavigate) return E_INVALIDARG; - // TODO check grfHLNF for type of link - LPWSTR szTarget = NULL; - LPWSTR szLocation = NULL; - LPWSTR szTargetFrame = NULL; - HRESULT hr; - hr = pihlNavigate->GetStringReference(HLINKGETREF_DEFAULT, &szTarget, &szLocation); - hr = pihlNavigate->GetTargetFrameName(&szTargetFrame); - if (szTarget && szTarget[0] != WCHAR('\0')) - { - NS_ConvertUTF16toUTF8 spec(szTarget); - nsCOMPtr uri; - nsresult rv = NS_NewURI(getter_AddRefs(uri), spec); - if (NS_SUCCEEDED(rv) && uri) - { - nsCOMPtr webNav = do_GetInterface(mDOMWindow); - if (webNav) - { - nsCOMPtr lh = do_QueryInterface(webNav); - if (lh) - { - nsCOMPtr window = - do_GetInterface(mDOMWindow); - - nsAutoPopupStatePusher popupStatePusher(window, - openAllowed); - - nsCOMPtr content(do_QueryInterface(mDOMElement)); - - // XXX Not checking whether content is editable, - // should we? - lh->OnLinkClick(content, uri, - szTargetFrame ? szTargetFrame : mUseTarget); - } - } - hr = S_OK; - } - else - { - hr = E_FAIL; - } - } - else - { - hr = E_FAIL; - } - if (szTarget) - CoTaskMemFree(szTarget); - if (szLocation) - CoTaskMemFree(szLocation); - if (szTargetFrame) - CoTaskMemFree(szTargetFrame); - if (mUseTarget) - { - SysFreeString(mUseTarget); - mUseTarget = NULL; - } - return hr; - } - - virtual HRESULT STDMETHODCALLTYPE OnNavigate( - /* [in] */ DWORD grfHLNF, - /* [unique][in] */ IMoniker *pimkTarget, - /* [unique][in] */ LPCWSTR pwzLocation, - /* [unique][in] */ LPCWSTR pwzFriendlyName, - /* [in] */ DWORD dwreserved) - { - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE UpdateHlink( - /* [in] */ ULONG uHLID, - /* [unique][in] */ IMoniker *pimkTarget, - /* [unique][in] */ LPCWSTR pwzLocation, - /* [unique][in] */ LPCWSTR pwzFriendlyName) - { - return E_NOTIMPL; - } - -// IBindHost - virtual HRESULT STDMETHODCALLTYPE CreateMoniker( - /* [in] */ LPOLESTR szName, - /* [in] */ IBindCtx *pBC, - /* [out] */ IMoniker **ppmk, - /* [in] */ DWORD dwReserved) - { - if (!szName || !ppmk) return E_POINTER; - if (!*szName) return E_INVALIDARG; - - *ppmk = NULL; - - // Get the BASE url - CComPtr baseURLMoniker; - nsCOMPtr doc(do_QueryInterface(mDOMDocument)); - if (doc) - { - nsIURI *baseURI = doc->GetBaseURI(); - nsCAutoString spec; - if (baseURI && - NS_SUCCEEDED(baseURI->GetSpec(spec))) - { - USES_CONVERSION; - if (FAILED(CreateURLMoniker(NULL, A2CW(spec.get()), &baseURLMoniker))) - return E_UNEXPECTED; - } - } - - // Make the moniker - HRESULT hr = CreateURLMoniker(baseURLMoniker, szName, ppmk); - if (SUCCEEDED(hr) && !*ppmk) - hr = E_FAIL; - return hr; - } - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE MonikerBindToStorage( - /* [in] */ IMoniker *pMk, - /* [in] */ IBindCtx *pBC, - /* [in] */ IBindStatusCallback *pBSC, - /* [in] */ REFIID riid, - /* [out] */ void **ppvObj) - { - if (!pMk || !ppvObj) return E_POINTER; - - *ppvObj = NULL; - HRESULT hr = S_OK; - CComPtr spBindCtx; - if (pBC) - { - spBindCtx = pBC; - if (pBSC) - { - hr = RegisterBindStatusCallback(spBindCtx, pBSC, NULL, 0); - if (FAILED(hr)) - return hr; - } - } - else - { - if (pBSC) - hr = CreateAsyncBindCtx(0, pBSC, NULL, &spBindCtx); - else - hr = CreateBindCtx(0, &spBindCtx); - if (SUCCEEDED(hr) && !spBindCtx) - hr = E_FAIL; - if (FAILED(hr)) - return hr; - } - return pMk->BindToStorage(spBindCtx, NULL, riid, ppvObj); - } - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE MonikerBindToObject( - /* [in] */ IMoniker *pMk, - /* [in] */ IBindCtx *pBC, - /* [in] */ IBindStatusCallback *pBSC, - /* [in] */ REFIID riid, - /* [out] */ void **ppvObj) - { - return E_NOTIMPL; - } - -// ITargetFrame - virtual HRESULT STDMETHODCALLTYPE SetFrameName( - /* [in] */ LPCWSTR pszFrameName) - { - NS_ASSERTION(FALSE, "ITargetFrame::SetFrameName is not implemented"); - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE GetFrameName( - /* [out] */ LPWSTR *ppszFrameName) - { - NS_ASSERTION(FALSE, "ITargetFrame::GetFrameName is not implemented"); - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE GetParentFrame( - /* [out] */ IUnknown **ppunkParent) - { - NS_ASSERTION(FALSE, "ITargetFrame::GetParentFrame is not implemented"); - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE FindFrame( - /* [in] */ LPCWSTR pszTargetName, - /* [in] */ IUnknown *ppunkContextFrame, - /* [in] */ DWORD dwFlags, - /* [out] */ IUnknown **ppunkTargetFrame) - { - if (dwFlags & 0x1) // TODO test if the named frame exists and presumably return NULL if it doesn't - { - } - - if (mUseTarget) - { - SysFreeString(mUseTarget); - mUseTarget = NULL; - } - if (pszTargetName) - { - mUseTarget = SysAllocString(pszTargetName); - } - - QueryInterface(__uuidof(IUnknown), (void **) ppunkTargetFrame); - return S_OK;; - } - - virtual HRESULT STDMETHODCALLTYPE SetFrameSrc( - /* [in] */ LPCWSTR pszFrameSrc) - { - NS_ASSERTION(FALSE, "ITargetFrame::SetFrameSrc is not implemented"); - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE GetFrameSrc( - /* [out] */ LPWSTR *ppszFrameSrc) - { - NS_ASSERTION(FALSE, "ITargetFrame::GetFrameSrc is not implemented"); - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE GetFramesContainer( - /* [out] */ IOleContainer **ppContainer) - { - NS_ASSERTION(FALSE, "ITargetFrame::GetFramesContainer is not implemented"); - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE SetFrameOptions( - /* [in] */ DWORD dwFlags) - { - NS_ASSERTION(FALSE, "ITargetFrame::SetFrameOptions is not implemented"); - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE GetFrameOptions( - /* [out] */ DWORD *pdwFlags) - { - NS_ASSERTION(FALSE, "ITargetFrame::GetFrameOptions is not implemented"); - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE SetFrameMargins( - /* [in] */ DWORD dwWidth, - /* [in] */ DWORD dwHeight) - { - NS_ASSERTION(FALSE, "ITargetFrame::SetFrameMargins is not implemented"); - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE GetFrameMargins( - /* [out] */ DWORD *pdwWidth, - /* [out] */ DWORD *pdwHeight) - { - NS_ASSERTION(FALSE, "ITargetFrame::GetFrameMargins is not implemented"); - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE RemoteNavigate( - /* [in] */ ULONG cLength, - /* [size_is][in] */ ULONG *pulData) - { - NS_ASSERTION(FALSE, "ITargetFrame::RemoteNavigate is not implemented"); - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE OnChildFrameActivate( - /* [in] */ IUnknown *pUnkChildFrame) - { - NS_ASSERTION(FALSE, "ITargetFrame::OnChildFrameActivate is not implemented"); - return E_NOTIMPL; - } - - virtual HRESULT STDMETHODCALLTYPE OnChildFrameDeactivate( - /* [in] */ IUnknown *pUnkChildFrame) - { - NS_ASSERTION(FALSE, "ITargetFrame::OnChildFrameDeactivate is not implemented"); - return E_NOTIMPL; - } -}; - -HRESULT MozAxPlugin::GetServiceProvider(PluginInstanceData *pData, IServiceProvider **pSP) -{ - // Note this should be called on the main NPAPI thread - CComObject *pDoc = NULL; - CComObject::CreateInstance(&pDoc); - ATLASSERT(pDoc); - if (!pDoc) - { - return E_OUTOFMEMORY; - } - pDoc->Init(pData); - // QI does the AddRef - return pDoc->QueryInterface(_uuidof(IServiceProvider), (void **) pSP); -} diff --git a/embedding/browser/activex/src/plugin/XPConnect.cpp b/embedding/browser/activex/src/plugin/XPConnect.cpp deleted file mode 100644 index 9bf27c3312e..00000000000 --- a/embedding/browser/activex/src/plugin/XPConnect.cpp +++ /dev/null @@ -1,1134 +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): - * Adam Lock - * - * 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 "stdafx.h" - -#ifdef XPCOM_GLUE -#include "nsXPCOMGlue.h" -#endif - -#include "nsCOMPtr.h" -#include "nsIComponentManager.h" -#include "nsComponentManagerUtils.h" -#include "nsServiceManagerUtils.h" - -#include "nsIMozAxPlugin.h" -#include "nsIVariant.h" -#include "nsMemory.h" - -#include "nsIDOMDocument.h" -#include "nsIDOMNode.h" -#include "nsIDOMNodeList.h" -#include "nsIDOMElement.h" -#include "nsIDOMEventTarget.h" -#include "nsIDOMWindow.h" - -#include "nsIInterfaceRequestorUtils.h" -#include "nsIEventListenerManager.h" - -#include "nsIScriptEventManager.h" -#include "jsapi.h" - -#include "LegacyPlugin.h" -#include "XPConnect.h" - -#ifdef XPC_IDISPATCH_SUPPORT -#include "nsIDOMWindowInternal.h" -#include "nsIDOMLocation.h" -#include "nsNetUtil.h" -#ifdef XPCOM_GLUE -#include "nsEmbedString.h" -#endif -#include "nsIURI.h" -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// nsScriptablePeer - -nsScriptablePeer::nsScriptablePeer() : - mTearOff(new nsScriptablePeerTearOff(this)) -{ - NS_ASSERTION(mTearOff, "can't create tearoff"); - MozAxPlugin::AddRef(); -} - -nsScriptablePeer::~nsScriptablePeer() -{ - delete mTearOff; - MozAxPlugin::Release(); -} - -NS_IMPL_ADDREF(nsScriptablePeer) -NS_IMPL_RELEASE(nsScriptablePeer) - -// Custom QueryInterface impl to deal with the IDispatch tearoff -NS_IMETHODIMP -nsScriptablePeer::QueryInterface(const nsIID & aIID, void **aInstancePtr) -{ - NS_ASSERTION(aInstancePtr, "QueryInterface requires a non-NULL destination!"); - if (!aInstancePtr) - return NS_ERROR_NULL_POINTER; - *aInstancePtr = nsnull; - - nsISupports* foundInterface = nsnull; - if (aIID.Equals(NS_GET_IID(nsISupports))) - foundInterface = static_cast(static_cast(this)); - else if (aIID.Equals(NS_GET_IID(nsIClassInfo))) - foundInterface = static_cast(this); - else if (aIID.Equals(NS_GET_IID(nsIMozAxPlugin))) - foundInterface = static_cast(this); - else if (memcmp(&aIID, &__uuidof(IDispatch), sizeof(nsID)) == 0) - { - HRESULT hr = mTearOff->QueryInterface(__uuidof(IDispatch), aInstancePtr); - if (SUCCEEDED(hr)) return NS_OK; - return E_FAIL; - } - - NS_IF_ADDREF(foundInterface); - *aInstancePtr = foundInterface; - return (*aInstancePtr) ? NS_OK : NS_NOINTERFACE; -} - -HRESULT -nsScriptablePeer::GetIDispatch(IDispatch **pdisp) -{ - if (pdisp == NULL) - { - return E_INVALIDARG; - } - *pdisp = NULL; - - IUnknownPtr unk; - HRESULT hr = mPlugin->pControlSite->GetControlUnknown(&unk); - if (unk.GetInterfacePtr() == NULL) - { - return E_FAIL; - } - - IDispatchPtr disp = unk; - if (disp.GetInterfacePtr() == NULL) - { - return E_FAIL; - } - - *pdisp = disp.GetInterfacePtr(); - (*pdisp)->AddRef(); - - return S_OK; -} - -nsresult -nsScriptablePeer::HR2NS(HRESULT hr) const -{ - switch (hr) - { - case S_OK: - return NS_OK; - case E_NOTIMPL: - return NS_ERROR_NOT_IMPLEMENTED; - case E_NOINTERFACE: - return NS_ERROR_NO_INTERFACE; - case E_INVALIDARG: - return NS_ERROR_INVALID_ARG; - case E_ABORT: - return NS_ERROR_ABORT; - case E_UNEXPECTED: - return NS_ERROR_UNEXPECTED; - case E_OUTOFMEMORY: - return NS_ERROR_OUT_OF_MEMORY; - case E_POINTER: - return NS_ERROR_INVALID_POINTER; - case E_FAIL: - default: - return NS_ERROR_FAILURE; - } -} - -HRESULT -nsScriptablePeer::ConvertVariants(nsIVariant *aIn, VARIANT *aOut) -{ - if (aIn == NULL || aOut == NULL) - { - return NS_ERROR_INVALID_ARG; - } - - PRBool isWritable = PR_FALSE; - nsCOMPtr writable = do_QueryInterface(aIn); - if (writable) - { - writable->GetWritable(&isWritable); - } - - PRUint16 type; - nsresult rv = aIn->GetDataType(&type); - switch (type) - { - case nsIDataType::VTYPE_INT8: - { - PRUint8 value = 0; - rv = aIn->GetAsInt8(&value); - aOut->vt = VT_I1; - aOut->cVal = value; - } - break; - case nsIDataType::VTYPE_INT16: - { - PRInt16 value = 0; - rv = aIn->GetAsInt16(&value); - aOut->vt = VT_I2; - aOut->iVal = value; - } - break; - case nsIDataType::VTYPE_INT32: - { - PRInt32 value = 0; - rv = aIn->GetAsInt32(&value); - aOut->vt = VT_I4; - aOut->lVal = value; - } - break; - case nsIDataType::VTYPE_CHAR: - case nsIDataType::VTYPE_UINT8: - { - PRUint8 value = 0; - rv = aIn->GetAsInt8(&value); - aOut->vt = VT_UI1; - aOut->bVal = value; - } - break; - case nsIDataType::VTYPE_WCHAR: - case nsIDataType::VTYPE_UINT16: - { - PRUint16 value = 0; - rv = aIn->GetAsUint16(&value); - aOut->vt = VT_I2; - aOut->uiVal = value; - } - break; - case nsIDataType::VTYPE_UINT32: - { - PRUint32 value = 0; - rv = aIn->GetAsUint32(&value); - aOut->vt = VT_I4; - aOut->ulVal = value; - } - break; - case nsIDataType::VTYPE_FLOAT: - { - float value = 0; - rv = aIn->GetAsFloat(&value); - aOut->vt = VT_R4; - aOut->fltVal = value; - } - break; - case nsIDataType::VTYPE_DOUBLE: - { - double value = 0; - rv = aIn->GetAsDouble(&value); - aOut->vt = VT_R4; - aOut->dblVal = value; - } - break; - case nsIDataType::VTYPE_BOOL: - { - PRBool value = 0; - rv = aIn->GetAsBool(&value); - aOut->vt = VT_BOOL; - aOut->dblVal = value ? VARIANT_TRUE : VARIANT_FALSE; - } - break; - case nsIDataType::VTYPE_EMPTY: - VariantClear(aOut); - break; - - case nsIDataType::VTYPE_STRING_SIZE_IS: - case nsIDataType::VTYPE_CHAR_STR: - { - nsCString value; - aIn->GetAsString(getter_Copies(value)); - nsString valueWide; - NS_CStringToUTF16(value, NS_CSTRING_ENCODING_ASCII, valueWide); - aOut->vt = VT_BSTR; - aOut->bstrVal = SysAllocString(valueWide.get()); - } - break; - case nsIDataType::VTYPE_WSTRING_SIZE_IS: - case nsIDataType::VTYPE_WCHAR_STR: - { - nsString value; - aIn->GetAsWString(getter_Copies(value)); - aOut->vt = VT_BSTR; - aOut->bstrVal = SysAllocString(value.get()); - } - break; - - case nsIDataType::VTYPE_ASTRING: - { - nsAutoString value; - aIn->GetAsAString(value); - aOut->vt = VT_BSTR; - aOut->bstrVal = SysAllocString(value.get()); - } - break; - - case nsIDataType::VTYPE_DOMSTRING: - { - nsAutoString value; - aIn->GetAsAString(value); - aOut->vt = VT_BSTR; - aOut->bstrVal = SysAllocString(value.get()); - } - break; - - case nsIDataType::VTYPE_CSTRING: - { - nsCAutoString value; - aIn->GetAsACString(value); - nsAutoString valueWide; - NS_CStringToUTF16(value, NS_CSTRING_ENCODING_ASCII, valueWide); - aOut->vt = VT_BSTR; - aOut->bstrVal = SysAllocString(valueWide.get()); - } - break; - case nsIDataType::VTYPE_UTF8STRING: - { - nsCAutoString value; - aIn->GetAsAUTF8String(value); - nsAutoString valueWide; - CopyUTF8toUTF16(value, valueWide); - aOut->vt = VT_BSTR; - aOut->bstrVal = SysAllocString(valueWide.get()); - } - - // Unsupported types - default: - case nsIDataType::VTYPE_INT64: - case nsIDataType::VTYPE_UINT64: - case nsIDataType::VTYPE_VOID: - case nsIDataType::VTYPE_ID: - case nsIDataType::VTYPE_INTERFACE: - case nsIDataType::VTYPE_INTERFACE_IS: - case nsIDataType::VTYPE_ARRAY: - case nsIDataType::VTYPE_EMPTY_ARRAY: - return E_INVALIDARG; - } - - return S_OK; -} - - -HRESULT -nsScriptablePeer::ConvertVariants(VARIANT *aIn, nsIVariant **aOut) -{ - if (aIn == NULL || aOut == NULL) - { - return NS_ERROR_INVALID_ARG; - } - - *aOut = nsnull; - - nsresult rv; - nsCOMPtr v = do_CreateInstance("@mozilla.org/variant;1", &rv); - - // NOTE: THIS IS AN UGLY BACKWARDS COMPATIBILITY HACK TO WORKAROUND - // XPCOM GLUE'S INABILITY TO FIND A CERTAIN ENTRY POINT IN MOZ1.0.x/NS7.0! - // DO NOT TAUNT THE HACK - if (NS_FAILED(rv)) - { - // do_CreateInstance macro is broken so load the component manager by - // hand and get it to create the component. - HMODULE hlib = ::LoadLibraryW(L"xpcom.dll"); - if (hlib) - { - nsIComponentManager *pManager = nsnull; // A frozen interface, even in 1.0.x - typedef nsresult (*Moz1XGetComponentManagerFunc)(nsIComponentManager* *result); - Moz1XGetComponentManagerFunc compMgr = (Moz1XGetComponentManagerFunc) - ::GetProcAddress(hlib, "NS_GetComponentManager"); - if (compMgr) - { - compMgr(&pManager); - if (pManager) - { - rv = pManager->CreateInstanceByContractID("@mozilla.org/variant;1", - nsnull, NS_GET_IID(nsIWritableVariant), - getter_AddRefs(v)); - pManager->Release(); - } - } - ::FreeLibrary(hlib); - } - } - // END HACK - NS_ENSURE_SUCCESS(rv, rv); - - switch (aIn->vt) - { - case VT_EMPTY: - v->SetAsEmpty(); - break; - case VT_BSTR: - v->SetAsWString(aIn->bstrVal); - break; - case VT_I1: - v->SetAsInt8(aIn->cVal); - break; - case VT_I2: - v->SetAsInt16(aIn->iVal); - break; - case VT_I4: - v->SetAsInt32(aIn->lVal); - break; - case VT_UI1: - v->SetAsUint8(aIn->bVal); - break; - case VT_UI2: - v->SetAsUint16(aIn->uiVal); - break; - case VT_UI4: - v->SetAsUint32(aIn->ulVal); - break; - case VT_BOOL: - v->SetAsBool(aIn->boolVal == VARIANT_TRUE ? PR_TRUE : PR_FALSE); - break; - case VT_R4: - v->SetAsFloat(aIn->fltVal); - break; - case VT_R8: - v->SetAsDouble(aIn->dblVal); - break; - } - - *aOut = v; - NS_ADDREF(*aOut); - - return NS_OK; -} - -NS_IMETHODIMP -nsScriptablePeer::InternalInvoke(const char *aMethod, unsigned int aNumArgs, nsIVariant *aArgs[]) -{ - HRESULT hr; - DISPID dispid; - - IDispatchPtr disp; - if (FAILED(GetIDispatch(&disp))) - { - return NPERR_GENERIC_ERROR; - } - - USES_CONVERSION; - OLECHAR* szMember = A2OLE(aMethod); - hr = disp->GetIDsOfNames(IID_NULL, &szMember, 1, LOCALE_USER_DEFAULT, &dispid); - if (FAILED(hr)) - { - return NPERR_GENERIC_ERROR; - } - - _variant_t *pArgs = NULL; - if (aNumArgs > 0) - { - pArgs = new _variant_t[aNumArgs]; - if (pArgs == NULL) - { - return NS_ERROR_OUT_OF_MEMORY; - } - for (unsigned int i = 0; i < aNumArgs; i++) - { - hr = ConvertVariants(aArgs[i], &pArgs[i]); - if (FAILED(hr)) - { - delete []pArgs; - return NS_ERROR_INVALID_ARG; - } - } - } - - DISPPARAMS dispparams = {NULL, NULL, 0, 0}; - _variant_t vResult; - - dispparams.cArgs = aNumArgs; - dispparams.rgvarg = pArgs; - - hr = disp->Invoke( - dispid, - IID_NULL, - LOCALE_USER_DEFAULT, - DISPATCH_METHOD, - &dispparams, &vResult, NULL, NULL); - - if (pArgs) - { - delete []pArgs; - } - - if (FAILED(hr)) - { - return NPERR_GENERIC_ERROR; - } - - return NS_OK; -} - -/////////////////////////////////////////////////////////////////////////////// -// nsIMozAxPlugin - -NS_IMETHODIMP -nsScriptablePeer::Invoke(const char *aMethod) -{ - return InternalInvoke(aMethod, 0, NULL); -} - -NS_IMETHODIMP -nsScriptablePeer::Invoke1(const char *aMethod, nsIVariant *a) -{ - nsIVariant *args[1]; - args[0] = a; - return InternalInvoke(aMethod, sizeof(args) / sizeof(args[0]), args); -} - -NS_IMETHODIMP -nsScriptablePeer::Invoke2(const char *aMethod, nsIVariant *a, nsIVariant *b) -{ - nsIVariant *args[2]; - args[0] = a; - args[1] = b; - return InternalInvoke(aMethod, sizeof(args) / sizeof(args[0]), args); -} - -NS_IMETHODIMP -nsScriptablePeer::Invoke3(const char *aMethod, nsIVariant *a, nsIVariant *b, nsIVariant *c) -{ - nsIVariant *args[3]; - args[0] = a; - args[1] = b; - args[2] = c; - return InternalInvoke(aMethod, sizeof(args) / sizeof(args[0]), args); -} - -NS_IMETHODIMP -nsScriptablePeer::Invoke4(const char *aMethod, nsIVariant *a, nsIVariant *b, nsIVariant *c, nsIVariant *d) -{ - nsIVariant *args[4]; - args[0] = a; - args[1] = b; - args[2] = c; - args[3] = d; - return InternalInvoke(aMethod, sizeof(args) / sizeof(args[0]), args); -} - -NS_IMETHODIMP -nsScriptablePeer::GetProperty(const char *propertyName, nsIVariant **_retval) -{ - HRESULT hr; - DISPID dispid; - IDispatchPtr disp; - if (FAILED(GetIDispatch(&disp))) - { - return NPERR_GENERIC_ERROR; - } - USES_CONVERSION; - OLECHAR* szMember = A2OLE(propertyName); - hr = disp->GetIDsOfNames(IID_NULL, &szMember, 1, LOCALE_USER_DEFAULT, &dispid); - if (FAILED(hr)) - { - return NPERR_GENERIC_ERROR; - } - - _variant_t vResult; - - DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0}; - hr = disp->Invoke( - dispid, - IID_NULL, - LOCALE_USER_DEFAULT, - DISPATCH_PROPERTYGET, - &dispparamsNoArgs, &vResult, NULL, NULL); - - if (FAILED(hr)) - { - return NPERR_GENERIC_ERROR; - } - - nsCOMPtr propertyValue; - ConvertVariants(&vResult, getter_AddRefs(propertyValue)); - *_retval = propertyValue; - NS_IF_ADDREF(*_retval); - - return NS_OK; -} - -/* void setProperty (in string propertyName, in string propertyValue); */ -NS_IMETHODIMP -nsScriptablePeer::SetProperty(const char *propertyName, nsIVariant *propertyValue) -{ - HRESULT hr; - DISPID dispid; - IDispatchPtr disp; - if (FAILED(GetIDispatch(&disp))) - { - return NPERR_GENERIC_ERROR; - } - USES_CONVERSION; - OLECHAR* szMember = A2OLE(propertyName); - hr = disp->GetIDsOfNames(IID_NULL, &szMember, 1, LOCALE_USER_DEFAULT, &dispid); - if (FAILED(hr)) - { - return NPERR_GENERIC_ERROR; - } - - _variant_t v; - ConvertVariants(propertyValue, &v); - - DISPID dispIdPut = DISPID_PROPERTYPUT; - DISPPARAMS functionArgs; - _variant_t vResult; - - functionArgs.rgdispidNamedArgs = &dispIdPut; - functionArgs.rgvarg = &v; - functionArgs.cArgs = 1; - functionArgs.cNamedArgs = 1; - - hr = disp->Invoke( - dispid, - IID_NULL, - LOCALE_USER_DEFAULT, - DISPATCH_PROPERTYPUT, - &functionArgs, &vResult, NULL, NULL); - - if (FAILED(hr)) - { - return NPERR_GENERIC_ERROR; - } - - return NS_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// - -#ifdef XPC_IDISPATCH_SUPPORT -HRESULT -nsEventSink::InternalInvoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) -{ - FUNCDESC *pFuncDesc = NULL; - HRESULT hr = S_OK; - CComBSTR bstrName; - - // Must search and compare each member to the dispid... - if (m_spEventSinkTypeInfo) - { - HRESULT hr = S_OK; - TYPEATTR* pAttr; - hr = m_spEventSinkTypeInfo->GetTypeAttr(&pAttr); - if (pAttr) - { - int i; - for (i = 0; i < pAttr->cFuncs;i++) - { - hr = m_spEventSinkTypeInfo->GetFuncDesc(i, &pFuncDesc); - if (FAILED(hr)) - return hr; - if (pFuncDesc->memid == dispIdMember) - { - UINT cNames = 0; - m_spEventSinkTypeInfo->GetNames(dispIdMember, &bstrName, 1, &cNames); - break; - } - - m_spEventSinkTypeInfo->ReleaseFuncDesc(pFuncDesc); - pFuncDesc = NULL; - } - m_spEventSinkTypeInfo->ReleaseTypeAttr(pAttr); - } - } - if (!pFuncDesc) - { - // Return - return S_OK; - } - -#ifdef DEBUG - { - // Dump out some info to look at - ATLTRACE(_T("Invoke(%d)\n"), (int) dispIdMember); - - ATLTRACE(_T(" ")); - - /* Return code */ - switch (pFuncDesc->elemdescFunc.tdesc.vt) - { - case VT_HRESULT: ATLTRACE(_T("HRESULT")); break; - case VT_VOID: ATLTRACE(_T("void")); break; - default: ATLTRACE(_T("void /* vt = %d */"), pFuncDesc->elemdescFunc.tdesc.vt); break; - } - - /* Function name */ - ATLTRACE(_T(" %S("), SUCCEEDED(hr) ? bstrName.m_str : L"?unknown?"); - - /* Parameters */ - for (int i = 0; i < pFuncDesc->cParams; i++) - { - USHORT paramFlags = pFuncDesc->lprgelemdescParam[i].paramdesc.wParamFlags; - ATLTRACE("["); - BOOL addComma = FALSE; - if (paramFlags & PARAMFLAG_FIN) - { - ATLTRACE(_T("in")); addComma = TRUE; - } - if (paramFlags & PARAMFLAG_FOUT) - { - ATLTRACE(addComma ? _T(",out") : _T("out")); addComma = TRUE; - } - if (paramFlags & PARAMFLAG_FRETVAL) - { - ATLTRACE(addComma ? _T(",retval") : _T("retval")); addComma = TRUE; - } - ATLTRACE("] "); - - VARTYPE vt = pFuncDesc->lprgelemdescParam[i].tdesc.vt; - switch (vt) - { - case VT_HRESULT: ATLTRACE(_T("HRESULT")); break; - case VT_VARIANT: ATLTRACE(_T("VARIANT")); break; - case VT_I2: ATLTRACE(_T("short")); break; - case VT_I4: ATLTRACE(_T("long")); break; - case VT_R8: ATLTRACE(_T("double")); break; - case VT_BOOL: ATLTRACE(_T("VARIANT_BOOL")); break; - case VT_BSTR: ATLTRACE(_T("BSTR")); break; - case VT_DISPATCH: ATLTRACE(_T("IDispatch *")); break; - case VT_UNKNOWN: ATLTRACE(_T("IUnknown *")); break; - case VT_USERDEFINED: ATLTRACE(_T("/* Userdefined */")); break; - case VT_PTR: ATLTRACE(_T("void *")); break; - case VT_VOID: ATLTRACE(_T("void")); break; - // More could be added... - default: ATLTRACE(_T("/* vt = %d */"), vt); break; - } - if (i + 1 < pFuncDesc->cParams) - { - ATLTRACE(_T(", ")); - } - } - ATLTRACE(_T(");\n")); - } -#endif - m_spEventSinkTypeInfo->ReleaseFuncDesc(pFuncDesc); - pFuncDesc = NULL; - - nsCOMPtr element; - NPN_GetValue(mPlugin->pPluginInstance, NPNVDOMElement, - static_cast(getter_AddRefs(element))); - if (!element) - { - NS_ERROR("can't get the object element"); - return S_OK; - } - nsAutoString id; - if (NS_FAILED(element->GetAttribute(NS_LITERAL_STRING("id"), id)) || - id.IsEmpty()) - { - // Object has no name so it can't fire events - return S_OK; - } - - nsDependentString eventName(bstrName.m_str); - - // Fire the script event handler... - nsCOMPtr window; - NPN_GetValue(mPlugin->pPluginInstance, NPNVDOMWindow, - static_cast(getter_AddRefs(window))); - - nsCOMPtr eventManager(do_GetInterface(window)); - if (!eventManager) return S_OK; - - nsCOMPtr handler; - - eventManager->FindEventHandler(id, eventName, pDispParams->cArgs, getter_AddRefs(handler)); - if (!handler) - { - return S_OK; - } - - // Create a list of arguments to pass along - // - // This array is created on the stack if the number of arguments - // less than kMaxArgsOnStack. Otherwise, the array is heap - // allocated. - // - const int kMaxArgsOnStack = 10; - - PRUint32 argc = pDispParams->cArgs; - jsval *args = nsnull; - jsval stackArgs[kMaxArgsOnStack]; - - // Heap allocate the jsval array if it is too big to fit on - // the stack (ie. more than kMaxArgsOnStack arguments) - if (argc > kMaxArgsOnStack) - { - args = new jsval[argc]; - if (!args) return S_OK; - } - else if (argc) - { - // Use the jsval array on the stack... - args = stackArgs; - } - - if (argc) - { - nsCOMPtr disp(do_GetService("@mozilla.org/nsdispatchsupport;1")); - for (UINT i = 0; i < argc; i++) - { - // Arguments are listed backwards, intentionally, in rgvarg - disp->COMVariant2JSVal(&pDispParams->rgvarg[argc - 1 - i], &args[i]); - } - } - - // Fire the Event. - eventManager->InvokeEventHandler(handler, element, args, argc); - - // Free the jsvals if they were heap allocated... - if (args != stackArgs) - { - delete [] args; - } - - // TODO Turn js objects for out params back into VARIANTS - - // TODO Turn js return code into VARIANT - - // TODO handle js exception and fill in exception info (do we care?) - - if (pExcepInfo) - { - pExcepInfo->wCode = 0; - } - - return S_OK; -} -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// nsScriptablePeerTearOff - -nsScriptablePeerTearOff::nsScriptablePeerTearOff(nsScriptablePeer *pOwner) : - mOwner(pOwner) -{ - NS_ASSERTION(mOwner, "no owner"); -} - -HRESULT STDMETHODCALLTYPE nsScriptablePeerTearOff::QueryInterface(REFIID riid, void **ppvObject) -{ - if (::IsEqualIID(riid, _uuidof(IDispatch))) - { - *ppvObject = dynamic_cast(this); - mOwner->AddRef(); - return NS_OK; - } - nsID iid; - memcpy(&iid, &riid, sizeof(nsID)); - return mOwner->QueryInterface(iid, ppvObject); -} - -ULONG STDMETHODCALLTYPE nsScriptablePeerTearOff::AddRef() -{ - return mOwner->AddRef(); -} - -ULONG STDMETHODCALLTYPE nsScriptablePeerTearOff::Release() -{ - return mOwner->Release(); -} - -// IDispatch -HRESULT STDMETHODCALLTYPE nsScriptablePeerTearOff::GetTypeInfoCount(UINT __RPC_FAR *pctinfo) -{ - CComPtr disp; - if (FAILED(mOwner->GetIDispatch(&disp))) - { - return E_UNEXPECTED; - } - return disp->GetTypeInfoCount(pctinfo); -} - -HRESULT STDMETHODCALLTYPE nsScriptablePeerTearOff::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) -{ - CComPtr disp; - if (FAILED(mOwner->GetIDispatch(&disp))) - { - return E_UNEXPECTED; - } - return disp->GetTypeInfo(iTInfo, lcid, ppTInfo); -} - -HRESULT STDMETHODCALLTYPE nsScriptablePeerTearOff::GetIDsOfNames(REFIID riid, LPOLESTR __RPC_FAR *rgszNames, UINT cNames, LCID lcid, DISPID __RPC_FAR *rgDispId) -{ - CComPtr disp; - if (FAILED(mOwner->GetIDispatch(&disp))) - { - return E_UNEXPECTED; - } - return disp->GetIDsOfNames(riid, rgszNames, cNames, lcid, rgDispId); -} - -HRESULT STDMETHODCALLTYPE nsScriptablePeerTearOff::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS __RPC_FAR *pDispParams, VARIANT __RPC_FAR *pVarResult, EXCEPINFO __RPC_FAR *pExcepInfo, UINT __RPC_FAR *puArgErr) -{ - CComPtr disp; - if (FAILED(mOwner->GetIDispatch(&disp))) - { - return E_UNEXPECTED; - } - return disp->Invoke(dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Some public methods - - -static PRUint32 gInstances = 0; - -void MozAxPlugin::AddRef() -{ - if (gInstances == 0) - { -#ifdef XPCOM_GLUE - XPCOMGlueStartup(nsnull); -#endif - MozAxPlugin::PrefGetHostingFlags(); // Initial call to set it up - } - gInstances++; -} - -void MozAxPlugin::Release() -{ - if (--gInstances == 0) - { -#ifdef XPC_IDISPATCH_SUPPORT - MozAxPlugin::ReleasePrefObserver(); -#endif -#ifdef XPCOM_GLUE - XPCOMGlueShutdown(); -#endif - } -} - -#ifdef XPC_IDISPATCH_SUPPORT -nsresult MozAxPlugin::GetCurrentLocation(NPP instance, nsIURI **aLocation) -{ - NS_ENSURE_ARG_POINTER(aLocation); - *aLocation = nsnull; - nsCOMPtr domWindow; - NPN_GetValue(instance, NPNVDOMWindow, (void *) &domWindow); - if (!domWindow) - { - return NS_ERROR_FAILURE; - } - nsCOMPtr windowInternal = do_QueryInterface(domWindow); - if (!windowInternal) - { - return NS_ERROR_FAILURE; - } - - nsCOMPtr location; -#ifdef XPCOM_GLUE - nsEmbedString href; -#else - nsAutoString href; -#endif - windowInternal->GetLocation(getter_AddRefs(location)); - if (!location || - NS_FAILED(location->GetHref(href))) - { - return NS_ERROR_FAILURE; - } - - return NS_NewURI(aLocation, href); -} -#endif - -CLSID MozAxPlugin::GetCLSIDForType(const char *mimeType) -{ - if (mimeType == NULL) - { - return CLSID_NULL; - } - - // Read the registry to see if there is a CLSID for an object to be associated with - // this MIME type. - USES_CONVERSION; - CRegKey keyMimeDB; - if (keyMimeDB.Open(HKEY_CLASSES_ROOT, _T("MIME\\Database\\Content Type"), KEY_READ) == ERROR_SUCCESS) - { - CRegKey keyMimeType; - if (keyMimeType.Open(keyMimeDB, A2CT(mimeType), KEY_READ) == ERROR_SUCCESS) - { - USES_CONVERSION; - TCHAR szGUID[64]; - ULONG nCount = (sizeof(szGUID) / sizeof(szGUID[0])) - 1; - - GUID guidValue = GUID_NULL; - if (keyMimeType.QueryValue(szGUID, _T("CLSID"), &nCount) == ERROR_SUCCESS && - SUCCEEDED(::CLSIDFromString(T2OLE(szGUID), &guidValue))) - { - return guidValue; - } - } - } - return CLSID_NULL; -} - - -nsScriptablePeer * -MozAxPlugin::GetPeerForCLSID(const CLSID &clsid) -{ - return new nsScriptablePeer(); -} - -void -MozAxPlugin::GetIIDForCLSID(const CLSID &clsid, nsIID &iid) -{ -#ifdef XPC_IDISPATCH_SUPPORT - memcpy(&iid, &__uuidof(IDispatch), sizeof(iid)); -#else - iid = NS_GET_IID(nsIMozAxPlugin); -#endif -} - -// Called by NPP_GetValue to provide the scripting values -NPError -MozAxPlugin::GetValue(NPP instance, NPPVariable variable, void *value) -{ - if (instance == NULL) - { - return NPERR_INVALID_INSTANCE_ERROR; - } - - PluginInstanceData *pData = (PluginInstanceData *) instance->pdata; - if (!pData || - !pData->pControlSite || - !pData->pControlSite->IsObjectValid()) - { - return NPERR_GENERIC_ERROR; - } - - // Test if the object is allowed to be scripted - -#ifdef XPC_IDISPATCH_SUPPORT - PRUint32 hostingFlags = MozAxPlugin::PrefGetHostingFlags(); - if (hostingFlags & nsIActiveXSecurityPolicy::HOSTING_FLAGS_SCRIPT_SAFE_OBJECTS && - !(hostingFlags & nsIActiveXSecurityPolicy::HOSTING_FLAGS_SCRIPT_ALL_OBJECTS)) - { - // Ensure the object is safe for scripting on the specified interface - nsCOMPtr dispSupport = do_GetService(NS_IDISPATCH_SUPPORT_CONTRACTID); - if (!dispSupport) return NPERR_GENERIC_ERROR; - - PRBool isScriptable = PR_FALSE; - - // Test if the object says its safe for scripting on IDispatch - nsIID iid; - memcpy(&iid, &__uuidof(IDispatch), sizeof(iid)); - CComPtr controlUnk; - pData->pControlSite->GetControlUnknown(&controlUnk); - dispSupport->IsObjectSafeForScripting(reinterpret_cast(controlUnk.p), iid, &isScriptable); - - // Test if the class id says safe for scripting - if (!isScriptable) - { - PRBool classExists = PR_FALSE; - nsCID cid; - memcpy(&cid, &pData->clsid, sizeof(cid)); - dispSupport->IsClassMarkedSafeForScripting(cid, &classExists, &isScriptable); - } - if (!isScriptable) - { - return NPERR_GENERIC_ERROR; - } - } - else if (hostingFlags & nsIActiveXSecurityPolicy::HOSTING_FLAGS_SCRIPT_ALL_OBJECTS) - { - // Drop through since all objects are scriptable - } - else - { - return NPERR_GENERIC_ERROR; - } -#else - // Object *must* be safe - if (!pData->pControlSite->IsObjectSafeForScripting(__uuidof(IDispatch))) - { - return NPERR_GENERIC_ERROR; - } -#endif - - // Happy happy fun fun - redefine some NPPVariable values that we might - // be asked for but not defined by every PluginSDK - - const int kVarScriptableInstance = 10; // NPPVpluginScriptableInstance - const int kVarScriptableIID = 11; // NPPVpluginScriptableIID - - if (variable == kVarScriptableInstance) - { - if (!pData->pScriptingPeer) - { - nsScriptablePeer *peer = MozAxPlugin::GetPeerForCLSID(pData->clsid); - if (peer) - { - peer->AddRef(); - pData->pScriptingPeer = (nsIMozAxPlugin *) peer; - peer->mPlugin = pData; - } - } - if (pData->pScriptingPeer) - { - pData->pScriptingPeer->AddRef(); - *((nsISupports **) value)= pData->pScriptingPeer; - return NPERR_NO_ERROR; - } - } - else if (variable == kVarScriptableIID) - { - nsIID *piid = (nsIID *) NPN_MemAlloc(sizeof(nsIID)); - GetIIDForCLSID(pData->clsid, *piid); - *((nsIID **) value) = piid; - return NPERR_NO_ERROR; - } - return NPERR_GENERIC_ERROR; -} diff --git a/embedding/browser/activex/src/plugin/XPConnect.h b/embedding/browser/activex/src/plugin/XPConnect.h deleted file mode 100644 index 9d04c828c69..00000000000 --- a/embedding/browser/activex/src/plugin/XPConnect.h +++ /dev/null @@ -1,161 +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): - * Adam Lock - * Paul Oswald - * - * 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 ***** */ -#ifndef XPCONNECT_H -#define XPCONNECT_H - -#include - -#ifdef XPC_IDISPATCH_SUPPORT -#include "nsIDispatchSupport.h" -#include "nsIActiveXSecurityPolicy.h" -#endif - -#include "nsID.h" -#include "nsCOMPtr.h" -#include "nsIClassInfo.h" -#include "nsIProgrammingLanguage.h" -#include "nsIMozAxPlugin.h" -#include "nsServiceManagerUtils.h" -#include "nsIURI.h" - -#include "ControlEventSink.h" - -struct PluginInstanceData; - -template class nsIClassInfoImpl : public nsIClassInfo -{ - NS_IMETHODIMP GetFlags(PRUint32 *aFlags) - { - *aFlags = nsIClassInfo::PLUGIN_OBJECT | nsIClassInfo::DOM_OBJECT; - return NS_OK; - } - NS_IMETHODIMP GetImplementationLanguage(PRUint32 *aImplementationLanguage) - { - *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; - return NS_OK; - } - // The rest of the methods can safely return error codes... - NS_IMETHODIMP GetInterfaces(PRUint32 *count, nsIID * **array) - { return NS_ERROR_NOT_IMPLEMENTED; } - NS_IMETHODIMP GetHelperForLanguage(PRUint32 language, nsISupports **_retval) - { return NS_ERROR_NOT_IMPLEMENTED; } - NS_IMETHODIMP GetContractID(char * *aContractID) - { return NS_ERROR_NOT_IMPLEMENTED; } - NS_IMETHODIMP GetClassDescription(char * *aClassDescription) - { return NS_ERROR_NOT_IMPLEMENTED; } - NS_IMETHODIMP GetClassID(nsCID * *aClassID) - { return NS_ERROR_NOT_IMPLEMENTED; } - NS_IMETHODIMP GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) - { return NS_ERROR_NOT_IMPLEMENTED; } -}; - -class nsScriptablePeerTearOff; - -class nsScriptablePeer : - public nsIClassInfoImpl, - public nsIMozAxPlugin -{ - friend nsScriptablePeerTearOff; -protected: - virtual ~nsScriptablePeer(); - -public: - nsScriptablePeer(); - - nsScriptablePeerTearOff *mTearOff; - PluginInstanceData* mPlugin; - - NS_DECL_ISUPPORTS - NS_DECL_NSIMOZAXPLUGIN - -protected: - HRESULT GetIDispatch(IDispatch **pdisp); - HRESULT ConvertVariants(nsIVariant *aIn, VARIANT *aOut); - HRESULT ConvertVariants(VARIANT *aIn, nsIVariant **aOut); - nsresult HR2NS(HRESULT hr) const; - NS_IMETHOD InternalInvoke(const char *aMethod, unsigned int aNumArgs, nsIVariant *aArgs[]); -}; - -class nsScriptablePeerTearOff : - public IDispatch -{ -public: - nsScriptablePeerTearOff(nsScriptablePeer *pOwner); - nsScriptablePeer *mOwner; - -// IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release( void); - -// IDispatch - virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT __RPC_FAR *pctinfo); - virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); - virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR __RPC_FAR *rgszNames, UINT cNames, LCID lcid, DISPID __RPC_FAR *rgDispId); - virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS __RPC_FAR *pDispParams, VARIANT __RPC_FAR *pVarResult, EXCEPINFO __RPC_FAR *pExcepInfo, UINT __RPC_FAR *puArgErr); -}; - -#ifdef XPC_IDISPATCH_SUPPORT -class nsEventSink : public CControlEventSink -{ -public: - PluginInstanceData* mPlugin; - - virtual HRESULT InternalInvoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr); -}; - -typedef CComObject nsEventSinkInstance; -#endif - -namespace MozAxPlugin { - extern void AddRef(); - extern void Release(); - extern CLSID GetCLSIDForType(const char *mimeType); - extern NPError GetValue(NPP instance, NPPVariable variable, void *value); - extern nsScriptablePeer *GetPeerForCLSID(const CLSID &clsid); - extern void GetIIDForCLSID(const CLSID &clsid, nsIID &iid); - extern HRESULT GetServiceProvider(PluginInstanceData *pData, IServiceProvider **pSP); -#ifdef XPC_IDISPATCH_SUPPORT - extern PRUint32 PrefGetHostingFlags(); - extern void ReleasePrefObserver(); - extern nsresult GetCurrentLocation(NPP instance, nsIURI **aLocation); -#endif -} - -#endif diff --git a/embedding/browser/activex/src/plugin/activex.js b/embedding/browser/activex/src/plugin/activex.js deleted file mode 100644 index 7cc5deb65c2..00000000000 --- a/embedding/browser/activex/src/plugin/activex.js +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- Mode: Java; tab-width: 4; 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): - * Adam Lock - * - * 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 ***** */ - - -/////////////////////////////////////////////////////////////////////////////// -// This is the default preferences file defining the behavior for hosting -// ActiveX controls in Gecko embedded applications. Embedders should override -// this file to set their own policy. -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// General hosting flags settings. Read nsIActiveXSecurityPolicy.idl in -// http://lxr.mozilla.org/seamonkey/find?string=nsIActiveXSecurityPolicy.idl -// for more combinations. -// -// Briefly, -// -// 0 means no hosting of activex controls whatsoever -// 13 means medium settings (safe for scripting controls and download / install) -// 31 means host anything (extremely dangerous!) -// - -pref("security.xpconnect.activex.global.hosting_flags", 13); - - -/////////////////////////////////////////////////////////////////////////////// -// Whitelist / Blacklist capabilities -// -// The whitelist and blacklist settings define what controls Gecko will host -// and the default allow / deny behavior. -// -// Note 1: -// -// The hosting flags pref value above takes priority over settings below. -// Therefore if the hosting flags are set to 0 (i.e. host nothing) then -// no control will be hosted no matter what controls are enabled. Likewise, -// If safe for scripting checks are (wisely) enabled, no unsafe control -// will be hosted even if it is explicitly enabled below. -// -// -// Note 2: -// -// Gecko always reads the IE browser's control blacklist if one is defined -// in the registry. This is to ensure any control identified by Microsoft -// or others as unsafe is not hosted without requiring it to be explicitly -// listed here also. -// - - -/////////////////////////////////////////////////////////////////////////////// -// This pref sets the default policy to allow all controls or deny them all -// default. If the value is false, only controls explicitly enabled by their -// classid will be allowed. Otherwise all controls are allowed except those -// explicitly disabled by their classid. -// -// If you are writing an embedding application that only needs to run -// certain known controls, (e.g. an intranet control of some kind) you are -// advised to use the false value and enable the control explicitly. - -pref("security.classID.allowByDefault", true); - - -/////////////////////////////////////////////////////////////////////////////// -// Specify below the controls that should be explicitly enabled or disabled. -// This is achieved by writing a policy rule, specifiying the classid of the -// control and giving the control "AllAccess" or "NoAccess". -// -// CIDaaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee -// -// You could explicitly ban a control (using the appropriate classid) like this -// -// pref("capability.policy.default.ClassID.CID039ef260-2a0d-11d5-90a7-0010a4e73d9a", "NoAccess"); -// -// If you want to explicity enable a control then do this: -// -// pref("capability.policy.default.ClassID.CID039ef260-2a0d-11d5-90a7-0010a4e73d9a", "AllAccess"); -// -// If you want to explicitly ban or allow a control for one or more sites then -// you can create a policy for those sites. This example creates a domain -// called 'trustable' containing sites where you allow an additional control -// to be hosted.: -// -// user_pref("capability.policy.policynames", "trustable"); -// user_pref("capability.policy.trustable.sites", "http://www.site1.net http://www.site2.net"); -// user_pref("capability.policy.trustable.ClassID.CID039ef260-2a0d-11d5-90a7-0010a4e73d9a", "AllAccess"); -// - - diff --git a/embedding/browser/activex/src/plugin/install.js b/embedding/browser/activex/src/plugin/install.js deleted file mode 100644 index e7dd041302a..00000000000 --- a/embedding/browser/activex/src/plugin/install.js +++ /dev/null @@ -1,161 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Settings! - -var SOFTWARE_NAME = "ActiveX Plugin"; -var VERSION = "1.0.0.3"; -var PLID_BASE = "@mozilla.org/ActiveXPlugin"; -var PLID = PLID_BASE + ",version=" + VERSION; - -var FLDR_COMPONENTS = getFolder("Components"); -var FLDR_PLUGINS = getFolder("Plugins"); -var FLDR_PREFS = getFolder("Program","defaults/pref"); -var FLDR_WINSYS = getFolder("Win System"); - -var PLUGIN = new FileToInstall("npmozax.dll", 300, FLDR_PLUGINS); -var XPT = new FileToInstall("nsIMozAxPlugin.xpt", 2, FLDR_COMPONENTS); -var SECURITYPOLICY = new FileToInstall("nsAxSecurityPolicy.js", 9, FLDR_COMPONENTS); -var PREFS = new FileToInstall("activex.js", 5, FLDR_PREFS); - -var MSVCRT = new FileToInstall("msvcrt.dll", 400, FLDR_WINSYS); -var MSSTL60 = new FileToInstall("msvcp60.dll", 300, FLDR_WINSYS); -var MSSTL70 = new FileToInstall("msvcp70.dll", 300, FLDR_WINSYS); - -var filesToAdd = new Array(PLUGIN, XPT, SECURITYPOLICY, PREFS); -var sysFilesToAdd = new Array(MSVCRT, MSSTL60, MSSTL70); - - -/////////////////////////////////////////////////////////////////////////////// - - -// Invoke initInstall to start the installation -err = initInstall(SOFTWARE_NAME, PLID, VERSION); -if (err == BAD_PACKAGE_NAME) -{ - // HACK: Mozilla 1.1 has a busted PLID parser which doesn't like the equals sign - PLID = PLID_BASE; - err = initInstall(SOFTWARE_NAME, PLID, VERSION); -} -if (err == SUCCESS) -{ - // Install plugin files - err = verifyDiskSpace(FLDR_PLUGINS, calcSpaceRequired(filesToAdd)); - if (err == SUCCESS) - { - for (i = 0; i < filesToAdd.length; i++) - { - err = addFile(PLID, VERSION, filesToAdd[i].name, filesToAdd[i].path, null); - if (err != SUCCESS) - { - alert("Installation of " + filesToAdd[i].name + " failed. Error code " + err); - logComment("adding file " + filesToAdd[i].name + " failed. Errror code: " + err); - break; - } - } - } - else - { - logComment("Cancelling current browser install due to lack of space..."); - } - - // Install C runtime files - if (err == SUCCESS) - { - if (verifyDiskSpace(FLDR_WINSYS, calcSpaceRequired(sysFilesToAdd)) == SUCCESS) - { - // Install system dlls *only* if they do not exist. - // - // NOTE: Ignore problems installing these files, since all kinds - // of stuff could cause this to fail and I really don't care - // about dealing with email describing failed permissions, - // locked files or whatnot. - for (i = 0; i < sysFilesToAdd.length; i++) - { - fileTemp = sysFilesToAdd[i].path + sysFilesToAdd[i].name; - fileUrl = getFolder("file:///", fileTemp); - if (File.exists(fileUrl) == false) - { - logComment("File not found: " + fileTemp); - addFile("/Microsoft/Shared", - VERSION, - sysFilesToAdd[i].name, // dir name in jar to extract - sysFilesToAdd[i].path, // Where to put this file (Returned from getFolder) - "", // subdir name to create relative to fProgram - WIN_SHARED_FILE); - logComment("addFile() of " + sysFilesToAdd[i].name + " returned: " + err); - } - else - { - logComment("File found: " + sysFilesToAdd[i].name ); - } - } - } - else - { - logComment("Cancelling current browser install due to lack of space..."); - } - } -} -else -{ - logComment("Install failed at initInstall level with " + err); -} - -if (err == SUCCESS) -{ - err = performInstall(); - if (err == SUCCESS) - { - alert("Installation performed successfully, you must restart the browser for the changes to take effect"); - } -} -else - cancelInstall(); - -/** - * Function for preinstallation of plugin (FirstInstall). - * You should not stop the install process because the function failed, - * you still have a chance to install the plugin for the already - * installed gecko browsers. - * - * @param dirPath directory path from getFolder - * @param spaceRequired required space in kilobytes - * - **/ -function verifyDiskSpace(dirPath, spaceRequired) -{ - var spaceAvailable; - - // Get the available disk space on the given path - spaceAvailable = fileGetDiskSpaceAvailable(dirPath); - - // Convert the available disk space into kilobytes - spaceAvailable = parseInt(spaceAvailable / 1024); - - // do the verification - if(spaceAvailable < spaceRequired) - { - logComment("Insufficient disk space: " + dirPath); - logComment(" required : " + spaceRequired + " K"); - logComment(" available: " + spaceAvailable + " K"); - return INSUFFICIENT_DISK_SPACE; - } - - return SUCCESS; -} - -function calcSpaceRequired(fileArray) -{ - var spaceRqd = 0; - for (i = 0; i < fileArray.length; i++) - { - spaceRqd += fileArray[i].size; - } - return spaceRqd; -} - -function FileToInstall(fileName, fileSize, dirPath) -{ - this.name = fileName; - this.size = fileSize; - this.path = dirPath; -} \ No newline at end of file diff --git a/embedding/browser/activex/src/plugin/npwin.cpp b/embedding/browser/activex/src/plugin/npwin.cpp deleted file mode 100644 index d9ab782804d..00000000000 --- a/embedding/browser/activex/src/plugin/npwin.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/* IMPORTANT NOTE - This file has been hacked to add support for NPP_GetValue & NPP_SetValue! */ - -/* npwin.cpp */ - -//\\// INCLUDE -//#include "StdAfx.h" - -#include "npapi.h" -#include "npfunctions.h" - -//\\// DEFINE -#ifdef WIN32 - #define NP_EXPORT -#else - #define NP_EXPORT _export -#endif - -//\\// GLOBAL DATA -NPNetscapeFuncs* g_pNavigatorFuncs = 0; - -//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\. -////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//. -// PLUGIN DLL entry points -// -// These are the Windows specific DLL entry points. They must be exoprted -// - -// we need these to be global since we have to fill one of its field -// with a data (class) which requires knowlwdge of the navigator -// jump-table. This jump table is known at Initialize time (NP_Initialize) -// which is called after NP_GetEntryPoint -static NPPluginFuncs* g_pluginFuncs; - -//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\. -////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//. -// NP_GetEntryPoints -// -// fills in the func table used by Navigator to call entry points in -// plugin DLL. -// -NPError WINAPI NP_EXPORT -NP_GetEntryPoints(NPPluginFuncs* pFuncs) -{ - // trap a NULL ptr - if(pFuncs == NULL) - return NPERR_INVALID_FUNCTABLE_ERROR; - - // if the plugin's function table is smaller than the plugin expects, - // then they are incompatible, and should return an error - - pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; - pFuncs->newp = NPP_New; - pFuncs->destroy = NPP_Destroy; - pFuncs->setwindow = NPP_SetWindow; - pFuncs->newstream = NPP_NewStream; - pFuncs->destroystream = NPP_DestroyStream; - pFuncs->asfile = NPP_StreamAsFile; - pFuncs->writeready = NPP_WriteReady; - pFuncs->write = NPP_Write; - pFuncs->print = NPP_Print; - pFuncs->event = 0; /// reserved -#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT - pFuncs->getvalue = NPP_GetValue; - pFuncs->setvalue = NPP_SetValue; -#endif - - g_pluginFuncs = pFuncs; - - return NPERR_NO_ERROR; -} - -//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\. -////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//. -// NP_Initialize -// -// called immediately after the plugin DLL is loaded -// -NPError WINAPI NP_EXPORT -NP_Initialize(NPNetscapeFuncs* pFuncs) -{ - // trap a NULL ptr - if(pFuncs == NULL) - return NPERR_INVALID_FUNCTABLE_ERROR; - - g_pNavigatorFuncs = pFuncs; // save it for future reference - - // if the plugin's major ver level is lower than the Navigator's, - // then they are incompatible, and should return an error - if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR) - return NPERR_INCOMPATIBLE_VERSION_ERROR; - - // We have to defer these assignments until g_pNavigatorFuncs is set - int navMinorVers = g_pNavigatorFuncs->version & 0xFF; - - if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) { - g_pluginFuncs->urlnotify = NPP_URLNotify; - } - - // NPP_Initialize is a standard (cross-platform) initialize function. - return NPP_Initialize(); -} - -//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\. -////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//. -// NP_Shutdown -// -// called immediately before the plugin DLL is unloaded. -// This function should check for some ref count on the dll to see if it is -// unloadable or it needs to stay in memory. -// -NPError WINAPI NP_EXPORT -NP_Shutdown() -{ - NPP_Shutdown(); - g_pNavigatorFuncs = NULL; - return NPERR_NO_ERROR; -} - -// END - PLUGIN DLL entry points -////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//. -//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\. - -/* NAVIGATOR Entry points */ - -/* These entry points expect to be called from within the plugin. The - noteworthy assumption is that DS has already been set to point to the - plugin's DLL data segment. Don't call these functions from outside - the plugin without ensuring DS is set to the DLLs data segment first. -*/ - -/* returns the major/minor version numbers of the Plugin API for the plugin - and the Navigator -*/ -void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor) -{ - *plugin_major = NP_VERSION_MAJOR; - *plugin_minor = NP_VERSION_MINOR; - *netscape_major = HIBYTE(g_pNavigatorFuncs->version); - *netscape_minor = LOBYTE(g_pNavigatorFuncs->version); -} - -/* causes the specified URL to be fetched and streamed in -*/ -NPError NPN_GetURLNotify(NPP instance, const char *url, const char *target, void* notifyData) - -{ - int navMinorVers = g_pNavigatorFuncs->version & 0xFF; - NPError err; - if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) { - err = g_pNavigatorFuncs->geturlnotify(instance, url, target, notifyData); - } - else { - err = NPERR_INCOMPATIBLE_VERSION_ERROR; - } - return err; -} - - -NPError NPN_GetURL(NPP instance, const char *url, const char *target) -{ - return g_pNavigatorFuncs->geturl(instance, url, target); -} - -NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData) -{ - int navMinorVers = g_pNavigatorFuncs->version & 0xFF; - NPError err; - if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) { - err = g_pNavigatorFuncs->posturlnotify(instance, url, window, len, buf, file, notifyData); - } - else { - err = NPERR_INCOMPATIBLE_VERSION_ERROR; - } - return err; -} - - -NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file) -{ - return g_pNavigatorFuncs->posturl(instance, url, window, len, buf, file); -} - -/* Requests that a number of bytes be provided on a stream. Typically - this would be used if a stream was in "pull" mode. An optional - position can be provided for streams which are seekable. -*/ -NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList) -{ - return g_pNavigatorFuncs->requestread(stream, rangeList); -} - -/* Creates a new stream of data from the plug-in to be interpreted - by Netscape in the current window. -*/ -NPError NPN_NewStream(NPP instance, NPMIMEType type, - const char* target, NPStream** stream) -{ - int navMinorVersion = g_pNavigatorFuncs->version & 0xFF; - NPError err; - - if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) { - err = g_pNavigatorFuncs->newstream(instance, type, target, stream); - } - else { - err = NPERR_INCOMPATIBLE_VERSION_ERROR; - } - return err; -} - -/* Provides len bytes of data. -*/ -int32_t NPN_Write(NPP instance, NPStream *stream, - int32_t len, void *buffer) -{ - int navMinorVersion = g_pNavigatorFuncs->version & 0xFF; - int32_t result; - - if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) { - result = g_pNavigatorFuncs->write(instance, stream, len, buffer); - } - else { - result = -1; - } - return result; -} - -/* Closes a stream object. -reason indicates why the stream was closed. -*/ -NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason) -{ - int navMinorVersion = g_pNavigatorFuncs->version & 0xFF; - NPError err; - - if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) { - err = g_pNavigatorFuncs->destroystream(instance, stream, reason); - } - else { - err = NPERR_INCOMPATIBLE_VERSION_ERROR; - } - return err; -} - -/* Provides a text status message in the Netscape client user interface -*/ -void NPN_Status(NPP instance, const char *message) -{ - g_pNavigatorFuncs->status(instance, message); -} - -/* returns the user agent string of Navigator, which contains version info -*/ -const char* NPN_UserAgent(NPP instance) -{ - return g_pNavigatorFuncs->uagent(instance); -} - -/* allocates memory from the Navigator's memory space. Necessary so that - saved instance data may be freed by Navigator when exiting. -*/ - - -void* NPN_MemAlloc(uint32_t size) -{ - return g_pNavigatorFuncs->memalloc(size); -} - -/* reciprocal of MemAlloc() above -*/ -void NPN_MemFree(void* ptr) -{ - g_pNavigatorFuncs->memfree(ptr); -} - -/* private function to Netscape. do not use! -*/ -void NPN_ReloadPlugins(NPBool reloadPages) -{ - g_pNavigatorFuncs->reloadplugins(reloadPages); -} - -NPError NPN_GetValue(NPP instance, NPNVariable variable, void *result) -{ - return g_pNavigatorFuncs->getvalue(instance, variable, result); -} diff --git a/embedding/browser/activex/src/plugin/nsAxSecurityPolicy.js b/embedding/browser/activex/src/plugin/nsAxSecurityPolicy.js deleted file mode 100644 index 1fabb201b6a..00000000000 --- a/embedding/browser/activex/src/plugin/nsAxSecurityPolicy.js +++ /dev/null @@ -1,232 +0,0 @@ -/* ***** 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 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 ***** */ - -const NS_IACTIVEXSECURITYPOLICY_CONTRACTID = - "@mozilla.org/nsactivexsecuritypolicy;1"; -const NS_IACTIVEXSECURITYPOLICY_CID = - Components.ID("{B9BDB43B-109E-44b8-858C-B68C6C3DF86F}"); - -const nsISupports = Components.interfaces.nsISupports; -const nsIObserver = Components.interfaces.nsIObserver; -const nsIActiveXSecurityPolicy = Components.interfaces.nsIActiveXSecurityPolicy; - -/////////////////////////////////////////////////////////////////////////////// -// Constants representing some default flag combinations of varying degrees -// of safety. - -// No controls at all -const kTotalSecurityHostingFlags = - nsIActiveXSecurityPolicy.HOSTING_FLAGS_HOST_NOTHING; - -// Host only safe controls, no downloading or scripting -const kHighSecurityHostingFlags = - nsIActiveXSecurityPolicy.HOSTING_FLAGS_HOST_SAFE_OBJECTS; - -// Host and script safe controls and allow downloads -const kMediumSecurityGlobalHostingFlags = - nsIActiveXSecurityPolicy.HOSTING_FLAGS_HOST_SAFE_OBJECTS | - nsIActiveXSecurityPolicy.HOSTING_FLAGS_DOWNLOAD_CONTROLS | - nsIActiveXSecurityPolicy.HOSTING_FLAGS_SCRIPT_SAFE_OBJECTS; - -// Host any control and script safe controls -const kLowSecurityHostFlags = - nsIActiveXSecurityPolicy.HOSTING_FLAGS_HOST_SAFE_OBJECTS | - nsIActiveXSecurityPolicy.HOSTING_FLAGS_DOWNLOAD_CONTROLS | - nsIActiveXSecurityPolicy.HOSTING_FLAGS_SCRIPT_SAFE_OBJECTS | - nsIActiveXSecurityPolicy.HOSTING_FLAGS_HOST_ALL_OBJECTS; - -// Goodbye cruel world -const kNoSecurityHostingFlags = - nsIActiveXSecurityPolicy.HOSTING_FLAGS_HOST_SAFE_OBJECTS | - nsIActiveXSecurityPolicy.HOSTING_FLAGS_DOWNLOAD_CONTROLS | - nsIActiveXSecurityPolicy.HOSTING_FLAGS_SCRIPT_SAFE_OBJECTS | - nsIActiveXSecurityPolicy.HOSTING_FLAGS_SCRIPT_ALL_OBJECTS | - nsIActiveXSecurityPolicy.HOSTING_FLAGS_HOST_ALL_OBJECTS; - -/////////////////////////////////////////////////////////////////////////////// -// Constants representing the default hosting flag values when there is -// no pref value. Note that these should be as tight as possible except for -// testing purposes. - -const kDefaultGlobalHostingFlags = kMediumSecurityGlobalHostingFlags; -const kDefaultOtherHostingFlags = kMediumSecurityGlobalHostingFlags; - -// Preferences security policy reads from -const kHostingPrefPart1 = "security.xpconnect.activex."; -const kHostingPrefPart2 = ".hosting_flags"; -const kGlobalHostingFlagsPref = kHostingPrefPart1 + "global" + kHostingPrefPart2; - -var gPref = null; - -function addPrefListener(observer, prefStr) -{ - try { - if (gPref == null) { - var prefService = Components.classes["@mozilla.org/preferences-service;1"] - .getService(Components.interfaces.nsIPrefService); - gPref = prefService.getBranch(null); - } - var pbi = gPref.QueryInterface(Components.interfaces.nsIPrefBranch2); - pbi.addObserver(prefStr, observer, false); - } catch(ex) { - dump("Failed to observe prefs: " + ex + "\n"); - } -} - -function AxSecurityPolicy() -{ - addPrefListener(this, kGlobalHostingFlagsPref); - this.syncPrefs(); - this.globalHostingFlags = kDefaultGlobalHostingFlags; -} - -AxSecurityPolicy.prototype = { - syncPrefs: function() - { - var hostingFlags = this.globalHostingFlags; - try { - if (gPref == null) { - var prefService = Components.classes["@mozilla.org/preferences-service;1"] - .getService(Components.interfaces.nsIPrefService); - gPref = prefService.getBranch(null); - } - hostingFlags = gPref.getIntPref(kGlobalHostingFlagsPref); - } - catch (ex) { - dump("Failed to read control hosting flags from \"" + kGlobalHostingFlagsPref + "\"\n"); - hostingFlags = kDefaultGlobalHostingFlags; - } - if (hostingFlags != this.globalHostingFlags) - { - dump("Global activex hosting flags have changed value to " + hostingFlags + "\n"); - this.globalHostingFlags = hostingFlags - } - }, - - // nsIActiveXSecurityPolicy - getHostingFlags: function(context) - { - var hostingFlags; - if (context == null || context == "global") { - hostingFlags = this.globalHostingFlags; - } - else { - try { - var prefName = kHostingPrefPart1 + context + kHostingPrefPart2; - hostingFlags = gPref.getIntPref(prefName); - } - catch (ex) { - dump("Failed to read control hosting prefs for \"" + context + "\" from \"" + prefName + "\" pref\n"); - hostingFlags = kDefaultOtherHostingFlags; - } - hostingFlags = kDefaultOtherHostingFlags; - } - return hostingFlags; - }, - // nsIObserver - observe: function(subject, topic, prefName) - { - if (topic != "nsPref:changed") - return; - this.syncPrefs(); - - }, - // nsISupports - QueryInterface: function(iid) { - if (iid.equals(nsISupports) || - iid.equals(nsIActiveXSecurityPolicy) || - iid.equals(nsIObserver)) - return this; - - throw Components.results.NS_ERROR_NO_INTERFACE; - } -}; - -/* factory for AxSecurityPolicy */ -var AxSecurityPolicyFactory = { - createInstance: function (outer, iid) - { - if (outer != null) - throw Components.results.NS_ERROR_NO_AGGREGATION; - if (!iid.equals(nsISupports) && - !iid.equals(nsIActiveXSecurityPolicy) && - !iid.equals(nsIObserver)) - throw Components.results.NS_ERROR_INVALID_ARG; - return new AxSecurityPolicy(); - } -}; - - -var AxSecurityPolicyModule = { - registerSelf: function (compMgr, fileSpec, location, type) - { - debug("*** Registering axsecurity policy.\n"); - compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar); - compMgr.registerFactoryLocation( - NS_IACTIVEXSECURITYPOLICY_CID , - "ActiveX Security Policy Service", - NS_IACTIVEXSECURITYPOLICY_CONTRACTID, - fileSpec, - location, - type); - }, - unregisterSelf: function(compMgr, fileSpec, location) - { - compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar); - compMgr.unregisterFactoryLocation(NS_IACTIVEXSECURITYPOLICY_CID, fileSpec); - }, - getClassObject: function(compMgr, cid, iid) - { - if (cid.equals(NS_IACTIVEXSECURITYPOLICY_CID)) - return AxSecurityPolicyFactory; - - if (!iid.equals(Components.interfaces.nsIFactory)) - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - - throw Components.results.NS_ERROR_NO_INTERFACE; - }, - canUnload: function(compMgr) - { - return true; - } -}; - -/* entrypoint */ -function NSGetModule(compMgr, fileSpec) { - return AxSecurityPolicyModule; -} - - diff --git a/embedding/browser/activex/src/plugin/nsIMozAxPlugin.idl b/embedding/browser/activex/src/plugin/nsIMozAxPlugin.idl deleted file mode 100644 index 59e9796d607..00000000000 --- a/embedding/browser/activex/src/plugin/nsIMozAxPlugin.idl +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: IDL; tab-width: 4; 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 browser. - * - * The Initial Developer of the Original Code is - * Netscape Communications, Inc. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 "nsISupports.idl" - -interface nsIVariant; - -[scriptable, uuid(b30c2717-2bbf-4475-9ddf-9e26f893f32a)] -interface nsIMozAxPlugin : nsISupports -{ - void invoke(in string str); - void invoke1(in string str, in nsIVariant a); - void invoke2(in string str, in nsIVariant a, in nsIVariant b); - void invoke3(in string str, in nsIVariant a, in nsIVariant b, in nsIVariant c); - void invoke4(in string str, in nsIVariant a, in nsIVariant b, in nsIVariant c, in nsIVariant d); - - /* Set and get values */ - nsIVariant getProperty(in string propertyName); - void setProperty(in string propertyName, in nsIVariant propertyValue); -}; diff --git a/embedding/browser/activex/src/plugin/plugin.sln b/embedding/browser/activex/src/plugin/plugin.sln deleted file mode 100644 index 6d02314dc34..00000000000 --- a/embedding/browser/activex/src/plugin/plugin.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "plugin", "plugin.vcproj", "{E992202E-EF6C-48DC-96F4-9522F09411EE}" -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = Debug - ConfigName.1 = Release - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {E992202E-EF6C-48DC-96F4-9522F09411EE}.Debug.ActiveCfg = Debug|Win32 - {E992202E-EF6C-48DC-96F4-9522F09411EE}.Debug.Build.0 = Debug|Win32 - {E992202E-EF6C-48DC-96F4-9522F09411EE}.Release.ActiveCfg = Release|Win32 - {E992202E-EF6C-48DC-96F4-9522F09411EE}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/embedding/browser/activex/src/plugin/plugin.vcproj b/embedding/browser/activex/src/plugin/plugin.vcproj deleted file mode 100644 index 414a0907efe..00000000000 --- a/embedding/browser/activex/src/plugin/plugin.vcproj +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/embedding/browser/activex/src/plugin/resource.h b/embedding/browser/activex/src/plugin/resource.h deleted file mode 100644 index 905b525d2a1..00000000000 --- a/embedding/browser/activex/src/plugin/resource.h +++ /dev/null @@ -1 +0,0 @@ -// resource.h diff --git a/embedding/browser/activex/src/plugin/test.htm b/embedding/browser/activex/src/plugin/test.htm deleted file mode 100644 index d214a597dc7..00000000000 --- a/embedding/browser/activex/src/plugin/test.htm +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - Mozilla Plugin Test Page - - - - - -

This page is designed for Communicator 4.x with the Mozilla -ActiveX plugin installed! You also need to have the MS calendar control -installed to see anything

- -

This version uses the EMBED tag

-

- - -

- -

This version uses the OBJECT tag, with a few different parameter settings.

-

- - - - - - - - - - - - - -

- - - - diff --git a/embedding/browser/activex/src/pluginhostctrl/PluginHostCtrl.rgs b/embedding/browser/activex/src/pluginhostctrl/PluginHostCtrl.rgs deleted file mode 100644 index 988779dd667..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/PluginHostCtrl.rgs +++ /dev/null @@ -1,39 +0,0 @@ -HKCR -{ - Mozilla.PluginHostCtrl.1 = s 'MozillaPluginHostCtrl Class' - { - CLSID = s '{DBB2DE32-61F1-4F7F-BEB8-A37F5BC24EE2}' - } - Mozilla.PluginHostCtrl = s 'MozillaPluginHostCtrl Class' - { - CLSID = s '{DBB2DE32-61F1-4F7F-BEB8-A37F5BC24EE2}' - CurVer = s 'Mozilla.PluginHostCtrl.1' - } - NoRemove CLSID - { - ForceRemove {DBB2DE32-61F1-4F7F-BEB8-A37F5BC24EE2} = s 'MozillaPluginHostCtrl Class' - { - ForceRemove 'Implemented Categories' - { - ForceRemove '{7DD95801-9882-11CF-9FA9-00AA006C42C4}' - ForceRemove '{7DD95802-9882-11CF-9FA9-00AA006C42C4}' - } - ProgID = s 'Mozilla.PluginHostCtrl.1' - VersionIndependentProgID = s 'Mozilla.PluginHostCtrl' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - ForceRemove 'Control' - ForceRemove 'Insertable' - ForceRemove 'ToolboxBitmap32' = s '%MODULE%, 101' - 'MiscStatus' = s '0' - { - '1' = s '131473' - } - 'TypeLib' = s '{5C670C1C-33E2-4B67-8D1E-CC2CF8091A0A}' - 'Version' = s '1.0' - } - } -} diff --git a/embedding/browser/activex/src/pluginhostctrl/README.txt b/embedding/browser/activex/src/pluginhostctrl/README.txt deleted file mode 100644 index 7429af168c9..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/README.txt +++ /dev/null @@ -1,83 +0,0 @@ -ActiveX control for hosting Netscape plugins in IE -================================================== - -This folder contains an ActiveX control that allows you to host -NP API compatible plugins within Internet Explorer. It's pretty simple to -use and is a self-contained DLL called pluginhostctrl.dll. It has no runtime -or build dependencies on any other -part of the Mozilla - - -To build -======== - -1. Open pluginhostctrl.dsp -2. Build "Win32 Debug" or another target -3. Open some of the test files in IE to verify it works - -The control currently reads plugins from your most current Netscape 4.x -installation. There is no support for Mozilla or NS 6.x yet. - -A note to developers: If you intend to modify this control IN ANY WAY then -you MUST also change the CLSID. This is necessary to prevent your control -from registering itself over this control or vice versa. - -Use a tool such as guidgen.exe or uuidgen.exe to create a new CLSID. - - -Manual installation -=================== - -Assuming you have the precompiled DLL and wish to install it on a machine, -you must register it: - -regsvr32 pluginhostctrl.dll - -You must have administrator privileges to install a new control on -operating systems such as Windows NT, 2000 & XP. - - -Usage -===== - -Insert some HTML like this into your content: - - - - - - - - -The CLSID attribute tells IE to create an instance of the plugin hosting -control, the width and height specify the dimensions in pixels. - -The following attributes have tag equivalents: - -* is equivalent to TYPE - Specifies the MIME type of the plugin. The control uses this value to - determine which plugin it should create to handle the content. - -* is equivalent to SRC - Specifies an URL for the initial stream of data to feed the plugin. - If you havent't specified a "type" PARAM, the control will attempt to use - the MIME type of this stream to create the correct plugin. - -* is equivalent to PLUGINSPAGE - Specifies a URL where the plugin may be installed from. The default - plugin will redirect you to this page when you do not have the correct - plugin installed. - -You may also supply any custom plugin parameters as additional -elements. - - -Still to do -=========== - -* Only hosts windowed plugins. -* Doesn't work for the Adobe Acrobat plugin yet. -* No progress indication to show when there is network activity -* Plugins cannot create writeable streams. -* Package pluginhostctrl.dll into a CAB file automatic installation in IE. diff --git a/embedding/browser/activex/src/pluginhostctrl/StdAfx.cpp b/embedding/browser/activex/src/pluginhostctrl/StdAfx.cpp deleted file mode 100644 index 9ee408b7a75..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/StdAfx.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 "stdafx.h" - -#ifdef _ATL_STATIC_REGISTRY -#include -#include -#endif - -// #include diff --git a/embedding/browser/activex/src/pluginhostctrl/StdAfx.h b/embedding/browser/activex/src/pluginhostctrl/StdAfx.h deleted file mode 100644 index bf6be20558b..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/StdAfx.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 ***** */ - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__113F2370_7A1B_4C16_BDFB_37785C884DA6__INCLUDED_) -#define AFX_STDAFX_H__113F2370_7A1B_4C16_BDFB_37785C884DA6__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define STRICT -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0403 -#endif -#define _ATL_APARTMENT_THREADED - -#include -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#include -#include -#include -#include -#include -#include - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#include "npapi.h" -#include "npupp.h" - - -#endif // !defined(AFX_STDAFX_H__113F2370_7A1B_4C16_BDFB_37785C884DA6__INCLUDED) diff --git a/embedding/browser/activex/src/pluginhostctrl/cab/README.txt b/embedding/browser/activex/src/pluginhostctrl/cab/README.txt deleted file mode 100644 index 156f0c983d9..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/cab/README.txt +++ /dev/null @@ -1,58 +0,0 @@ -Mozilla ActiveX Control for hosting Plug-ins - -Adam Lock - - -Want to generate a CAB file for the plugin host control? - -First off you need the Cabinet SDK and the signing tools: - - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncabsdk/html/cabdl.asp - http://msdn.microsoft.com/MSDN-FILES/027/000/219/codesign.exe - -More informative blurb about signing is here: - - http://www.verisign.com/support/tlc/codesign/install.html - -Please don't email me questions about signing since I'm just following the -instructions in these links. - -Install the CAB and signing tools somewhere and edit the line in makecab.bat -to specify the correct PATH to these programs. - -Next build the pluginhostctrl.dll (e.g. from the ReleaseMinSize target) and type - - makecab ..\ReleaseMinSize\pluginhostctrl.dll - -This produces pluginhostctrl.cab which you can place on a webserver somewhere -so IE can download it when it's specified in the tag, e.g. - - - - -The makecab script automatically signs the CAB file with a TEST CERTIFICATE. YOu -will be prompted to create or enter a password - just make one up and remember -it. - - DO NOT DISTRIBUTE CAB FILES SIGNED WITH THE TEST CERTIFICATE!!!! - -If you want to sign the CAB file with a real certificate, run makecab like this: - - makecab ..\ReleaseMinSize\pluginhostctrl.dll xx.cer xx.key xx.spc - -Where xx.* files are your real certificate, key and your software publisher -certificate. If you don't have a real certificate you need to visit somewhere -like Verisign and buy one. - -There is a sample verify.htm page that you may load in IE to see if the -control installs and runs correctly. - -STILL TO DO: - - o Figure out what's wrong with pluginhostctrl.inf that stops atl.dll from - installing. For the time being atl.dll is commented out of the .inf file - which means it won't be installed and the plugin won't work if its not - installed already. - o Script is untested with a real key/cert/spc but should work. diff --git a/embedding/browser/activex/src/pluginhostctrl/cab/makecab.bat b/embedding/browser/activex/src/pluginhostctrl/cab/makecab.bat deleted file mode 100755 index f331fae5748..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/cab/makecab.bat +++ /dev/null @@ -1,70 +0,0 @@ -@echo off - -set OLDPATH=%PATH% -set PATH=d:\m\cabsdk\bin;d:\m\codesign\bin;%PATH% - -set OUTDIR=.\out -set OUTCAB=.\pluginhostctrl.cab - -set PLUGINHOSTCTRLDLL=%1 -set CERTFILE=%2 -set KEYFILE=%3 -set SPCFILE=%4 - -REM === Check arguments === - -if NOT .%PLUGINHOSTCTRLDLL%.==.. goto have_pluginhostctrl -echo Usage : %0 pluginhostctrl [certfile keyfile spcfile] -echo . -echo Specify the path to the pluginhostctrl.dll file as the first argument -echo and optionally the certificate and keyfile as extra arguments. -goto end -:have_pluginhostctrl -if EXIST %PLUGINHOSTCTRLDLL% goto valid_pluginhostctrl -echo ERROR: The specified pluginhostctrl.dll file "%PLUGINHOSTCTRLDLL%" does not exist. -goto end -:valid_pluginhostctrl - - -REM === Make the CAB file === - -mkdir %OUTDIR% -copy %PLUGINHOSTCTRLDLL% %OUTDIR% -copy redist\*.* %OUTDIR% -copy pluginhostctrl.inf %OUTDIR% -cabarc -s 6144 -r -P %OUTDIR%\ N %OUTCAB% out\*.* - - -REM === Generate a test certificate to sign this thing with === - -if NOT .%TESTCERT%.==.. goto end_testcert -echo Generating a test certificate... -set KEYFILE=.\test.key -set CERTFILE=.\test.cer -set SPCFILE=.\test.spc -makecert -sv %KEYFILE% -n "CN=testcert.untrusted.org" %CERTFILE% -cert2spc %CERTFILE% %SPCFILE% -:end_testcert - - -REM === Sign the CAB file === - -if .%CERTFILE%.==.. goto the_end -if .%KEYFILE%.==.. goto the_end -if .%SPCFILE%.==.. goto the_end -if NOT EXIST %CERTFILE% goto the_end -if NOT EXIST %KEYFILE% goto the_end -if NOT EXIST %SPCFILE% goto the_end -echo Signing %OUTCAB% -signcode -spc %SPCFILE% -v %KEYFILE% -n "Mozilla ActiveX control for hosting plugins" %OUTCAB% - - -REM == THE END === - -:the_end -set PATH=%OLDPATH% -set OLDPATH= -set OUTCAB= -set CERTFILE= -set KEYFILE= -set SPCFILE= diff --git a/embedding/browser/activex/src/pluginhostctrl/cab/pluginhostctrl.inf b/embedding/browser/activex/src/pluginhostctrl/cab/pluginhostctrl.inf deleted file mode 100644 index 7ba88918c61..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/cab/pluginhostctrl.inf +++ /dev/null @@ -1,22 +0,0 @@ -; pluginhostctrl.inf -[version] -signature="$CHICAGO$" -AdvancedINF=2.0 - -[Add.Code] -pluginhostctrl.dll=pluginhostctrl.dll -;atl.dll=atl.dll - -; Required DLLs - -[pluginhostctrl.dll] -file-win32-x86=thiscab -clsid={DBB2DE32-61F1-4F7F-BEB8-A37F5BC24EE2} -FileVersion=1,0,0,1 -RegisterServer=yes - -;[atl.dll] -;file-win32-x86=thiscab -;DestDir=11 -;RegisterServer=yes -;FileVersion=6,0,0,8449 diff --git a/embedding/browser/activex/src/pluginhostctrl/cab/redist/ATL.DLL b/embedding/browser/activex/src/pluginhostctrl/cab/redist/ATL.DLL deleted file mode 100644 index 6b7a8b0c9b2..00000000000 Binary files a/embedding/browser/activex/src/pluginhostctrl/cab/redist/ATL.DLL and /dev/null differ diff --git a/embedding/browser/activex/src/pluginhostctrl/cab/verify.htm b/embedding/browser/activex/src/pluginhostctrl/cab/verify.htm deleted file mode 100644 index cc1a7684568..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/cab/verify.htm +++ /dev/null @@ -1,12 +0,0 @@ - - - CAB file verification - - -

Test page to verify CAB file was created and signed correctly

- - - - \ No newline at end of file diff --git a/embedding/browser/activex/src/pluginhostctrl/npn.cpp b/embedding/browser/activex/src/pluginhostctrl/npn.cpp deleted file mode 100644 index ebfc247294f..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/npn.cpp +++ /dev/null @@ -1,487 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 "stdafx.h" - -#include "npn.h" -#include "Pluginhostctrl.h" - -#include "nsPluginHostWnd.h" - -static NPError -_OpenURL(NPP npp, const char *szURL, const char *szTarget, void *pNotifyData, const char *pData, uint32 len, NPBool isFile) -{ - if (!npp) - { - return NPERR_INVALID_INSTANCE_ERROR; - } - - void *postData = NULL; - uint32 postDataLen = 0; - if (pData) - { - if (!isFile) - { - postData = (void *) pData; - postDataLen = len; - } - else - { - // TODO read the file specified in the postdata param into memory - } - } - - nsPluginHostWnd *pWnd = (nsPluginHostWnd *) npp->ndata; - ATLASSERT(pWnd); - - // Other window targets - if (szTarget) - { - CComPtr cpBrowser; - pWnd->GetWebBrowserApp(&cpBrowser); - if (!cpBrowser) - { - return NPERR_GENERIC_ERROR; - } - - CComBSTR url(szURL); - - HRESULT hr; - - // Test if the input URL has a schema which means it's relative, - // otherwise consider it to be relative to the current URL - - WCHAR szSchema[10]; - const DWORD cbSchema = sizeof(szSchema) / sizeof(szSchema[0]); - DWORD cbSchemaUsed = 0; - - memset(szSchema, 0, cbSchema); - hr = CoInternetParseUrl(url.m_str, PARSE_SCHEMA, 0, - szSchema, cbSchema, &cbSchemaUsed, 0); - - if (hr != S_OK || cbSchemaUsed == 0) - { - // Convert relative URLs to absolute, so that they can be loaded - // by the Browser - - CComBSTR bstrCurrentURL; - cpBrowser->get_LocationURL(&bstrCurrentURL); - - if (bstrCurrentURL.Length()) - { - USES_CONVERSION; - DWORD cbNewURL = (url.Length() + bstrCurrentURL.Length() + 1) * sizeof(WCHAR); - DWORD cbNewURLUsed = 0; - WCHAR *pszNewURL = (WCHAR *) calloc(cbNewURL, 1); - ATLASSERT(pszNewURL); - - CoInternetCombineUrl( - bstrCurrentURL.m_str, - url.m_str, - 0, - pszNewURL, - cbNewURL, - &cbNewURLUsed, - 0); - - ATLASSERT(cbNewURLUsed < cbNewURL); - - url = pszNewURL; - free(pszNewURL); - } - } - - CComVariant vFlags; - CComVariant vTarget(szTarget); - CComVariant vPostData; - CComVariant vHeaders; - - // Initialise postdata - if (postData) - { - // According to the documentation. - // The post data specified by PostData is passed as a SAFEARRAY - // structure. The variant should be of type VT_ARRAY and point to - // a SAFEARRAY. The SAFEARRAY should be of element type VT_UI1, - // dimension one, and have an element count equal to the number of - // bytes of post data. - - SAFEARRAYBOUND saBound[1]; - saBound[0].lLbound = 0; - saBound[0].cElements = len; - vPostData.vt = VT_ARRAY | VT_UI1; - vPostData.parray = SafeArrayCreate(VT_UI1, 1, saBound); - SafeArrayLock(vPostData.parray); - memcpy(vPostData.parray->pvData, postData, postDataLen); - SafeArrayUnlock(vPostData.parray); - } - - cpBrowser->Navigate(url, &vFlags, &vTarget, &vPostData, &vHeaders); - // TODO listen to navigation & send a URL notify to plugin when completed - return NPERR_NO_ERROR; - } - - USES_CONVERSION; - HRESULT hr = pWnd->OpenURLStream(A2CT(szURL), pNotifyData, postData, postDataLen); - return SUCCEEDED(hr) ? NPERR_NO_ERROR : NPERR_GENERIC_ERROR; -} - - -NPError NP_EXPORT -NPN_GetURL(NPP npp, const char* relativeURL, const char* target) -{ - return _OpenURL(npp, relativeURL, target, NULL, NULL, 0, FALSE); -} - -//////////////////////////////////////////////////////////////////////// -NPError NP_EXPORT -NPN_GetURLNotify(NPP npp, - const char* relativeURL, - const char* target, - void* notifyData) -{ - if (strncmp("javascript:", relativeURL, 11) == 0) - return NPERR_INVALID_URL; - - return _OpenURL(npp, relativeURL, target, notifyData, NULL, 0, FALSE); -} - - -//////////////////////////////////////////////////////////////////////// -NPError NP_EXPORT -NPN_PostURLNotify(NPP npp, - const char *relativeURL, - const char *target, - uint32 len, - const char *buf, - NPBool file, - void *notifyData) -{ - return _OpenURL(npp, relativeURL, target, notifyData, buf, len, file); -} - - -//////////////////////////////////////////////////////////////////////// -NPError NP_EXPORT -NPN_PostURL(NPP npp, - const char *relativeURL, - const char *target, - uint32 len, - const char *buf, - NPBool file) -{ - return _OpenURL(npp, relativeURL, target, NULL, buf, len, file); -} - - -//////////////////////////////////////////////////////////////////////// -NPError NP_EXPORT -NPN_NewStream(NPP npp, NPMIMEType type, const char* window, NPStream* *result) -{ - if (!npp) - { - return NPERR_INVALID_INSTANCE_ERROR; - } - - return NPERR_GENERIC_ERROR; -} - - -//////////////////////////////////////////////////////////////////////// -int32 NP_EXPORT -NPN_Write(NPP npp, NPStream *pstream, int32 len, void *buffer) -{ - if (!npp) - { - return NPERR_INVALID_INSTANCE_ERROR; - } - - return NPERR_GENERIC_ERROR; -} - - -//////////////////////////////////////////////////////////////////////// -NPError NP_EXPORT -NPN_DestroyStream(NPP npp, NPStream *pstream, NPError reason) -{ - if (!npp) - { - return NPERR_INVALID_INSTANCE_ERROR; - } - - return NPERR_GENERIC_ERROR; -} - - -//////////////////////////////////////////////////////////////////////// -void NP_EXPORT -NPN_Status(NPP npp, const char *message) -{ - if (!npp) - { - return; - } - - nsPluginHostWnd *pWnd = (nsPluginHostWnd *) npp->ndata; - ATLASSERT(pWnd); - - // Update the status bar in the browser - CComPtr cpBrowser; - pWnd->GetWebBrowserApp(&cpBrowser); - if (cpBrowser) - { - USES_CONVERSION; - cpBrowser->put_StatusText(A2OLE(message)); - } -} - - -//////////////////////////////////////////////////////////////////////// -void * NP_EXPORT -NPN_MemAlloc (uint32 size) -{ - return malloc(size); -} - - -//////////////////////////////////////////////////////////////////////// -void NP_EXPORT -NPN_MemFree (void *ptr) -{ - if (ptr) - { - free(ptr); - } -} - - -//////////////////////////////////////////////////////////////////////// -uint32 NP_EXPORT -NPN_MemFlush(uint32 size) -{ - return 0; -} - - -//////////////////////////////////////////////////////////////////////// -void NP_EXPORT -NPN_ReloadPlugins(NPBool reloadPages) -{ -} - - -//////////////////////////////////////////////////////////////////////// -void NP_EXPORT -NPN_InvalidateRect(NPP npp, NPRect *invalidRect) -{ - if (!npp) - { - return; - } - - nsPluginHostWnd *pWnd = (nsPluginHostWnd *) npp->ndata; - ATLASSERT(pWnd); - - RECT *prc = NULL; - RECT rcInvalid; - if (invalidRect) - { - prc = &rcInvalid; - prc->left = invalidRect->left; - prc->bottom = invalidRect->bottom; - prc->top = invalidRect->top; - prc->right = invalidRect->right; - } - pWnd->InvalidateRect(prc, FALSE); -} - - -//////////////////////////////////////////////////////////////////////// -void NP_EXPORT -NPN_InvalidateRegion(NPP npp, NPRegion invalidRegion) -{ - if (!npp) - { - return; - } - nsPluginHostWnd *pWnd = (nsPluginHostWnd *) npp->ndata; - ATLASSERT(pWnd); - - pWnd->InvalidateRgn(invalidRegion, FALSE); -} - - -//////////////////////////////////////////////////////////////////////// -void NP_EXPORT -NPN_ForceRedraw(NPP npp) -{ - if (!npp) - { - return; - } - nsPluginHostWnd *pWnd = (nsPluginHostWnd *) npp->ndata; - ATLASSERT(pWnd); - pWnd->InvalidateRect(NULL, FALSE); -} - -//////////////////////////////////////////////////////////////////////// -NPError NP_EXPORT -NPN_GetValue(NPP npp, NPNVariable variable, void *result) -{ - if (!npp) - { - return NPERR_INVALID_INSTANCE_ERROR; - } - - if (!result) - { - return NPERR_INVALID_PARAM; - } - - nsPluginHostWnd *pWnd = (nsPluginHostWnd *) npp->ndata; - ATLASSERT(pWnd); - - CComPtr cpBrowser; - pWnd->GetWebBrowserApp(&cpBrowser); - - // Test the variable - switch (variable) - { - case NPNVnetscapeWindow: - *((HWND *) result) = pWnd->m_hWnd; - break; - case NPNVjavascriptEnabledBool: - // TODO - *((NPBool *) result) = FALSE; - break; - case NPNVasdEnabledBool: - *((NPBool *) result) = FALSE; - break; - case NPNVisOfflineBool: - *((NPBool *) result) = FALSE; - if (cpBrowser) - { - CComQIPtr cpBrowser2 = cpBrowser; - if (cpBrowser2) - { - VARIANT_BOOL bOffline = VARIANT_FALSE; - cpBrowser2->get_Offline(&bOffline); - *((NPBool *) result) = (bOffline == VARIANT_TRUE) ? TRUE : FALSE; - } - } - break; - default: - return NPERR_GENERIC_ERROR; - } - return NPERR_NO_ERROR; -} - - -//////////////////////////////////////////////////////////////////////// -NPError NP_EXPORT -NPN_SetValue(NPP npp, NPPVariable variable, void *result) -{ - if (!npp) - { - return NPERR_INVALID_INSTANCE_ERROR; - } - - nsPluginHostWnd *pWnd = (nsPluginHostWnd *) npp->ndata; - ATLASSERT(pWnd); - - switch (variable) - { - case NPPVpluginWindowBool: - { - pWnd->SetPluginWindowless((result == NULL) ? true : false); - } - return NPERR_NO_ERROR; - case NPPVpluginTransparentBool: - { - pWnd->SetPluginTransparent((result != NULL) ? true : false); - } - return NPERR_NO_ERROR; - } - - return NPERR_GENERIC_ERROR; -} - - -//////////////////////////////////////////////////////////////////////// -NPError NP_EXPORT -NPN_RequestRead(NPStream *pstream, NPByteRange *rangeList) -{ - if (!pstream || !rangeList || !pstream->ndata) - { - return NPERR_INVALID_PARAM; - } - - return NPERR_GENERIC_ERROR; -} - -//////////////////////////////////////////////////////////////////////// -JRIEnv* NP_EXPORT -NPN_GetJavaEnv(void) -{ - return NULL; -} - - -//////////////////////////////////////////////////////////////////////// -const char * NP_EXPORT -NPN_UserAgent(NPP npp) -{ - return "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6"; -} - - -//////////////////////////////////////////////////////////////////////// -java_lang_Class* NP_EXPORT -NPN_GetJavaClass(void* handle) -{ - return NULL; -} - - -//////////////////////////////////////////////////////////////////////// -jref NP_EXPORT -NPN_GetJavaPeer(NPP npp) -{ - return NULL; -} - - diff --git a/embedding/browser/activex/src/pluginhostctrl/npn.h b/embedding/browser/activex/src/pluginhostctrl/npn.h deleted file mode 100644 index 1579d6334ed..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/npn.h +++ /dev/null @@ -1,116 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * 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 ***** */ -#ifndef NPN_H -#define NPN_H - -#include "npapi.h" -#include "npupp.h" - -#define NP_EXPORT - -//////////////////////////////////////////////////////////////////////// -// stub functions that are exported to the 4.x plugin as entry -// points via the CALLBACKS variable. -// -NPError NP_EXPORT -NPN_RequestRead(NPStream *pstream, NPByteRange *rangeList); - -NPError NP_EXPORT -NPN_GetURLNotify(NPP npp, const char* relativeURL, const char* target, void* notifyData); - -NPError NP_EXPORT -NPN_GetValue(NPP npp, NPNVariable variable, void *r_value); - -NPError NP_EXPORT -NPN_SetValue(NPP npp, NPPVariable variable, void *r_value); - -NPError NP_EXPORT -NPN_GetURL(NPP npp, const char* relativeURL, const char* target); - -NPError NP_EXPORT -NPN_PostURLNotify(NPP npp, const char* relativeURL, const char *target, - uint32 len, const char *buf, NPBool file, void* notifyData); - -NPError NP_EXPORT -NPN_PostURL(NPP npp, const char* relativeURL, const char *target, uint32 len, - const char *buf, NPBool file); - -NPError NP_EXPORT -NPN_NewStream(NPP npp, NPMIMEType type, const char* window, NPStream** pstream); - -int32 NP_EXPORT -NPN_Write(NPP npp, NPStream *pstream, int32 len, void *buffer); - -NPError NP_EXPORT -NPN_DestroyStream(NPP npp, NPStream *pstream, NPError reason); - -void NP_EXPORT -NPN_Status(NPP npp, const char *message); - -void* NP_EXPORT -NPN_MemAlloc (uint32 size); - -void NP_EXPORT -NPN_MemFree (void *ptr); - -uint32 NP_EXPORT -NPN_MemFlush(uint32 size); - -void NP_EXPORT -NPN_ReloadPlugins(NPBool reloadPages); - -void NP_EXPORT -NPN_InvalidateRect(NPP npp, NPRect *invalidRect); - -void NP_EXPORT -NPN_InvalidateRegion(NPP npp, NPRegion invalidRegion); - -const char* NP_EXPORT -NPN_UserAgent(NPP npp); - -JRIEnv* NP_EXPORT -NPN_GetJavaEnv(void); - -jref NP_EXPORT -NPN_GetJavaPeer(NPP npp); - -java_lang_Class* NP_EXPORT -NPN_GetJavaClass(void* handle); - -void NP_EXPORT -NPN_ForceRedraw(NPP npp); - -#endif diff --git a/embedding/browser/activex/src/pluginhostctrl/nsPluginHostCtrl.cpp b/embedding/browser/activex/src/pluginhostctrl/nsPluginHostCtrl.cpp deleted file mode 100644 index 4903a9852af..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/nsPluginHostCtrl.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 "stdafx.h" - -#include "Pluginhostctrl.h" -#include "nsPluginHostCtrl.h" - -///////////////////////////////////////////////////////////////////////////// -// nsPluginHostCtrl - -nsPluginHostCtrl::nsPluginHostCtrl() -{ - m_bWindowOnly = TRUE; -} - -nsPluginHostCtrl::~nsPluginHostCtrl() -{ -} - - -HRESULT nsPluginHostCtrl::GetWebBrowserApp(IWebBrowserApp **pBrowser) -{ - ATLASSERT(pBrowser); - if (!pBrowser) - { - return E_INVALIDARG; - } - - // Get the web browser through the site the control is attached to. - // Note: The control could be running in some other container than IE - // so code shouldn't expect this function to work all the time. - - CComPtr cpWebBrowser; - CComQIPtr cpServiceProvider = m_spClientSite; - - HRESULT hr; - if (cpServiceProvider) - { - hr = cpServiceProvider->QueryService(IID_IWebBrowserApp, &cpWebBrowser); - } - if (!cpWebBrowser) - { - return E_FAIL; - } - - *pBrowser = cpWebBrowser; - (*pBrowser)->AddRef(); - - return S_OK; -} - -/////////////////////////////////////////////////////////////////////////////// -// IMozPluginHostCtrl - -STDMETHODIMP nsPluginHostCtrl::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog) -{ - CComQIPtr cpPropBag2 = pPropBag; - if (cpPropBag2) - { - // Read *all* the properties via IPropertyBag2 and store them somewhere - // so they can be fed into the plugin instance at creation.. - ULONG nProperties; - cpPropBag2->CountProperties(&nProperties); - if (nProperties > 0) - { - PROPBAG2 *pProperties = (PROPBAG2 *) malloc(sizeof(PROPBAG2) * nProperties); - ULONG nPropertiesGotten = 0; - cpPropBag2->GetPropertyInfo(0, nProperties, pProperties, &nPropertiesGotten); - for (ULONG i = 0; i < nPropertiesGotten; i++) - { - if (pProperties[i].vt == VT_BSTR) - { - USES_CONVERSION; - CComVariant v; - HRESULT hrRead; - cpPropBag2->Read(1, &pProperties[i], NULL, &v, &hrRead); - AddPluginParam(OLE2A(pProperties[i].pstrName), OLE2A(v.bstrVal)); - } - if (pProperties[i].pstrName) - { - CoTaskMemFree(pProperties[i].pstrName); - } - } - free(pProperties); - } - } - return IPersistPropertyBagImpl::Load(pPropBag, pErrorLog); -} - -/////////////////////////////////////////////////////////////////////////////// -// IMozPluginHostCtrl - -STDMETHODIMP nsPluginHostCtrl::get_PluginContentType(BSTR *pVal) -{ - return GetPluginContentType(pVal); -} - -STDMETHODIMP nsPluginHostCtrl::put_PluginContentType(BSTR newVal) -{ - return SetPluginContentType(newVal); -} - -STDMETHODIMP nsPluginHostCtrl::get_PluginSource(BSTR *pVal) -{ - return GetPluginSource(pVal); -} - -STDMETHODIMP nsPluginHostCtrl::put_PluginSource(BSTR newVal) -{ - return SetPluginSource(newVal); -} - -STDMETHODIMP nsPluginHostCtrl::get_PluginsPage(BSTR *pVal) -{ - return GetPluginsPage(pVal); -} - -STDMETHODIMP nsPluginHostCtrl::put_PluginsPage(BSTR newVal) -{ - return SetPluginsPage(newVal); -} diff --git a/embedding/browser/activex/src/pluginhostctrl/nsPluginHostCtrl.h b/embedding/browser/activex/src/pluginhostctrl/nsPluginHostCtrl.h deleted file mode 100644 index 5ba7eb4ef87..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/nsPluginHostCtrl.h +++ /dev/null @@ -1,169 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 ***** */ - -// nsPluginHostCtrl.h : Declaration of the nsPluginHostCtrl - -#ifndef __PLUGINHOSTCTRL_H_ -#define __PLUGINHOSTCTRL_H_ - -#include "resource.h" // main symbols -#include - -#include "nsPluginHostWnd.h" -#include "nsPluginWnd.h" - -///////////////////////////////////////////////////////////////////////////// -// nsPluginHostCtrl -class ATL_NO_VTABLE nsPluginHostCtrl : - public CComObjectRootEx, - public CStockPropImpl, - public CComControl, - public IPersistStreamInitImpl, - public IOleControlImpl, - public IOleObjectImpl, - public IOleInPlaceActiveObjectImpl, - public IViewObjectExImpl, - public IOleInPlaceObjectWindowlessImpl, - public ISupportErrorInfo, - public IConnectionPointContainerImpl, - public IPersistStorageImpl, - public IPersistPropertyBagImpl, - public ISpecifyPropertyPagesImpl, - public IQuickActivateImpl, - public IDataObjectImpl, - public IProvideClassInfo2Impl<&CLSID_MozPluginHostCtrl, &DIID__IMozPluginHostCtrlEvents, &LIBID_PLUGINHOSTCTRLLib>, - public IPropertyNotifySinkCP, - public CComCoClass -{ -protected: - virtual ~nsPluginHostCtrl(); - -public: - nsPluginHostCtrl(); - -DECLARE_REGISTRY_RESOURCEID(IDR_PLUGINHOSTCTRL) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(nsPluginHostCtrl) - COM_INTERFACE_ENTRY(IMozPluginHostCtrl) - COM_INTERFACE_ENTRY2(IDispatch, IMozPluginHostCtrl) - COM_INTERFACE_ENTRY(IViewObjectEx) - COM_INTERFACE_ENTRY(IViewObject2) - COM_INTERFACE_ENTRY(IViewObject) - COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) - COM_INTERFACE_ENTRY(IOleInPlaceObject) - COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless) - COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) - COM_INTERFACE_ENTRY(IOleControl) - COM_INTERFACE_ENTRY(IOleObject) - COM_INTERFACE_ENTRY(IPersistStreamInit) - COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit) - COM_INTERFACE_ENTRY(IPersistPropertyBag) - COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY(IConnectionPointContainer) -// COM_INTERFACE_ENTRY(ISpecifyPropertyPages) - COM_INTERFACE_ENTRY(IQuickActivate) - COM_INTERFACE_ENTRY(IPersistStorage) - COM_INTERFACE_ENTRY(IDataObject) - COM_INTERFACE_ENTRY(IProvideClassInfo) - COM_INTERFACE_ENTRY(IProvideClassInfo2) -END_COM_MAP() - -BEGIN_PROP_MAP(nsPluginHostCtrl) - PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4) - PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4) - PROP_ENTRY("HWND", DISPID_HWND, CLSID_NULL) - PROP_ENTRY("Text", DISPID_TEXT, CLSID_NULL) - // Mozilla plugin host control properties - PROP_ENTRY("type", 1, CLSID_NULL) - PROP_ENTRY("src", 2, CLSID_NULL) - PROP_ENTRY("pluginspage", 3, CLSID_NULL) - // Example entries - // PROP_ENTRY("Property Description", dispid, clsid) - // PROP_PAGE(CLSID_StockColorPage) -END_PROP_MAP() - -BEGIN_CONNECTION_POINT_MAP(nsPluginHostCtrl) - CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink) -END_CONNECTION_POINT_MAP() - -BEGIN_MSG_MAP(nsPluginHostWnd) - CHAIN_MSG_MAP(nsPluginHostWnd) -END_MSG_MAP() - - -// Handler prototypes: -// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); -// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); -// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); - -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) - { - static const IID* arr[] = - { - &IID_IMozPluginHostCtrl, - }; - for (int i=0; i - * - * 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 "stdafx.h" - -#include "nsPluginHostWnd.h" - -#include "nsURLDataCallback.h" - -#include "npn.h" - -#define NS_4XPLUGIN_CALLBACK(_type, _name) _type (__stdcall * _name) - -typedef NS_4XPLUGIN_CALLBACK(NPError, NP_GETENTRYPOINTS) (NPPluginFuncs* pCallbacks); -typedef NS_4XPLUGIN_CALLBACK(NPError, NP_PLUGININIT) (const NPNetscapeFuncs* pCallbacks); -typedef NS_4XPLUGIN_CALLBACK(NPError, NP_PLUGINSHUTDOWN) (void); - -const kArraySizeIncrement = 10; - -nsSimpleArray nsPluginHostWnd::m_LoadedPlugins; - -nsPluginHostWnd::nsPluginHostWnd() : - m_bPluginIsAlive(false), - m_bCreatePluginFromStreamData(false), - m_bPluginIsWindowless(false), - m_bPluginIsTransparent(false), - m_pLoadedPlugin(NULL), - m_nArgs(0), - m_nArgsMax(0), - m_pszArgNames(NULL), - m_pszArgValues(NULL) -{ - InitPluginCallbacks(); - memset(&m_NPPFuncs, 0, sizeof(m_NPPFuncs)); -} - -nsPluginHostWnd::~nsPluginHostWnd() -{ -} - -LRESULT nsPluginHostWnd::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -{ - SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) | WS_CLIPCHILDREN); - - // Load a list of plugins - CreatePluginList( - PLUGINS_FROM_IE | PLUGINS_FROM_NS4X | - PLUGINS_FROM_FIREFOX | PLUGINS_FROM_MOZILLA); - - HRESULT hr = E_FAIL; - if (m_bstrContentType.Length() == 0 && - m_bstrSource.Length() != 0) - { - USES_CONVERSION; - // Do a late instantiation of the plugin based on the content type of - // the stream data. - m_bCreatePluginFromStreamData = true; - hr = OpenURLStream(OLE2T(m_bstrSource), NULL, NULL, 0); - } - else - { - // Create a plugin based upon the specified content type property - USES_CONVERSION; - hr = LoadPluginByContentType(OLE2T(m_bstrContentType)); - if (SUCCEEDED(hr)) - { - hr = CreatePluginInstance(); - if (m_bstrSource.Length()) - { - OpenURLStream(OLE2T(m_bstrSource), NULL, NULL, 0); - } - } - } - - return SUCCEEDED(hr) ? 0 : -1; -} - -LRESULT nsPluginHostWnd::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -{ - DestroyPluginInstance(); - UnloadPlugin(); - CleanupPluginList(); - return 0; -} - -LRESULT nsPluginHostWnd::OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -{ - SizeToFitPluginInstance(); - return 0; -} - -LRESULT nsPluginHostWnd::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - PAINTSTRUCT ps; - HDC hdc = BeginPaint(&ps); - - RECT rc; - GetClientRect(&rc); - - if (m_bPluginIsWindowless && m_NPPFuncs.event) - { - if (this->m_bPluginIsTransparent) - { - int x = 0; - const int inc = 20; - for (int i = rc.left; i < rc.right; i += inc) - { - const COLORREF c1 = RGB(255, 120, 120); - const COLORREF c2 = RGB(120, 120, 255); - RECT rcStrip = rc; - HBRUSH hbr = CreateSolidBrush(x % 2 ? c1 : c2); - rcStrip.left = i; - rcStrip.right = i + inc; - FillRect(hdc, &rcStrip, hbr); - DeleteObject(hbr); - x++; - } - } - else - { - FillRect(hdc, &rc, (HBRUSH) GetStockObject(GRAY_BRUSH)); - } - - m_NPWindow.type = NPWindowTypeDrawable; - m_NPWindow.window = hdc; - m_NPWindow.x = 0; - m_NPWindow.y = 0; - m_NPWindow.width = rc.right - rc.left; - m_NPWindow.height = rc.bottom - rc.top; - m_NPWindow.clipRect.left = 0; - m_NPWindow.clipRect.top = 0; - m_NPWindow.clipRect.right = m_NPWindow.width; - m_NPWindow.clipRect.bottom = m_NPWindow.height; - - if (m_NPPFuncs.setwindow) - { - NPError npres = m_NPPFuncs.setwindow(&m_NPP, &m_NPWindow); - } - - NPRect paintRect; - paintRect.left = rc.left; - paintRect.top = rc.top; - paintRect.right = rc.right; - paintRect.bottom = rc.bottom; - - NPEvent evt; - evt.event = WM_PAINT; - evt.wParam = wParam; - evt.lParam = (LPARAM) &paintRect; - m_NPPFuncs.event(&m_NPP, &evt); - } - else - { - FillRect(hdc, &rc, (HBRUSH) GetStockObject(GRAY_BRUSH)); - } - - EndPaint(&ps); - - return 0; -} - -LRESULT nsPluginHostWnd::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) -{ - if (m_bPluginIsWindowless && m_NPPFuncs.event) - { - NPEvent evt; - evt.event = uMsg; - evt.wParam = wParam; - evt.lParam = lParam; - m_NPPFuncs.event(&m_NPP, &evt); - } - return 0; -} - -LRESULT nsPluginHostWnd::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) -{ - if (m_bPluginIsWindowless && m_NPPFuncs.event) - { - NPEvent evt; - evt.event = uMsg; - evt.wParam = wParam; - evt.lParam = lParam; - m_NPPFuncs.event(&m_NPP, &evt); - } - return 0; -} - -LRESULT nsPluginHostWnd::OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) -{ - if (m_bPluginIsWindowless && m_NPPFuncs.event) - { - NPEvent evt; - evt.event = uMsg; - evt.wParam = wParam; - evt.lParam = lParam; - m_NPPFuncs.event(&m_NPP, &evt); - } - return 0; -} - - -/////////////////////////////////////////////////////////////////////////////// - -NPNetscapeFuncs nsPluginHostWnd::g_NPNFuncs; - -HRESULT nsPluginHostWnd::InitPluginCallbacks() -{ - static BOOL gCallbacksSet = FALSE; - if (gCallbacksSet) - { - return S_OK; - } - - gCallbacksSet = TRUE; - - memset(&g_NPNFuncs, 0, sizeof(g_NPNFuncs)); - g_NPNFuncs.size = sizeof(g_NPNFuncs); - g_NPNFuncs.version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR; - - g_NPNFuncs.geturl = NewNPN_GetURLProc(NPN_GetURL); - g_NPNFuncs.posturl = NewNPN_PostURLProc(NPN_PostURL); - g_NPNFuncs.requestread = NewNPN_RequestReadProc(NPN_RequestRead); - g_NPNFuncs.newstream = NewNPN_NewStreamProc(NPN_NewStream); - g_NPNFuncs.write = NewNPN_WriteProc(NPN_Write); - g_NPNFuncs.destroystream = NewNPN_DestroyStreamProc(NPN_DestroyStream); - g_NPNFuncs.status = NewNPN_StatusProc(NPN_Status); - g_NPNFuncs.uagent = NewNPN_UserAgentProc(NPN_UserAgent); - g_NPNFuncs.memalloc = NewNPN_MemAllocProc(NPN_MemAlloc); - g_NPNFuncs.memfree = NewNPN_MemFreeProc(NPN_MemFree); - g_NPNFuncs.memflush = NewNPN_MemFlushProc(NPN_MemFlush); - g_NPNFuncs.reloadplugins = NewNPN_ReloadPluginsProc(NPN_ReloadPlugins); - g_NPNFuncs.getJavaEnv = NewNPN_GetJavaEnvProc(NPN_GetJavaEnv); - g_NPNFuncs.getJavaPeer = NewNPN_GetJavaPeerProc(NPN_GetJavaPeer); - g_NPNFuncs.geturlnotify = NewNPN_GetURLNotifyProc(NPN_GetURLNotify); - g_NPNFuncs.posturlnotify = NewNPN_PostURLNotifyProc(NPN_PostURLNotify); - g_NPNFuncs.getvalue = NewNPN_GetValueProc(NPN_GetValue); - g_NPNFuncs.setvalue = NewNPN_SetValueProc(NPN_SetValue); - g_NPNFuncs.invalidaterect = NewNPN_InvalidateRectProc(NPN_InvalidateRect); - g_NPNFuncs.invalidateregion = NewNPN_InvalidateRegionProc(NPN_InvalidateRegion); - g_NPNFuncs.forceredraw = NewNPN_ForceRedrawProc(NPN_ForceRedraw); - - return S_OK; -} - -HRESULT nsPluginHostWnd::GetWebBrowserApp(IWebBrowserApp **pBrowser) -{ - // Override this method if there is a way to get this iface - ATLASSERT(pBrowser); - if (!pBrowser) - { - return E_INVALIDARG; - } - *pBrowser = NULL; - return S_OK; -} - -void nsPluginHostWnd::SetPluginWindowless(bool bWindowless) -{ - m_bPluginIsWindowless = bWindowless; -} - -void nsPluginHostWnd::SetPluginTransparent(bool bTransparent) -{ - m_bPluginIsTransparent = bTransparent; -} - -HRESULT nsPluginHostWnd::GetBaseURL(TCHAR **ppszBaseURL) -{ - ATLASSERT(ppszBaseURL); - *ppszBaseURL = NULL; - - CComPtr cpWebBrowser; - GetWebBrowserApp(&cpWebBrowser); - if (!cpWebBrowser) - { - return E_FAIL; - } - - USES_CONVERSION; - CComBSTR bstrURL; - cpWebBrowser->get_LocationURL(&bstrURL); - - DWORD cbBaseURL = (bstrURL.Length() + 1) * sizeof(WCHAR); - DWORD cbBaseURLUsed = 0; - WCHAR *pszBaseURL = (WCHAR *) malloc(cbBaseURL); - ATLASSERT(pszBaseURL); - - CoInternetParseUrl( - bstrURL.m_str, - PARSE_ROOTDOCUMENT, - 0, - pszBaseURL, - cbBaseURL, - &cbBaseURLUsed, - 0); - - *ppszBaseURL = _tcsdup(W2T(pszBaseURL)); - free(pszBaseURL); - - return S_OK; -} - -HRESULT nsPluginHostWnd::LoadPluginByContentType(const TCHAR *pszContentType) -{ - TCHAR * pszPluginPath = NULL; - - // Set the content type - USES_CONVERSION; - SetPluginContentType(T2OLE(pszContentType)); - - // Search for a plugin that can handle this content - HRESULT hr = FindPluginPathByContentType(pszContentType, &pszPluginPath); - if (FAILED(hr)) - { - // Try the default 'catch-all' plugin - hr = FindPluginPathByContentType(_T("*"), &pszPluginPath); - if (FAILED(hr)) - { - return hr; - } - } - - hr = LoadPlugin(pszPluginPath); - free(pszPluginPath); - - return hr; -} - - - -HRESULT nsPluginHostWnd::GetPluginContentType(BSTR *pVal) -{ - if (!pVal) - { - return E_INVALIDARG; - } - *pVal = m_bstrContentType.Copy(); - return S_OK; -} - -HRESULT nsPluginHostWnd::SetPluginContentType(BSTR newVal) -{ - // Security. Copying the source BSTR this way ensures that embedded NULL - // characters do not end up in the destination BSTR. SysAllocString will - // create a copy truncated at the first NULL char. - m_bstrContentType.Empty(); - m_bstrContentType.Attach(SysAllocString(newVal)); - return S_OK; -} - -HRESULT nsPluginHostWnd::GetPluginSource(BSTR *pVal) -{ - if (!pVal) - { - return E_INVALIDARG; - } - *pVal = m_bstrSource.Copy(); - return S_OK; -} - -HRESULT nsPluginHostWnd::SetPluginSource(BSTR newVal) -{ - // Security. Copying the source BSTR this way ensures that embedded NULL - // characters do not end up in the destination BSTR. SysAllocString will - // create a copy truncated at the first NULL char. - m_bstrSource.Empty(); - m_bstrSource.Attach(SysAllocString(newVal)); - return S_OK; -} - -HRESULT nsPluginHostWnd::GetPluginsPage(BSTR *pVal) -{ - if (!pVal) - { - return E_INVALIDARG; - } - *pVal = m_bstrPluginsPage.Copy(); - return S_OK; -} - -HRESULT nsPluginHostWnd::SetPluginsPage(BSTR newVal) -{ - // Security. Copying the source BSTR this way ensures that embedded NULL - // characters do not end up in the destination BSTR. SysAllocString will - // create a copy truncated at the first NULL char. - m_bstrPluginsPage.Empty(); - m_bstrPluginsPage.Attach(SysAllocString(newVal)); - return S_OK; -} - -HRESULT nsPluginHostWnd::ReadPluginsFromGeckoAppPath(const TCHAR *szAppName) -{ - const TCHAR szGeneralKey[] = _T("SOFTWARE\\Mozilla\\"); - const size_t nGeneralKeyLen = sizeof(szGeneralKey) / sizeof(TCHAR); - - const size_t nMainKeyLen = nGeneralKeyLen + _tcslen(szAppName); - - TCHAR *szMainKey = new TCHAR[nMainKeyLen]; - memset(szMainKey, 0, nMainKeyLen * sizeof(TCHAR)); - _tcscpy(szMainKey, szGeneralKey); - _tcscat(szMainKey, szAppName); - - CRegKey keyGeneral; - if (keyGeneral.Open(HKEY_LOCAL_MACHINE, szMainKey, KEY_READ) == ERROR_SUCCESS) - { - // First find the Current Version - TCHAR szVersion[64]; - const size_t nVersionLen = sizeof(szVersion) / sizeof(szVersion[0]); - memset(szVersion, 0, sizeof(szVersion)); - - DWORD nVersion = nVersionLen; - keyGeneral.QueryStringValue(_T("CurrentVersion"), szVersion, &nVersion); - if (nVersion > 0) - { - TCHAR *szBracket = _tcschr(szVersion, TCHAR('(')); - if (szBracket) - { - while (szBracket >= szVersion) - { - if (*szBracket == TCHAR(' ') || *szBracket == TCHAR('(')) - { - *szBracket = TCHAR('\0'); - szBracket--; - } - else - break; - } - } - nVersion = _tcslen(szVersion); - - TCHAR *szKey = new TCHAR[nMainKeyLen + nVersion + 32]; - _tcscpy(szKey, szMainKey); - _tcscat(szKey, _T(" ")); - _tcscat(szKey, szVersion); - _tcscat(szKey, _T("\\Extensions")); - - CRegKey key; - if (key.Open(HKEY_LOCAL_MACHINE, szKey, KEY_READ) == ERROR_SUCCESS) - { - TCHAR szPluginsDir[_MAX_PATH]; - memset(szPluginsDir, 0, sizeof(szPluginsDir)); - DWORD nPluginsDir = sizeof(szPluginsDir) / sizeof(szPluginsDir[0]); - key.QueryStringValue(_T("Plugins"), szPluginsDir, &nPluginsDir); - if (szPluginsDir[0]) - { - CreatePluginListFrom(szPluginsDir); - } - } - delete []szKey; - } - } - delete []szMainKey; - return S_OK; -} - -HRESULT nsPluginHostWnd::CreatePluginList(unsigned long ulFlags) -{ - // This function trawls through the plugin directory and builds a list - // of plugins and what MIME types each plugin handles. - - CleanupPluginList(); - - // Firefox - if (ulFlags & PLUGINS_FROM_FIREFOX) - { - ReadPluginsFromGeckoAppPath(_T("Mozilla Firefox")); - } - - // Mozilla - if (ulFlags & PLUGINS_FROM_MOZILLA) - { - ReadPluginsFromGeckoAppPath(_T("Mozilla")); - } - - // Try and obtain a path to the plugins in Netscape 4.x - if (ulFlags & PLUGINS_FROM_NS4X) - { - TCHAR szPluginsDir[_MAX_PATH]; - memset(szPluginsDir, 0, sizeof(szPluginsDir)); - - CRegKey keyNS; - const TCHAR *kNav4xKey = _T("Software\\Netscape\\Netscape Navigator"); - if (keyNS.Open(HKEY_LOCAL_MACHINE, kNav4xKey, KEY_READ) == ERROR_SUCCESS) - { - TCHAR szVersion[10]; - DWORD nVersion = sizeof(szVersion) / sizeof(szVersion[0]); - keyNS.QueryValue(szVersion, _T("CurrentVersion"), &nVersion); - - CRegKey keyVersion; - if (keyVersion.Open(keyNS, szVersion, KEY_READ) == ERROR_SUCCESS) - { - CRegKey keyMain; - if (keyMain.Open(keyVersion, _T("Main"), KEY_READ) == ERROR_SUCCESS) - { - DWORD nPluginsDir = sizeof(szPluginsDir) / sizeof(szPluginsDir[0]); - keyMain.QueryValue(szPluginsDir, _T("Plugins Directory"), &nPluginsDir); - keyMain.Close(); - } - keyVersion.Close(); - } - keyNS.Close(); - } - if (szPluginsDir[0]) - { - CreatePluginListFrom(szPluginsDir); - } - } - - // Try and obtain a path to the plugins in Internet Explorer - if (ulFlags & PLUGINS_FROM_IE) - { - TCHAR szPluginsDir[_MAX_PATH]; - memset(szPluginsDir, 0, sizeof(szPluginsDir)); - - CRegKey keyIE; - const TCHAR *kIEKey = _T("Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE"); - if (keyIE.Open(HKEY_LOCAL_MACHINE, kIEKey, KEY_READ) == ERROR_SUCCESS) - { - DWORD nPluginsDir = sizeof(szPluginsDir) / sizeof(szPluginsDir[0]); - keyIE.QueryValue(szPluginsDir, _T("Path"), &nPluginsDir); - - TCHAR *szSemiColon = _tcschr(szPluginsDir, _TCHAR(';')); - if (szSemiColon) - { - *szSemiColon = _TCHAR('\0'); - } - - ULONG nLen = _tcslen(szPluginsDir); - if (nLen > 0 && szPluginsDir[nLen - 1] == _TCHAR('\\')) - { - szPluginsDir[nLen - 1] = _TCHAR('\0'); - } - _tcscat(szPluginsDir, _T("\\Plugins")); - - keyIE.Close(); - } - if (szPluginsDir[0]) - { - CreatePluginListFrom(szPluginsDir); - } - } - - return S_OK; -} - -HRESULT nsPluginHostWnd::CreatePluginListFrom(const TCHAR *szPluginsDir) -{ - HANDLE hFind; - WIN32_FIND_DATA finddata; - - // Change to the plugin directory - TCHAR szCurrentDir[MAX_PATH + 1]; - GetCurrentDirectory(sizeof(szCurrentDir) / sizeof(szCurrentDir[0]), szCurrentDir); - SetCurrentDirectory(szPluginsDir); - - // Search for files matching the "np*dll" pattern - hFind = FindFirstFile(_T("np*dll"), &finddata); - if (hFind != INVALID_HANDLE_VALUE) - { - do { - PluginInfo *pInfo = new PluginInfo; - if (!pInfo) - { - CleanupPluginList(); - SetCurrentDirectory(szCurrentDir); - return E_OUTOFMEMORY; - } - if (SUCCEEDED(GetPluginInfo(finddata.cFileName, pInfo))) - { - pInfo->szPluginName = _tcsdup(finddata.cFileName); - pInfo->szPluginPath = _tcsdup(szPluginsDir); - m_Plugins.AppendElement(pInfo); - } - else - { - ATLTRACE(_T("Error: Cannot plugin info for \"%s\".\n"), finddata.cFileName); - delete pInfo; - } - } while (FindNextFile(hFind, &finddata)); - FindClose(hFind); - } - - SetCurrentDirectory(szCurrentDir); - - return S_OK; -} - - -HRESULT nsPluginHostWnd::CleanupPluginList() -{ - // Free the memory used by the plugin info list - for (unsigned long i = 0; i < m_Plugins.Count(); i++) - { - PluginInfo *pI = m_Plugins[i]; - if (pI->szMIMEType) - free(pI->szMIMEType); - if (pI->szPluginName) - free(pI->szPluginName); - if (pI->szPluginPath) - free(pI->szPluginPath); - free(pI); - } - m_Plugins.Empty(); - return S_OK; -} - - -HRESULT nsPluginHostWnd::GetPluginInfo(const TCHAR *pszPluginPath, PluginInfo *pInfo) -{ - // Get the version info from the plugin - USES_CONVERSION; - DWORD nVersionInfoSize; - DWORD nZero = 0; - void *pVersionInfo = NULL; - nVersionInfoSize = GetFileVersionInfoSize((TCHAR *)pszPluginPath, &nZero); - if (nVersionInfoSize) - { - pVersionInfo = malloc(nVersionInfoSize); - } - if (!pVersionInfo) - { - return E_OUTOFMEMORY; - } - - GetFileVersionInfo((TCHAR *)pszPluginPath, NULL, nVersionInfoSize, pVersionInfo); - - // Extract the MIMEType info - TCHAR *szValue = NULL; - UINT nValueLength = 0; - if (!VerQueryValue(pVersionInfo, - _T("\\StringFileInfo\\040904E4\\MIMEType"), - (void **) &szValue, &nValueLength)) - { - return E_FAIL; - } - - if (pInfo) - { - pInfo->szMIMEType = _tcsdup(szValue); - } - - free(pVersionInfo); - - return S_OK; -} - -HRESULT nsPluginHostWnd::FindPluginPathByContentType(const TCHAR *pszContentType, TCHAR **ppszPluginPath) -{ - *ppszPluginPath = NULL; - - if (pszContentType == NULL) - { - return E_FAIL; - } - - // Search the list of plugins for one that will handle the content type - TCHAR szPluginPath[_MAX_PATH + 1]; - unsigned long nContentType = _tcslen(pszContentType); - for (unsigned long i = 0; i < m_Plugins.Count(); i++) - { - PluginInfo *pI = m_Plugins[i]; - if (pI->szMIMEType) - { - TCHAR *pszMIMEType = pI->szMIMEType; - do { - if (_tcsncmp(pszContentType, pszMIMEType, nContentType) == 0) - { - // Found a match - _tmakepath(szPluginPath, NULL, - pI->szPluginPath, pI->szPluginName, NULL); - *ppszPluginPath = _tcsdup(szPluginPath); - return S_OK; - } - // Check the other types the plugin handles - pszMIMEType = _tcschr(pszMIMEType, TCHAR('|')); - if (pszMIMEType) - { - pszMIMEType++; - } - } while (pszMIMEType && *pszMIMEType); - } - } - - return E_FAIL; -} - -HRESULT nsPluginHostWnd::LoadPlugin(const TCHAR *szPluginPath) -{ - ATLASSERT(m_pLoadedPlugin == NULL); - if (m_pLoadedPlugin) - { - return E_UNEXPECTED; - } - - // TODO critical section - - // Test if the plugin has already been loaded - for (unsigned long i = 0; i < m_LoadedPlugins.Count(); i++) - { - if (_tcscmp(m_LoadedPlugins[i]->szFullPath, szPluginPath) == 0) - { - m_pLoadedPlugin = m_LoadedPlugins[i]; - memcpy(&m_NPPFuncs, &m_pLoadedPlugin->NPPFuncs, sizeof(m_NPPFuncs)); - m_pLoadedPlugin->nRefCount++; - return S_OK; - } - } - - // Plugin library is being loaded for the first time so initialise it - // and store an entry in the loaded plugins array. - - HINSTANCE hInstance = LoadLibrary(szPluginPath); - if (!hInstance) - { - return E_FAIL; - } - - m_pLoadedPlugin = new LoadedPluginInfo; - if (!m_pLoadedPlugin) - { - ATLASSERT(m_pLoadedPlugin); - return E_OUTOFMEMORY; - } - - // Get the plugin function entry points - NP_GETENTRYPOINTS pfnGetEntryPoints = - (NP_GETENTRYPOINTS) GetProcAddress(hInstance, "NP_GetEntryPoints"); - if (pfnGetEntryPoints) - { - pfnGetEntryPoints(&m_NPPFuncs); - } - - // Tell the plugin to initialize itself - NP_PLUGININIT pfnInitialize = (NP_PLUGININIT) - GetProcAddress(hInstance, "NP_Initialize"); - if (!pfnInitialize) - { - pfnInitialize = (NP_PLUGININIT) - GetProcAddress(hInstance, "NP_PluginInit"); - } - if (pfnInitialize) - { - pfnInitialize(&g_NPNFuncs); - } - - // Create a new entry for the plugin - m_pLoadedPlugin->szFullPath = _tcsdup(szPluginPath); - m_pLoadedPlugin->nRefCount = 1; - m_pLoadedPlugin->hInstance = hInstance; - memcpy(&m_pLoadedPlugin->NPPFuncs, &m_NPPFuncs, sizeof(m_NPPFuncs)); - - // Add it to the array - m_LoadedPlugins.AppendElement(m_pLoadedPlugin); - - return S_OK; -} - -HRESULT nsPluginHostWnd::UnloadPlugin() -{ - if (!m_pLoadedPlugin) - { - return E_FAIL; - } - - // TODO critical section - - ATLASSERT(m_pLoadedPlugin->nRefCount > 0); - if (m_pLoadedPlugin->nRefCount == 1) - { - NP_PLUGINSHUTDOWN pfnShutdown = (NP_PLUGINSHUTDOWN) - GetProcAddress( - m_pLoadedPlugin->hInstance, - "NP_Shutdown"); - if (pfnShutdown) - { - pfnShutdown(); - } - FreeLibrary(m_pLoadedPlugin->hInstance); - - // Delete the entry from the array - m_LoadedPlugins.RemoveElement(m_pLoadedPlugin); - free(m_pLoadedPlugin->szFullPath); - delete m_pLoadedPlugin; - } - else - { - m_pLoadedPlugin->nRefCount--; - } - - m_pLoadedPlugin = NULL; - - return S_OK; -} - - -HRESULT nsPluginHostWnd::AddPluginParam(const char *szName, const char *szValue) -{ - ATLASSERT(szName); - ATLASSERT(szValue); - if (!szName || !szValue) - { - return E_INVALIDARG; - } - - // Skip params that already there - for (unsigned long i = 0; i < m_nArgs; i++) - { - if (stricmp(szName, m_pszArgNames[i]) == 0) - { - return S_OK; - } - } - - // Add the value - if (!m_pszArgNames) - { - ATLASSERT(!m_pszArgValues); - m_nArgsMax = kArraySizeIncrement; - m_pszArgNames = (char **) malloc(sizeof(char *) * m_nArgsMax); - m_pszArgValues = (char **) malloc(sizeof(char *) * m_nArgsMax); - } - else if (m_nArgs == m_nArgsMax) - { - m_nArgsMax += kArraySizeIncrement; - m_pszArgNames = (char **) realloc(m_pszArgNames, sizeof(char *) * m_nArgsMax); - m_pszArgValues = (char **) realloc(m_pszArgValues, sizeof(char *) * m_nArgsMax); - } - if (!m_pszArgNames || !m_pszArgValues) - { - return E_OUTOFMEMORY; - } - - m_pszArgNames[m_nArgs] = strdup(szName); - m_pszArgValues[m_nArgs] = strdup(szValue); - - m_nArgs++; - - return S_OK; -} - - -HRESULT nsPluginHostWnd::CreatePluginInstance() -{ - m_NPP.pdata = NULL; - m_NPP.ndata = this; - - USES_CONVERSION; - char *szContentType = strdup(OLE2A(m_bstrContentType.m_str)); - - // Create a child window to house the plugin - RECT rc; - GetClientRect(&rc); -// m_wndPlugin.Create(m_hWnd, rc, NULL, WS_CHILD | WS_VISIBLE); - -// m_NPWindow.window = (void *) m_wndPlugin.m_hWnd; - m_NPWindow.window = (void *) m_hWnd; - m_NPWindow.type = NPWindowTypeWindow; - - if (m_NPPFuncs.newp) - { - // Create the arguments to be fed into the plugin - if (m_bstrSource.m_str) - { - AddPluginParam("SRC", OLE2A(m_bstrSource.m_str)); - } - if (m_bstrContentType.m_str) - { - AddPluginParam("TYPE", OLE2A(m_bstrContentType.m_str)); - } - if (m_bstrPluginsPage.m_str) - { - AddPluginParam("PLUGINSPAGE", OLE2A(m_bstrPluginsPage.m_str)); - } - char szTmp[50]; - sprintf(szTmp, "%d", (int) (rc.right - rc.left)); - AddPluginParam("WIDTH", szTmp); - sprintf(szTmp, "%d", (int) (rc.bottom - rc.top)); - AddPluginParam("HEIGHT", szTmp); - - NPSavedData *pSaved = NULL; - - // Create the plugin instance - NPError npres = m_NPPFuncs.newp(szContentType, &m_NPP, NP_EMBED, - (short) m_nArgs, m_pszArgNames, m_pszArgValues, pSaved); - - if (npres != NPERR_NO_ERROR) - { - return E_FAIL; - } - } - - m_bPluginIsAlive = true; - - SizeToFitPluginInstance(); - - return S_OK; -} - -HRESULT nsPluginHostWnd::DestroyPluginInstance() -{ - if (!m_bPluginIsAlive) - { - return S_OK; - } - - // Destroy the plugin - if (m_NPPFuncs.destroy) - { - NPSavedData *pSavedData = NULL; - NPError npres = m_NPPFuncs.destroy(&m_NPP, &pSavedData); - - // TODO could store saved data instead of just deleting it. - if (pSavedData && pSavedData->buf) - { - NPN_MemFree(pSavedData->buf); - } - } - - // Destroy the arguments - if (m_pszArgNames) - { - for (unsigned long i = 0; i < m_nArgs; i++) - { - free(m_pszArgNames[i]); - } - free(m_pszArgNames); - m_pszArgNames = NULL; - } - if (m_pszArgValues) - { - for (unsigned long i = 0; i < m_nArgs; i++) - { - free(m_pszArgValues[i]); - } - free(m_pszArgValues); - m_pszArgValues = NULL; - } - - //m_wndPlugin.DestroyWindow(); - - m_bPluginIsAlive = false; - - return S_OK; -} - -HRESULT nsPluginHostWnd::SizeToFitPluginInstance() -{ - if (!m_bPluginIsAlive) - { - return S_OK; - } - - // Resize the plugin to fit the window - - RECT rc; - GetClientRect(&rc); - - //m_wndPlugin.SetWindowPos(HWND_TOP, - // rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, - // SWP_NOZORDER); - - m_NPWindow.x = 0; - m_NPWindow.y = 0; - m_NPWindow.width = rc.right - rc.left; - m_NPWindow.height = rc.bottom - rc.top; - m_NPWindow.clipRect.left = 0; - m_NPWindow.clipRect.top = 0; - m_NPWindow.clipRect.right = m_NPWindow.width; - m_NPWindow.clipRect.bottom = m_NPWindow.height; - - if (m_NPPFuncs.setwindow) - { - NPError npres = m_NPPFuncs.setwindow(&m_NPP, &m_NPWindow); - } - - return S_OK; -} - -HRESULT nsPluginHostWnd::OpenURLStream(const TCHAR *szURL, void *pNotifyData, const void *pPostData, unsigned long nPostDataLength) -{ - nsURLDataCallback::OpenURL(this, szURL, pNotifyData, pPostData, nPostDataLength); - return S_OK; -} diff --git a/embedding/browser/activex/src/pluginhostctrl/nsPluginHostWnd.h b/embedding/browser/activex/src/pluginhostctrl/nsPluginHostWnd.h deleted file mode 100644 index 69049f57281..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/nsPluginHostWnd.h +++ /dev/null @@ -1,263 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 ***** */ -#ifndef PLUGINHOSTWND_H -#define PLUGINHOSTWND_H - -#include "nsPluginWnd.h" - -class nsURLDataCallback; - -template -class nsSimpleArray -{ - Entry *m_pData; - unsigned long m_nSize; - unsigned long m_nMaxSize; - unsigned long m_nExpandArrayBy; -public: - nsSimpleArray(unsigned long nExpandArrayBy = 10) : - m_pData(NULL), - m_nSize(0), - m_nMaxSize(0), - m_nExpandArrayBy(nExpandArrayBy) - { - } - - virtual ~nsSimpleArray() - { - Empty(); - } - - Entry ElementAt(unsigned long aIndex) const - { - ATLASSERT(aIndex < m_nSize); - return m_pData[aIndex]; - } - - Entry operator[](unsigned long aIndex) const - { - return ElementAt(aIndex); - } - - void AppendElement(Entry entry) - { - if (!m_pData) - { - m_nMaxSize = m_nExpandArrayBy; - m_pData = (Entry *) malloc(sizeof(Entry) * m_nMaxSize); - } - else if (m_nSize == m_nMaxSize) - { - m_nMaxSize += m_nExpandArrayBy; - m_pData = (Entry *) realloc(m_pData, sizeof(Entry) * m_nMaxSize); - } - ATLASSERT(m_pData); - if (m_pData) - { - m_pData[m_nSize++] = entry; - } - } - - void RemoveElementAt(unsigned long nIndex) - { - ATLASSERT(aIndex < m_nSize); - if (nIndex < m_nSize) - { - m_nSize--; - if (m_nSize > 0) - { - m_pData[nIndex] = m_pData[m_nSize - 1]; - m_nSize--; - } - } - } - - void RemoveElement(Entry entry) - { - unsigned long i = 0; - while (i < m_nSize) - { - if (m_pData[i] == entry) - { - m_nSize--; - if (m_nSize > 0) - { - m_pData[i] = m_pData[m_nSize - 1]; - m_nSize--; - } - continue; - } - i++; - } - } - - void Empty() - { - if (m_pData) - { - free(m_pData); - m_pData = NULL; - m_nSize = m_nMaxSize = 0; - } - } - BOOL IsEmpty() const { return m_nSize == 0 ? TRUE : FALSE; } - unsigned long Count() const { return m_nSize; } -}; - - -#define PLUGINS_FROM_IE 0x1 -#define PLUGINS_FROM_NS4X 0x2 -#define PLUGINS_FROM_FIREFOX 0x4 -#define PLUGINS_FROM_MOZILLA 0x8 - -class nsPluginHostWnd : public CWindowImpl -{ -public: - nsPluginHostWnd(); - virtual ~nsPluginHostWnd(); - -DECLARE_WND_CLASS(_T("MozCtrlPluginHostWindow")) - -BEGIN_MSG_MAP(nsPluginHostWnd) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) - MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) -// CHAIN_MSG_MAP(CWindowImpl) -END_MSG_MAP() - -// Windows message handlers -public: - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - -public: - CComBSTR m_bstrText; - -public: - CComBSTR m_bstrContentType; - CComBSTR m_bstrSource; - CComBSTR m_bstrPluginsPage; - - // Array of plugins - struct PluginInfo - { - TCHAR *szPluginPath; - TCHAR *szPluginName; - TCHAR *szMIMEType; - }; - - nsSimpleArray m_Plugins; - - // Array of names and values to pass to the new plugin - unsigned long m_nArgs; - unsigned long m_nArgsMax; - char **m_pszArgNames; - char **m_pszArgValues; - - // Array of loaded plugins which is shared amongst instances of this control - struct LoadedPluginInfo - { - TCHAR *szFullPath; // Path + plugin name - HINSTANCE hInstance; - DWORD nRefCount; - NPPluginFuncs NPPFuncs; - }; - - static nsSimpleArray m_LoadedPlugins; - - LoadedPluginInfo *m_pLoadedPlugin; - - NPWindow m_NPWindow; - - static NPNetscapeFuncs g_NPNFuncs; - static HRESULT InitPluginCallbacks(); - - HRESULT CreatePluginList(unsigned long ulFlags); - HRESULT CreatePluginListFrom(const TCHAR *szPluginsDir); - HRESULT CleanupPluginList(); - HRESULT GetPluginInfo(const TCHAR * pszPluginPath, PluginInfo *pInfo); - -public: - NPP_t m_NPP; - bool m_bPluginIsAlive; - bool m_bCreatePluginFromStreamData; - bool m_bPluginIsWindowless; - bool m_bPluginIsTransparent; - - nsPluginWnd m_wndPlugin; - - // Struct holding pointers to the functions within the plugin - NPPluginFuncs m_NPPFuncs; - - virtual HRESULT GetWebBrowserApp(IWebBrowserApp **pBrowser); - - HRESULT GetBaseURL(TCHAR **szBaseURL); - - HRESULT GetPluginSource(/*[out, retval]*/ BSTR *pVal); - HRESULT SetPluginSource(/*[in]*/ BSTR newVal); - HRESULT GetPluginContentType(/*[out, retval]*/ BSTR *pVal); - HRESULT SetPluginContentType(/*[in]*/ BSTR newVal); - HRESULT GetPluginsPage(/*[out, retval]*/ BSTR *pVal); - HRESULT SetPluginsPage(/*[in]*/ BSTR newVal); - - HRESULT AddPluginParam(const char *szName, const char *szValue); - HRESULT LoadPluginByContentType(const TCHAR *pszContentType); - HRESULT ReadPluginsFromGeckoAppPath(const TCHAR *szAppName); - HRESULT LoadPlugin(const TCHAR *pszPluginPath); - HRESULT FindPluginPathByContentType(const TCHAR *pszContentType, TCHAR **ppszPluginPath); - HRESULT UnloadPlugin(); - - HRESULT OpenURLStream(const TCHAR *szURL, void *pNotifyData, const void *pPostData, unsigned long nDataLength); - - HRESULT CreatePluginInstance(); - HRESULT DestroyPluginInstance(); - HRESULT SizeToFitPluginInstance(); - - void SetPluginWindowless(bool bWindowless); - void SetPluginTransparent(bool bTransparent); -}; - -#endif diff --git a/embedding/browser/activex/src/pluginhostctrl/nsPluginWnd.cpp b/embedding/browser/activex/src/pluginhostctrl/nsPluginWnd.cpp deleted file mode 100644 index 4ad1a1f1270..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/nsPluginWnd.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 "stdafx.h" -#include "pluginhostctrl.h" -#include "nsPluginWnd.h" - -#ifdef _DEBUG -#undef THIS_FILE -static char THIS_FILE[]=__FILE__; -#define new DEBUG_NEW -#endif - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -nsPluginWnd::nsPluginWnd() -{ - -} - -nsPluginWnd::~nsPluginWnd() -{ - -} - -LRESULT nsPluginWnd::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - PAINTSTRUCT ps; - HDC hdc; - RECT rc; - - hdc = BeginPaint(&ps); - GetClientRect(&rc); - FillRect(hdc, &rc, (HBRUSH) GetStockObject(LTGRAY_BRUSH)); - EndPaint(&ps); - - return 0; -} diff --git a/embedding/browser/activex/src/pluginhostctrl/nsPluginWnd.h b/embedding/browser/activex/src/pluginhostctrl/nsPluginWnd.h deleted file mode 100644 index 6eecba549af..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/nsPluginWnd.h +++ /dev/null @@ -1,56 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 ***** */ -#ifndef __PLUGINWND_H_ -#define __PLUGINWND_H_ - -class nsPluginWnd : public CWindowImpl -{ -public: - nsPluginWnd(); - virtual ~nsPluginWnd(); - - DECLARE_WND_CLASS(_T("MozCtrlPluginWindow")) - -BEGIN_MSG_MAP(nsPluginWnd) - MESSAGE_HANDLER(WM_PAINT, OnPaint) -END_MSG_MAP() - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - -}; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/src/pluginhostctrl/nsURLDataCallback.cpp b/embedding/browser/activex/src/pluginhostctrl/nsURLDataCallback.cpp deleted file mode 100644 index 4e5c156533c..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/nsURLDataCallback.cpp +++ /dev/null @@ -1,640 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 "stdafx.h" - -#include - -#include "Pluginhostctrl.h" -#include "nsPluginHostWnd.h" -#include "nsURLDataCallback.h" - - -///////////////////////////////////////////////////////////////////////////// -// nsURLDataCallback - -nsURLDataCallback::nsURLDataCallback() : - m_pOwner(NULL), - m_pNotifyData(NULL), - m_szContentType(NULL), - m_szURL(NULL), - m_nDataPos(0), - m_nDataMax(0), - m_hPostData(NULL), - m_bSaveToTempFile(FALSE), - m_bNotifyOnWrite(TRUE), - m_szTempFileName(NULL), - m_pTempFile(NULL) -{ - memset(&m_NPStream, 0, sizeof(m_NPStream)); - m_NPStream.ndata = this; -} - -nsURLDataCallback::~nsURLDataCallback() -{ - SetPostData(NULL, 0); - SetURL(NULL); - SetContentType(NULL); - if (m_pTempFile) - { - fclose(m_pTempFile); - remove(m_szTempFileName); - } - if (m_szTempFileName) - { - free(m_szTempFileName); - } -} - -void nsURLDataCallback::SetPostData(const void *pData, unsigned long nSize) -{ - // Copy the post data into an HGLOBAL so it can be given to the - // bind object during the call to GetBindInfo - if (m_hPostData) - { - GlobalFree(m_hPostData); - m_hPostData = NULL; - } - if (pData) - { - m_hPostData = GlobalAlloc(GHND, nSize); - if (m_hPostData) - { - void *pPostData = GlobalLock(m_hPostData); - ATLASSERT(pPostData); - memcpy(pPostData, pData, nSize); - GlobalUnlock(m_hPostData); - } - } -} - -HRESULT nsURLDataCallback::OpenURL(nsPluginHostWnd *pOwner, const TCHAR *szURL, void *pNotifyData, const void *pPostData, unsigned long nPostDataSize) -{ - // Create the callback object - CComObject *pCallback = NULL; - CComObject::CreateInstance(&pCallback); - if (!pCallback) - { - return E_OUTOFMEMORY; - } - pCallback->AddRef(); - - // Initialise it - pCallback->SetOwner(pOwner); - pCallback->SetNotifyData(pNotifyData); - if (pPostData && nPostDataSize > 0) - { - pCallback->SetPostData(pPostData, nPostDataSize); - } - - USES_CONVERSION; - pCallback->SetURL(T2CA(szURL)); - - // Create an object window on this thread that will be sent messages when - // something happens on the worker thread. - RECT rcPos = {0, 0, 10, 10}; - pCallback->Create(HWND_DESKTOP, rcPos); - - // Start the worker thread - _beginthread(StreamThread, 0, pCallback); - - return S_OK; -} - -void __cdecl nsURLDataCallback::StreamThread(void *pData) -{ - HRESULT hr = CoInitialize(NULL); - ATLASSERT(SUCCEEDED(hr)); - - CComObject *pThis = (CComObject *) pData; - - // Open the URL - hr = URLOpenStream(NULL, pThis->m_szURL, 0, static_cast(pThis)); - ATLASSERT(SUCCEEDED(hr)); - - // Pump messages until WM_QUIT arrives - BOOL bQuit = FALSE; - while (!bQuit) - { - MSG msg; - if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) - { - if (GetMessage(&msg, NULL, 0, 0)) - { - DispatchMessage(&msg); - } - else - { - bQuit = TRUE; - } - } - } - - CoUninitialize(); - _endthread(); -} - -/////////////////////////////////////////////////////////////////////////////// -// Windows message handlers - -LRESULT nsURLDataCallback::OnNPPNewStream(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - _NewStreamData *pNewStreamData = (_NewStreamData *) lParam; - - // Notify the plugin that a new stream has been created - if (m_pOwner->m_NPPFuncs.newstream) - { - NPError npres = m_pOwner->m_NPPFuncs.newstream( - pNewStreamData->npp, - pNewStreamData->contenttype, - pNewStreamData->stream, - pNewStreamData->seekable, - pNewStreamData->stype); - - // How does the plugin want its data? - switch (*(pNewStreamData->stype)) - { - case NP_NORMAL: - m_bSaveToTempFile = FALSE; - m_bNotifyOnWrite = TRUE; - break; - case NP_ASFILEONLY: - m_bNotifyOnWrite = FALSE; - m_bSaveToTempFile = TRUE; - break; - case NP_ASFILE: - m_bNotifyOnWrite = TRUE; - m_bSaveToTempFile = TRUE; - break; - case NP_SEEK: - // TODO!!! - ATLASSERT(0); - break; - } - } - return 0; -} - -LRESULT nsURLDataCallback::OnNPPDestroyStream(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - _DestroyStreamData *pDestroyStreamData = (_DestroyStreamData *) lParam; - - // Tell the plugin the name of the temporary file containing the data - if (m_bSaveToTempFile) - { - // Close the file - if (m_pTempFile) - { - fclose(m_pTempFile); - } - - // Determine whether the plugin should be told the name of the temp - // file depending on whether it completed properly or not. - char *szTempFileName = NULL; - if (pDestroyStreamData->reason == NPRES_DONE && - m_pTempFile) - { - szTempFileName = m_szTempFileName; - } - - // Notify the plugin - if (m_pOwner->m_NPPFuncs.asfile) - { - m_pOwner->m_NPPFuncs.asfile( - pDestroyStreamData->npp, - pDestroyStreamData->stream, - szTempFileName); - } - - // Remove the file if it wasn't passed into the plugin - if (!szTempFileName || - !m_pOwner->m_NPPFuncs.asfile) - { - remove(szTempFileName); - } - - // Cleanup strings & pointers - if (m_szTempFileName) - { - free(m_szTempFileName); - m_szTempFileName = NULL; - } - m_pTempFile = NULL; - } - - // Notify the plugin that the stream has been closed - if (m_pOwner->m_NPPFuncs.destroystream) - { - m_pOwner->m_NPPFuncs.destroystream( - pDestroyStreamData->npp, - pDestroyStreamData->stream, - pDestroyStreamData->reason); - } - - return 0; -} - -LRESULT nsURLDataCallback::OnNPPURLNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - _UrlNotifyData *pUrlNotifyData = (_UrlNotifyData *) lParam; - - // Notify the plugin that the url has loaded - if (m_pNotifyData && m_pOwner->m_NPPFuncs.urlnotify) - { - m_pOwner->m_NPPFuncs.urlnotify( - pUrlNotifyData->npp, - pUrlNotifyData->url, - pUrlNotifyData->reason, - pUrlNotifyData->notifydata); - } - return 0; -} - -LRESULT nsURLDataCallback::OnNPPWriteReady(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - _WriteReadyData *pWriteReadyData = (_WriteReadyData *) lParam; - if (m_pOwner->m_NPPFuncs.writeready && - m_bNotifyOnWrite) - { - pWriteReadyData->result = m_pOwner->m_NPPFuncs.writeready( - pWriteReadyData->npp, - pWriteReadyData->stream); - } - - return 0; -} - -LRESULT nsURLDataCallback::OnNPPWrite(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - _WriteData *pWriteData = (_WriteData *) lParam; - -#ifdef DUMP_STREAM_DATA_AS_HEX - // Dumps out the data to the display so you can see it's correct as its - // fed into the plugin. - const int kLineBreakAfter = 16; - const int kSpaceBreakAfter = 8; - ATLTRACE(_T("nsURLDataCallback::OnNPPWrite()\n")); - for (int i = 0; i < pWriteData->len; i++) - { - TCHAR szLine[100]; - TCHAR szTmp[20]; - if (i % kLineBreakAfter == 0) - { - _stprintf(szLine, _T("%04x "), i); - } - unsigned char b = ((unsigned char *) pWriteData->buffer)[i]; - _stprintf(szTmp, _T("%02X "), (unsigned int) b); - _tcscat(szLine, szTmp); - - if (i == pWriteData->len - 1 || - i % kLineBreakAfter == kLineBreakAfter - 1) - { - _tcscat(szLine, _T("\n")); - ATLTRACE(szLine); - } - else if (i % kSpaceBreakAfter == kSpaceBreakAfter - 1) - { - _tcscat(szLine, _T(" ")); - } - } - ATLTRACE(_T("--\n")); -#endif - - if (m_bSaveToTempFile) - { - if (!m_szTempFileName) - { - m_szTempFileName = strdup(_tempnam(NULL, "moz")); - } - if (!m_pTempFile) - { - m_pTempFile = fopen(m_szTempFileName, "wb"); - } - ATLASSERT(m_pTempFile); - if (m_pTempFile) - { - fwrite(pWriteData->buffer, 1, pWriteData->len, m_pTempFile); - } - } - - if (m_pOwner->m_NPPFuncs.write && - m_bNotifyOnWrite) - { - int32 nConsumed = m_pOwner->m_NPPFuncs.write( - pWriteData->npp, - pWriteData->stream, - pWriteData->offset, - pWriteData->len, - pWriteData->buffer); - if (nConsumed < 0) - { - // TODO destroy the stream! - } - ATLASSERT(nConsumed == pWriteData->len); - } - return 0; -} - -LRESULT nsURLDataCallback::OnClassCreatePluginInstance(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - // Test whether the plugin for this content type exists or not and if not, - // create it right now. - if (!m_pOwner->m_bPluginIsAlive && - m_pOwner->m_bCreatePluginFromStreamData) - { - if (FAILED(m_pOwner->LoadPluginByContentType(A2CT(m_szContentType))) || - FAILED(m_pOwner->CreatePluginInstance())) - { - return 1; - } - } - return 0; -} - -LRESULT nsURLDataCallback::OnClassCleanup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - DestroyWindow(); - Release(); - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// -// IBindStatusCallback implementation - -HRESULT STDMETHODCALLTYPE nsURLDataCallback::OnStartBinding( - /* [in] */ DWORD dwReserved, - /* [in] */ IBinding __RPC_FAR *pib) -{ - ATLTRACE(_T("nsURLDataCallback::OnStartBinding()\n")); - m_cpBinding = pib; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE nsURLDataCallback::GetPriority( - /* [out] */ LONG __RPC_FAR *pnPriority) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE nsURLDataCallback::OnLowResource( - /* [in] */ DWORD reserved) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE nsURLDataCallback::OnProgress( - /* [in] */ ULONG ulProgress, - /* [in] */ ULONG ulProgressMax, - /* [in] */ ULONG ulStatusCode, - /* [in] */ LPCWSTR szStatusText) -{ - switch (ulStatusCode) - { - case BINDSTATUS_BEGINDOWNLOADDATA: - case BINDSTATUS_REDIRECTING: - { - USES_CONVERSION; - SetURL(W2A(szStatusText)); - } - break; - - case BINDSTATUS_MIMETYPEAVAILABLE: - { - USES_CONVERSION; - SetContentType(W2A(szStatusText)); - } - break; - } - - m_nDataMax = ulProgressMax; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE nsURLDataCallback::OnStopBinding( - /* [in] */ HRESULT hresult, - /* [unique][in] */ LPCWSTR szError) -{ - ATLTRACE(_T("nsURLDataCallback::OnStopBinding()\n")); - if (m_pOwner && m_pOwner->m_bPluginIsAlive) - { - // TODO check for aborted ops and send NPRES_USER_BREAK - NPReason reason = SUCCEEDED(hresult) ? NPRES_DONE : NPRES_NETWORK_ERR; - - // Notify the plugin that the stream has been closed - _DestroyStreamData destroyStreamData; - destroyStreamData.npp = &m_pOwner->m_NPP; - destroyStreamData.stream = &m_NPStream; - destroyStreamData.reason = reason; - SendMessage(WM_NPP_DESTROYSTREAM, 0, (LPARAM) &destroyStreamData); - - // Notify the plugin that the url has loaded - _UrlNotifyData urlNotifyData; - urlNotifyData.npp = &m_pOwner->m_NPP; - urlNotifyData.url = m_szURL; - urlNotifyData.reason = reason; - urlNotifyData.notifydata = m_pNotifyData; - SendMessage(WM_NPP_URLNOTIFY, 0, (LPARAM) &urlNotifyData); - } - - m_cpBinding.Release(); - - SendMessage(WM_CLASS_CLEANUP); - PostQuitMessage(0); - - return S_OK; -} - -/* [local] */ HRESULT STDMETHODCALLTYPE nsURLDataCallback::GetBindInfo( - /* [out] */ DWORD __RPC_FAR *grfBINDF, - /* [unique][out][in] */ BINDINFO __RPC_FAR *pbindinfo) -{ - *grfBINDF = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | - BINDF_GETNEWESTVERSION; - - ULONG cbSize = pbindinfo->cbSize; - memset(pbindinfo, 0, cbSize); // zero out structure - pbindinfo->cbSize = cbSize; - if (m_hPostData) - { - pbindinfo->dwBindVerb = BINDVERB_POST; - pbindinfo->stgmedData.tymed = TYMED_HGLOBAL; - pbindinfo->stgmedData.hGlobal = m_hPostData; - } - else - { - pbindinfo->dwBindVerb = BINDVERB_GET; - } - - return S_OK ; -} - -/* [local] */ HRESULT STDMETHODCALLTYPE nsURLDataCallback::OnDataAvailable( - /* [in] */ DWORD grfBSCF, - /* [in] */ DWORD dwSize, - /* [in] */ FORMATETC __RPC_FAR *pformatetc, - /* [in] */ STGMEDIUM __RPC_FAR *pstgmed) -{ - ATLTRACE(_T("nsURLDataCallback::OnDataAvailable()\n")); - if (pstgmed->tymed != TYMED_ISTREAM || - !pstgmed->pstm) - { - return S_OK; - } - if (!m_pOwner) - { - return S_OK; - } - - // Notify the plugin that a stream has been opened - if (grfBSCF & BSCF_FIRSTDATANOTIFICATION) - { - USES_CONVERSION; - - // Test if there is a plugin yet. If not try and create one for this - // kind of content. - if (SendMessage(WM_CLASS_CREATEPLUGININSTANCE)) - { - m_cpBinding->Abort(); - return S_OK; - } - - // Tell the plugin that there is a new stream of data - m_NPStream.url = m_szURL; - m_NPStream.end = 0; - m_NPStream.lastmodified = 0; - m_NPStream.notifyData = m_pNotifyData; - - uint16 stype = NP_NORMAL; - _NewStreamData newStreamData; - newStreamData.npp = &m_pOwner->m_NPP; - newStreamData.contenttype = m_szContentType; - newStreamData.stream = &m_NPStream; - newStreamData.seekable = FALSE; - newStreamData.stype = &stype; - SendMessage(WM_NPP_NEWSTREAM, 0, (LPARAM) &newStreamData); - } - if (!m_pOwner->m_bPluginIsAlive) - { - return S_OK; - } - - m_NPStream.end = m_nDataMax; - - ATLTRACE(_T("Data for stream %s (%d of %d bytes are available)\n"), m_szURL, dwSize, m_NPStream.end); - - // Feed the stream data into the plugin - HRESULT hr; - char bData[16384]; - while (m_nDataPos < dwSize) - { - ULONG nBytesToRead = dwSize - m_nDataPos; - ULONG nBytesRead = 0; - - if (nBytesToRead > sizeof(bData)) - { - nBytesToRead = sizeof(bData); - } - - // How many bytes can the plugin cope with? - _WriteReadyData writeReadyData; - writeReadyData.npp = &m_pOwner->m_NPP; - writeReadyData.stream = &m_NPStream; - writeReadyData.result = nBytesToRead; - SendMessage(WM_NPP_WRITEREADY, 0, (LPARAM) &writeReadyData); - if (nBytesToRead > writeReadyData.result) - { - nBytesToRead = writeReadyData.result; - } - - // Read 'n' feed - ATLTRACE(_T(" Reading %d bytes\n"), (int) nBytesToRead); - hr = pstgmed->pstm->Read(&bData, nBytesToRead, &nBytesRead); - - _WriteData writeData; - writeData.npp = &m_pOwner->m_NPP; - writeData.stream = &m_NPStream; - writeData.offset = m_nDataPos; - writeData.len = nBytesRead; - writeData.buffer = bData; - SendMessage(WM_NPP_WRITE, 0, (LPARAM) &writeData); - - m_nDataPos += nBytesRead; - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE nsURLDataCallback::OnObjectAvailable( - /* [in] */ REFIID riid, - /* [iid_is][in] */ IUnknown __RPC_FAR *punk) -{ - return S_OK; -} - -/////////////////////////////////////////////////////////////////////////////// -// IAuthenticate implementation - -HRESULT STDMETHODCALLTYPE nsURLDataCallback::Authenticate( - /* [out] */ HWND __RPC_FAR *phwnd, - /* [out] */ LPWSTR __RPC_FAR *pszUsername, - /* [out] */ LPWSTR __RPC_FAR *pszPassword) -{ - ATLTRACE(_T("nsURLDataCallback::Authenticate()\n")); - - // Caller wants to pose a password dialog so get a parent HWND for it. - *phwnd = HWND_DESKTOP; - if (m_pOwner) - { - *phwnd = m_pOwner->m_hWnd; - CComPtr cpBrowser; - m_pOwner->GetWebBrowserApp(&cpBrowser); - if (cpBrowser) - { - long hwnd = NULL; - cpBrowser->get_HWND(&hwnd); - if (hwnd) - { - *phwnd = (HWND) hwnd; - } - } - } - - // Caller will figure these out for itself - *pszUsername = NULL; - *pszPassword = NULL; - - return S_OK; -} diff --git a/embedding/browser/activex/src/pluginhostctrl/nsURLDataCallback.h b/embedding/browser/activex/src/pluginhostctrl/nsURLDataCallback.h deleted file mode 100644 index 22315539d3f..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/nsURLDataCallback.h +++ /dev/null @@ -1,222 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 ***** */ -#ifndef __NSURLDATACALLBACK_H_ -#define __NSURLDATACALLBACK_H_ - -#include "resource.h" // main symbols - -#include - -#include "npapi.h" - -class nsPluginHostWnd; - -#define WM_NPP_NEWSTREAM WM_USER -#define WM_NPP_DESTROYSTREAM WM_USER + 1 -#define WM_NPP_URLNOTIFY WM_USER + 2 -#define WM_NPP_WRITEREADY WM_USER + 3 -#define WM_NPP_WRITE WM_USER + 4 - -#define WM_CLASS_CLEANUP WM_USER + 10 -#define WM_CLASS_CREATEPLUGININSTANCE WM_USER + 11 - -struct _DestroyStreamData -{ - NPP npp; - NPStream *stream; - NPReason reason; -}; - -struct _UrlNotifyData -{ - NPP npp; - char *url; - NPReason reason; - void *notifydata; -}; - -struct _NewStreamData -{ - NPP npp; - char *contenttype; - NPStream *stream; - NPBool seekable; - uint16 *stype; -}; - -struct _WriteReadyData -{ - NPP npp; - NPStream *stream; - int32 result; -}; - -struct _WriteData -{ - NPP npp; - NPStream *stream; - int32 offset; - int32 len; - void* buffer; -}; - -///////////////////////////////////////////////////////////////////////////// -// nsURLDataCallback -class ATL_NO_VTABLE nsURLDataCallback : - public CComObjectRootEx, - public CWindowImpl, - public CComCoClass, - public IBindStatusCallback, - public IAuthenticate -{ -public: - nsURLDataCallback(); - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(nsURLDataCallback) - COM_INTERFACE_ENTRY(IBindStatusCallback) - COM_INTERFACE_ENTRY(IAuthenticate) -END_COM_MAP() - - DECLARE_WND_CLASS(_T("MozStreamWindow")) - -BEGIN_MSG_MAP(nsURLDataCallback) - MESSAGE_HANDLER(WM_NPP_NEWSTREAM, OnNPPNewStream) - MESSAGE_HANDLER(WM_NPP_DESTROYSTREAM, OnNPPDestroyStream) - MESSAGE_HANDLER(WM_NPP_URLNOTIFY, OnNPPURLNotify) - MESSAGE_HANDLER(WM_NPP_WRITEREADY, OnNPPWriteReady) - MESSAGE_HANDLER(WM_NPP_WRITE, OnNPPWrite) - MESSAGE_HANDLER(WM_CLASS_CLEANUP, OnClassCleanup) - MESSAGE_HANDLER(WM_CLASS_CREATEPLUGININSTANCE, OnClassCreatePluginInstance) -END_MSG_MAP() - - LRESULT OnNPPNewStream(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnNPPDestroyStream(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnNPPURLNotify(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnNPPWriteReady(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnNPPWrite(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - - LRESULT OnClassCreatePluginInstance(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnClassCleanup(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - -protected: - virtual ~nsURLDataCallback(); - -protected: - nsPluginHostWnd *m_pOwner; - void *m_pNotifyData; - HGLOBAL m_hPostData; - - NPStream m_NPStream; - unsigned long m_nDataPos; - unsigned long m_nDataMax; - - char *m_szContentType; - char *m_szURL; - - BOOL m_bSaveToTempFile; - BOOL m_bNotifyOnWrite; - FILE *m_pTempFile; - char *m_szTempFileName; - - CComPtr m_cpBinding; - - void SetURL(const char *szURL) - { - if (m_szURL) { free(m_szURL); m_szURL = NULL; } - if (szURL) { m_szURL = strdup(szURL); } - } - void SetContentType(const char *szContentType) - { - if (m_szContentType) { free(m_szContentType); m_szContentType = NULL; } - if (szContentType) { m_szContentType = strdup(szContentType); } - } - void SetPostData(const void *pData, unsigned long nSize); - void SetOwner(nsPluginHostWnd *pOwner) { m_pOwner = pOwner; } - void SetNotifyData(void *pNotifyData) { m_pNotifyData = pNotifyData; } - - static void __cdecl StreamThread(void *pThis); - -public: - static HRESULT OpenURL(nsPluginHostWnd *pOwner, const TCHAR *szURL, void *pNotifyData, const void *pData, unsigned long nSize); - -// IBindStatusCallback -public: - virtual HRESULT STDMETHODCALLTYPE OnStartBinding( - /* [in] */ DWORD dwReserved, - /* [in] */ IBinding __RPC_FAR *pib); - - virtual HRESULT STDMETHODCALLTYPE GetPriority( - /* [out] */ LONG __RPC_FAR *pnPriority); - - virtual HRESULT STDMETHODCALLTYPE OnLowResource( - /* [in] */ DWORD reserved); - - virtual HRESULT STDMETHODCALLTYPE OnProgress( - /* [in] */ ULONG ulProgress, - /* [in] */ ULONG ulProgressMax, - /* [in] */ ULONG ulStatusCode, - /* [in] */ LPCWSTR szStatusText); - - virtual HRESULT STDMETHODCALLTYPE OnStopBinding( - /* [in] */ HRESULT hresult, - /* [unique][in] */ LPCWSTR szError); - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetBindInfo( - /* [out] */ DWORD __RPC_FAR *grfBINDF, - /* [unique][out][in] */ BINDINFO __RPC_FAR *pbindinfo); - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE OnDataAvailable( - /* [in] */ DWORD grfBSCF, - /* [in] */ DWORD dwSize, - /* [in] */ FORMATETC __RPC_FAR *pformatetc, - /* [in] */ STGMEDIUM __RPC_FAR *pstgmed); - - virtual HRESULT STDMETHODCALLTYPE OnObjectAvailable( - /* [in] */ REFIID riid, - /* [iid_is][in] */ IUnknown __RPC_FAR *punk); - -// IAuthenticate -public: - virtual HRESULT STDMETHODCALLTYPE Authenticate( - /* [out] */ HWND __RPC_FAR *phwnd, - /* [out] */ LPWSTR __RPC_FAR *pszUsername, - /* [out] */ LPWSTR __RPC_FAR *pszPassword); -}; - -#endif //__NSURLDATACALLBACK_H_ diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginho.bmp b/embedding/browser/activex/src/pluginhostctrl/pluginho.bmp deleted file mode 100644 index 122976492c7..00000000000 Binary files a/embedding/browser/activex/src/pluginhostctrl/pluginho.bmp and /dev/null differ diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.cpp b/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.cpp deleted file mode 100644 index aadea029400..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 ***** */ - */ - -// pluginhostctrl.cpp : Implementation of DLL Exports. - - -// Note: Proxy/Stub Information -// To build a separate proxy/stub DLL, -// run nmake -f pluginhostctrlps.mk in the project directory. - -#include "stdafx.h" -#include "resource.h" -#include -#include "pluginhostctrl.h" - -#include "pluginhostctrl_i.c" -#include "nsPluginHostCtrl.h" - -CComModule _Module; - -BEGIN_OBJECT_MAP(ObjectMap) - OBJECT_ENTRY(CLSID_MozPluginHostCtrl, nsPluginHostCtrl) -END_OBJECT_MAP() - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - _Module.Init(ObjectMap, hInstance, &LIBID_PLUGINHOSTCTRLLib); - DisableThreadLibraryCalls(hInstance); - } - else if (dwReason == DLL_PROCESS_DETACH) - _Module.Term(); - return TRUE; // ok -} - -///////////////////////////////////////////////////////////////////////////// -// Used to determine whether the DLL can be unloaded by OLE - -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ - return _Module.GetClassObject(rclsid, riid, ppv); -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -STDAPI DllRegisterServer(void) -{ - // registers object, typelib and all interfaces in typelib - return _Module.RegisterServer(TRUE); -} - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry - -STDAPI DllUnregisterServer(void) -{ - return _Module.UnregisterServer(TRUE); -} - - diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.def b/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.def deleted file mode 100644 index 7366b3dc1cf..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.def +++ /dev/null @@ -1,9 +0,0 @@ -; pluginhostctrl.def : Declares the module parameters. - -LIBRARY "pluginhostctrl.DLL" - -EXPORTS - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.dsp b/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.dsp deleted file mode 100644 index 50517dda0d9..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.dsp +++ /dev/null @@ -1,272 +0,0 @@ -# Microsoft Developer Studio Project File - Name="pluginhostctrl" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=pluginhostctrl - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "pluginhostctrl.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "pluginhostctrl.mak" CFG="pluginhostctrl - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "pluginhostctrl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "pluginhostctrl - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "pluginhostctrl - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "pluginhostctrl - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX- /ZI /Od /I "pluginsdk_include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE RSC /l 0x1809 /d "_DEBUG" -# ADD RSC /l 0x1809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib version.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# Begin Custom Build - Performing registration -OutDir=.\Debug -TargetPath=.\Debug\pluginhostctrl.dll -InputPath=.\Debug\pluginhostctrl.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "pluginhostctrl - Win32 Release MinSize" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseMinSize" -# PROP BASE Intermediate_Dir "ReleaseMinSize" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseMinSize" -# PROP Intermediate_Dir "ReleaseMinSize" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX- /O1 /I "pluginsdk_include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_MIN_CRT" /D "_ATL_DLL" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x1809 /d "NDEBUG" -# ADD RSC /l 0x1809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib version.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseMinSize -TargetPath=.\ReleaseMinSize\pluginhostctrl.dll -InputPath=.\ReleaseMinSize\pluginhostctrl.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "pluginhostctrl - Win32 Release MinDependency" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseMinDependency" -# PROP BASE Intermediate_Dir "ReleaseMinDependency" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseMinDependency" -# PROP Intermediate_Dir "ReleaseMinDependency" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX- /O1 /I "pluginsdk_include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x1809 /d "NDEBUG" -# ADD RSC /l 0x1809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib version.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseMinDependency -TargetPath=.\ReleaseMinDependency\pluginhostctrl.dll -InputPath=.\ReleaseMinDependency\pluginhostctrl.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ENDIF - -# Begin Target - -# Name "pluginhostctrl - Win32 Debug" -# Name "pluginhostctrl - Win32 Release MinSize" -# Name "pluginhostctrl - Win32 Release MinDependency" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\npn.cpp -# End Source File -# Begin Source File - -SOURCE=.\nsPluginHostCtrl.cpp -# End Source File -# Begin Source File - -SOURCE=.\nsPluginWnd.cpp -# End Source File -# Begin Source File - -SOURCE=.\nsURLDataCallback.cpp -# End Source File -# Begin Source File - -SOURCE=.\pluginhostctrl.cpp -# End Source File -# Begin Source File - -SOURCE=.\pluginhostctrl.def -# End Source File -# Begin Source File - -SOURCE=.\pluginhostctrl.idl -# ADD MTL /tlb ".\pluginhostctrl.tlb" /h "pluginhostctrl.h" /iid "pluginhostctrl_i.c" /Oicf -# End Source File -# Begin Source File - -SOURCE=.\pluginhostctrl.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\npn.h -# End Source File -# Begin Source File - -SOURCE=.\nsPluginHostCtrl.h -# End Source File -# Begin Source File - -SOURCE=.\nsPluginWnd.h -# End Source File -# Begin Source File - -SOURCE=.\nsURLDataCallback.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\PluginHostCtrl.rgs -# End Source File -# End Group -# Begin Group "Test Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\tests\ns4x_reference_test3.htm -# End Source File -# Begin Source File - -SOURCE=.\tests\test1.htm -# End Source File -# Begin Source File - -SOURCE=.\tests\test2.htm -# End Source File -# Begin Source File - -SOURCE=.\tests\test3.htm -# End Source File -# Begin Source File - -SOURCE=.\tests\test4.htm -# End Source File -# Begin Source File - -SOURCE=.\tests\test5.htm -# End Source File -# Begin Source File - -SOURCE=.\tests\test6.htm -# End Source File -# Begin Source File - -SOURCE=.\tests\test7.htm -# End Source File -# Begin Source File - -SOURCE=.\tests\test8.htm -# End Source File -# Begin Source File - -SOURCE=.\tests\test9.htm -# End Source File -# End Group -# Begin Source File - -SOURCE=.\PluginHostCtrlUI.htm -# End Source File -# End Target -# End Project diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.idl b/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.idl deleted file mode 100644 index 8491c2b5eb1..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.idl +++ /dev/null @@ -1,100 +0,0 @@ -/* ***** 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 Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Adam Lock - * - * 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 ***** */ -// pluginhostctrl.idl : IDL source for pluginhostctrl.dll -// - -// This file will be processed by the MIDL tool to -// produce the type library (pluginhostctrl.tlb) and marshalling code. - -import "oaidl.idl"; -import "ocidl.idl"; -#include "olectl.h" - - - [ - object, - uuid(A37A5B60-071D-4885-AD8A-CC6B57F691CF), - dual, - helpstring("IMozPluginHostCtrl Interface"), - pointer_default(unique) - ] - interface IMozPluginHostCtrl : IDispatch - { - [propget, id(DISPID_HWND)] - HRESULT Window([out, retval]long* phwnd); - [propput, id(DISPID_TEXT)] - HRESULT Text([in]BSTR strText); - [propget, id(DISPID_TEXT)] - HRESULT Text([out, retval]BSTR* pstrText); - [propget, id(1), helpstring("property PluginContentType")] HRESULT PluginContentType([out, retval] BSTR *pVal); - [propput, id(1), helpstring("property PluginContentType")] HRESULT PluginContentType([in] BSTR newVal); - [propget, id(2), helpstring("property PluginSource")] HRESULT PluginSource([out, retval] BSTR *pVal); - [propput, id(2), helpstring("property PluginSource")] HRESULT PluginSource([in] BSTR newVal); - [propget, id(3), helpstring("property PluginsPage")] HRESULT PluginsPage([out, retval] BSTR *pVal); - [propput, id(3), helpstring("property PluginsPage")] HRESULT PluginsPage([in] BSTR newVal); - }; - -[ - uuid(5C670C1C-33E2-4B67-8D1E-CC2CF8091A0A), - version(1.0), - helpstring("pluginhostctrl 1.0 Type Library") -] -library PLUGINHOSTCTRLLib -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - - [ - uuid(A059405B-2AFC-4C24-9140-F9AD6FE2B11B), - helpstring("_IMozPluginHostCtrlEvents Interface") - ] - dispinterface _IMozPluginHostCtrlEvents - { - properties: - methods: - }; - - [ - uuid(DBB2DE32-61F1-4F7F-BEB8-A37F5BC24EE2), - helpstring("Mozilla PluginHostCtrl Class") - ] - coclass MozPluginHostCtrl - { - [default] interface IMozPluginHostCtrl; - [default, source] dispinterface _IMozPluginHostCtrlEvents; - }; -}; diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.rc b/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.rc deleted file mode 100644 index 0430e2f38a2..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.rc +++ /dev/null @@ -1,132 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "1 TYPELIB ""pluginhostctrl.tlb""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "pluginhostctrl Module\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "pluginhostctrl\0" - VALUE "LegalCopyright", "Copyright 2001\0" - VALUE "OriginalFilename", "pluginhostctrl.DLL\0" - VALUE "ProductName", "pluginhostctrl Module\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - VALUE "OLESelfRegister", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_PLUGINHOSTCTRL BITMAP DISCARDABLE "pluginho.bmp" - - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_PLUGINHOSTCTRL REGISTRY DISCARDABLE "PluginHostCtrl.rgs" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_PROJNAME "pluginhostctrl" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "pluginhostctrl.tlb" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.sln b/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.sln deleted file mode 100644 index 8f2dff710ed..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.sln +++ /dev/null @@ -1,27 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pluginhostctrl", "pluginhostctrl.vcproj", "{2E8F0B45-A837-4C6C-A072-E89771A90B3A}" -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = Debug - ConfigName.1 = Release - ConfigName.2 = Release MinDependency - ConfigName.3 = Release MinSize - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {2E8F0B45-A837-4C6C-A072-E89771A90B3A}.Debug.ActiveCfg = Debug|Win32 - {2E8F0B45-A837-4C6C-A072-E89771A90B3A}.Debug.Build.0 = Debug|Win32 - {2E8F0B45-A837-4C6C-A072-E89771A90B3A}.Release.ActiveCfg = Release MinDependency|Win32 - {2E8F0B45-A837-4C6C-A072-E89771A90B3A}.Release.Build.0 = Release MinDependency|Win32 - {2E8F0B45-A837-4C6C-A072-E89771A90B3A}.Release MinDependency.ActiveCfg = Release MinDependency|Win32 - {2E8F0B45-A837-4C6C-A072-E89771A90B3A}.Release MinDependency.Build.0 = Release MinDependency|Win32 - {2E8F0B45-A837-4C6C-A072-E89771A90B3A}.Release MinSize.ActiveCfg = Release MinSize|Win32 - {2E8F0B45-A837-4C6C-A072-E89771A90B3A}.Release MinSize.Build.0 = Release MinSize|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.vcproj b/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.vcproj deleted file mode 100644 index 2124f75f151..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrl.vcproj +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrlps.def b/embedding/browser/activex/src/pluginhostctrl/pluginhostctrlps.def deleted file mode 100644 index 579c7338821..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrlps.def +++ /dev/null @@ -1,11 +0,0 @@ - -LIBRARY "pluginhostctrlPS" - -DESCRIPTION 'Proxy/Stub DLL' - -EXPORTS - DllGetClassObject @1 PRIVATE - DllCanUnloadNow @2 PRIVATE - GetProxyDllInfo @3 PRIVATE - DllRegisterServer @4 PRIVATE - DllUnregisterServer @5 PRIVATE diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrlps.mk b/embedding/browser/activex/src/pluginhostctrl/pluginhostctrlps.mk deleted file mode 100644 index 195c66a66b4..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginhostctrlps.mk +++ /dev/null @@ -1,16 +0,0 @@ - -pluginhostctrlps.dll: dlldata.obj pluginhostctrl_p.obj pluginhostctrl_i.obj - link /dll /out:pluginhostctrlps.dll /def:pluginhostctrlps.def /entry:DllMain dlldata.obj pluginhostctrl_p.obj pluginhostctrl_i.obj \ - kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \ - -.c.obj: - cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \ - $< - -clean: - @del pluginhostctrlps.dll - @del pluginhostctrlps.lib - @del pluginhostctrlps.exp - @del dlldata.obj - @del pluginhostctrl_p.obj - @del pluginhostctrl_i.obj diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jni.h b/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jni.h deleted file mode 100644 index b75c0e55744..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jni.h +++ /dev/null @@ -1,1815 +0,0 @@ -/* - * @(#)jni.h 1.26 97/01/27 - */ -/* ***** 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 Java Runtime Interface. - * - * The Initial Developer of the Original Code is - * Sun Microsystems, Inc. and Netscape Communications Corp. - * Portions created by the Initial Developer are Copyright (C) 1993-1996 - * 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 ***** */ - -/* - * We used part of Netscape's Java Runtime Interface (JRI) as the starting - * point of our design and implementation. - */ - -#ifndef JNI_H -#define JNI_H - -#include -#include - -/* jni_md.h contains the machine-dependent typedefs for jbyte, jint - and jlong */ - -#include "jni_md.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * JNI Types - */ - -typedef unsigned char jboolean; -typedef unsigned short jchar; -typedef short jshort; -typedef float jfloat; -typedef double jdouble; - -typedef jint jsize; - -#ifdef __cplusplus - -class _jobject {}; -class _jclass : public _jobject {}; -class _jthrowable : public _jobject {}; -class _jstring : public _jobject {}; -class _jarray : public _jobject {}; -class _jbooleanArray : public _jarray {}; -class _jbyteArray : public _jarray {}; -class _jcharArray : public _jarray {}; -class _jshortArray : public _jarray {}; -class _jintArray : public _jarray {}; -class _jlongArray : public _jarray {}; -class _jfloatArray : public _jarray {}; -class _jdoubleArray : public _jarray {}; -class _jobjectArray : public _jarray {}; - -typedef _jobject *jobject; -typedef _jclass *jclass; -typedef _jthrowable *jthrowable; -typedef _jstring *jstring; -typedef _jarray *jarray; -typedef _jbooleanArray *jbooleanArray; -typedef _jbyteArray *jbyteArray; -typedef _jcharArray *jcharArray; -typedef _jshortArray *jshortArray; -typedef _jintArray *jintArray; -typedef _jlongArray *jlongArray; -typedef _jfloatArray *jfloatArray; -typedef _jdoubleArray *jdoubleArray; -typedef _jobjectArray *jobjectArray; - -#else - -struct _jobject; - -typedef struct _jobject *jobject; -typedef jobject jclass; -typedef jobject jthrowable; -typedef jobject jstring; -typedef jobject jarray; -typedef jarray jbooleanArray; -typedef jarray jbyteArray; -typedef jarray jcharArray; -typedef jarray jshortArray; -typedef jarray jintArray; -typedef jarray jlongArray; -typedef jarray jfloatArray; -typedef jarray jdoubleArray; -typedef jarray jobjectArray; - -#endif - -typedef jobject jref; /* For transition---not meant to be part of public - API anymore.*/ - -typedef union jvalue { - jboolean z; - jbyte b; - jchar c; - jshort s; - jint i; - jlong j; - jfloat f; - jdouble d; - jobject l; -} jvalue; - -struct _jfieldID; -typedef struct _jfieldID *jfieldID; - -struct _jmethodID; -typedef struct _jmethodID *jmethodID; - -/* - * jboolean constants - */ - -#define JNI_FALSE 0 -#define JNI_TRUE 1 - -/* - * possible return values for JNI functions. - */ - -#define JNI_OK 0 -#define JNI_ERR (-1) - -/* - * used in ReleaseScalarArrayElements - */ - -#define JNI_COMMIT 1 -#define JNI_ABORT 2 - -/* - * used in RegisterNatives to describe native method name, signature, - * and function pointer. - */ - -typedef struct { - char *name; - char *signature; - void *fnPtr; -} JNINativeMethod; - -/* - * JNI Native Method Interface. - */ - -struct JNINativeInterface_; - -struct JNIEnv_; - -#ifdef __cplusplus -typedef JNIEnv_ JNIEnv; -#else -typedef const struct JNINativeInterface_ *JNIEnv; -#endif - -/* - * JNI Invocation Interface. - */ - -struct JNIInvokeInterface_; - -struct JavaVM_; - -#ifdef __cplusplus -typedef JavaVM_ JavaVM; -#else -typedef const struct JNIInvokeInterface_ *JavaVM; -#endif - -struct JNINativeInterface_ { - void *reserved0; - void *reserved1; - void *reserved2; - - void *reserved3; - jint (*GetVersion)(JNIEnv *env); - - jclass (*DefineClass) - (JNIEnv *env, const char *name, jobject loader, const jbyte *buf, - jsize len); - jclass (*FindClass) - (JNIEnv *env, const char *name); - - void *reserved4; - void *reserved5; - void *reserved6; - - jclass (*GetSuperclass) - (JNIEnv *env, jclass sub); - jboolean (*IsAssignableFrom) - (JNIEnv *env, jclass sub, jclass sup); - void *reserved7; - - - jint (*_Throw) - (JNIEnv *env, jthrowable obj); - jint (*ThrowNew) - (JNIEnv *env, jclass clazz, const char *msg); - jthrowable (*ExceptionOccurred) - (JNIEnv *env); - void (*ExceptionDescribe) - (JNIEnv *env); - void (*ExceptionClear) - (JNIEnv *env); - void (*FatalError) - (JNIEnv *env, const char *msg); - void *reserved8; - void *reserved9; - - jobject (*NewGlobalRef) - (JNIEnv *env, jobject lobj); - void (*DeleteGlobalRef) - (JNIEnv *env, jobject gref); - void (*DeleteLocalRef) - (JNIEnv *env, jobject obj); - jboolean (*IsSameObject) - (JNIEnv *env, jobject obj1, jobject obj2); - void *reserved10; - void *reserved11; - - jobject (*AllocObject) - (JNIEnv *env, jclass clazz); - jobject (*NewObject) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jobject (*NewObjectV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jobject (*NewObjectA) - (JNIEnv *env, jclass clazz, jmethodID methodID, jvalue *args); - - jclass (*GetObjectClass) - (JNIEnv *env, jobject obj); - jboolean (*IsInstanceOf) - (JNIEnv *env, jobject obj, jclass clazz); - - jmethodID (*GetMethodID) - (JNIEnv *env, jclass clazz, const char *name, const char *sig); - - jobject (*CallObjectMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jobject (*CallObjectMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jobject (*CallObjectMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, jvalue * args); - - jboolean (*CallBooleanMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jboolean (*CallBooleanMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jboolean (*CallBooleanMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, jvalue * args); - - jbyte (*CallByteMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jbyte (*CallByteMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jbyte (*CallByteMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, jvalue *args); - - jchar (*CallCharMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jchar (*CallCharMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jchar (*CallCharMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, jvalue *args); - - jshort (*CallShortMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jshort (*CallShortMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jshort (*CallShortMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, jvalue *args); - - jint (*CallIntMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jint (*CallIntMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jint (*CallIntMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, jvalue *args); - - jlong (*CallLongMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jlong (*CallLongMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jlong (*CallLongMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, jvalue *args); - - jfloat (*CallFloatMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jfloat (*CallFloatMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jfloat (*CallFloatMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, jvalue *args); - - jdouble (*CallDoubleMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jdouble (*CallDoubleMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jdouble (*CallDoubleMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, jvalue *args); - - void (*CallVoidMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - void (*CallVoidMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - void (*CallVoidMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, jvalue * args); - - jobject (*CallNonvirtualObjectMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jobject (*CallNonvirtualObjectMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jobject (*CallNonvirtualObjectMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - jvalue * args); - - jboolean (*CallNonvirtualBooleanMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jboolean (*CallNonvirtualBooleanMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jboolean (*CallNonvirtualBooleanMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - jvalue * args); - - jbyte (*CallNonvirtualByteMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jbyte (*CallNonvirtualByteMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jbyte (*CallNonvirtualByteMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - jvalue *args); - - jchar (*CallNonvirtualCharMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jchar (*CallNonvirtualCharMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jchar (*CallNonvirtualCharMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - jvalue *args); - - jshort (*CallNonvirtualShortMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jshort (*CallNonvirtualShortMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jshort (*CallNonvirtualShortMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - jvalue *args); - - jint (*CallNonvirtualIntMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jint (*CallNonvirtualIntMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jint (*CallNonvirtualIntMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - jvalue *args); - - jlong (*CallNonvirtualLongMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jlong (*CallNonvirtualLongMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jlong (*CallNonvirtualLongMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - jvalue *args); - - jfloat (*CallNonvirtualFloatMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jfloat (*CallNonvirtualFloatMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jfloat (*CallNonvirtualFloatMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - jvalue *args); - - jdouble (*CallNonvirtualDoubleMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jdouble (*CallNonvirtualDoubleMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jdouble (*CallNonvirtualDoubleMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - jvalue *args); - - void (*CallNonvirtualVoidMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - void (*CallNonvirtualVoidMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - void (*CallNonvirtualVoidMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - jvalue * args); - - jfieldID (*GetFieldID) - (JNIEnv *env, jclass clazz, const char *name, const char *sig); - - jobject (*GetObjectField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jboolean (*GetBooleanField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jbyte (*GetByteField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jchar (*GetCharField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jshort (*GetShortField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jint (*GetIntField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jlong (*GetLongField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jfloat (*GetFloatField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jdouble (*GetDoubleField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - - void (*SetObjectField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jobject val); - void (*SetBooleanField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jboolean val); - void (*SetByteField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jbyte val); - void (*SetCharField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jchar val); - void (*SetShortField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jshort val); - void (*SetIntField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jint val); - void (*SetLongField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jlong val); - void (*SetFloatField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jfloat val); - void (*SetDoubleField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jdouble val); - - jmethodID (*GetStaticMethodID) - (JNIEnv *env, jclass clazz, const char *name, const char *sig); - - jobject (*CallStaticObjectMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jobject (*CallStaticObjectMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jobject (*CallStaticObjectMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, jvalue *args); - - jboolean (*CallStaticBooleanMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jboolean (*CallStaticBooleanMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jboolean (*CallStaticBooleanMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, jvalue *args); - - jbyte (*CallStaticByteMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jbyte (*CallStaticByteMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jbyte (*CallStaticByteMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, jvalue *args); - - jchar (*CallStaticCharMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jchar (*CallStaticCharMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jchar (*CallStaticCharMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, jvalue *args); - - jshort (*CallStaticShortMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jshort (*CallStaticShortMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jshort (*CallStaticShortMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, jvalue *args); - - jint (*CallStaticIntMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jint (*CallStaticIntMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jint (*CallStaticIntMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, jvalue *args); - - jlong (*CallStaticLongMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jlong (*CallStaticLongMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jlong (*CallStaticLongMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, jvalue *args); - - jfloat (*CallStaticFloatMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jfloat (*CallStaticFloatMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jfloat (*CallStaticFloatMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, jvalue *args); - - jdouble (*CallStaticDoubleMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jdouble (*CallStaticDoubleMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jdouble (*CallStaticDoubleMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, jvalue *args); - - void (*CallStaticVoidMethod) - (JNIEnv *env, jclass cls, jmethodID methodID, ...); - void (*CallStaticVoidMethodV) - (JNIEnv *env, jclass cls, jmethodID methodID, va_list args); - void (*CallStaticVoidMethodA) - (JNIEnv *env, jclass cls, jmethodID methodID, jvalue * args); - - jfieldID (*GetStaticFieldID) - (JNIEnv *env, jclass clazz, const char *name, const char *sig); - jobject (*GetStaticObjectField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jboolean (*GetStaticBooleanField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jbyte (*GetStaticByteField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jchar (*GetStaticCharField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jshort (*GetStaticShortField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jint (*GetStaticIntField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jlong (*GetStaticLongField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jfloat (*GetStaticFloatField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jdouble (*GetStaticDoubleField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - - void (*SetStaticObjectField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jobject value); - void (*SetStaticBooleanField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jboolean value); - void (*SetStaticByteField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jbyte value); - void (*SetStaticCharField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jchar value); - void (*SetStaticShortField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jshort value); - void (*SetStaticIntField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jint value); - void (*SetStaticLongField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jlong value); - void (*SetStaticFloatField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jfloat value); - void (*SetStaticDoubleField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jdouble value); - - jstring (*NewString) - (JNIEnv *env, const jchar *unicode, jsize len); - jsize (*GetStringLength) - (JNIEnv *env, jstring str); - const jchar *(*GetStringChars) - (JNIEnv *env, jstring str, jboolean *isCopy); - void (*ReleaseStringChars) - (JNIEnv *env, jstring str, const jchar *chars); - - jstring (*NewStringUTF) - (JNIEnv *env, const char *utf); - jsize (*GetStringUTFLength) - (JNIEnv *env, jstring str); - const char* (*GetStringUTFChars) - (JNIEnv *env, jstring str, jboolean *isCopy); - void (*ReleaseStringUTFChars) - (JNIEnv *env, jstring str, const char* chars); - - - jsize (*GetArrayLength) - (JNIEnv *env, jarray array); - - jobjectArray (*NewObjectArray) - (JNIEnv *env, jsize len, jclass clazz, jobject init); - jobject (*GetObjectArrayElement) - (JNIEnv *env, jobjectArray array, jsize index); - void (*SetObjectArrayElement) - (JNIEnv *env, jobjectArray array, jsize index, jobject val); - - jbooleanArray (*NewBooleanArray) - (JNIEnv *env, jsize len); - jbyteArray (*NewByteArray) - (JNIEnv *env, jsize len); - jcharArray (*NewCharArray) - (JNIEnv *env, jsize len); - jshortArray (*NewShortArray) - (JNIEnv *env, jsize len); - jintArray (*NewIntArray) - (JNIEnv *env, jsize len); - jlongArray (*NewLongArray) - (JNIEnv *env, jsize len); - jfloatArray (*NewFloatArray) - (JNIEnv *env, jsize len); - jdoubleArray (*NewDoubleArray) - (JNIEnv *env, jsize len); - - jboolean * (*GetBooleanArrayElements) - (JNIEnv *env, jbooleanArray array, jboolean *isCopy); - jbyte * (*GetByteArrayElements) - (JNIEnv *env, jbyteArray array, jboolean *isCopy); - jchar * (*GetCharArrayElements) - (JNIEnv *env, jcharArray array, jboolean *isCopy); - jshort * (*GetShortArrayElements) - (JNIEnv *env, jshortArray array, jboolean *isCopy); - jint * (*GetIntArrayElements) - (JNIEnv *env, jintArray array, jboolean *isCopy); - jlong * (*GetLongArrayElements) - (JNIEnv *env, jlongArray array, jboolean *isCopy); - jfloat * (*GetFloatArrayElements) - (JNIEnv *env, jfloatArray array, jboolean *isCopy); - jdouble * (*GetDoubleArrayElements) - (JNIEnv *env, jdoubleArray array, jboolean *isCopy); - - void (*ReleaseBooleanArrayElements) - (JNIEnv *env, jbooleanArray array, jboolean *elems, jint mode); - void (*ReleaseByteArrayElements) - (JNIEnv *env, jbyteArray array, jbyte *elems, jint mode); - void (*ReleaseCharArrayElements) - (JNIEnv *env, jcharArray array, jchar *elems, jint mode); - void (*ReleaseShortArrayElements) - (JNIEnv *env, jshortArray array, jshort *elems, jint mode); - void (*ReleaseIntArrayElements) - (JNIEnv *env, jintArray array, jint *elems, jint mode); - void (*ReleaseLongArrayElements) - (JNIEnv *env, jlongArray array, jlong *elems, jint mode); - void (*ReleaseFloatArrayElements) - (JNIEnv *env, jfloatArray array, jfloat *elems, jint mode); - void (*ReleaseDoubleArrayElements) - (JNIEnv *env, jdoubleArray array, jdouble *elems, jint mode); - - void (*GetBooleanArrayRegion) - (JNIEnv *env, jbooleanArray array, jsize start, jsize l, jboolean *buf); - void (*GetByteArrayRegion) - (JNIEnv *env, jbyteArray array, jsize start, jsize len, jbyte *buf); - void (*GetCharArrayRegion) - (JNIEnv *env, jcharArray array, jsize start, jsize len, jchar *buf); - void (*GetShortArrayRegion) - (JNIEnv *env, jshortArray array, jsize start, jsize len, jshort *buf); - void (*GetIntArrayRegion) - (JNIEnv *env, jintArray array, jsize start, jsize len, jint *buf); - void (*GetLongArrayRegion) - (JNIEnv *env, jlongArray array, jsize start, jsize len, jlong *buf); - void (*GetFloatArrayRegion) - (JNIEnv *env, jfloatArray array, jsize start, jsize len, jfloat *buf); - void (*GetDoubleArrayRegion) - (JNIEnv *env, jdoubleArray array, jsize start, jsize len, jdouble *buf); - - void (*SetBooleanArrayRegion) - (JNIEnv *env, jbooleanArray array, jsize start, jsize l, jboolean *buf); - void (*SetByteArrayRegion) - (JNIEnv *env, jbyteArray array, jsize start, jsize len, jbyte *buf); - void (*SetCharArrayRegion) - (JNIEnv *env, jcharArray array, jsize start, jsize len, jchar *buf); - void (*SetShortArrayRegion) - (JNIEnv *env, jshortArray array, jsize start, jsize len, jshort *buf); - void (*SetIntArrayRegion) - (JNIEnv *env, jintArray array, jsize start, jsize len, jint *buf); - void (*SetLongArrayRegion) - (JNIEnv *env, jlongArray array, jsize start, jsize len, jlong *buf); - void (*SetFloatArrayRegion) - (JNIEnv *env, jfloatArray array, jsize start, jsize len, jfloat *buf); - void (*SetDoubleArrayRegion) - (JNIEnv *env, jdoubleArray array, jsize start, jsize len, jdouble *buf); - - jint (*RegisterNatives) - (JNIEnv *env, jclass clazz, const JNINativeMethod *methods, - jint nMethods); - jint (*UnregisterNatives) - (JNIEnv *env, jclass clazz); - - jint (*MonitorEnter) - (JNIEnv *env, jobject obj); - jint (*MonitorExit) - (JNIEnv *env, jobject obj); - - jint (*GetJavaVM) - (JNIEnv *env, JavaVM **vm); -}; - -/* - * We use inlined functions for C++ so that programmers can write: - * - * env->FindClass("java/lang/String") - * - * in C++ rather than: - * - * (*env)->FindClass(env, "java/lang/String") - * - * in C. - */ - -struct JNIEnv_ { - const struct JNINativeInterface_ *functions; - void *reserved0; - void *reserved1[6]; -#ifdef __cplusplus - - jint GetVersion() { - return functions->GetVersion(this); - } - jclass DefineClass(const char *name, jobject loader, const jbyte *buf, - jsize len) { - return functions->DefineClass(this, name, loader, buf, len); - } - jclass FindClass(const char *name) { - return functions->FindClass(this, name); - } - jclass GetSuperclass(jclass sub) { - return functions->GetSuperclass(this, sub); - } - jboolean IsAssignableFrom(jclass sub, jclass sup) { - return functions->IsAssignableFrom(this, sub, sup); - } - - jint _Throw(jthrowable obj) { - return functions->_Throw(this, obj); - } - jint ThrowNew(jclass clazz, const char *msg) { - return functions->ThrowNew(this, clazz, msg); - } - jthrowable ExceptionOccurred() { - return functions->ExceptionOccurred(this); - } - void ExceptionDescribe() { - functions->ExceptionDescribe(this); - } - void ExceptionClear() { - functions->ExceptionClear(this); - } - void FatalError(const char *msg) { - functions->FatalError(this, msg); - } - - jobject NewGlobalRef(jobject lobj) { - return functions->NewGlobalRef(this,lobj); - } - void DeleteGlobalRef(jobject gref) { - functions->DeleteGlobalRef(this,gref); - } - void DeleteLocalRef(jobject obj) { - functions->DeleteLocalRef(this, obj); - } - - jboolean IsSameObject(jobject obj1, jobject obj2) { - return functions->IsSameObject(this,obj1,obj2); - } - - jobject AllocObject(jclass clazz) { - return functions->AllocObject(this,clazz); - } - jobject NewObject(jclass clazz, jmethodID methodID, ...) { - va_list args; - jobject result; - va_start(args, methodID); - result = functions->NewObjectV(this,clazz,methodID,args); - va_end(args); - return result; - } - jobject NewObjectV(jclass clazz, jmethodID methodID, - va_list args) { - return functions->NewObjectV(this,clazz,methodID,args); - } - jobject NewObjectA(jclass clazz, jmethodID methodID, - jvalue *args) { - return functions->NewObjectA(this,clazz,methodID,args); - } - - jclass GetObjectClass(jobject obj) { - return functions->GetObjectClass(this,obj); - } - jboolean IsInstanceOf(jobject obj, jclass clazz) { - return functions->IsInstanceOf(this,obj,clazz); - } - - jmethodID GetMethodID(jclass clazz, const char *name, - const char *sig) { - return functions->GetMethodID(this,clazz,name,sig); - } - - jobject CallObjectMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jobject result; - va_start(args,methodID); - result = functions->CallObjectMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jobject CallObjectMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallObjectMethodV(this,obj,methodID,args); - } - jobject CallObjectMethodA(jobject obj, jmethodID methodID, - jvalue * args) { - return functions->CallObjectMethodA(this,obj,methodID,args); - } - - jboolean CallBooleanMethod(jobject obj, - jmethodID methodID, ...) { - va_list args; - jboolean result; - va_start(args,methodID); - result = functions->CallBooleanMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jboolean CallBooleanMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallBooleanMethodV(this,obj,methodID,args); - } - jboolean CallBooleanMethodA(jobject obj, jmethodID methodID, - jvalue * args) { - return functions->CallBooleanMethodA(this,obj,methodID, args); - } - - jbyte CallByteMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jbyte result; - va_start(args,methodID); - result = functions->CallByteMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jbyte CallByteMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallByteMethodV(this,obj,methodID,args); - } - jbyte CallByteMethodA(jobject obj, jmethodID methodID, - jvalue * args) { - return functions->CallByteMethodA(this,obj,methodID,args); - } - - jchar CallCharMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jchar result; - va_start(args,methodID); - result = functions->CallCharMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jchar CallCharMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallCharMethodV(this,obj,methodID,args); - } - jchar CallCharMethodA(jobject obj, jmethodID methodID, - jvalue * args) { - return functions->CallCharMethodA(this,obj,methodID,args); - } - - jshort CallShortMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jshort result; - va_start(args,methodID); - result = functions->CallShortMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jshort CallShortMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallShortMethodV(this,obj,methodID,args); - } - jshort CallShortMethodA(jobject obj, jmethodID methodID, - jvalue * args) { - return functions->CallShortMethodA(this,obj,methodID,args); - } - - jint CallIntMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jint result; - va_start(args,methodID); - result = functions->CallIntMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jint CallIntMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallIntMethodV(this,obj,methodID,args); - } - jint CallIntMethodA(jobject obj, jmethodID methodID, - jvalue * args) { - return functions->CallIntMethodA(this,obj,methodID,args); - } - - jlong CallLongMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jlong result; - va_start(args,methodID); - result = functions->CallLongMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jlong CallLongMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallLongMethodV(this,obj,methodID,args); - } - jlong CallLongMethodA(jobject obj, jmethodID methodID, - jvalue * args) { - return functions->CallLongMethodA(this,obj,methodID,args); - } - - jfloat CallFloatMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jfloat result; - va_start(args,methodID); - result = functions->CallFloatMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jfloat CallFloatMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallFloatMethodV(this,obj,methodID,args); - } - jfloat CallFloatMethodA(jobject obj, jmethodID methodID, - jvalue * args) { - return functions->CallFloatMethodA(this,obj,methodID,args); - } - - jdouble CallDoubleMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jdouble result; - va_start(args,methodID); - result = functions->CallDoubleMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jdouble CallDoubleMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallDoubleMethodV(this,obj,methodID,args); - } - jdouble CallDoubleMethodA(jobject obj, jmethodID methodID, - jvalue * args) { - return functions->CallDoubleMethodA(this,obj,methodID,args); - } - - void CallVoidMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - va_start(args,methodID); - functions->CallVoidMethodV(this,obj,methodID,args); - va_end(args); - } - void CallVoidMethodV(jobject obj, jmethodID methodID, - va_list args) { - functions->CallVoidMethodV(this,obj,methodID,args); - } - void CallVoidMethodA(jobject obj, jmethodID methodID, - jvalue * args) { - functions->CallVoidMethodA(this,obj,methodID,args); - } - - jobject CallNonvirtualObjectMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jobject result; - va_start(args,methodID); - result = functions->CallNonvirtualObjectMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jobject CallNonvirtualObjectMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualObjectMethodV(this,obj,clazz, - methodID,args); - } - jobject CallNonvirtualObjectMethodA(jobject obj, jclass clazz, - jmethodID methodID, jvalue * args) { - return functions->CallNonvirtualObjectMethodA(this,obj,clazz, - methodID,args); - } - - jboolean CallNonvirtualBooleanMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jboolean result; - va_start(args,methodID); - result = functions->CallNonvirtualBooleanMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jboolean CallNonvirtualBooleanMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualBooleanMethodV(this,obj,clazz, - methodID,args); - } - jboolean CallNonvirtualBooleanMethodA(jobject obj, jclass clazz, - jmethodID methodID, jvalue * args) { - return functions->CallNonvirtualBooleanMethodA(this,obj,clazz, - methodID, args); - } - - jbyte CallNonvirtualByteMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jbyte result; - va_start(args,methodID); - result = functions->CallNonvirtualByteMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jbyte CallNonvirtualByteMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualByteMethodV(this,obj,clazz, - methodID,args); - } - jbyte CallNonvirtualByteMethodA(jobject obj, jclass clazz, - jmethodID methodID, jvalue * args) { - return functions->CallNonvirtualByteMethodA(this,obj,clazz, - methodID,args); - } - - jchar CallNonvirtualCharMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jchar result; - va_start(args,methodID); - result = functions->CallNonvirtualCharMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jchar CallNonvirtualCharMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualCharMethodV(this,obj,clazz, - methodID,args); - } - jchar CallNonvirtualCharMethodA(jobject obj, jclass clazz, - jmethodID methodID, jvalue * args) { - return functions->CallNonvirtualCharMethodA(this,obj,clazz, - methodID,args); - } - - jshort CallNonvirtualShortMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jshort result; - va_start(args,methodID); - result = functions->CallNonvirtualShortMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jshort CallNonvirtualShortMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualShortMethodV(this,obj,clazz, - methodID,args); - } - jshort CallNonvirtualShortMethodA(jobject obj, jclass clazz, - jmethodID methodID, jvalue * args) { - return functions->CallNonvirtualShortMethodA(this,obj,clazz, - methodID,args); - } - - jint CallNonvirtualIntMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jint result; - va_start(args,methodID); - result = functions->CallNonvirtualIntMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jint CallNonvirtualIntMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualIntMethodV(this,obj,clazz, - methodID,args); - } - jint CallNonvirtualIntMethodA(jobject obj, jclass clazz, - jmethodID methodID, jvalue * args) { - return functions->CallNonvirtualIntMethodA(this,obj,clazz, - methodID,args); - } - - jlong CallNonvirtualLongMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jlong result; - va_start(args,methodID); - result = functions->CallNonvirtualLongMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jlong CallNonvirtualLongMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualLongMethodV(this,obj,clazz, - methodID,args); - } - jlong CallNonvirtualLongMethodA(jobject obj, jclass clazz, - jmethodID methodID, jvalue * args) { - return functions->CallNonvirtualLongMethodA(this,obj,clazz, - methodID,args); - } - - jfloat CallNonvirtualFloatMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jfloat result; - va_start(args,methodID); - result = functions->CallNonvirtualFloatMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jfloat CallNonvirtualFloatMethodV(jobject obj, jclass clazz, - jmethodID methodID, - va_list args) { - return functions->CallNonvirtualFloatMethodV(this,obj,clazz, - methodID,args); - } - jfloat CallNonvirtualFloatMethodA(jobject obj, jclass clazz, - jmethodID methodID, - jvalue * args) { - return functions->CallNonvirtualFloatMethodA(this,obj,clazz, - methodID,args); - } - - jdouble CallNonvirtualDoubleMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jdouble result; - va_start(args,methodID); - result = functions->CallNonvirtualDoubleMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jdouble CallNonvirtualDoubleMethodV(jobject obj, jclass clazz, - jmethodID methodID, - va_list args) { - return functions->CallNonvirtualDoubleMethodV(this,obj,clazz, - methodID,args); - } - jdouble CallNonvirtualDoubleMethodA(jobject obj, jclass clazz, - jmethodID methodID, - jvalue * args) { - return functions->CallNonvirtualDoubleMethodA(this,obj,clazz, - methodID,args); - } - - void CallNonvirtualVoidMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - va_start(args,methodID); - functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args); - va_end(args); - } - void CallNonvirtualVoidMethodV(jobject obj, jclass clazz, - jmethodID methodID, - va_list args) { - functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args); - } - void CallNonvirtualVoidMethodA(jobject obj, jclass clazz, - jmethodID methodID, - jvalue * args) { - functions->CallNonvirtualVoidMethodA(this,obj,clazz,methodID,args); - } - - jfieldID GetFieldID(jclass clazz, const char *name, - const char *sig) { - return functions->GetFieldID(this,clazz,name,sig); - } - - jobject GetObjectField(jobject obj, jfieldID fieldID) { - return functions->GetObjectField(this,obj,fieldID); - } - jboolean GetBooleanField(jobject obj, jfieldID fieldID) { - return functions->GetBooleanField(this,obj,fieldID); - } - jbyte GetByteField(jobject obj, jfieldID fieldID) { - return functions->GetByteField(this,obj,fieldID); - } - jchar GetCharField(jobject obj, jfieldID fieldID) { - return functions->GetCharField(this,obj,fieldID); - } - jshort GetShortField(jobject obj, jfieldID fieldID) { - return functions->GetShortField(this,obj,fieldID); - } - jint GetIntField(jobject obj, jfieldID fieldID) { - return functions->GetIntField(this,obj,fieldID); - } - jlong GetLongField(jobject obj, jfieldID fieldID) { - return functions->GetLongField(this,obj,fieldID); - } - jfloat GetFloatField(jobject obj, jfieldID fieldID) { - return functions->GetFloatField(this,obj,fieldID); - } - jdouble GetDoubleField(jobject obj, jfieldID fieldID) { - return functions->GetDoubleField(this,obj,fieldID); - } - - void SetObjectField(jobject obj, jfieldID fieldID, jobject val) { - functions->SetObjectField(this,obj,fieldID,val); - } - void SetBooleanField(jobject obj, jfieldID fieldID, - jboolean val) { - functions->SetBooleanField(this,obj,fieldID,val); - } - void SetByteField(jobject obj, jfieldID fieldID, - jbyte val) { - functions->SetByteField(this,obj,fieldID,val); - } - void SetCharField(jobject obj, jfieldID fieldID, - jchar val) { - functions->SetCharField(this,obj,fieldID,val); - } - void SetShortField(jobject obj, jfieldID fieldID, - jshort val) { - functions->SetShortField(this,obj,fieldID,val); - } - void SetIntField(jobject obj, jfieldID fieldID, - jint val) { - functions->SetIntField(this,obj,fieldID,val); - } - void SetLongField(jobject obj, jfieldID fieldID, - jlong val) { - functions->SetLongField(this,obj,fieldID,val); - } - void SetFloatField(jobject obj, jfieldID fieldID, - jfloat val) { - functions->SetFloatField(this,obj,fieldID,val); - } - void SetDoubleField(jobject obj, jfieldID fieldID, - jdouble val) { - functions->SetDoubleField(this,obj,fieldID,val); - } - - jmethodID GetStaticMethodID(jclass clazz, const char *name, - const char *sig) { - return functions->GetStaticMethodID(this,clazz,name,sig); - } - - jobject CallStaticObjectMethod(jclass clazz, jmethodID methodID, - ...) { - va_list args; - jobject result; - va_start(args,methodID); - result = functions->CallStaticObjectMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jobject CallStaticObjectMethodV(jclass clazz, jmethodID methodID, - va_list args) { - return functions->CallStaticObjectMethodV(this,clazz,methodID,args); - } - jobject CallStaticObjectMethodA(jclass clazz, jmethodID methodID, - jvalue *args) { - return functions->CallStaticObjectMethodA(this,clazz,methodID,args); - } - - jboolean CallStaticBooleanMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jboolean result; - va_start(args,methodID); - result = functions->CallStaticBooleanMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jboolean CallStaticBooleanMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticBooleanMethodV(this,clazz,methodID,args); - } - jboolean CallStaticBooleanMethodA(jclass clazz, - jmethodID methodID, jvalue *args) { - return functions->CallStaticBooleanMethodA(this,clazz,methodID,args); - } - - jbyte CallStaticByteMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jbyte result; - va_start(args,methodID); - result = functions->CallStaticByteMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jbyte CallStaticByteMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticByteMethodV(this,clazz,methodID,args); - } - jbyte CallStaticByteMethodA(jclass clazz, - jmethodID methodID, jvalue *args) { - return functions->CallStaticByteMethodA(this,clazz,methodID,args); - } - - jchar CallStaticCharMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jchar result; - va_start(args,methodID); - result = functions->CallStaticCharMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jchar CallStaticCharMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticCharMethodV(this,clazz,methodID,args); - } - jchar CallStaticCharMethodA(jclass clazz, - jmethodID methodID, jvalue *args) { - return functions->CallStaticCharMethodA(this,clazz,methodID,args); - } - - jshort CallStaticShortMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jshort result; - va_start(args,methodID); - result = functions->CallStaticShortMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jshort CallStaticShortMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticShortMethodV(this,clazz,methodID,args); - } - jshort CallStaticShortMethodA(jclass clazz, - jmethodID methodID, jvalue *args) { - return functions->CallStaticShortMethodA(this,clazz,methodID,args); - } - - jint CallStaticIntMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jint result; - va_start(args,methodID); - result = functions->CallStaticIntMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jint CallStaticIntMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticIntMethodV(this,clazz,methodID,args); - } - jint CallStaticIntMethodA(jclass clazz, - jmethodID methodID, jvalue *args) { - return functions->CallStaticIntMethodA(this,clazz,methodID,args); - } - - jlong CallStaticLongMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jlong result; - va_start(args,methodID); - result = functions->CallStaticLongMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jlong CallStaticLongMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticLongMethodV(this,clazz,methodID,args); - } - jlong CallStaticLongMethodA(jclass clazz, - jmethodID methodID, jvalue *args) { - return functions->CallStaticLongMethodA(this,clazz,methodID,args); - } - - jfloat CallStaticFloatMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jfloat result; - va_start(args,methodID); - result = functions->CallStaticFloatMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jfloat CallStaticFloatMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticFloatMethodV(this,clazz,methodID,args); - } - jfloat CallStaticFloatMethodA(jclass clazz, - jmethodID methodID, jvalue *args) { - return functions->CallStaticFloatMethodA(this,clazz,methodID,args); - } - - jdouble CallStaticDoubleMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jdouble result; - va_start(args,methodID); - result = functions->CallStaticDoubleMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jdouble CallStaticDoubleMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticDoubleMethodV(this,clazz,methodID,args); - } - jdouble CallStaticDoubleMethodA(jclass clazz, - jmethodID methodID, jvalue *args) { - return functions->CallStaticDoubleMethodA(this,clazz,methodID,args); - } - - void CallStaticVoidMethod(jclass cls, jmethodID methodID, ...) { - va_list args; - va_start(args,methodID); - functions->CallStaticVoidMethodV(this,cls,methodID,args); - va_end(args); - } - void CallStaticVoidMethodV(jclass cls, jmethodID methodID, - va_list args) { - functions->CallStaticVoidMethodV(this,cls,methodID,args); - } - void CallStaticVoidMethodA(jclass cls, jmethodID methodID, - jvalue * args) { - functions->CallStaticVoidMethodA(this,cls,methodID,args); - } - - jfieldID GetStaticFieldID(jclass clazz, const char *name, - const char *sig) { - return functions->GetStaticFieldID(this,clazz,name,sig); - } - jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticObjectField(this,clazz,fieldID); - } - jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticBooleanField(this,clazz,fieldID); - } - jbyte GetStaticByteField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticByteField(this,clazz,fieldID); - } - jchar GetStaticCharField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticCharField(this,clazz,fieldID); - } - jshort GetStaticShortField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticShortField(this,clazz,fieldID); - } - jint GetStaticIntField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticIntField(this,clazz,fieldID); - } - jlong GetStaticLongField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticLongField(this,clazz,fieldID); - } - jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticFloatField(this,clazz,fieldID); - } - jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticDoubleField(this,clazz,fieldID); - } - - void SetStaticObjectField(jclass clazz, jfieldID fieldID, - jobject value) { - functions->SetStaticObjectField(this,clazz,fieldID,value); - } - void SetStaticBooleanField(jclass clazz, jfieldID fieldID, - jboolean value) { - functions->SetStaticBooleanField(this,clazz,fieldID,value); - } - void SetStaticByteField(jclass clazz, jfieldID fieldID, - jbyte value) { - functions->SetStaticByteField(this,clazz,fieldID,value); - } - void SetStaticCharField(jclass clazz, jfieldID fieldID, - jchar value) { - functions->SetStaticCharField(this,clazz,fieldID,value); - } - void SetStaticShortField(jclass clazz, jfieldID fieldID, - jshort value) { - functions->SetStaticShortField(this,clazz,fieldID,value); - } - void SetStaticIntField(jclass clazz, jfieldID fieldID, - jint value) { - functions->SetStaticIntField(this,clazz,fieldID,value); - } - void SetStaticLongField(jclass clazz, jfieldID fieldID, - jlong value) { - functions->SetStaticLongField(this,clazz,fieldID,value); - } - void SetStaticFloatField(jclass clazz, jfieldID fieldID, - jfloat value) { - functions->SetStaticFloatField(this,clazz,fieldID,value); - } - void SetStaticDoubleField(jclass clazz, jfieldID fieldID, - jdouble value) { - functions->SetStaticDoubleField(this,clazz,fieldID,value); - } - - jstring NewString(const jchar *unicode, jsize len) { - return functions->NewString(this,unicode,len); - } - jsize GetStringLength(jstring str) { - return functions->GetStringLength(this,str); - } - const jchar *GetStringChars(jstring str, jboolean *isCopy) { - return functions->GetStringChars(this,str,isCopy); - } - void ReleaseStringChars(jstring str, const jchar *chars) { - functions->ReleaseStringChars(this,str,chars); - } - - jstring NewStringUTF(const char *utf) { - return functions->NewStringUTF(this,utf); - } - jsize GetStringUTFLength(jstring str) { - return functions->GetStringUTFLength(this,str); - } - const char* GetStringUTFChars(jstring str, jboolean *isCopy) { - return functions->GetStringUTFChars(this,str,isCopy); - } - void ReleaseStringUTFChars(jstring str, const char* chars) { - functions->ReleaseStringUTFChars(this,str,chars); - } - - jsize GetArrayLength(jarray array) { - return functions->GetArrayLength(this,array); - } - - jobjectArray NewObjectArray(jsize len, jclass clazz, - jobject init) { - return functions->NewObjectArray(this,len,clazz,init); - } - jobject GetObjectArrayElement(jobjectArray array, jsize index) { - return functions->GetObjectArrayElement(this,array,index); - } - void SetObjectArrayElement(jobjectArray array, jsize index, - jobject val) { - functions->SetObjectArrayElement(this,array,index,val); - } - - jbooleanArray NewBooleanArray(jsize len) { - return functions->NewBooleanArray(this,len); - } - jbyteArray NewByteArray(jsize len) { - return functions->NewByteArray(this,len); - } - jcharArray NewCharArray(jsize len) { - return functions->NewCharArray(this,len); - } - jshortArray NewShortArray(jsize len) { - return functions->NewShortArray(this,len); - } - jintArray NewIntArray(jsize len) { - return functions->NewIntArray(this,len); - } - jlongArray NewLongArray(jsize len) { - return functions->NewLongArray(this,len); - } - jfloatArray NewFloatArray(jsize len) { - return functions->NewFloatArray(this,len); - } - jdoubleArray NewDoubleArray(jsize len) { - return functions->NewDoubleArray(this,len); - } - - jboolean * GetBooleanArrayElements(jbooleanArray array, jboolean *isCopy) { - return functions->GetBooleanArrayElements(this,array,isCopy); - } - jbyte * GetByteArrayElements(jbyteArray array, jboolean *isCopy) { - return functions->GetByteArrayElements(this,array,isCopy); - } - jchar * GetCharArrayElements(jcharArray array, jboolean *isCopy) { - return functions->GetCharArrayElements(this,array,isCopy); - } - jshort * GetShortArrayElements(jshortArray array, jboolean *isCopy) { - return functions->GetShortArrayElements(this,array,isCopy); - } - jint * GetIntArrayElements(jintArray array, jboolean *isCopy) { - return functions->GetIntArrayElements(this,array,isCopy); - } - jlong * GetLongArrayElements(jlongArray array, jboolean *isCopy) { - return functions->GetLongArrayElements(this,array,isCopy); - } - jfloat * GetFloatArrayElements(jfloatArray array, jboolean *isCopy) { - return functions->GetFloatArrayElements(this,array,isCopy); - } - jdouble * GetDoubleArrayElements(jdoubleArray array, jboolean *isCopy) { - return functions->GetDoubleArrayElements(this,array,isCopy); - } - - void ReleaseBooleanArrayElements(jbooleanArray array, - jboolean *elems, - jint mode) { - functions->ReleaseBooleanArrayElements(this,array,elems,mode); - } - void ReleaseByteArrayElements(jbyteArray array, - jbyte *elems, - jint mode) { - functions->ReleaseByteArrayElements(this,array,elems,mode); - } - void ReleaseCharArrayElements(jcharArray array, - jchar *elems, - jint mode) { - functions->ReleaseCharArrayElements(this,array,elems,mode); - } - void ReleaseShortArrayElements(jshortArray array, - jshort *elems, - jint mode) { - functions->ReleaseShortArrayElements(this,array,elems,mode); - } - void ReleaseIntArrayElements(jintArray array, - jint *elems, - jint mode) { - functions->ReleaseIntArrayElements(this,array,elems,mode); - } - void ReleaseLongArrayElements(jlongArray array, - jlong *elems, - jint mode) { - functions->ReleaseLongArrayElements(this,array,elems,mode); - } - void ReleaseFloatArrayElements(jfloatArray array, - jfloat *elems, - jint mode) { - functions->ReleaseFloatArrayElements(this,array,elems,mode); - } - void ReleaseDoubleArrayElements(jdoubleArray array, - jdouble *elems, - jint mode) { - functions->ReleaseDoubleArrayElements(this,array,elems,mode); - } - - void GetBooleanArrayRegion(jbooleanArray array, - jsize start, jsize len, jboolean *buf) { - functions->GetBooleanArrayRegion(this,array,start,len,buf); - } - void GetByteArrayRegion(jbyteArray array, - jsize start, jsize len, jbyte *buf) { - functions->GetByteArrayRegion(this,array,start,len,buf); - } - void GetCharArrayRegion(jcharArray array, - jsize start, jsize len, jchar *buf) { - functions->GetCharArrayRegion(this,array,start,len,buf); - } - void GetShortArrayRegion(jshortArray array, - jsize start, jsize len, jshort *buf) { - functions->GetShortArrayRegion(this,array,start,len,buf); - } - void GetIntArrayRegion(jintArray array, - jsize start, jsize len, jint *buf) { - functions->GetIntArrayRegion(this,array,start,len,buf); - } - void GetLongArrayRegion(jlongArray array, - jsize start, jsize len, jlong *buf) { - functions->GetLongArrayRegion(this,array,start,len,buf); - } - void GetFloatArrayRegion(jfloatArray array, - jsize start, jsize len, jfloat *buf) { - functions->GetFloatArrayRegion(this,array,start,len,buf); - } - void GetDoubleArrayRegion(jdoubleArray array, - jsize start, jsize len, jdouble *buf) { - functions->GetDoubleArrayRegion(this,array,start,len,buf); - } - - void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len, - jboolean *buf) { - functions->SetBooleanArrayRegion(this,array,start,len,buf); - } - void SetByteArrayRegion(jbyteArray array, jsize start, jsize len, - jbyte *buf) { - functions->SetByteArrayRegion(this,array,start,len,buf); - } - void SetCharArrayRegion(jcharArray array, jsize start, jsize len, - jchar *buf) { - functions->SetCharArrayRegion(this,array,start,len,buf); - } - void SetShortArrayRegion(jshortArray array, jsize start, jsize len, - jshort *buf) { - functions->SetShortArrayRegion(this,array,start,len,buf); - } - void SetIntArrayRegion(jintArray array, jsize start, jsize len, - jint *buf) { - functions->SetIntArrayRegion(this,array,start,len,buf); - } - void SetLongArrayRegion(jlongArray array, jsize start, jsize len, - jlong *buf) { - functions->SetLongArrayRegion(this,array,start,len,buf); - } - void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len, - jfloat *buf) { - functions->SetFloatArrayRegion(this,array,start,len,buf); - } - void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len, - jdouble *buf) { - functions->SetDoubleArrayRegion(this,array,start,len,buf); - } - - jint RegisterNatives(jclass clazz, const JNINativeMethod *methods, - jint nMethods) { - return functions->RegisterNatives(this,clazz,methods,nMethods); - } - jint UnregisterNatives(jclass clazz) { - return functions->UnregisterNatives(this,clazz); - } - - jint MonitorEnter(jobject obj) { - return functions->MonitorEnter(this,obj); - } - jint MonitorExit(jobject obj) { - return functions->MonitorExit(this,obj); - } - - jint GetJavaVM(JavaVM **vm) { - return functions->GetJavaVM(this,vm); - } - -#endif /* __cplusplus */ -}; - -/* These structures will be VM-specific. */ - -typedef struct JDK1_1InitArgs { - jint reserved0; - void *reserved1; - - jint checkSource; - jint nativeStackSize; - jint javaStackSize; - jint minHeapSize; - jint maxHeapSize; - jint verifyMode; - char *classpath; - - jint (*vfprintf)(FILE *fp, const char *format, va_list args); - void (*exit)(jint code); - void (*abort)(); - - jint enableClassGC; - jint enableVerboseGC; - jint disableAsyncGC; - jint verbose; - jint debugAgent; - jint debugPort; -} JDK1_1InitArgs; - -typedef struct JDK1_1AttachArgs { - void * __padding; /* C compilers don't allow empty structures. */ -} JDK1_1AttachArgs; - -/* End VM-specific. */ - -struct JNIInvokeInterface_ { - void *reserved0; - void *reserved1; - void *reserved2; - - jint (*DestroyJavaVM)(JavaVM *vm); - - jint (*AttachCurrentThread) - (JavaVM *vm, JNIEnv **penv, void *args); - - jint (*DetachCurrentThread)(JavaVM *vm); -}; - -struct JavaVM_ { - const struct JNIInvokeInterface_ *functions; - void *reserved0; - void *reserved1; - void *reserved2; -#ifdef __cplusplus - - jint DestroyJavaVM() { - return functions->DestroyJavaVM(this); - } - jint AttachCurrentThread(JNIEnv **penv, void *args) { - return functions->AttachCurrentThread(this, penv, args); - } - jint DetachCurrentThread() { - return functions->DetachCurrentThread(this); - } - -#endif -}; - -void JNICALL JNI_GetDefaultJavaVMInitArgs(void *); - -jint JNICALL JNI_CreateJavaVM(JavaVM **, JNIEnv **, void *); - -jint JNICALL JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *); - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* JNI_H */ - - diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jni_md.h b/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jni_md.h deleted file mode 100644 index fd7c0786bba..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jni_md.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ***** 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 Java Runtime Interface. - * - * The Initial Developer of the Original Code is - * Sun Microsystems, Inc. - * Portions created by the Initial Developer are Copyright (C) 1993-1996 - * 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 ***** */ - -#ifndef JNI_MD_H -#define JNI_MD_H - -#include "jri_md.h" - -#define JNICALL JRI_CALLBACK - -#ifdef XP_WIN -#define JNIEXPORT __declspec(dllexport) -#else -#define JNIEXPORT -#endif - -#endif /* JNI_MD_H */ diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jri.h b/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jri.h deleted file mode 100644 index 590be8d0074..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jri.h +++ /dev/null @@ -1,685 +0,0 @@ -/* -*- Mode: C; tab-width: 4; -*- */ -/* ***** 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 Java Runtime Interface. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1996 - * 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 ***** */ - -#ifndef JRI_H -#define JRI_H - -#include "jritypes.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/******************************************************************************* - * JRIEnv - ******************************************************************************/ - -/* The type of the JRIEnv interface. */ -typedef struct JRIEnvInterface JRIEnvInterface; - -/* The type of a JRIEnv instance. */ -typedef const JRIEnvInterface* JRIEnv; - -/******************************************************************************* - * JRIEnv Operations - ******************************************************************************/ - -#define JRI_DefineClass(env, classLoader, buf, bufLen) \ - (((*(env))->DefineClass)(env, JRI_DefineClass_op, classLoader, buf, bufLen)) - -#define JRI_FindClass(env, name) \ - (((*(env))->FindClass)(env, JRI_FindClass_op, name)) - -#define JRI_Throw(env, obj) \ - (((*(env))->Throw)(env, JRI_Throw_op, obj)) - -#define JRI_ThrowNew(env, clazz, message) \ - (((*(env))->ThrowNew)(env, JRI_ThrowNew_op, clazz, message)) - -#define JRI_ExceptionOccurred(env) \ - (((*(env))->ExceptionOccurred)(env, JRI_ExceptionOccurred_op)) - -#define JRI_ExceptionDescribe(env) \ - (((*(env))->ExceptionDescribe)(env, JRI_ExceptionDescribe_op)) - -#define JRI_ExceptionClear(env) \ - (((*(env))->ExceptionClear)(env, JRI_ExceptionClear_op)) - -#define JRI_NewGlobalRef(env, ref) \ - (((*(env))->NewGlobalRef)(env, JRI_NewGlobalRef_op, ref)) - -#define JRI_DisposeGlobalRef(env, gref) \ - (((*(env))->DisposeGlobalRef)(env, JRI_DisposeGlobalRef_op, gref)) - -#define JRI_GetGlobalRef(env, gref) \ - (((*(env))->GetGlobalRef)(env, JRI_GetGlobalRef_op, gref)) - -#define JRI_SetGlobalRef(env, gref, ref) \ - (((*(env))->SetGlobalRef)(env, JRI_SetGlobalRef_op, gref, ref)) - -#define JRI_IsSameObject(env, a, b) \ - (((*(env))->IsSameObject)(env, JRI_IsSameObject_op, a, b)) - -#define JRI_NewObject(env) ((*(env))->NewObject) -#define JRI_NewObjectV(env, clazz, methodID, args) \ - (((*(env))->NewObjectV)(env, JRI_NewObject_op_va_list, clazz, methodID, args)) -#define JRI_NewObjectA(env, clazz, method, args) \ - (((*(env))->NewObjectA)(env, JRI_NewObject_op_array, clazz, methodID, args)) - -#define JRI_GetObjectClass(env, obj) \ - (((*(env))->GetObjectClass)(env, JRI_GetObjectClass_op, obj)) - -#define JRI_IsInstanceOf(env, obj, clazz) \ - (((*(env))->IsInstanceOf)(env, JRI_IsInstanceOf_op, obj, clazz)) - -#define JRI_GetMethodID(env, clazz, name, sig) \ - (((*(env))->GetMethodID)(env, JRI_GetMethodID_op, clazz, name, sig)) - -#define JRI_CallMethod(env) ((*(env))->CallMethod) -#define JRI_CallMethodV(env, obj, methodID, args) \ - (((*(env))->CallMethodV)(env, JRI_CallMethod_op_va_list, obj, methodID, args)) -#define JRI_CallMethodA(env, obj, methodID, args) \ - (((*(env))->CallMethodA)(env, JRI_CallMethod_op_array, obj, methodID, args)) - -#define JRI_CallMethodBoolean(env) ((*(env))->CallMethodBoolean) -#define JRI_CallMethodBooleanV(env, obj, methodID, args) \ - (((*(env))->CallMethodBooleanV)(env, JRI_CallMethodBoolean_op_va_list, obj, methodID, args)) -#define JRI_CallMethodBooleanA(env, obj, methodID, args) \ - (((*(env))->CallMethodBooleanA)(env, JRI_CallMethodBoolean_op_array, obj, methodID, args)) - -#define JRI_CallMethodByte(env) ((*(env))->CallMethodByte) -#define JRI_CallMethodByteV(env, obj, methodID, args) \ - (((*(env))->CallMethodByteV)(env, JRI_CallMethodByte_op_va_list, obj, methodID, args)) -#define JRI_CallMethodByteA(env, obj, methodID, args) \ - (((*(env))->CallMethodByteA)(env, JRI_CallMethodByte_op_array, obj, methodID, args)) - -#define JRI_CallMethodChar(env) ((*(env))->CallMethodChar) -#define JRI_CallMethodCharV(env, obj, methodID, args) \ - (((*(env))->CallMethodCharV)(env, JRI_CallMethodChar_op_va_list, obj, methodID, args)) -#define JRI_CallMethodCharA(env, obj, methodID, args) \ - (((*(env))->CallMethodCharA)(env, JRI_CallMethodChar_op_array, obj, methodID, args)) - -#define JRI_CallMethodShort(env) ((*(env))->CallMethodShort) -#define JRI_CallMethodShortV(env, obj, methodID, args) \ - (((*(env))->CallMethodShortV)(env, JRI_CallMethodShort_op_va_list, obj, methodID, args)) -#define JRI_CallMethodShortA(env, obj, methodID, args) \ - (((*(env))->CallMethodShortA)(env, JRI_CallMethodShort_op_array, obj, methodID, args)) - -#define JRI_CallMethodInt(env) ((*(env))->CallMethodInt) -#define JRI_CallMethodIntV(env, obj, methodID, args) \ - (((*(env))->CallMethodIntV)(env, JRI_CallMethodInt_op_va_list, obj, methodID, args)) -#define JRI_CallMethodIntA(env, obj, methodID, args) \ - (((*(env))->CallMethodIntA)(env, JRI_CallMethodInt_op_array, obj, methodID, args)) - -#define JRI_CallMethodLong(env) ((*(env))->CallMethodLong) -#define JRI_CallMethodLongV(env, obj, methodID, args) \ - (((*(env))->CallMethodLongV)(env, JRI_CallMethodLong_op_va_list, obj, methodID, args)) -#define JRI_CallMethodLongA(env, obj, methodID, args) \ - (((*(env))->CallMethodLongA)(env, JRI_CallMethodLong_op_array, obj, methodID, args)) - -#define JRI_CallMethodFloat(env) ((*(env))->CallMethodFloat) -#define JRI_CallMethodFloatV(env, obj, methodID, args) \ - (((*(env))->CallMethodFloatV)(env, JRI_CallMethodFloat_op_va_list, obj, methodID, args)) -#define JRI_CallMethodFloatA(env, obj, methodID, args) \ - (((*(env))->CallMethodFloatA)(env, JRI_CallMethodFloat_op_array, obj, methodID, args)) - -#define JRI_CallMethodDouble(env) ((*(env))->CallMethodDouble) -#define JRI_CallMethodDoubleV(env, obj, methodID, args) \ - (((*(env))->CallMethodDoubleV)(env, JRI_CallMethodDouble_op_va_list, obj, methodID, args)) -#define JRI_CallMethodDoubleA(env, obj, methodID, args) \ - (((*(env))->CallMethodDoubleA)(env, JRI_CallMethodDouble_op_array, obj, methodID, args)) - -#define JRI_GetFieldID(env, clazz, name, sig) \ - (((*(env))->GetFieldID)(env, JRI_GetFieldID_op, clazz, name, sig)) - -#define JRI_GetField(env, obj, fieldID) \ - (((*(env))->GetField)(env, JRI_GetField_op, obj, fieldID)) - -#define JRI_GetFieldBoolean(env, obj, fieldID) \ - (((*(env))->GetFieldBoolean)(env, JRI_GetFieldBoolean_op, obj, fieldID)) - -#define JRI_GetFieldByte(env, obj, fieldID) \ - (((*(env))->GetFieldByte)(env, JRI_GetFieldByte_op, obj, fieldID)) - -#define JRI_GetFieldChar(env, obj, fieldID) \ - (((*(env))->GetFieldChar)(env, JRI_GetFieldChar_op, obj, fieldID)) - -#define JRI_GetFieldShort(env, obj, fieldID) \ - (((*(env))->GetFieldShort)(env, JRI_GetFieldShort_op, obj, fieldID)) - -#define JRI_GetFieldInt(env, obj, fieldID) \ - (((*(env))->GetFieldInt)(env, JRI_GetFieldInt_op, obj, fieldID)) - -#define JRI_GetFieldLong(env, obj, fieldID) \ - (((*(env))->GetFieldLong)(env, JRI_GetFieldLong_op, obj, fieldID)) - -#define JRI_GetFieldFloat(env, obj, fieldID) \ - (((*(env))->GetFieldFloat)(env, JRI_GetFieldFloat_op, obj, fieldID)) - -#define JRI_GetFieldDouble(env, obj, fieldID) \ - (((*(env))->GetFieldDouble)(env, JRI_GetFieldDouble_op, obj, fieldID)) - -#define JRI_SetField(env, obj, fieldID, value) \ - (((*(env))->SetField)(env, JRI_SetField_op, obj, fieldID, value)) - -#define JRI_SetFieldBoolean(env, obj, fieldID, value) \ - (((*(env))->SetFieldBoolean)(env, JRI_SetFieldBoolean_op, obj, fieldID, value)) - -#define JRI_SetFieldByte(env, obj, fieldID, value) \ - (((*(env))->SetFieldByte)(env, JRI_SetFieldByte_op, obj, fieldID, value)) - -#define JRI_SetFieldChar(env, obj, fieldID, value) \ - (((*(env))->SetFieldChar)(env, JRI_SetFieldChar_op, obj, fieldID, value)) - -#define JRI_SetFieldShort(env, obj, fieldID, value) \ - (((*(env))->SetFieldShort)(env, JRI_SetFieldShort_op, obj, fieldID, value)) - -#define JRI_SetFieldInt(env, obj, fieldID, value) \ - (((*(env))->SetFieldInt)(env, JRI_SetFieldInt_op, obj, fieldID, value)) - -#define JRI_SetFieldLong(env, obj, fieldID, value) \ - (((*(env))->SetFieldLong)(env, JRI_SetFieldLong_op, obj, fieldID, value)) - -#define JRI_SetFieldFloat(env, obj, fieldID, value) \ - (((*(env))->SetFieldFloat)(env, JRI_SetFieldFloat_op, obj, fieldID, value)) - -#define JRI_SetFieldDouble(env, obj, fieldID, value) \ - (((*(env))->SetFieldDouble)(env, JRI_SetFieldDouble_op, obj, fieldID, value)) - -#define JRI_IsSubclassOf(env, a, b) \ - (((*(env))->IsSubclassOf)(env, JRI_IsSubclassOf_op, a, b)) - -#define JRI_GetStaticMethodID(env, clazz, name, sig) \ - (((*(env))->GetStaticMethodID)(env, JRI_GetStaticMethodID_op, clazz, name, sig)) - -#define JRI_CallStaticMethod(env) ((*(env))->CallStaticMethod) -#define JRI_CallStaticMethodV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodV)(env, JRI_CallStaticMethod_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodA)(env, JRI_CallStaticMethod_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodBoolean(env) ((*(env))->CallStaticMethodBoolean) -#define JRI_CallStaticMethodBooleanV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodBooleanV)(env, JRI_CallStaticMethodBoolean_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodBooleanA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodBooleanA)(env, JRI_CallStaticMethodBoolean_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodByte(env) ((*(env))->CallStaticMethodByte) -#define JRI_CallStaticMethodByteV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodByteV)(env, JRI_CallStaticMethodByte_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodByteA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodByteA)(env, JRI_CallStaticMethodByte_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodChar(env) ((*(env))->CallStaticMethodChar) -#define JRI_CallStaticMethodCharV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodCharV)(env, JRI_CallStaticMethodChar_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodCharA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodCharA)(env, JRI_CallStaticMethodChar_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodShort(env) ((*(env))->CallStaticMethodShort) -#define JRI_CallStaticMethodShortV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodShortV)(env, JRI_CallStaticMethodShort_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodShortA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodShortA)(env, JRI_CallStaticMethodShort_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodInt(env) ((*(env))->CallStaticMethodInt) -#define JRI_CallStaticMethodIntV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodIntV)(env, JRI_CallStaticMethodInt_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodIntA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodIntA)(env, JRI_CallStaticMethodInt_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodLong(env) ((*(env))->CallStaticMethodLong) -#define JRI_CallStaticMethodLongV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodLongV)(env, JRI_CallStaticMethodLong_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodLongA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodLongA)(env, JRI_CallStaticMethodLong_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodFloat(env) ((*(env))->CallStaticMethodFloat) -#define JRI_CallStaticMethodFloatV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodFloatV)(env, JRI_CallStaticMethodFloat_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodFloatA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodFloatA)(env, JRI_CallStaticMethodFloat_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodDouble(env) ((*(env))->CallStaticMethodDouble) -#define JRI_CallStaticMethodDoubleV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodDoubleV)(env, JRI_CallStaticMethodDouble_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodDoubleA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodDoubleA)(env, JRI_CallStaticMethodDouble_op_array, clazz, methodID, args)) - -#define JRI_GetStaticFieldID(env, clazz, name, sig) \ - (((*(env))->GetStaticFieldID)(env, JRI_GetStaticFieldID_op, clazz, name, sig)) - -#define JRI_GetStaticField(env, clazz, fieldID) \ - (((*(env))->GetStaticField)(env, JRI_GetStaticField_op, clazz, fieldID)) - -#define JRI_GetStaticFieldBoolean(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldBoolean)(env, JRI_GetStaticFieldBoolean_op, clazz, fieldID)) - -#define JRI_GetStaticFieldByte(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldByte)(env, JRI_GetStaticFieldByte_op, clazz, fieldID)) - -#define JRI_GetStaticFieldChar(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldChar)(env, JRI_GetStaticFieldChar_op, clazz, fieldID)) - -#define JRI_GetStaticFieldShort(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldShort)(env, JRI_GetStaticFieldShort_op, clazz, fieldID)) - -#define JRI_GetStaticFieldInt(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldInt)(env, JRI_GetStaticFieldInt_op, clazz, fieldID)) - -#define JRI_GetStaticFieldLong(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldLong)(env, JRI_GetStaticFieldLong_op, clazz, fieldID)) - -#define JRI_GetStaticFieldFloat(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldFloat)(env, JRI_GetStaticFieldFloat_op, clazz, fieldID)) - -#define JRI_GetStaticFieldDouble(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldDouble)(env, JRI_GetStaticFieldDouble_op, clazz, fieldID)) - -#define JRI_SetStaticField(env, clazz, fieldID, value) \ - (((*(env))->SetStaticField)(env, JRI_SetStaticField_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldBoolean(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldBoolean)(env, JRI_SetStaticFieldBoolean_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldByte(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldByte)(env, JRI_SetStaticFieldByte_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldChar(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldChar)(env, JRI_SetStaticFieldChar_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldShort(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldShort)(env, JRI_SetStaticFieldShort_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldInt(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldInt)(env, JRI_SetStaticFieldInt_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldLong(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldLong)(env, JRI_SetStaticFieldLong_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldFloat(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldFloat)(env, JRI_SetStaticFieldFloat_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldDouble(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldDouble)(env, JRI_SetStaticFieldDouble_op, clazz, fieldID, value)) - -#define JRI_NewString(env, unicode, len) \ - (((*(env))->NewString)(env, JRI_NewString_op, unicode, len)) - -#define JRI_GetStringLength(env, string) \ - (((*(env))->GetStringLength)(env, JRI_GetStringLength_op, string)) - -#define JRI_GetStringChars(env, string) \ - (((*(env))->GetStringChars)(env, JRI_GetStringChars_op, string)) - -#define JRI_NewStringUTF(env, utf, len) \ - (((*(env))->NewStringUTF)(env, JRI_NewStringUTF_op, utf, len)) - -#define JRI_GetStringUTFLength(env, string) \ - (((*(env))->GetStringUTFLength)(env, JRI_GetStringUTFLength_op, string)) - -#define JRI_GetStringUTFChars(env, string) \ - (((*(env))->GetStringUTFChars)(env, JRI_GetStringUTFChars_op, string)) - -#define JRI_NewScalarArray(env, length, elementSig, initialElements) \ - (((*(env))->NewScalarArray)(env, JRI_NewScalarArray_op, length, elementSig, initialElements)) - -#define JRI_GetScalarArrayLength(env, array) \ - (((*(env))->GetScalarArrayLength)(env, JRI_GetScalarArrayLength_op, array)) - -#define JRI_GetScalarArrayElements(env, array) \ - (((*(env))->GetScalarArrayElements)(env, JRI_GetScalarArrayElements_op, array)) - -#define JRI_NewObjectArray(env, length, elementClass, initialElement) \ - (((*(env))->NewObjectArray)(env, JRI_NewObjectArray_op, length, elementClass, initialElement)) - -#define JRI_GetObjectArrayLength(env, array) \ - (((*(env))->GetObjectArrayLength)(env, JRI_GetObjectArrayLength_op, array)) - -#define JRI_GetObjectArrayElement(env, array, index) \ - (((*(env))->GetObjectArrayElement)(env, JRI_GetObjectArrayElement_op, array, index)) - -#define JRI_SetObjectArrayElement(env, array, index, value) \ - (((*(env))->SetObjectArrayElement)(env, JRI_SetObjectArrayElement_op, array, index, value)) - -#define JRI_RegisterNatives(env, clazz, nameAndSigArray, nativeProcArray) \ - (((*(env))->RegisterNatives)(env, JRI_RegisterNatives_op, clazz, nameAndSigArray, nativeProcArray)) - -#define JRI_UnregisterNatives(env, clazz) \ - (((*(env))->UnregisterNatives)(env, JRI_UnregisterNatives_op, clazz)) - -#define JRI_NewStringPlatform(env, string, len, encoding, encodingLength) \ - (((*(env))->NewStringPlatform)(env, JRI_NewStringPlatform_op, string, len, encoding, encodingLength)) - -#define JRI_GetStringPlatformChars(env, string, encoding, encodingLength) \ - (((*(env))->GetStringPlatformChars)(env, JRI_GetStringPlatformChars_op, string, encoding, encodingLength)) - - -/******************************************************************************* - * JRIEnv Interface - ******************************************************************************/ - -struct java_lang_ClassLoader; -struct java_lang_Class; -struct java_lang_Throwable; -struct java_lang_Object; -struct java_lang_String; - -struct JRIEnvInterface { - void* reserved0; - void* reserved1; - void* reserved2; - void* reserved3; - struct java_lang_Class* (*FindClass)(JRIEnv* env, jint op, const char* a); - void (*Throw)(JRIEnv* env, jint op, struct java_lang_Throwable* a); - void (*ThrowNew)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b); - struct java_lang_Throwable* (*ExceptionOccurred)(JRIEnv* env, jint op); - void (*ExceptionDescribe)(JRIEnv* env, jint op); - void (*ExceptionClear)(JRIEnv* env, jint op); - jglobal (*NewGlobalRef)(JRIEnv* env, jint op, void* a); - void (*DisposeGlobalRef)(JRIEnv* env, jint op, jglobal a); - void* (*GetGlobalRef)(JRIEnv* env, jint op, jglobal a); - void (*SetGlobalRef)(JRIEnv* env, jint op, jglobal a, void* b); - jbool (*IsSameObject)(JRIEnv* env, jint op, void* a, void* b); - void* (*NewObject)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - void* (*NewObjectV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - void* (*NewObjectA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - struct java_lang_Class* (*GetObjectClass)(JRIEnv* env, jint op, void* a); - jbool (*IsInstanceOf)(JRIEnv* env, jint op, void* a, struct java_lang_Class* b); - jint (*GetMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c); - void* (*CallMethod)(JRIEnv* env, jint op, void* a, jint b, ...); - void* (*CallMethodV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - void* (*CallMethodA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jbool (*CallMethodBoolean)(JRIEnv* env, jint op, void* a, jint b, ...); - jbool (*CallMethodBooleanV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jbool (*CallMethodBooleanA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jbyte (*CallMethodByte)(JRIEnv* env, jint op, void* a, jint b, ...); - jbyte (*CallMethodByteV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jbyte (*CallMethodByteA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jchar (*CallMethodChar)(JRIEnv* env, jint op, void* a, jint b, ...); - jchar (*CallMethodCharV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jchar (*CallMethodCharA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jshort (*CallMethodShort)(JRIEnv* env, jint op, void* a, jint b, ...); - jshort (*CallMethodShortV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jshort (*CallMethodShortA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jint (*CallMethodInt)(JRIEnv* env, jint op, void* a, jint b, ...); - jint (*CallMethodIntV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jint (*CallMethodIntA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jlong (*CallMethodLong)(JRIEnv* env, jint op, void* a, jint b, ...); - jlong (*CallMethodLongV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jlong (*CallMethodLongA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jfloat (*CallMethodFloat)(JRIEnv* env, jint op, void* a, jint b, ...); - jfloat (*CallMethodFloatV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jfloat (*CallMethodFloatA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jdouble (*CallMethodDouble)(JRIEnv* env, jint op, void* a, jint b, ...); - jdouble (*CallMethodDoubleV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jdouble (*CallMethodDoubleA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jint (*GetFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c); - void* (*GetField)(JRIEnv* env, jint op, void* a, jint b); - jbool (*GetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b); - jbyte (*GetFieldByte)(JRIEnv* env, jint op, void* a, jint b); - jchar (*GetFieldChar)(JRIEnv* env, jint op, void* a, jint b); - jshort (*GetFieldShort)(JRIEnv* env, jint op, void* a, jint b); - jint (*GetFieldInt)(JRIEnv* env, jint op, void* a, jint b); - jlong (*GetFieldLong)(JRIEnv* env, jint op, void* a, jint b); - jfloat (*GetFieldFloat)(JRIEnv* env, jint op, void* a, jint b); - jdouble (*GetFieldDouble)(JRIEnv* env, jint op, void* a, jint b); - void (*SetField)(JRIEnv* env, jint op, void* a, jint b, void* c); - void (*SetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b, jbool c); - void (*SetFieldByte)(JRIEnv* env, jint op, void* a, jint b, jbyte c); - void (*SetFieldChar)(JRIEnv* env, jint op, void* a, jint b, jchar c); - void (*SetFieldShort)(JRIEnv* env, jint op, void* a, jint b, jshort c); - void (*SetFieldInt)(JRIEnv* env, jint op, void* a, jint b, jint c); - void (*SetFieldLong)(JRIEnv* env, jint op, void* a, jint b, jlong c); - void (*SetFieldFloat)(JRIEnv* env, jint op, void* a, jint b, jfloat c); - void (*SetFieldDouble)(JRIEnv* env, jint op, void* a, jint b, jdouble c); - jbool (*IsSubclassOf)(JRIEnv* env, jint op, struct java_lang_Class* a, struct java_lang_Class* b); - jint (*GetStaticMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c); - void* (*CallStaticMethod)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - void* (*CallStaticMethodV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - void* (*CallStaticMethodA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jbool (*CallStaticMethodBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jbool (*CallStaticMethodBooleanV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jbool (*CallStaticMethodBooleanA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jbyte (*CallStaticMethodByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jbyte (*CallStaticMethodByteV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jbyte (*CallStaticMethodByteA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jchar (*CallStaticMethodChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jchar (*CallStaticMethodCharV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jchar (*CallStaticMethodCharA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jshort (*CallStaticMethodShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jshort (*CallStaticMethodShortV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jshort (*CallStaticMethodShortA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jint (*CallStaticMethodInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jint (*CallStaticMethodIntV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jint (*CallStaticMethodIntA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jlong (*CallStaticMethodLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jlong (*CallStaticMethodLongV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jlong (*CallStaticMethodLongA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jfloat (*CallStaticMethodFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jfloat (*CallStaticMethodFloatV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jfloat (*CallStaticMethodFloatA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jdouble (*CallStaticMethodDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jdouble (*CallStaticMethodDoubleV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jdouble (*CallStaticMethodDoubleA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jint (*GetStaticFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c); - void* (*GetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jbool (*GetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jbyte (*GetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jchar (*GetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jshort (*GetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jint (*GetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jlong (*GetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jfloat (*GetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jdouble (*GetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - void (*SetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, void* c); - void (*SetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbool c); - void (*SetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbyte c); - void (*SetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jchar c); - void (*SetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jshort c); - void (*SetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jint c); - void (*SetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jlong c); - void (*SetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jfloat c); - void (*SetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jdouble c); - struct java_lang_String* (*NewString)(JRIEnv* env, jint op, const jchar* a, jint b); - jint (*GetStringLength)(JRIEnv* env, jint op, struct java_lang_String* a); - const jchar* (*GetStringChars)(JRIEnv* env, jint op, struct java_lang_String* a); - struct java_lang_String* (*NewStringUTF)(JRIEnv* env, jint op, const jbyte* a, jint b); - jint (*GetStringUTFLength)(JRIEnv* env, jint op, struct java_lang_String* a); - const jbyte* (*GetStringUTFChars)(JRIEnv* env, jint op, struct java_lang_String* a); - void* (*NewScalarArray)(JRIEnv* env, jint op, jint a, const char* b, const jbyte* c); - jint (*GetScalarArrayLength)(JRIEnv* env, jint op, void* a); - jbyte* (*GetScalarArrayElements)(JRIEnv* env, jint op, void* a); - void* (*NewObjectArray)(JRIEnv* env, jint op, jint a, struct java_lang_Class* b, void* c); - jint (*GetObjectArrayLength)(JRIEnv* env, jint op, void* a); - void* (*GetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b); - void (*SetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b, void* c); - void (*RegisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a, char** b, void** c); - void (*UnregisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a); - struct java_lang_Class* (*DefineClass)(JRIEnv* env, jint op, struct java_lang_ClassLoader* a, jbyte* b, jsize bLen); - struct java_lang_String* (*NewStringPlatform)(JRIEnv* env, jint op, const jbyte* a, jint b, const jbyte* c, jint d); - const jbyte* (*GetStringPlatformChars)(JRIEnv* env, jint op, struct java_lang_String* a, const jbyte* b, jint c); -}; - -/* -** **************************************************************************** -** JRIEnv Operation IDs -** *************************************************************************** -*/ - -typedef enum JRIEnvOperations { - JRI_Reserved0_op, - JRI_Reserved1_op, - JRI_Reserved2_op, - JRI_Reserved3_op, - JRI_FindClass_op, - JRI_Throw_op, - JRI_ThrowNew_op, - JRI_ExceptionOccurred_op, - JRI_ExceptionDescribe_op, - JRI_ExceptionClear_op, - JRI_NewGlobalRef_op, - JRI_DisposeGlobalRef_op, - JRI_GetGlobalRef_op, - JRI_SetGlobalRef_op, - JRI_IsSameObject_op, - JRI_NewObject_op, - JRI_NewObject_op_va_list, - JRI_NewObject_op_array, - JRI_GetObjectClass_op, - JRI_IsInstanceOf_op, - JRI_GetMethodID_op, - JRI_CallMethod_op, - JRI_CallMethod_op_va_list, - JRI_CallMethod_op_array, - JRI_CallMethodBoolean_op, - JRI_CallMethodBoolean_op_va_list, - JRI_CallMethodBoolean_op_array, - JRI_CallMethodByte_op, - JRI_CallMethodByte_op_va_list, - JRI_CallMethodByte_op_array, - JRI_CallMethodChar_op, - JRI_CallMethodChar_op_va_list, - JRI_CallMethodChar_op_array, - JRI_CallMethodShort_op, - JRI_CallMethodShort_op_va_list, - JRI_CallMethodShort_op_array, - JRI_CallMethodInt_op, - JRI_CallMethodInt_op_va_list, - JRI_CallMethodInt_op_array, - JRI_CallMethodLong_op, - JRI_CallMethodLong_op_va_list, - JRI_CallMethodLong_op_array, - JRI_CallMethodFloat_op, - JRI_CallMethodFloat_op_va_list, - JRI_CallMethodFloat_op_array, - JRI_CallMethodDouble_op, - JRI_CallMethodDouble_op_va_list, - JRI_CallMethodDouble_op_array, - JRI_GetFieldID_op, - JRI_GetField_op, - JRI_GetFieldBoolean_op, - JRI_GetFieldByte_op, - JRI_GetFieldChar_op, - JRI_GetFieldShort_op, - JRI_GetFieldInt_op, - JRI_GetFieldLong_op, - JRI_GetFieldFloat_op, - JRI_GetFieldDouble_op, - JRI_SetField_op, - JRI_SetFieldBoolean_op, - JRI_SetFieldByte_op, - JRI_SetFieldChar_op, - JRI_SetFieldShort_op, - JRI_SetFieldInt_op, - JRI_SetFieldLong_op, - JRI_SetFieldFloat_op, - JRI_SetFieldDouble_op, - JRI_IsSubclassOf_op, - JRI_GetStaticMethodID_op, - JRI_CallStaticMethod_op, - JRI_CallStaticMethod_op_va_list, - JRI_CallStaticMethod_op_array, - JRI_CallStaticMethodBoolean_op, - JRI_CallStaticMethodBoolean_op_va_list, - JRI_CallStaticMethodBoolean_op_array, - JRI_CallStaticMethodByte_op, - JRI_CallStaticMethodByte_op_va_list, - JRI_CallStaticMethodByte_op_array, - JRI_CallStaticMethodChar_op, - JRI_CallStaticMethodChar_op_va_list, - JRI_CallStaticMethodChar_op_array, - JRI_CallStaticMethodShort_op, - JRI_CallStaticMethodShort_op_va_list, - JRI_CallStaticMethodShort_op_array, - JRI_CallStaticMethodInt_op, - JRI_CallStaticMethodInt_op_va_list, - JRI_CallStaticMethodInt_op_array, - JRI_CallStaticMethodLong_op, - JRI_CallStaticMethodLong_op_va_list, - JRI_CallStaticMethodLong_op_array, - JRI_CallStaticMethodFloat_op, - JRI_CallStaticMethodFloat_op_va_list, - JRI_CallStaticMethodFloat_op_array, - JRI_CallStaticMethodDouble_op, - JRI_CallStaticMethodDouble_op_va_list, - JRI_CallStaticMethodDouble_op_array, - JRI_GetStaticFieldID_op, - JRI_GetStaticField_op, - JRI_GetStaticFieldBoolean_op, - JRI_GetStaticFieldByte_op, - JRI_GetStaticFieldChar_op, - JRI_GetStaticFieldShort_op, - JRI_GetStaticFieldInt_op, - JRI_GetStaticFieldLong_op, - JRI_GetStaticFieldFloat_op, - JRI_GetStaticFieldDouble_op, - JRI_SetStaticField_op, - JRI_SetStaticFieldBoolean_op, - JRI_SetStaticFieldByte_op, - JRI_SetStaticFieldChar_op, - JRI_SetStaticFieldShort_op, - JRI_SetStaticFieldInt_op, - JRI_SetStaticFieldLong_op, - JRI_SetStaticFieldFloat_op, - JRI_SetStaticFieldDouble_op, - JRI_NewString_op, - JRI_GetStringLength_op, - JRI_GetStringChars_op, - JRI_NewStringUTF_op, - JRI_GetStringUTFLength_op, - JRI_GetStringUTFChars_op, - JRI_NewScalarArray_op, - JRI_GetScalarArrayLength_op, - JRI_GetScalarArrayElements_op, - JRI_NewObjectArray_op, - JRI_GetObjectArrayLength_op, - JRI_GetObjectArrayElement_op, - JRI_SetObjectArrayElement_op, - JRI_RegisterNatives_op, - JRI_UnregisterNatives_op, - JRI_DefineClass_op, - JRI_NewStringPlatform_op, - JRI_GetStringPlatformChars_op -} JRIEnvOperations; - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* JRI_H */ -/******************************************************************************/ diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jri_md.h b/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jri_md.h deleted file mode 100644 index 0003c56d34e..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jri_md.h +++ /dev/null @@ -1,516 +0,0 @@ -/* -*- Mode: C; tab-width: 4; -*- */ -/* ***** 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 Java Runtime Interface. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corp. - * Portions created by the Initial Developer are Copyright (C) 1996 - * 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 ***** */ - -#ifndef JRI_MD_H -#define JRI_MD_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * WHAT'S UP WITH THIS FILE? - * - * This is where we define the mystical JRI_PUBLIC_API macro that works on all - * platforms. If you're running with Visual C++, Symantec C, or Borland's - * development environment on the PC, you're all set. Or if you're on the Mac - * with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't - * matter. - * - * On UNIX though you probably care about a couple of other symbols though: - * IS_LITTLE_ENDIAN must be defined for little-endian systems - * HAVE_LONG_LONG must be defined on systems that have 'long long' integers - * HAVE_ALIGNED_LONGLONGS must be defined if long-longs must be 8 byte aligned - * HAVE_ALIGNED_DOUBLES must be defined if doubles must be 8 byte aligned - * IS_64 must be defined on 64-bit machines (like Dec Alpha) - ******************************************************************************/ - -/* DLL Entry modifiers... */ - -/* PC */ -#if defined(XP_WIN) || defined(XP_OS2) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32) -# include -# if defined(_MSC_VER) -# if defined(WIN32) || defined(_WIN32) -# define JRI_PUBLIC_API(ResultType) _declspec(dllexport) ResultType -# define JRI_PUBLIC_VAR(VarType) VarType -# define JRI_NATIVE_STUB(ResultType) _declspec(dllexport) ResultType -# define JRI_CALLBACK -# else /* !_WIN32 */ -# if defined(_WINDLL) -# define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export __loadds -# define JRI_PUBLIC_VAR(VarType) VarType -# define JRI_NATIVE_STUB(ResultType) ResultType __cdecl __loadds -# define JRI_CALLBACK __loadds -# else /* !WINDLL */ -# define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export -# define JRI_PUBLIC_VAR(VarType) VarType -# define JRI_NATIVE_STUB(ResultType) ResultType __cdecl __export -# define JRI_CALLBACK __export -# endif /* !WINDLL */ -# endif /* !_WIN32 */ -# elif defined(__BORLANDC__) -# if defined(WIN32) || defined(_WIN32) -# define JRI_PUBLIC_API(ResultType) __export ResultType -# define JRI_PUBLIC_VAR(VarType) VarType -# define JRI_NATIVE_STUB(ResultType) __export ResultType -# define JRI_CALLBACK -# else /* !_WIN32 */ -# define JRI_PUBLIC_API(ResultType) ResultType _cdecl _export _loadds -# define JRI_PUBLIC_VAR(VarType) VarType -# define JRI_NATIVE_STUB(ResultType) ResultType _cdecl _loadds -# define JRI_CALLBACK _loadds -# endif -# else -# error Unsupported PC development environment. -# endif -# ifndef IS_LITTLE_ENDIAN -# define IS_LITTLE_ENDIAN -# endif - -/* Mac */ -#elif macintosh || Macintosh || THINK_C -# if defined(__MWERKS__) /* Metrowerks */ -# if !__option(enumsalwaysint) -# error You need to define 'Enums Always Int' for your project. -# endif -# if defined(GENERATING68K) && !GENERATINGCFM -# if !__option(fourbyteints) -# error You need to define 'Struct Alignment: 68k' for your project. -# endif -# endif /* !GENERATINGCFM */ -# define JRI_PUBLIC_API(ResultType) __declspec(export) ResultType -# define JRI_PUBLIC_VAR(VarType) JRI_PUBLIC_API(VarType) -# define JRI_NATIVE_STUB(ResultType) JRI_PUBLIC_API(ResultType) -# elif defined(__SC__) /* Symantec */ -# error What are the Symantec defines? (warren@netscape.com) -# elif macintosh && applec /* MPW */ -# error Please upgrade to the latest MPW compiler (SC). -# else -# error Unsupported Mac development environment. -# endif -# define JRI_CALLBACK - -/* Unix or else */ -#else -# define JRI_PUBLIC_API(ResultType) ResultType -# define JRI_PUBLIC_VAR(VarType) VarType -# define JRI_NATIVE_STUB(ResultType) ResultType -# define JRI_CALLBACK -#endif - -/******************************************************************************/ - -/* Java Scalar Types */ - -#if 0 /* now in jni.h */ -typedef short jchar; -typedef short jshort; -typedef float jfloat; -typedef double jdouble; -typedef juint jsize; -#endif - -typedef unsigned char jbool; -typedef signed char jbyte; -#ifdef IS_64 /* XXX ok for alpha, but not right on all 64-bit architectures */ -typedef unsigned int juint; -typedef int jint; -#else -typedef unsigned long juint; -typedef long jint; -#endif - -/******************************************************************************* - * jlong : long long (64-bit signed integer type) support. - ******************************************************************************/ - -/* -** Bit masking macros. (n must be <= 31 to be portable) -*/ -#define JRI_BIT(n) ((juint)1 << (n)) -#define JRI_BITMASK(n) (JRI_BIT(n) - 1) - -#ifdef HAVE_LONG_LONG - -#if !(defined(WIN32) || defined(_WIN32)) -typedef long long jlong; -typedef unsigned long long julong; - -#define jlong_MAXINT 0x7fffffffffffffffLL -#define jlong_MININT 0x8000000000000000LL -#define jlong_ZERO 0x0LL - -#else -typedef LONGLONG jlong; -typedef DWORDLONG julong; - -#define jlong_MAXINT 0x7fffffffffffffffi64 -#define jlong_MININT 0x8000000000000000i64 -#define jlong_ZERO 0x0i64 - -#endif - -#define jlong_IS_ZERO(a) ((a) == 0) -#define jlong_EQ(a, b) ((a) == (b)) -#define jlong_NE(a, b) ((a) != (b)) -#define jlong_GE_ZERO(a) ((a) >= 0) -#define jlong_CMP(a, op, b) ((a) op (b)) - -#define jlong_AND(r, a, b) ((r) = (a) & (b)) -#define jlong_OR(r, a, b) ((r) = (a) | (b)) -#define jlong_XOR(r, a, b) ((r) = (a) ^ (b)) -#define jlong_OR2(r, a) ((r) = (r) | (a)) -#define jlong_NOT(r, a) ((r) = ~(a)) - -#define jlong_NEG(r, a) ((r) = -(a)) -#define jlong_ADD(r, a, b) ((r) = (a) + (b)) -#define jlong_SUB(r, a, b) ((r) = (a) - (b)) - -#define jlong_MUL(r, a, b) ((r) = (a) * (b)) -#define jlong_DIV(r, a, b) ((r) = (a) / (b)) -#define jlong_MOD(r, a, b) ((r) = (a) % (b)) - -#define jlong_SHL(r, a, b) ((r) = (a) << (b)) -#define jlong_SHR(r, a, b) ((r) = (a) >> (b)) -#define jlong_USHR(r, a, b) ((r) = (julong)(a) >> (b)) -#define jlong_ISHL(r, a, b) ((r) = ((jlong)(a)) << (b)) - -#define jlong_L2I(i, l) ((i) = (int)(l)) -#define jlong_L2UI(ui, l) ((ui) =(unsigned int)(l)) -#define jlong_L2F(f, l) ((f) = (l)) -#define jlong_L2D(d, l) ((d) = (l)) - -#define jlong_I2L(l, i) ((l) = (i)) -#define jlong_UI2L(l, ui) ((l) = (ui)) -#define jlong_F2L(l, f) ((l) = (f)) -#define jlong_D2L(l, d) ((l) = (d)) - -#define jlong_UDIVMOD(qp, rp, a, b) \ - (*(qp) = ((julong)(a) / (b)), \ - *(rp) = ((julong)(a) % (b))) - -#else /* !HAVE_LONG_LONG */ - -typedef struct { -#ifdef IS_LITTLE_ENDIAN - juint lo, hi; -#else - juint hi, lo; -#endif -} jlong; -typedef jlong julong; - -extern jlong jlong_MAXINT, jlong_MININT, jlong_ZERO; - -#define jlong_IS_ZERO(a) (((a).hi == 0) && ((a).lo == 0)) -#define jlong_EQ(a, b) (((a).hi == (b).hi) && ((a).lo == (b).lo)) -#define jlong_NE(a, b) (((a).hi != (b).hi) || ((a).lo != (b).lo)) -#define jlong_GE_ZERO(a) (((a).hi >> 31) == 0) - -/* - * NB: jlong_CMP and jlong_UCMP work only for strict relationals (<, >). - */ -#define jlong_CMP(a, op, b) (((int32)(a).hi op (int32)(b).hi) || \ - (((a).hi == (b).hi) && ((a).lo op (b).lo))) -#define jlong_UCMP(a, op, b) (((a).hi op (b).hi) || \ - (((a).hi == (b).hi) && ((a).lo op (b).lo))) - -#define jlong_AND(r, a, b) ((r).lo = (a).lo & (b).lo, \ - (r).hi = (a).hi & (b).hi) -#define jlong_OR(r, a, b) ((r).lo = (a).lo | (b).lo, \ - (r).hi = (a).hi | (b).hi) -#define jlong_XOR(r, a, b) ((r).lo = (a).lo ^ (b).lo, \ - (r).hi = (a).hi ^ (b).hi) -#define jlong_OR2(r, a) ((r).lo = (r).lo | (a).lo, \ - (r).hi = (r).hi | (a).hi) -#define jlong_NOT(r, a) ((r).lo = ~(a).lo, \ - (r).hi = ~(a).hi) - -#define jlong_NEG(r, a) ((r).lo = -(int32)(a).lo, \ - (r).hi = -(int32)(a).hi - ((r).lo != 0)) -#define jlong_ADD(r, a, b) { \ - jlong _a, _b; \ - _a = a; _b = b; \ - (r).lo = _a.lo + _b.lo; \ - (r).hi = _a.hi + _b.hi + ((r).lo < _b.lo); \ -} - -#define jlong_SUB(r, a, b) { \ - jlong _a, _b; \ - _a = a; _b = b; \ - (r).lo = _a.lo - _b.lo; \ - (r).hi = _a.hi - _b.hi - (_a.lo < _b.lo); \ -} \ - -/* - * Multiply 64-bit operands a and b to get 64-bit result r. - * First multiply the low 32 bits of a and b to get a 64-bit result in r. - * Then add the outer and inner products to r.hi. - */ -#define jlong_MUL(r, a, b) { \ - jlong _a, _b; \ - _a = a; _b = b; \ - jlong_MUL32(r, _a.lo, _b.lo); \ - (r).hi += _a.hi * _b.lo + _a.lo * _b.hi; \ -} - -/* XXX _jlong_lo16(a) = ((a) << 16 >> 16) is better on some archs (not on mips) */ -#define _jlong_lo16(a) ((a) & JRI_BITMASK(16)) -#define _jlong_hi16(a) ((a) >> 16) - -/* - * Multiply 32-bit operands a and b to get 64-bit result r. - * Use polynomial expansion based on primitive field element (1 << 16). - */ -#define jlong_MUL32(r, a, b) { \ - juint _a1, _a0, _b1, _b0, _y0, _y1, _y2, _y3; \ - _a1 = _jlong_hi16(a), _a0 = _jlong_lo16(a); \ - _b1 = _jlong_hi16(b), _b0 = _jlong_lo16(b); \ - _y0 = _a0 * _b0; \ - _y1 = _a0 * _b1; \ - _y2 = _a1 * _b0; \ - _y3 = _a1 * _b1; \ - _y1 += _jlong_hi16(_y0); /* can't carry */ \ - _y1 += _y2; /* might carry */ \ - if (_y1 < _y2) _y3 += 1 << 16; /* propagate */ \ - (r).lo = (_jlong_lo16(_y1) << 16) + _jlong_lo16(_y0); \ - (r).hi = _y3 + _jlong_hi16(_y1); \ -} - -/* - * Divide 64-bit unsigned operand a by 64-bit unsigned operand b, setting *qp - * to the 64-bit unsigned quotient, and *rp to the 64-bit unsigned remainder. - * Minimize effort if one of qp and rp is null. - */ -#define jlong_UDIVMOD(qp, rp, a, b) jlong_udivmod(qp, rp, a, b) - -extern JRI_PUBLIC_API(void) -jlong_udivmod(julong *qp, julong *rp, julong a, julong b); - -#define jlong_DIV(r, a, b) { \ - jlong _a, _b; \ - juint _negative = (int32)(a).hi < 0; \ - if (_negative) { \ - jlong_NEG(_a, a); \ - } else { \ - _a = a; \ - } \ - if ((int32)(b).hi < 0) { \ - _negative ^= 1; \ - jlong_NEG(_b, b); \ - } else { \ - _b = b; \ - } \ - jlong_UDIVMOD(&(r), 0, _a, _b); \ - if (_negative) \ - jlong_NEG(r, r); \ -} - -#define jlong_MOD(r, a, b) { \ - jlong _a, _b; \ - juint _negative = (int32)(a).hi < 0; \ - if (_negative) { \ - jlong_NEG(_a, a); \ - } else { \ - _a = a; \ - } \ - if ((int32)(b).hi < 0) { \ - jlong_NEG(_b, b); \ - } else { \ - _b = b; \ - } \ - jlong_UDIVMOD(0, &(r), _a, _b); \ - if (_negative) \ - jlong_NEG(r, r); \ -} - -/* - * NB: b is a juint, not jlong or julong, for the shift ops. - */ -#define jlong_SHL(r, a, b) { \ - if (b) { \ - jlong _a; \ - _a = a; \ - if ((b) < 32) { \ - (r).lo = _a.lo << (b); \ - (r).hi = (_a.hi << (b)) | (_a.lo >> (32 - (b))); \ - } else { \ - (r).lo = 0; \ - (r).hi = _a.lo << ((b) & 31); \ - } \ - } else { \ - (r) = (a); \ - } \ -} - -/* a is an int32, b is int32, r is jlong */ -#define jlong_ISHL(r, a, b) { \ - if (b) { \ - jlong _a; \ - _a.lo = (a); \ - _a.hi = 0; \ - if ((b) < 32) { \ - (r).lo = (a) << (b); \ - (r).hi = ((a) >> (32 - (b))); \ - } else { \ - (r).lo = 0; \ - (r).hi = (a) << ((b) & 31); \ - } \ - } else { \ - (r).lo = (a); \ - (r).hi = 0; \ - } \ -} - -#define jlong_SHR(r, a, b) { \ - if (b) { \ - jlong _a; \ - _a = a; \ - if ((b) < 32) { \ - (r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b)); \ - (r).hi = (int32)_a.hi >> (b); \ - } else { \ - (r).lo = (int32)_a.hi >> ((b) & 31); \ - (r).hi = (int32)_a.hi >> 31; \ - } \ - } else { \ - (r) = (a); \ - } \ -} - -#define jlong_USHR(r, a, b) { \ - if (b) { \ - jlong _a; \ - _a = a; \ - if ((b) < 32) { \ - (r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b)); \ - (r).hi = _a.hi >> (b); \ - } else { \ - (r).lo = _a.hi >> ((b) & 31); \ - (r).hi = 0; \ - } \ - } else { \ - (r) = (a); \ - } \ -} - -#define jlong_L2I(i, l) ((i) = (l).lo) -#define jlong_L2UI(ui, l) ((ui) = (l).lo) -#define jlong_L2F(f, l) { double _d; jlong_L2D(_d, l); (f) = (float) _d; } - -#define jlong_L2D(d, l) { \ - int32 _negative; \ - jlong _absval; \ - \ - _negative = (l).hi >> 31; \ - if (_negative) { \ - jlong_NEG(_absval, l); \ - } else { \ - _absval = l; \ - } \ - (d) = (double)_absval.hi * 4.294967296e9 + _absval.lo; \ - if (_negative) \ - (d) = -(d); \ -} - -#define jlong_I2L(l, i) ((l).hi = (i) >> 31, (l).lo = (i)) -#define jlong_UI2L(l, ui) ((l).hi = 0, (l).lo = (ui)) -#define jlong_F2L(l, f) { double _d = (double) f; jlong_D2L(l, _d); } - -#define jlong_D2L(l, d) { \ - int _negative; \ - double _absval, _d_hi; \ - jlong _lo_d; \ - \ - _negative = ((d) < 0); \ - _absval = _negative ? -(d) : (d); \ - \ - (l).hi = (juint)(_absval / 4.294967296e9); \ - (l).lo = 0; \ - jlong_L2D(_d_hi, l); \ - _absval -= _d_hi; \ - _lo_d.hi = 0; \ - if (_absval < 0) { \ - _lo_d.lo = (juint) -_absval; \ - jlong_SUB(l, l, _lo_d); \ - } else { \ - _lo_d.lo = (juint) _absval; \ - jlong_ADD(l, l, _lo_d); \ - } \ - \ - if (_negative) \ - jlong_NEG(l, l); \ -} - -#endif /* !HAVE_LONG_LONG */ - -/******************************************************************************/ - -#ifdef HAVE_ALIGNED_LONGLONGS -#define JRI_GET_INT64(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \ - ((_t).x[1] = ((jint*)(_addr))[1]), \ - (_t).l ) -#define JRI_SET_INT64(_t, _addr, _v) ( (_t).l = (_v), \ - ((jint*)(_addr))[0] = (_t).x[0], \ - ((jint*)(_addr))[1] = (_t).x[1] ) -#else -#define JRI_GET_INT64(_t,_addr) (*(jlong*)(_addr)) -#define JRI_SET_INT64(_t, _addr, _v) (*(jlong*)(_addr) = (_v)) -#endif - -/* If double's must be aligned on doubleword boundaries then define this */ -#ifdef HAVE_ALIGNED_DOUBLES -#define JRI_GET_DOUBLE(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \ - ((_t).x[1] = ((jint*)(_addr))[1]), \ - (_t).d ) -#define JRI_SET_DOUBLE(_t, _addr, _v) ( (_t).d = (_v), \ - ((jint*)(_addr))[0] = (_t).x[0], \ - ((jint*)(_addr))[1] = (_t).x[1] ) -#else -#define JRI_GET_DOUBLE(_t,_addr) (*(jdouble*)(_addr)) -#define JRI_SET_DOUBLE(_t, _addr, _v) (*(jdouble*)(_addr) = (_v)) -#endif - -/******************************************************************************/ -#ifdef __cplusplus -} -#endif -#endif /* JRI_MD_H */ -/******************************************************************************/ diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jritypes.h b/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jritypes.h deleted file mode 100644 index 4f6d4c0a38b..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/jritypes.h +++ /dev/null @@ -1,238 +0,0 @@ -/* -*- Mode: C; tab-width: 4; -*- */ -/* ***** 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 Java Runtime Interface. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corp. - * Portions created by the Initial Developer are Copyright (C) 1996 - * 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 ***** */ - -#ifndef JRITYPES_H -#define JRITYPES_H - -#include "jni.h" -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * Types - ******************************************************************************/ - -struct JRIEnvInterface; - -typedef void* JRIRef; -typedef void* JRIGlobalRef; - -typedef jint JRIFieldID; -typedef jint JRIMethodID; - -/* synonyms: */ -typedef JRIGlobalRef jglobal; - -typedef union JRIValue { - jbool z; - jbyte b; - jchar c; - jshort s; - jint i; - jlong l; - jfloat f; - jdouble d; - jref r; -} JRIValue; - -typedef enum JRIBoolean { - JRIFalse = 0, - JRITrue = 1 -} JRIBoolean; - -typedef enum JRIConstant { - JRIUninitialized = -1 -} JRIConstant; - -/* convenience types (these must be distinct struct types for c++ overloading): */ -#if 0 /* now in jni.h */ -typedef struct jbooleanArrayStruct* jbooleanArray; -typedef struct jbyteArrayStruct* jbyteArray; -typedef struct jcharArrayStruct* jcharArray; -typedef struct jshortArrayStruct* jshortArray; -typedef struct jintArrayStruct* jintArray; -typedef struct jlongArrayStruct* jlongArray; -typedef struct jfloatArrayStruct* jfloatArray; -typedef struct jdoubleArrayStruct* jdoubleArray; -typedef struct jobjectArrayStruct* jobjectArray; -#endif -typedef struct jstringArrayStruct* jstringArray; -typedef struct jarrayArrayStruct* jarrayArray; - -#define JRIConstructorMethodName "" - -/******************************************************************************* - * Signature Construction Macros - ******************************************************************************/ - -/* -** These macros can be used to construct signature strings. Hopefully their names -** are a little easier to remember than the single character they correspond to. -** For example, to specify the signature of the method: -** -** public int read(byte b[], int off, int len); -** -** you could write something like this in C: -** -** char* readSig = JRISigMethod(JRISigArray(JRISigByte) -** JRISigInt -** JRISigInt) JRISigInt; -** -** Of course, don't put commas between the types. -*/ -#define JRISigArray(T) "[" T -#define JRISigByte "B" -#define JRISigChar "C" -#define JRISigClass(name) "L" name ";" -#define JRISigFloat "F" -#define JRISigDouble "D" -#define JRISigMethod(args) "(" args ")" -#define JRISigNoArgs "" -#define JRISigInt "I" -#define JRISigLong "J" -#define JRISigShort "S" -#define JRISigVoid "V" -#define JRISigBoolean "Z" - -/******************************************************************************* - * Environments - ******************************************************************************/ - -extern JRI_PUBLIC_API(const struct JRIEnvInterface**) -JRI_GetCurrentEnv(void); - -/******************************************************************************* - * Specific Scalar Array Types - ******************************************************************************/ - -/* -** The JRI Native Method Interface does not support boolean arrays. This -** is to allow Java runtime implementations to optimize boolean array -** storage. Using the ScalarArray operations on boolean arrays is bound -** to fail, so convert any boolean arrays to byte arrays in Java before -** passing them to a native method. -*/ - -#define JRI_NewByteArray(env, length, initialValues) \ - JRI_NewScalarArray(env, length, JRISigByte, (jbyte*)(initialValues)) -#define JRI_GetByteArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetByteArrayElements(env, array) \ - JRI_GetScalarArrayElements(env, array) - -#define JRI_NewCharArray(env, length, initialValues) \ - JRI_NewScalarArray(env, ((length) * sizeof(jchar)), JRISigChar, (jbyte*)(initialValues)) -#define JRI_GetCharArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetCharArrayElements(env, array) \ - ((jchar*)JRI_GetScalarArrayElements(env, array)) - -#define JRI_NewShortArray(env, length, initialValues) \ - JRI_NewScalarArray(env, ((length) * sizeof(jshort)), JRISigShort, (jbyte*)(initialValues)) -#define JRI_GetShortArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetShortArrayElements(env, array) \ - ((jshort*)JRI_GetScalarArrayElements(env, array)) - -#define JRI_NewIntArray(env, length, initialValues) \ - JRI_NewScalarArray(env, ((length) * sizeof(jint)), JRISigInt, (jbyte*)(initialValues)) -#define JRI_GetIntArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetIntArrayElements(env, array) \ - ((jint*)JRI_GetScalarArrayElements(env, array)) - -#define JRI_NewLongArray(env, length, initialValues) \ - JRI_NewScalarArray(env, ((length) * sizeof(jlong)), JRISigLong, (jbyte*)(initialValues)) -#define JRI_GetLongArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetLongArrayElements(env, array) \ - ((jlong*)JRI_GetScalarArrayElements(env, array)) - -#define JRI_NewFloatArray(env, length, initialValues) \ - JRI_NewScalarArray(env, ((length) * sizeof(jfloat)), JRISigFloat, (jbyte*)(initialValues)) -#define JRI_GetFloatArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetFloatArrayElements(env, array) \ - ((jfloat*)JRI_GetScalarArrayElements(env, array)) - -#define JRI_NewDoubleArray(env, length, initialValues) \ - JRI_NewScalarArray(env, ((length) * sizeof(jdouble)), JRISigDouble, (jbyte*)(initialValues)) -#define JRI_GetDoubleArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetDoubleArrayElements(env, array) \ - ((jdouble*)JRI_GetScalarArrayElements(env, array)) - -/******************************************************************************/ -/* -** JDK Stuff -- This stuff is still needed while we're using the JDK -** dynamic linking strategy to call native methods. -*/ - -typedef union JRI_JDK_stack_item { - /* Non pointer items */ - jint i; - jfloat f; - jint o; - /* Pointer items */ - void *h; - void *p; - unsigned char *addr; -#ifdef IS_64 - double d; - long l; /* == 64bits! */ -#endif -} JRI_JDK_stack_item; - -typedef union JRI_JDK_Java8Str { - jint x[2]; - jdouble d; - jlong l; - void *p; - float f; -} JRI_JDK_Java8; - -/******************************************************************************/ -#ifdef __cplusplus -} -#endif -#endif /* JRITYPES_H */ -/******************************************************************************/ diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/npapi.h b/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/npapi.h deleted file mode 100644 index 379796b525f..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/npapi.h +++ /dev/null @@ -1,462 +0,0 @@ -/* -*- Mode: C; tab-width: 4; -*- */ -/* - * npapi.h $Revision: 1.2 $ - * Netscape client plug-in API spec - */ - -#ifndef _NPAPI_H_ -#define _NPAPI_H_ - -#include "jri.h" /* Java Runtime Interface */ - -#ifdef _WINDOWS -# ifndef XP_WIN -# define XP_WIN 1 -# endif /* XP_WIN */ -#endif /* _WINDOWS */ - -#ifdef __MWERKS__ -# define _declspec __declspec -# ifdef macintosh -# ifndef XP_MAC -# define XP_MAC 1 -# endif /* XP_MAC */ -# endif /* macintosh */ -# ifdef __INTEL__ -# undef NULL -# ifndef XP_WIN -# define XP_WIN 1 -# endif /* XP_WIN */ -# endif /* __INTELL__ */ -#endif /* __MWERKS__ */ - -#ifdef XP_MAC - #include - #include -#endif - -#ifdef XP_UNIX - #include - #include -#endif - - -/*----------------------------------------------------------------------*/ -/* Plugin Version Constants */ -/*----------------------------------------------------------------------*/ - -#define NP_VERSION_MAJOR 0 -#define NP_VERSION_MINOR 11 - - - -/*----------------------------------------------------------------------*/ -/* Definition of Basic Types */ -/*----------------------------------------------------------------------*/ - -#ifndef _UINT16 -typedef unsigned short uint16; -#endif -#ifndef _UINT32 -#if defined(__alpha) -typedef unsigned int uint32; -#else /* __alpha */ -typedef unsigned long uint32; -#endif /* __alpha */ -#endif -#ifndef _INT16 -typedef short int16; -#endif -#ifndef _INT32 -#if defined(__alpha) -typedef int int32; -#else /* __alpha */ -typedef long int32; -#endif /* __alpha */ -#endif - -#ifndef FALSE -#define FALSE (0) -#endif -#ifndef TRUE -#define TRUE (1) -#endif -#ifndef NULL -#define NULL (0L) -#endif - -typedef unsigned char NPBool; -typedef int16 NPError; -typedef int16 NPReason; -typedef char* NPMIMEType; - - - -/*----------------------------------------------------------------------*/ -/* Structures and definitions */ -/*----------------------------------------------------------------------*/ - -#ifdef XP_MAC -#pragma options align=mac68k -#endif - -/* - * NPP is a plug-in's opaque instance handle - */ -typedef struct _NPP -{ - void* pdata; /* plug-in private data */ - void* ndata; /* netscape private data */ -} NPP_t; - -typedef NPP_t* NPP; - - -typedef struct _NPStream -{ - void* pdata; /* plug-in private data */ - void* ndata; /* netscape private data */ - const char* url; - uint32 end; - uint32 lastmodified; - void* notifyData; -} NPStream; - - -typedef struct _NPByteRange -{ - int32 offset; /* negative offset means from the end */ - uint32 length; - struct _NPByteRange* next; -} NPByteRange; - - -typedef struct _NPSavedData -{ - int32 len; - void* buf; -} NPSavedData; - - -typedef struct _NPRect -{ - uint16 top; - uint16 left; - uint16 bottom; - uint16 right; -} NPRect; - - -#ifdef XP_UNIX -/* - * Unix specific structures and definitions - */ - -/* - * Callback Structures. - * - * These are used to pass additional platform specific information. - */ -enum { - NP_SETWINDOW = 1, - NP_PRINT -}; - -typedef struct -{ - int32 type; -} NPAnyCallbackStruct; - -typedef struct -{ - int32 type; - Display* display; - Visual* visual; - Colormap colormap; - unsigned int depth; -} NPSetWindowCallbackStruct; - -typedef struct -{ - int32 type; - FILE* fp; -} NPPrintCallbackStruct; - -#endif /* XP_UNIX */ - -/* - * List of variable names for which NPP_GetValue shall be implemented - */ -typedef enum { - NPPVpluginNameString = 1, - NPPVpluginDescriptionString, - NPPVpluginWindowBool, - NPPVpluginTransparentBool -} NPPVariable; - -/* - * List of variable names for which NPN_GetValue is implemented by Mozilla - */ -typedef enum { - NPNVxDisplay = 1, - NPNVxtAppContext, - NPNVnetscapeWindow, - NPNVjavascriptEnabledBool, - NPNVasdEnabledBool, - NPNVisOfflineBool -} NPNVariable; - -/* - * The type of a NPWindow - it specifies the type of the data structure - * returned in the window field. - */ -typedef enum { - NPWindowTypeWindow = 1, - NPWindowTypeDrawable -} NPWindowType; - -typedef struct _NPWindow -{ - void* window; /* Platform specific window handle */ - int32 x; /* Position of top left corner relative */ - int32 y; /* to a netscape page. */ - uint32 width; /* Maximum window size */ - uint32 height; - NPRect clipRect; /* Clipping rectangle in port coordinates */ - /* Used by MAC only. */ -#ifdef XP_UNIX - void * ws_info; /* Platform-dependent additonal data */ -#endif /* XP_UNIX */ - NPWindowType type; /* Is this a window or a drawable? */ -} NPWindow; - - -typedef struct _NPFullPrint -{ - NPBool pluginPrinted; /* Set TRUE if plugin handled fullscreen */ - /* printing */ - NPBool printOne; /* TRUE if plugin should print one copy */ - /* to default printer */ - void* platformPrint; /* Platform-specific printing info */ -} NPFullPrint; - -typedef struct _NPEmbedPrint -{ - NPWindow window; - void* platformPrint; /* Platform-specific printing info */ -} NPEmbedPrint; - -typedef struct _NPPrint -{ - uint16 mode; /* NP_FULL or NP_EMBED */ - union - { - NPFullPrint fullPrint; /* if mode is NP_FULL */ - NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ - } print; -} NPPrint; - -#ifdef XP_MAC -typedef EventRecord NPEvent; -#elif defined(XP_WIN) -typedef struct _NPEvent -{ - uint16 event; - uint32 wParam; - uint32 lParam; -} NPEvent; -#elif defined (XP_UNIX) -typedef XEvent NPEvent; -#else -typedef void* NPEvent; -#endif /* XP_MAC */ - -#ifdef XP_MAC -typedef RgnHandle NPRegion; -#elif defined(XP_WIN) -typedef HRGN NPRegion; -#elif defined(XP_UNIX) -typedef Region NPRegion; -#else -typedef void *NPRegion; -#endif /* XP_MAC */ - -#ifdef XP_MAC -/* - * Mac-specific structures and definitions. - */ - -typedef struct NP_Port -{ - CGrafPtr port; /* Grafport */ - int32 portx; /* position inside the topmost window */ - int32 porty; -} NP_Port; - -/* - * Non-standard event types that can be passed to HandleEvent - */ -#define getFocusEvent (osEvt + 16) -#define loseFocusEvent (osEvt + 17) -#define adjustCursorEvent (osEvt + 18) - -#endif /* XP_MAC */ - - -/* - * Values for mode passed to NPP_New: - */ -#define NP_EMBED 1 -#define NP_FULL 2 - -/* - * Values for stream type passed to NPP_NewStream: - */ -#define NP_NORMAL 1 -#define NP_SEEK 2 -#define NP_ASFILE 3 -#define NP_ASFILEONLY 4 - -#define NP_MAXREADY (((unsigned)(~0)<<1)>>1) - -#ifdef XP_MAC -#pragma options align=reset -#endif - - -/*----------------------------------------------------------------------*/ -/* Error and Reason Code definitions */ -/*----------------------------------------------------------------------*/ - -/* - * Values of type NPError: - */ -#define NPERR_BASE 0 -#define NPERR_NO_ERROR (NPERR_BASE + 0) -#define NPERR_GENERIC_ERROR (NPERR_BASE + 1) -#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) -#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) -#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) -#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) -#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) -#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) -#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) -#define NPERR_INVALID_PARAM (NPERR_BASE + 9) -#define NPERR_INVALID_URL (NPERR_BASE + 10) -#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11) -#define NPERR_NO_DATA (NPERR_BASE + 12) -#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13) - -/* - * Values of type NPReason: - */ -#define NPRES_BASE 0 -#define NPRES_DONE (NPRES_BASE + 0) -#define NPRES_NETWORK_ERR (NPRES_BASE + 1) -#define NPRES_USER_BREAK (NPRES_BASE + 2) - -/* - * Don't use these obsolete error codes any more. - */ -#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR -#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR -#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK - -/* - * Version feature information - */ -#define NPVERS_HAS_STREAMOUTPUT 8 -#define NPVERS_HAS_NOTIFICATION 9 -#define NPVERS_HAS_LIVECONNECT 9 -#define NPVERS_68K_HAS_LIVECONNECT 11 -#define NPVERS_HAS_WINDOWLESS 11 - - -/*----------------------------------------------------------------------*/ -/* Function Prototypes */ -/*----------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * NPP_* functions are provided by the plugin and called by the navigator. - */ - -#ifdef XP_UNIX -char* NPP_GetMIMEDescription(void); -#endif /* XP_UNIX */ - -NPError NPP_Initialize(void); -void NPP_Shutdown(void); -NPError NPP_New(NPMIMEType pluginType, NPP instance, - uint16 mode, int16 argc, char* argn[], - char* argv[], NPSavedData* saved); -NPError NPP_Destroy(NPP instance, NPSavedData** save); -NPError NPP_SetWindow(NPP instance, NPWindow* window); -NPError NPP_NewStream(NPP instance, NPMIMEType type, - NPStream* stream, NPBool seekable, - uint16* stype); -NPError NPP_DestroyStream(NPP instance, NPStream* stream, - NPReason reason); -int32 NPP_WriteReady(NPP instance, NPStream* stream); -int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, - int32 len, void* buffer); -void NPP_StreamAsFile(NPP instance, NPStream* stream, - const char* fname); -void NPP_Print(NPP instance, NPPrint* platformPrint); -int16 NPP_HandleEvent(NPP instance, void* event); -void NPP_URLNotify(NPP instance, const char* url, - NPReason reason, void* notifyData); -jref NPP_GetJavaClass(void); -NPError NPP_GetValue(void *instance, NPPVariable variable, - void *value); -NPError NPP_SetValue(void *instance, NPNVariable variable, - void *value); - -/* - * NPN_* functions are provided by the navigator and called by the plugin. - */ - -void NPN_Version(int* plugin_major, int* plugin_minor, - int* netscape_major, int* netscape_minor); -NPError NPN_GetURLNotify(NPP instance, const char* url, - const char* target, void* notifyData); -NPError NPN_GetURL(NPP instance, const char* url, - const char* target); -NPError NPN_PostURLNotify(NPP instance, const char* url, - const char* target, uint32 len, - const char* buf, NPBool file, - void* notifyData); -NPError NPN_PostURL(NPP instance, const char* url, - const char* target, uint32 len, - const char* buf, NPBool file); -NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); -NPError NPN_NewStream(NPP instance, NPMIMEType type, - const char* target, NPStream** stream); -int32 NPN_Write(NPP instance, NPStream* stream, int32 len, - void* buffer); -NPError NPN_DestroyStream(NPP instance, NPStream* stream, - NPReason reason); -void NPN_Status(NPP instance, const char* message); -const char* NPN_UserAgent(NPP instance); -void* NPN_MemAlloc(uint32 size); -void NPN_MemFree(void* ptr); -uint32 NPN_MemFlush(uint32 size); -void NPN_ReloadPlugins(NPBool reloadPages); -JRIEnv* NPN_GetJavaEnv(void); -jref NPN_GetJavaPeer(NPP instance); -NPError NPN_GetValue(NPP instance, NPNVariable variable, - void *value); -NPError NPN_SetValue(NPP instance, NPPVariable variable, - void *value); -void NPN_InvalidateRect(NPP instance, NPRect *invalidRect); -void NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion); -void NPN_ForceRedraw(NPP instance); - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* _NPAPI_H_ */ diff --git a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/npupp.h b/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/npupp.h deleted file mode 100644 index 724aec4f7a9..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/npupp.h +++ /dev/null @@ -1,1160 +0,0 @@ -/* -*- Mode: C; tab-width: 4; -*- */ -/* - * npupp.h $Revision: 1.1 $ - * function call mecahnics needed by platform specific glue code. - */ - - -#ifndef _NPUPP_H_ -#define _NPUPP_H_ - -#ifndef GENERATINGCFM -#define GENERATINGCFM 0 -#endif - -#ifndef _NPAPI_H_ -#include "npapi.h" -#endif - -#include "jri.h" - -/****************************************************************************************** - plug-in function table macros - for each function in and out of the plugin API we define - typedef NPP_FooUPP - #define NewNPP_FooProc - #define CallNPP_FooProc - for mac, define the UPP magic for PPC/68K calling - *******************************************************************************************/ - - -/* NPP_Initialize */ - -#if GENERATINGCFM -typedef UniversalProcPtr NPP_InitializeUPP; - -enum { - uppNPP_InitializeProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0)) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPP_InitializeProc(FUNC) \ - (NPP_InitializeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_InitializeProcInfo, GetCurrentArchitecture()) -#define CallNPP_InitializeProc(FUNC) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_InitializeProcInfo) - -#else - -typedef void (*NPP_InitializeUPP)(void); -#define NewNPP_InitializeProc(FUNC) \ - ((NPP_InitializeUPP) (FUNC)) -#define CallNPP_InitializeProc(FUNC) \ - (*(FUNC))() - -#endif - - -/* NPP_Shutdown */ - -#if GENERATINGCFM -typedef UniversalProcPtr NPP_ShutdownUPP; - -enum { - uppNPP_ShutdownProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0)) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPP_ShutdownProc(FUNC) \ - (NPP_ShutdownUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_ShutdownProcInfo, GetCurrentArchitecture()) -#define CallNPP_ShutdownProc(FUNC) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_ShutdownProcInfo) - -#else - -typedef void (*NPP_ShutdownUPP)(void); -#define NewNPP_ShutdownProc(FUNC) \ - ((NPP_ShutdownUPP) (FUNC)) -#define CallNPP_ShutdownProc(FUNC) \ - (*(FUNC))() - -#endif - - -/* NPP_New */ - -#if GENERATINGCFM -typedef UniversalProcPtr NPP_NewUPP; - -enum { - uppNPP_NewProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPMIMEType))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(uint16))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int16))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(char **))) - | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(char **))) - | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(NPSavedData *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; - -#define NewNPP_NewProc(FUNC) \ - (NPP_NewUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewProcInfo, GetCurrentArchitecture()) -#define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewProcInfo, \ - (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) -#else - -typedef NPError (*NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved); -#define NewNPP_NewProc(FUNC) \ - ((NPP_NewUPP) (FUNC)) -#define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) - -#endif - - -/* NPP_Destroy */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_DestroyUPP; -enum { - uppNPP_DestroyProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPSavedData **))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_DestroyProc(FUNC) \ - (NPP_DestroyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyProcInfo, GetCurrentArchitecture()) -#define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyProcInfo, (ARG1), (ARG2)) -#else - -typedef NPError (*NPP_DestroyUPP)(NPP instance, NPSavedData** save); -#define NewNPP_DestroyProc(FUNC) \ - ((NPP_DestroyUPP) (FUNC)) -#define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \ - (*(FUNC))((ARG1), (ARG2)) - -#endif - - -/* NPP_SetWindow */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_SetWindowUPP; -enum { - uppNPP_SetWindowProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPWindow *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_SetWindowProc(FUNC) \ - (NPP_SetWindowUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetWindowProcInfo, GetCurrentArchitecture()) -#define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetWindowProcInfo, (ARG1), (ARG2)) - -#else - -typedef NPError (*NPP_SetWindowUPP)(NPP instance, NPWindow* window); -#define NewNPP_SetWindowProc(FUNC) \ - ((NPP_SetWindowUPP) (FUNC)) -#define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \ - (*(FUNC))((ARG1), (ARG2)) - -#endif - - -/* NPP_NewStream */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_NewStreamUPP; -enum { - uppNPP_NewStreamProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16 *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_NewStreamProc(FUNC) \ - (NPP_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewStreamProcInfo, GetCurrentArchitecture()) -#define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewStreamProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5)) -#else - -typedef NPError (*NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype); -#define NewNPP_NewStreamProc(FUNC) \ - ((NPP_NewStreamUPP) (FUNC)) -#define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5)) -#endif - - -/* NPP_DestroyStream */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_DestroyStreamUPP; -enum { - uppNPP_DestroyStreamProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_DestroyStreamProc(FUNC) \ - (NPP_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, GetCurrentArchitecture()) -#define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, (NPParg), (NPStreamPtr), (NPReasonArg)) - -#else - -typedef NPError (*NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason); -#define NewNPP_DestroyStreamProc(FUNC) \ - ((NPP_DestroyStreamUPP) (FUNC)) -#define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \ - (*(FUNC))((NPParg), (NPStreamPtr), (NPReasonArg)) - -#endif - - -/* NPP_WriteReady */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_WriteReadyUPP; -enum { - uppNPP_WriteReadyProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | RESULT_SIZE(SIZE_CODE(sizeof(int32))) -}; -#define NewNPP_WriteReadyProc(FUNC) \ - (NPP_WriteReadyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, GetCurrentArchitecture()) -#define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \ - (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, (NPParg), (NPStreamPtr)) - -#else - -typedef int32 (*NPP_WriteReadyUPP)(NPP instance, NPStream* stream); -#define NewNPP_WriteReadyProc(FUNC) \ - ((NPP_WriteReadyUPP) (FUNC)) -#define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \ - (*(FUNC))((NPParg), (NPStreamPtr)) - -#endif - - -/* NPP_Write */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_WriteUPP; -enum { - uppNPP_WriteProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int32))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(sizeof(int32))) -}; -#define NewNPP_WriteProc(FUNC) \ - (NPP_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteProcInfo, GetCurrentArchitecture()) -#define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \ - (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteProcInfo, (NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr)) - -#else - -typedef int32 (*NPP_WriteUPP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer); -#define NewNPP_WriteProc(FUNC) \ - ((NPP_WriteUPP) (FUNC)) -#define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \ - (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr)) - -#endif - - -/* NPP_StreamAsFile */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_StreamAsFileUPP; -enum { - uppNPP_StreamAsFileProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *))) - | RESULT_SIZE(SIZE_CODE(0)) -}; -#define NewNPP_StreamAsFileProc(FUNC) \ - (NPP_StreamAsFileUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, GetCurrentArchitecture()) -#define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, (ARG1), (ARG2), (ARG3)) - -#else - -typedef void (*NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname); -#define NewNPP_StreamAsFileProc(FUNC) \ - ((NPP_StreamAsFileUPP) (FUNC)) -#define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - -/* NPP_Print */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_PrintUPP; -enum { - uppNPP_PrintProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPrint *))) - | RESULT_SIZE(SIZE_CODE(0)) -}; -#define NewNPP_PrintProc(FUNC) \ - (NPP_PrintUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_PrintProcInfo, GetCurrentArchitecture()) -#define CallNPP_PrintProc(FUNC, NPParg, voidPtr) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_PrintProcInfo, (NPParg), (voidPtr)) - -#else - -typedef void (*NPP_PrintUPP)(NPP instance, NPPrint* platformPrint); -#define NewNPP_PrintProc(FUNC) \ - ((NPP_PrintUPP) (FUNC)) -#define CallNPP_PrintProc(FUNC, NPParg, NPPrintArg) \ - (*(FUNC))((NPParg), (NPPrintArg)) - -#endif - - -/* NPP_HandleEvent */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_HandleEventUPP; -enum { - uppNPP_HandleEventProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *))) - | RESULT_SIZE(SIZE_CODE(sizeof(int16))) -}; -#define NewNPP_HandleEventProc(FUNC) \ - (NPP_HandleEventUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_HandleEventProcInfo, GetCurrentArchitecture()) -#define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \ - (int16)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_HandleEventProcInfo, (NPParg), (voidPtr)) - -#else - -typedef int16 (*NPP_HandleEventUPP)(NPP instance, void* event); -#define NewNPP_HandleEventProc(FUNC) \ - ((NPP_HandleEventUPP) (FUNC)) -#define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \ - (*(FUNC))((NPParg), (voidPtr)) - -#endif - - -/* NPP_URLNotify */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_URLNotifyUPP; -enum { - uppNPP_URLNotifyProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(SIZE_CODE(0))) -}; -#define NewNPP_URLNotifyProc(FUNC) \ - (NPP_URLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, GetCurrentArchitecture()) -#define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4)) - -#else - -typedef void (*NPP_URLNotifyUPP)(NPP instance, const char* url, NPReason reason, void* notifyData); -#define NewNPP_URLNotifyProc(FUNC) \ - ((NPP_URLNotifyUPP) (FUNC)) -#define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4)) - -#endif - - -/* NPP_GetValue */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_GetValueUPP; -enum { - uppNPP_GetValueProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPVariable))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_GetValueProc(FUNC) \ - (NPP_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_GetValueProcInfo, GetCurrentArchitecture()) -#define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_GetValueProcInfo, (ARG1), (ARG2), (ARG3)) -#else - -typedef NPError (*NPP_GetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue); -#define NewNPP_GetValueProc(FUNC) \ - ((NPP_GetValueUPP) (FUNC)) -#define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - -/* NPP_SetValue */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_SetValueUPP; -enum { - uppNPP_SetValueProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_SetValueProc(FUNC) \ - (NPP_SetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetValueProcInfo, GetCurrentArchitecture()) -#define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetValueProcInfo, (ARG1), (ARG2), (ARG3)) -#else - -typedef NPError (*NPP_SetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue); -#define NewNPP_SetValueProc(FUNC) \ - ((NPP_SetValueUPP) (FUNC)) -#define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - - - -/* - * Netscape entry points - */ - - -/* NPN_GetValue */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_GetValueUPP; -enum { - uppNPN_GetValueProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_GetValueProc(FUNC) \ - (NPN_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetValueProcInfo, GetCurrentArchitecture()) -#define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetValueProcInfo, (ARG1), (ARG2), (ARG3)) -#else - -typedef NPError (*NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue); -#define NewNPN_GetValueProc(FUNC) \ - ((NPN_GetValueUPP) (FUNC)) -#define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - -/* NPN_SetValue */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_SetValueUPP; -enum { - uppNPN_SetValueProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPVariable))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_SetValueProc(FUNC) \ - (NPN_SetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_SetValueProcInfo, GetCurrentArchitecture()) -#define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_SetValueProcInfo, (ARG1), (ARG2), (ARG3)) -#else - -typedef NPError (*NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue); -#define NewNPN_SetValueProc(FUNC) \ - ((NPN_SetValueUPP) (FUNC)) -#define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - -/* NPN_GetUrlNotify */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_GetURLNotifyUPP; -enum { - uppNPN_GetURLNotifyProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_GetURLNotifyProc(FUNC) \ - (NPN_GetURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, GetCurrentArchitecture()) -#define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4)) -#else - -typedef NPError (*NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData); -#define NewNPN_GetURLNotifyProc(FUNC) \ - ((NPN_GetURLNotifyUPP) (FUNC)) -#define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4)) -#endif - - -/* NPN_PostUrlNotify */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_PostURLNotifyUPP; -enum { - uppNPN_PostURLNotifyProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool))) - | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_PostURLNotifyProc(FUNC) \ - (NPN_PostURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, GetCurrentArchitecture()) -#define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) -#else - -typedef NPError (*NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData); -#define NewNPN_PostURLNotifyProc(FUNC) \ - ((NPN_PostURLNotifyUPP) (FUNC)) -#define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) -#endif - - -/* NPN_GetUrl */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_GetURLUPP; -enum { - uppNPN_GetURLProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_GetURLProc(FUNC) \ - (NPN_GetURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLProcInfo, GetCurrentArchitecture()) -#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLProcInfo, (ARG1), (ARG2), (ARG3)) -#else - -typedef NPError (*NPN_GetURLUPP)(NPP instance, const char* url, const char* window); -#define NewNPN_GetURLProc(FUNC) \ - ((NPN_GetURLUPP) (FUNC)) -#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - -/* NPN_PostUrl */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_PostURLUPP; -enum { - uppNPN_PostURLProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_PostURLProc(FUNC) \ - (NPN_PostURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLProcInfo, GetCurrentArchitecture()) -#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6)) -#else - -typedef NPError (*NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file); -#define NewNPN_PostURLProc(FUNC) \ - ((NPN_PostURLUPP) (FUNC)) -#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6)) -#endif - - -/* NPN_RequestRead */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_RequestReadUPP; -enum { - uppNPN_RequestReadProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPByteRange *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_RequestReadProc(FUNC) \ - (NPN_RequestReadUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_RequestReadProcInfo, GetCurrentArchitecture()) -#define CallNPN_RequestReadProc(FUNC, stream, range) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_RequestReadProcInfo, (stream), (range)) - -#else - -typedef NPError (*NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList); -#define NewNPN_RequestReadProc(FUNC) \ - ((NPN_RequestReadUPP) (FUNC)) -#define CallNPN_RequestReadProc(FUNC, stream, range) \ - (*(FUNC))((stream), (range)) - -#endif - - -/* NPN_NewStream */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_NewStreamUPP; -enum { - uppNPN_NewStreamProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPStream **))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_NewStreamProc(FUNC) \ - (NPN_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_NewStreamProcInfo, GetCurrentArchitecture()) -#define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_NewStreamProcInfo, (npp), (type), (window), (stream)) - -#else - -typedef NPError (*NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream); -#define NewNPN_NewStreamProc(FUNC) \ - ((NPN_NewStreamUPP) (FUNC)) -#define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \ - (*(FUNC))((npp), (type), (window), (stream)) - -#endif - - -/* NPN_Write */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_WriteUPP; -enum { - uppNPN_WriteProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(sizeof(int32))) -}; -#define NewNPN_WriteProc(FUNC) \ - (NPN_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_WriteProcInfo, GetCurrentArchitecture()) -#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \ - (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_WriteProcInfo, (npp), (stream), (len), (buffer)) - -#else - -typedef int32 (*NPN_WriteUPP)(NPP instance, NPStream* stream, int32 len, void* buffer); -#define NewNPN_WriteProc(FUNC) \ - ((NPN_WriteUPP) (FUNC)) -#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \ - (*(FUNC))((npp), (stream), (len), (buffer)) - -#endif - - -/* NPN_DestroyStream */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_DestroyStreamUPP; -enum { - uppNPN_DestroyStreamProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP ))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_DestroyStreamProc(FUNC) \ - (NPN_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, GetCurrentArchitecture()) -#define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, (npp), (stream), (reason)) - -#else - -typedef NPError (*NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason); -#define NewNPN_DestroyStreamProc(FUNC) \ - ((NPN_DestroyStreamUPP) (FUNC)) -#define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \ - (*(FUNC))((npp), (stream), (reason)) - -#endif - - -/* NPN_Status */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_StatusUPP; -enum { - uppNPN_StatusProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char *))) -}; - -#define NewNPN_StatusProc(FUNC) \ - (NPN_StatusUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_StatusProcInfo, GetCurrentArchitecture()) -#define CallNPN_StatusProc(FUNC, npp, msg) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_StatusProcInfo, (npp), (msg)) - -#else - -typedef void (*NPN_StatusUPP)(NPP instance, const char* message); -#define NewNPN_StatusProc(FUNC) \ - ((NPN_StatusUPP) (FUNC)) -#define CallNPN_StatusProc(FUNC, npp, msg) \ - (*(FUNC))((npp), (msg)) - -#endif - - -/* NPN_UserAgent */ -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_UserAgentUPP; -enum { - uppNPN_UserAgentProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | RESULT_SIZE(SIZE_CODE(sizeof(const char *))) -}; - -#define NewNPN_UserAgentProc(FUNC) \ - (NPN_UserAgentUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_UserAgentProcInfo, GetCurrentArchitecture()) -#define CallNPN_UserAgentProc(FUNC, ARG1) \ - (const char*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_UserAgentProcInfo, (ARG1)) - -#else - -typedef const char* (*NPN_UserAgentUPP)(NPP instance); -#define NewNPN_UserAgentProc(FUNC) \ - ((NPN_UserAgentUPP) (FUNC)) -#define CallNPN_UserAgentProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN_MemAlloc */ -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_MemAllocUPP; -enum { - uppNPN_MemAllocProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32))) - | RESULT_SIZE(SIZE_CODE(sizeof(void *))) -}; - -#define NewNPN_MemAllocProc(FUNC) \ - (NPN_MemAllocUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemAllocProcInfo, GetCurrentArchitecture()) -#define CallNPN_MemAllocProc(FUNC, ARG1) \ - (void*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemAllocProcInfo, (ARG1)) - -#else - -typedef void* (*NPN_MemAllocUPP)(uint32 size); -#define NewNPN_MemAllocProc(FUNC) \ - ((NPN_MemAllocUPP) (FUNC)) -#define CallNPN_MemAllocProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN__MemFree */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_MemFreeUPP; -enum { - uppNPN_MemFreeProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(void *))) -}; - -#define NewNPN_MemFreeProc(FUNC) \ - (NPN_MemFreeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFreeProcInfo, GetCurrentArchitecture()) -#define CallNPN_MemFreeProc(FUNC, ARG1) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFreeProcInfo, (ARG1)) - -#else - -typedef void (*NPN_MemFreeUPP)(void* ptr); -#define NewNPN_MemFreeProc(FUNC) \ - ((NPN_MemFreeUPP) (FUNC)) -#define CallNPN_MemFreeProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN_MemFlush */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_MemFlushUPP; -enum { - uppNPN_MemFlushProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32))) - | RESULT_SIZE(SIZE_CODE(sizeof(uint32))) -}; - -#define NewNPN_MemFlushProc(FUNC) \ - (NPN_MemFlushUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFlushProcInfo, GetCurrentArchitecture()) -#define CallNPN_MemFlushProc(FUNC, ARG1) \ - (uint32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFlushProcInfo, (ARG1)) - -#else - -typedef uint32 (*NPN_MemFlushUPP)(uint32 size); -#define NewNPN_MemFlushProc(FUNC) \ - ((NPN_MemFlushUPP) (FUNC)) -#define CallNPN_MemFlushProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - - -/* NPN_ReloadPlugins */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_ReloadPluginsUPP; -enum { - uppNPN_ReloadPluginsProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPBool))) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPN_ReloadPluginsProc(FUNC) \ - (NPN_ReloadPluginsUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, GetCurrentArchitecture()) -#define CallNPN_ReloadPluginsProc(FUNC, ARG1) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, (ARG1)) - -#else - -typedef void (*NPN_ReloadPluginsUPP)(NPBool reloadPages); -#define NewNPN_ReloadPluginsProc(FUNC) \ - ((NPN_ReloadPluginsUPP) (FUNC)) -#define CallNPN_ReloadPluginsProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN_GetJavaEnv */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_GetJavaEnvUPP; -enum { - uppNPN_GetJavaEnvProcInfo = kThinkCStackBased - | RESULT_SIZE(SIZE_CODE(sizeof(JRIEnv*))) -}; - -#define NewNPN_GetJavaEnvProc(FUNC) \ - (NPN_GetJavaEnvUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo, GetCurrentArchitecture()) -#define CallNPN_GetJavaEnvProc(FUNC) \ - (JRIEnv*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo) - -#else - -typedef JRIEnv* (*NPN_GetJavaEnvUPP)(void); -#define NewNPN_GetJavaEnvProc(FUNC) \ - ((NPN_GetJavaEnvUPP) (FUNC)) -#define CallNPN_GetJavaEnvProc(FUNC) \ - (*(FUNC))() - -#endif - - -/* NPN_GetJavaPeer */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_GetJavaPeerUPP; -enum { - uppNPN_GetJavaPeerProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | RESULT_SIZE(SIZE_CODE(sizeof(jref))) -}; - -#define NewNPN_GetJavaPeerProc(FUNC) \ - (NPN_GetJavaPeerUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, GetCurrentArchitecture()) -#define CallNPN_GetJavaPeerProc(FUNC, ARG1) \ - (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, (ARG1)) - -#else - -typedef jref (*NPN_GetJavaPeerUPP)(NPP instance); -#define NewNPN_GetJavaPeerProc(FUNC) \ - ((NPN_GetJavaPeerUPP) (FUNC)) -#define CallNPN_GetJavaPeerProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN_InvalidateRect */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_InvalidateRectUPP; -enum { - uppNPN_InvalidateRectProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPRect *))) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPN_InvalidateRectProc(FUNC) \ - (NPN_InvalidateRectUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvalidateRectProcInfo, GetCurrentArchitecture()) -#define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvalidateRectProcInfo, (ARG1), (ARG2)) - -#else - -typedef void (*NPN_InvalidateRectUPP)(NPP instance, NPRect *rect); -#define NewNPN_InvalidateRectProc(FUNC) \ - ((NPN_InvalidateRectUPP) (FUNC)) -#define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \ - (*(FUNC))((ARG1), (ARG2)) - -#endif - - -/* NPN_InvalidateRegion */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_InvalidateRegionUPP; -enum { - uppNPN_InvalidateRegionProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPRegion))) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPN_InvalidateRegionProc(FUNC) \ - (NPN_InvalidateRegionUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvalidateRegionProcInfo, GetCurrentArchitecture()) -#define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvalidateRegionProcInfo, (ARG1), (ARG2)) - -#else - -typedef void (*NPN_InvalidateRegionUPP)(NPP instance, NPRegion region); -#define NewNPN_InvalidateRegionProc(FUNC) \ - ((NPN_InvalidateRegionUPP) (FUNC)) -#define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \ - (*(FUNC))((ARG1), (ARG2)) - -#endif - -/* NPN_ForceRedraw */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_ForceRedrawUPP; -enum { - uppNPN_ForceRedrawProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | RESULT_SIZE(SIZE_CODE(sizeof(0))) -}; - -#define NewNPN_ForceRedrawProc(FUNC) \ - (NPN_ForceRedrawUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ForceRedrawProcInfo, GetCurrentArchitecture()) -#define CallNPN_ForceRedrawProc(FUNC, ARG1) \ - (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ForceRedrawProcInfo, (ARG1)) - -#else - -typedef void (*NPN_ForceRedrawUPP)(NPP instance); -#define NewNPN_ForceRedrawProc(FUNC) \ - ((NPN_ForceRedrawUPP) (FUNC)) -#define CallNPN_ForceRedrawProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/****************************************************************************************** - * The actual plugin function table definitions - *******************************************************************************************/ - -#ifdef XP_MAC -#pragma align=mac68k -#endif - -typedef struct _NPPluginFuncs { - uint16 size; - uint16 version; - NPP_NewUPP newp; - NPP_DestroyUPP destroy; - NPP_SetWindowUPP setwindow; - NPP_NewStreamUPP newstream; - NPP_DestroyStreamUPP destroystream; - NPP_StreamAsFileUPP asfile; - NPP_WriteReadyUPP writeready; - NPP_WriteUPP write; - NPP_PrintUPP print; - NPP_HandleEventUPP event; - NPP_URLNotifyUPP urlnotify; - JRIGlobalRef javaClass; - NPP_GetValueUPP getvalue; - NPP_SetValueUPP setvalue; -} NPPluginFuncs; - -typedef struct _NPNetscapeFuncs { - uint16 size; - uint16 version; - NPN_GetURLUPP geturl; - NPN_PostURLUPP posturl; - NPN_RequestReadUPP requestread; - NPN_NewStreamUPP newstream; - NPN_WriteUPP write; - NPN_DestroyStreamUPP destroystream; - NPN_StatusUPP status; - NPN_UserAgentUPP uagent; - NPN_MemAllocUPP memalloc; - NPN_MemFreeUPP memfree; - NPN_MemFlushUPP memflush; - NPN_ReloadPluginsUPP reloadplugins; - NPN_GetJavaEnvUPP getJavaEnv; - NPN_GetJavaPeerUPP getJavaPeer; - NPN_GetURLNotifyUPP geturlnotify; - NPN_PostURLNotifyUPP posturlnotify; - NPN_GetValueUPP getvalue; - NPN_SetValueUPP setvalue; - NPN_InvalidateRectUPP invalidaterect; - NPN_InvalidateRegionUPP invalidateregion; - NPN_ForceRedrawUPP forceredraw; -} NPNetscapeFuncs; - -#ifdef XP_MAC -#pragma align=reset -#endif - - -#ifdef XP_MAC -/****************************************************************************************** - * Mac platform-specific plugin glue stuff - *******************************************************************************************/ - -/* - * Main entry point of the plugin. - * This routine will be called when the plugin is loaded. The function - * tables are passed in and the plugin fills in the NPPluginFuncs table - * and NPPShutdownUPP for Netscape's use. - */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_MainEntryUPP; -enum { - uppNPP_MainEntryProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPNetscapeFuncs*))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPluginFuncs*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPP_ShutdownUPP*))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_MainEntryProc(FUNC) \ - (NPP_MainEntryUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_MainEntryProcInfo, GetCurrentArchitecture()) -#define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \ - CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNPP_MainEntryProcInfo, (netscapeFunc), (pluginFunc), (shutdownUPP)) - -#else - -typedef NPError (*NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*); -#define NewNPP_MainEntryProc(FUNC) \ - ((NPP_MainEntryUPP) (FUNC)) -#define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \ - (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP)) - -#endif -#endif /* MAC */ - - -#ifdef _WINDOWS - -#ifdef __cplusplus -extern "C" { -#endif - -/* plugin meta member functions */ - -NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* pFuncs); - -NPError WINAPI NP_Initialize(NPNetscapeFuncs* pFuncs); - -NPError WINAPI NP_Shutdown(); - -#ifdef __cplusplus -} -#endif - -#endif /* _WINDOWS */ - -#ifdef XP_UNIX - -#ifdef __cplusplus -extern "C" { -#endif - -/* plugin meta member functions */ - -char* NP_GetMIMEDescription(void); -NPError NP_Initialize(NPNetscapeFuncs*, NPPluginFuncs*); -NPError NP_Shutdown(void); - -#ifdef __cplusplus -} -#endif - -#endif /* XP_UNIX */ - -#endif /* _NPUPP_H_ */ diff --git a/embedding/browser/activex/src/pluginhostctrl/resource.h b/embedding/browser/activex/src/pluginhostctrl/resource.h deleted file mode 100644 index fe3203538ca..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/resource.h +++ /dev/null @@ -1,18 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by pluginhostctrl.rc -// -#define IDS_PROJNAME 100 -#define IDB_PLUGINHOSTCTRL 101 -#define IDR_PLUGINHOSTCTRL 103 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 201 -#define _APS_NEXT_COMMAND_VALUE 32768 -#define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 105 -#endif -#endif diff --git a/embedding/browser/activex/src/pluginhostctrl/tests/ns4x_reference_test3.htm b/embedding/browser/activex/src/pluginhostctrl/tests/ns4x_reference_test3.htm deleted file mode 100644 index 23e6a5471c1..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/tests/ns4x_reference_test3.htm +++ /dev/null @@ -1,14 +0,0 @@ - - -Reference test 3 for the plugin - - -

Run this in NS 4.x to compare behaviours!

- - - \ No newline at end of file diff --git a/embedding/browser/activex/src/pluginhostctrl/tests/test1.htm b/embedding/browser/activex/src/pluginhostctrl/tests/test1.htm deleted file mode 100644 index b6c884d1e3c..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/tests/test1.htm +++ /dev/null @@ -1,11 +0,0 @@ - - -Test 1 for the plugin - - -

Test for default plugin.

- - - - - \ No newline at end of file diff --git a/embedding/browser/activex/src/pluginhostctrl/tests/test10.htm b/embedding/browser/activex/src/pluginhostctrl/tests/test10.htm deleted file mode 100644 index b86bf1cd315..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/tests/test10.htm +++ /dev/null @@ -1,26 +0,0 @@ - - -Test 10 for the plugin - - -

This page passes multiple custom parameters "sw1" and "sw2" through to the Shockwave plugin.

-

Also note that if you don't have a plugin to handle the "application/x-director" content type - you can use the page to test that the null plugin is being correctly loaded instead - with the proper MIME type and pluginspage values.

-
- - - - - - - -
-

-To play:
-1.Click on PLAY to turn machine on.
-2.Press 1 or 2 for one or two player game.
-3.Hold space bar to pull plunger, release to shoot ball.
-4.Use [CONTROL] key for left flipper; [SHIFT] key for right flipper.
- - \ No newline at end of file diff --git a/embedding/browser/activex/src/pluginhostctrl/tests/test11.htm b/embedding/browser/activex/src/pluginhostctrl/tests/test11.htm deleted file mode 100644 index 4dfd9790f77..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/tests/test11.htm +++ /dev/null @@ -1,10 +0,0 @@ - - -Test 11 for the plugin - - -

Test specifies no parameters at all.

- - - - \ No newline at end of file diff --git a/embedding/browser/activex/src/pluginhostctrl/tests/test2.htm b/embedding/browser/activex/src/pluginhostctrl/tests/test2.htm deleted file mode 100644 index 41975219e61..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/tests/test2.htm +++ /dev/null @@ -1,12 +0,0 @@ - - -Test 2 for the plugin - - -

Test for Shockwave plugin.

- - - - - - \ No newline at end of file diff --git a/embedding/browser/activex/src/pluginhostctrl/tests/test3.htm b/embedding/browser/activex/src/pluginhostctrl/tests/test3.htm deleted file mode 100644 index db3460b3e2f..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/tests/test3.htm +++ /dev/null @@ -1,12 +0,0 @@ - - -Test 3 for the plugin - - -

Test for QuickTime plugin.

- - - - - - \ No newline at end of file diff --git a/embedding/browser/activex/src/pluginhostctrl/tests/test4.htm b/embedding/browser/activex/src/pluginhostctrl/tests/test4.htm deleted file mode 100644 index ac580b1d882..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/tests/test4.htm +++ /dev/null @@ -1,12 +0,0 @@ - - -Test 4 for the plugin - - -

Test for the Adobe Acrobat plugin

- - - - - - diff --git a/embedding/browser/activex/src/pluginhostctrl/tests/test5.htm b/embedding/browser/activex/src/pluginhostctrl/tests/test5.htm deleted file mode 100644 index 1e6098b2c0d..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/tests/test5.htm +++ /dev/null @@ -1,15 +0,0 @@ - - -Test 5 for the plugin - - -

This page tests what happens when the plugin is fed a duff "foo/bar" MIME type. -It should show the default plugin. Clicking on the plugin should take you -to http://www.mozilla.org which is where the "pluginspage" parameter points.

- - - - - - - diff --git a/embedding/browser/activex/src/pluginhostctrl/tests/test6.htm b/embedding/browser/activex/src/pluginhostctrl/tests/test6.htm deleted file mode 100644 index a541085224c..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/tests/test6.htm +++ /dev/null @@ -1,12 +0,0 @@ - - -Test 6 for the plugin - - -

This test (for Shockwave plugin) does not specify the content type as a parameter. -The control must create the right plugin using the content type of the source data.

- - - - - \ No newline at end of file diff --git a/embedding/browser/activex/src/pluginhostctrl/tests/test7.htm b/embedding/browser/activex/src/pluginhostctrl/tests/test7.htm deleted file mode 100644 index 3187ffdda84..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/tests/test7.htm +++ /dev/null @@ -1,14 +0,0 @@ - - -Test 7 for the plugin - - -

This page contains several plugins of the same type.

- - - - - - - - \ No newline at end of file diff --git a/embedding/browser/activex/src/pluginhostctrl/tests/test8.htm b/embedding/browser/activex/src/pluginhostctrl/tests/test8.htm deleted file mode 100644 index 0a295b5274a..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/tests/test8.htm +++ /dev/null @@ -1,16 +0,0 @@ - - -Test 8 for the plugin - - -

This page contains several plugins of a different kind.

- - - - - - - - - - \ No newline at end of file diff --git a/embedding/browser/activex/src/pluginhostctrl/tests/test9.htm b/embedding/browser/activex/src/pluginhostctrl/tests/test9.htm deleted file mode 100644 index 24cdf95d19c..00000000000 --- a/embedding/browser/activex/src/pluginhostctrl/tests/test9.htm +++ /dev/null @@ -1,15 +0,0 @@ - - -Test 9 for the plugin - - -

This page passes a custom parameter "LOOP" through to the quicktime plugin so -it plays the clip in a continuous loop.

- - - - - - - - \ No newline at end of file diff --git a/embedding/browser/activex/src/xml/ParseExpat.cpp b/embedding/browser/activex/src/xml/ParseExpat.cpp deleted file mode 100644 index 6cefa2a11b6..00000000000 --- a/embedding/browser/activex/src/xml/ParseExpat.cpp +++ /dev/null @@ -1,171 +0,0 @@ -#include "stdafx.h" - -#define XML_UNICODE -#include "xmlparse.h" - -#ifdef XML_UNICODE -#define X2OLE W2COLE -#define X2T W2T -#else -#define X2OLE A2COLE -#define X2T A2T -#endif - - -struct ParserState -{ - CComQIPtr spXMLDocument; - CComQIPtr spXMLRoot; - CComQIPtr spXMLParent; -}; - -static ParserState cParserState; - - -// XML data handlers -static void OnStartElement(void *userData, const XML_Char *name, const XML_Char **atts); -static void OnEndElement(void *userData, const XML_Char *name); -static void OnCharacterData(void *userData, const XML_Char *s, int len); -static void OnDefault(void *userData, const XML_Char *s, int len); - - -struct ParseData -{ - CComQIPtr spDocument; - CComQIPtr spRoot; -}; - -HRESULT ParseExpat(const char *pBuffer, unsigned long cbBufSize, IXMLDocument *pDocument, IXMLElement **ppElement) -{ - if (pDocument == NULL) - { - return E_INVALIDARG; - } - - XML_Parser parser = XML_ParserCreate(NULL); - HRESULT hr = S_OK; - - cParserState.spXMLDocument = pDocument; - pDocument->get_root(&cParserState.spXMLParent); - - // Initialise the XML parser - XML_SetUserData(parser, &cParserState); - - // Initialise the data handlers - XML_SetElementHandler(parser, OnStartElement, OnEndElement); - XML_SetCharacterDataHandler(parser, OnCharacterData); - XML_SetDefaultHandler(parser, OnDefault); - - // Parse the data - if (!XML_Parse(parser, pBuffer, cbBufSize, 1)) - { - /* TODO Create error code - fprintf(stderr, - "%s at line %d\n", - XML_ErrorString(XML_GetErrorCode(parser)), - XML_GetCurrentLineNumber(parser)); - */ - hr = E_FAIL; - } - - // Cleanup - XML_ParserFree(parser); - - cParserState.spXMLRoot->QueryInterface(IID_IXMLElement, (void **) ppElement); - cParserState.spXMLDocument.Release(); - cParserState.spXMLParent.Release(); - - return S_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// - - -void OnStartElement(void *userData, const XML_Char *name, const XML_Char **atts) -{ - ParserState *pState = (ParserState *) userData; - if (pState) - { - USES_CONVERSION; - - CComQIPtr spXMLElement; - - // Create a new element - pState->spXMLDocument->createElement( - CComVariant(XMLELEMTYPE_ELEMENT), - CComVariant(X2OLE(name)), - &spXMLElement); - - if (spXMLElement) - { - // Create each attribute - for (int i = 0; atts[i] != NULL; i += 2) - { - const XML_Char *pszName = atts[i]; - const XML_Char *pszValue = atts[i+1]; - spXMLElement->setAttribute((BSTR) X2OLE(pszName), CComVariant(X2OLE(pszValue))); - } - - if (pState->spXMLRoot == NULL) - { - pState->spXMLRoot = spXMLElement; - } - if (pState->spXMLParent) - { - // Add the element to the end of the list - pState->spXMLParent->addChild(spXMLElement, -1, -1); - } - pState->spXMLParent = spXMLElement; - } - } -} - - -void OnEndElement(void *userData, const XML_Char *name) -{ - ParserState *pState = (ParserState *) userData; - if (pState) - { - CComQIPtr spNewParent; - if (pState->spXMLParent) - { - pState->spXMLParent->get_parent(&spNewParent); - pState->spXMLParent = spNewParent; - } - } -} - - -void OnDefault(void *userData, const XML_Char *s, int len) -{ - XML_Char *pString = new XML_Char[len + 1]; - memset(pString, 0, sizeof(XML_Char) * (len + 1)); - memcpy(pString, s, sizeof(XML_Char) * len); - - USES_CONVERSION; - ATLTRACE(_T("OnDefault: \"%s\"\n"), X2T(pString)); - - // TODO test if the buffer contains - // and store version in XML document - - // TODO test if the buffer contains DTD and store it - // in the XML document - - // TODO test if the buffer contains a comment, i.e. - // and create a comment XML element - - delete []pString; -} - - -void OnCharacterData(void *userData, const XML_Char *s, int len) -{ - ParserState *pState = (ParserState *) userData; - if (pState) - { - // TODO create TEXT element - } -} - - diff --git a/embedding/browser/activex/src/xml/StdAfx.cpp b/embedding/browser/activex/src/xml/StdAfx.cpp deleted file mode 100644 index a5eea178f78..00000000000 --- a/embedding/browser/activex/src/xml/StdAfx.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// stdafx.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -#ifdef _ATL_STATIC_REGISTRY -#include -#include -#endif - -#include diff --git a/embedding/browser/activex/src/xml/StdAfx.h b/embedding/browser/activex/src/xml/StdAfx.h deleted file mode 100644 index 88df7b7f1ec..00000000000 --- a/embedding/browser/activex/src/xml/StdAfx.h +++ /dev/null @@ -1,40 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__45E5B413_2805_11D3_9425_000000000000__INCLUDED_) -#define AFX_STDAFX_H__45E5B413_2805_11D3_9425_000000000000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define STRICT -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0403 -#endif -#define _ATL_APARTMENT_THREADED - -#include -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#include - -//#include "activexml.h" - -extern const CLSID CLSID_MozXMLElement; -extern const CLSID CLSID_MozXMLDocument; -extern const CLSID CLSID_MozXMLElementCollection; -extern const IID LIBID_MozActiveXMLLib; - -#include "XMLElement.h" -#include "XMLElementCollection.h" -#include "XMLDocument.h" - -extern HRESULT ParseExpat(const char *pBuffer, unsigned long cbBufSize, IXMLDocument *pDocument, IXMLElement **ppElement); - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__45E5B413_2805_11D3_9425_000000000000__INCLUDED) diff --git a/embedding/browser/activex/src/xml/XMLDocument.cpp b/embedding/browser/activex/src/xml/XMLDocument.cpp deleted file mode 100644 index 3f71405dc62..00000000000 --- a/embedding/browser/activex/src/xml/XMLDocument.cpp +++ /dev/null @@ -1,328 +0,0 @@ -// XMLDocument.cpp : Implementation of CXMLDocument -#include "stdafx.h" -//#include "Activexml.h" -#include "XMLDocument.h" - - -CXMLDocument::CXMLDocument() -{ - ATLTRACE(_T("CXMLDocument::CXMLDocument()\n")); - m_nReadyState = READYSTATE_COMPLETE; -} - - -CXMLDocument::~CXMLDocument() -{ -} - - -///////////////////////////////////////////////////////////////////////////// -// CXMLDocument - - -STDMETHODIMP CXMLDocument::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_IXMLDocument - }; - for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++) - { - if (InlineIsEqualGUID(*arr[i],riid)) - return S_OK; - } - return S_FALSE; -} - - -///////////////////////////////////////////////////////////////////////////// -// IPersistStreamInit implementation - - -HRESULT STDMETHODCALLTYPE CXMLDocument::Load(/* [in] */ LPSTREAM pStm) -{ - if (pStm == NULL) - { - return E_INVALIDARG; - } - - // Load the XML from the stream - STATSTG statstg; - pStm->Stat(&statstg, STATFLAG_NONAME); - - ULONG cbBufSize = statstg.cbSize.LowPart; - - char *pBuffer = new char[cbBufSize]; - if (pBuffer == NULL) - { - return E_OUTOFMEMORY; - } - - memset(pBuffer, 0, cbBufSize); - pStm->Read(pBuffer, cbBufSize, NULL); - - m_spRoot.Release(); - ParseExpat(pBuffer, cbBufSize, (IXMLDocument *) this, &m_spRoot); - - delete []pBuffer; - - m_nReadyState = READYSTATE_LOADED; - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::Save(/* [in] */ LPSTREAM pStm, /* [in] */ BOOL fClearDirty) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::GetSizeMax(/* [out] */ ULARGE_INTEGER __RPC_FAR *pCbSize) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::InitNew(void) -{ - return S_OK; -} - - -///////////////////////////////////////////////////////////////////////////// -// IPersistMoniker implementation - - -HRESULT STDMETHODCALLTYPE CXMLDocument::GetClassID(/* [out] */ CLSID __RPC_FAR *pClassID) -{ - if (pClassID == NULL) - { - return E_INVALIDARG; - } - *pClassID = CLSID_MozXMLDocument; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::IsDirty(void) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::Load(/* [in] */ BOOL fFullyAvailable, /* [in] */ IMoniker __RPC_FAR *pimkName, /* [in] */ LPBC pibc, /* [in] */ DWORD grfMode) -{ - if (pimkName == NULL) - { - return E_INVALIDARG; - } - - m_nReadyState = READYSTATE_LOADING; - - // Bind to the stream specified by the moniker - CComQIPtr spIStream; - if (FAILED(pimkName->BindToStorage(pibc, NULL, IID_IStream, (void **) &spIStream))) - { - return E_FAIL; - } - - return Load(spIStream); -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::Save(/* [in] */ IMoniker __RPC_FAR *pimkName, /* [in] */ LPBC pbc, /* [in] */ BOOL fRemember) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::SaveCompleted(/* [in] */ IMoniker __RPC_FAR *pimkName, /* [in] */ LPBC pibc) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::GetCurMoniker(/* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppimkName) -{ - return E_NOTIMPL; -} - - -///////////////////////////////////////////////////////////////////////////// -// IXMLError implementation - -HRESULT STDMETHODCALLTYPE CXMLDocument::GetErrorInfo(XML_ERROR __RPC_FAR *pErrorReturn) -{ - return E_NOTIMPL; -} - -///////////////////////////////////////////////////////////////////////////// -// IXMLDocument implementation - - -HRESULT STDMETHODCALLTYPE CXMLDocument::get_root(/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - *p = NULL; - if (m_spRoot) - { - m_spRoot->QueryInterface(IID_IXMLElement, (void **) p); - } - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::get_fileSize(/* [out][retval] */ BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::get_fileModifiedDate(/* [out][retval] */ BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::get_fileUpdatedDate(/* [out][retval] */ BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::get_URL(/* [out][retval] */ BSTR __RPC_FAR *p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - - USES_CONVERSION; - *p = SysAllocString(A2OLE(m_szURL.c_str())); - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::put_URL(/* [in] */ BSTR p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - - USES_CONVERSION; - m_szURL = OLE2A(p); - - // Destroy old document - CComQIPtr spIMoniker; - if (FAILED(CreateURLMoniker(NULL, A2W(m_szURL.c_str()), &spIMoniker))) - { - return E_FAIL; - } - - CComQIPtr spIBindCtx; - if (FAILED(CreateBindCtx(0, &spIBindCtx))) - { - return E_FAIL; - } - - if (FAILED(Load(TRUE, spIMoniker, spIBindCtx, 0))) - { - return E_FAIL; - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::get_mimeType(/* [out][retval] */ BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::get_readyState(/* [out][retval] */ long __RPC_FAR *pl) -{ - if (pl == NULL) - { - return E_INVALIDARG; - } - *pl = m_nReadyState; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::get_charset(/* [out][retval] */ BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::put_charset(/* [in] */ BSTR p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::get_version(/* [out][retval] */ BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::get_doctype(/* [out][retval] */ BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::get_dtdURL(/* [out][retval] */ BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLDocument::createElement(/* [in] */ VARIANT vType, /* [in][optional] */ VARIANT var1, /* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppElem) -{ - if (vType.vt != VT_I4) - { - return E_INVALIDARG; - } - if (ppElem == NULL) - { - return E_INVALIDARG; - } - - CXMLElementInstance *pInstance = NULL; - CXMLElementInstance::CreateInstance(&pInstance); - if (pInstance == NULL) - { - return E_OUTOFMEMORY; - } - - IXMLElement *pElement = NULL; - if (FAILED(pInstance->QueryInterface(IID_IXMLElement, (void **) &pElement))) - { - pInstance->Release(); - return E_NOINTERFACE; - } - - // Set the element type - long nType = vType.intVal; - pInstance->PutType(nType); - - // Set the tag name - if (var1.vt == VT_BSTR) - { - pInstance->put_tagName(var1.bstrVal); - } - - *ppElem = pElement; - return S_OK; -} - - diff --git a/embedding/browser/activex/src/xml/XMLDocument.h b/embedding/browser/activex/src/xml/XMLDocument.h deleted file mode 100644 index 27b38095910..00000000000 --- a/embedding/browser/activex/src/xml/XMLDocument.h +++ /dev/null @@ -1,80 +0,0 @@ -// XMLDocument.h : Declaration of the CXMLDocument - -#ifndef __XMLDOCUMENT_H_ -#define __XMLDOCUMENT_H_ - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CXMLDocument -class ATL_NO_VTABLE CXMLDocument : - public CComObjectRootEx, - public CComCoClass, - public ISupportErrorInfo, - public IDispatchImpl, - public IPersistMoniker, - public IPersistStreamInit -{ -public: - CXMLDocument(); - virtual ~CXMLDocument(); - - -DECLARE_REGISTRY_RESOURCEID(IDR_XMLDOCUMENT) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDocument) - COM_INTERFACE_ENTRY(IXMLDocument) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IPersistMoniker) - COM_INTERFACE_ENTRY(IPersistStreamInit) -// COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() - - LONG m_nReadyState; - std::string m_szURL; - CComQIPtr m_spRoot; - -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// IPersistStreamInit - //virtual HRESULT STDMETHODCALLTYPE IsDirty(void); - HRESULT STDMETHODCALLTYPE Load(/* [in] */ LPSTREAM pStm); - HRESULT STDMETHODCALLTYPE Save(/* [in] */ LPSTREAM pStm, /* [in] */ BOOL fClearDirty); - HRESULT STDMETHODCALLTYPE GetSizeMax(/* [out] */ ULARGE_INTEGER __RPC_FAR *pCbSize); - HRESULT STDMETHODCALLTYPE InitNew(void); - -// IPersistMoniker - HRESULT STDMETHODCALLTYPE GetClassID(/* [out] */ CLSID __RPC_FAR *pClassID); - HRESULT STDMETHODCALLTYPE IsDirty(void); - HRESULT STDMETHODCALLTYPE Load(/* [in] */ BOOL fFullyAvailable, /* [in] */ IMoniker __RPC_FAR *pimkName, /* [in] */ LPBC pibc, /* [in] */ DWORD grfMode); - HRESULT STDMETHODCALLTYPE Save(/* [in] */ IMoniker __RPC_FAR *pimkName, /* [in] */ LPBC pbc, /* [in] */ BOOL fRemember); - HRESULT STDMETHODCALLTYPE SaveCompleted(/* [in] */ IMoniker __RPC_FAR *pimkName, /* [in] */ LPBC pibc); - HRESULT STDMETHODCALLTYPE GetCurMoniker(/* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppimkName); - -// IXMLError - HRESULT STDMETHODCALLTYPE GetErrorInfo(XML_ERROR __RPC_FAR *pErrorReturn); - -// IXMLDocument - HRESULT STDMETHODCALLTYPE get_root(/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *p); - HRESULT STDMETHODCALLTYPE get_fileSize(/* [out][retval] */ BSTR __RPC_FAR *p); - HRESULT STDMETHODCALLTYPE get_fileModifiedDate(/* [out][retval] */ BSTR __RPC_FAR *p); - HRESULT STDMETHODCALLTYPE get_fileUpdatedDate(/* [out][retval] */ BSTR __RPC_FAR *p); - HRESULT STDMETHODCALLTYPE get_URL(/* [out][retval] */ BSTR __RPC_FAR *p); - HRESULT STDMETHODCALLTYPE put_URL(/* [in] */ BSTR p); - HRESULT STDMETHODCALLTYPE get_mimeType(/* [out][retval] */ BSTR __RPC_FAR *p); - HRESULT STDMETHODCALLTYPE get_readyState(/* [out][retval] */ long __RPC_FAR *pl); - HRESULT STDMETHODCALLTYPE get_charset(/* [out][retval] */ BSTR __RPC_FAR *p); - HRESULT STDMETHODCALLTYPE put_charset(/* [in] */ BSTR p); - HRESULT STDMETHODCALLTYPE get_version(/* [out][retval] */ BSTR __RPC_FAR *p); - HRESULT STDMETHODCALLTYPE get_doctype(/* [out][retval] */ BSTR __RPC_FAR *p); - HRESULT STDMETHODCALLTYPE get_dtdURL(/* [out][retval] */ BSTR __RPC_FAR *p); - HRESULT STDMETHODCALLTYPE createElement(/* [in] */ VARIANT vType, /* [in][optional] */ VARIANT var1, /* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppElem); -public: -}; - -typedef CComObject CXMLDocumentInstance; - -#endif //__XMLDOCUMENT_H_ diff --git a/embedding/browser/activex/src/xml/XMLDocument.rgs b/embedding/browser/activex/src/xml/XMLDocument.rgs deleted file mode 100644 index e7ffeca58cf..00000000000 --- a/embedding/browser/activex/src/xml/XMLDocument.rgs +++ /dev/null @@ -1,26 +0,0 @@ -HKCR -{ - Mozilla.XMLDocument.1 = s 'Mozilla XMLDocument Class' - { - CLSID = s '{45E5B41D-2805-11D3-9425-000000000000}' - } - Mozilla.XMLDocument = s 'Mozilla XMLDocument Class' - { - CLSID = s '{45E5B41D-2805-11D3-9425-000000000000}' - CurVer = s 'Mozilla.XMLDocument.1' - } - NoRemove CLSID - { - ForceRemove {45E5B41D-2805-11D3-9425-000000000000} = s 'Mozilla XMLDocument Class' - { - ProgID = s 'Mozilla.XMLDocument.1' - VersionIndependentProgID = s 'Mozilla.XMLDocument' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{45E5B410-2805-11D3-9425-000000000000}' - } - } -} diff --git a/embedding/browser/activex/src/xml/XMLElement.cpp b/embedding/browser/activex/src/xml/XMLElement.cpp deleted file mode 100644 index 11145fb7bfe..00000000000 --- a/embedding/browser/activex/src/xml/XMLElement.cpp +++ /dev/null @@ -1,226 +0,0 @@ -// XMLElement.cpp : Implementation of CXMLElement -#include "stdafx.h" -//#include "Activexml.h" -#include "XMLElement.h" - - -CXMLElement::CXMLElement() -{ - m_nType = 0; - m_pParent = NULL; -} - - -CXMLElement::~CXMLElement() -{ -} - - -HRESULT CXMLElement::SetParent(IXMLElement *pParent) -{ - // Note: parent is not refcounted - m_pParent = pParent; - return S_OK; -} - - -HRESULT CXMLElement::PutType(long nType) -{ - m_nType = nType; - return S_OK; -} - - -HRESULT CXMLElement::ReleaseAll() -{ - // Release all children - m_cChildren.clear(); - return S_OK; -} - - -///////////////////////////////////////////////////////////////////////////// -// CXMLElement - - -// Return the element's tag name -HRESULT STDMETHODCALLTYPE CXMLElement::get_tagName(/* [out][retval] */ BSTR __RPC_FAR *p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - USES_CONVERSION; - *p = SysAllocString(A2OLE(m_szTagName.c_str())); - return S_OK; -} - - -// Store the tag name -HRESULT STDMETHODCALLTYPE CXMLElement::put_tagName(/* [in] */ BSTR p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - USES_CONVERSION; - m_szTagName = OLE2A(p); - return S_OK; -} - - -// Returns the parent element -HRESULT STDMETHODCALLTYPE CXMLElement::get_parent(/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppParent) -{ - if (ppParent == NULL) - { - return E_INVALIDARG; - } - - *ppParent = NULL; - if (m_pParent) - { - return m_pParent->QueryInterface(IID_IXMLElement, (void **) ppParent); - } - - return S_OK; -} - - -// Set the specified attribute value -HRESULT STDMETHODCALLTYPE CXMLElement::setAttribute(/* [in] */ BSTR strPropertyName, /* [in] */ VARIANT PropertyValue) -{ - if (strPropertyName == NULL || PropertyValue.vt != VT_BSTR) - { - return E_INVALIDARG; - } - - USES_CONVERSION; - std::string szPropertyName = OLE2A(strPropertyName); - std::string szPropertyValue = OLE2A(PropertyValue.bstrVal); - m_cAttributes[szPropertyName] = szPropertyValue; - - return S_OK; -} - - -// Return the requested attribute -HRESULT STDMETHODCALLTYPE CXMLElement::getAttribute(/* [in] */ BSTR strPropertyName, /* [out][retval] */ VARIANT __RPC_FAR *PropertyValue) -{ - if (strPropertyName == NULL || PropertyValue == NULL) - { - return E_INVALIDARG; - } - - USES_CONVERSION; - std::string szPropertyName = OLE2A(strPropertyName); - StringMap::iterator i = m_cAttributes.find(szPropertyName); - if (i == m_cAttributes.end()) - { - return S_FALSE; - } - - PropertyValue->vt = VT_BSTR; - PropertyValue->bstrVal = SysAllocString(A2OLE((*i).second.c_str())); - return S_OK; -} - - -// Find and remove the specified attribute -HRESULT STDMETHODCALLTYPE CXMLElement::removeAttribute(/* [in] */ BSTR strPropertyName) -{ - if (strPropertyName == NULL) - { - return E_INVALIDARG; - } - - USES_CONVERSION; - std::string szPropertyName = OLE2A(strPropertyName); - StringMap::iterator i = m_cAttributes.find(szPropertyName); - if (i == m_cAttributes.end()) - { - return E_INVALIDARG; - } - - m_cAttributes.erase(i); - - return S_OK; -} - - -// Return the child collection for this element -HRESULT STDMETHODCALLTYPE CXMLElement::get_children(/* [out][retval] */ IXMLElementCollection __RPC_FAR *__RPC_FAR *pp) -{ - CXMLElementCollectionInstance *pCollection = NULL; - CXMLElementCollectionInstance::CreateInstance(&pCollection); - if (pCollection == NULL) - { - return E_OUTOFMEMORY; - } - - // Add children to the collection - for (ElementList::iterator i = m_cChildren.begin(); i != m_cChildren.end(); i++) - { - pCollection->Add(*i); - } - - pCollection->QueryInterface(IID_IXMLElementCollection, (void **) pp); - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CXMLElement::get_type(/* [out][retval] */ long __RPC_FAR *plType) -{ - if (plType == NULL) - { - return E_INVALIDARG; - } - *plType = m_nType; - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CXMLElement::get_text(/* [out][retval] */ BSTR __RPC_FAR *p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLElement::put_text(/* [in] */ BSTR p) -{ - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE CXMLElement::addChild(/* [in] */ IXMLElement __RPC_FAR *pChildElem, long lIndex, long lReserved) -{ - if (pChildElem == NULL) - { - return E_INVALIDARG; - } - - // Set the child's parent to be this element - ((CXMLElement *) pChildElem)->SetParent(this); - - if (lIndex < 0 || lIndex >= m_cChildren.size()) - { - // Append to end - m_cChildren.push_back(pChildElem); - } - else - { -// TODO m_cChildren.insert(&m_cChildren[lIndex]); - m_cChildren.push_back(pChildElem); - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CXMLElement::removeChild(/* [in] */ IXMLElement __RPC_FAR *pChildElem) -{ - // TODO - return E_NOTIMPL; -} - diff --git a/embedding/browser/activex/src/xml/XMLElement.h b/embedding/browser/activex/src/xml/XMLElement.h deleted file mode 100644 index ed5a2fd2802..00000000000 --- a/embedding/browser/activex/src/xml/XMLElement.h +++ /dev/null @@ -1,71 +0,0 @@ -// XMLElement.h : Declaration of the CXMLElement - -#ifndef __XMLELEMENT_H_ -#define __XMLELEMENT_H_ - -#include "resource.h" // main symbols - -#include -#include -#include - -typedef std::map StringMap; -typedef std::vector< CComQIPtr > ElementList; - -///////////////////////////////////////////////////////////////////////////// -// CXMLElement -class ATL_NO_VTABLE CXMLElement : - public CComObjectRootEx, - public CComCoClass, - public IDispatchImpl -{ - // Pointer to parent - IXMLElement *m_pParent; - // List of children - ElementList m_cChildren; - // Tag name - std::string m_szTagName; - // Text - std::string m_szText; - // Type - long m_nType; - // Attribute list - StringMap m_cAttributes; - -public: - CXMLElement(); - virtual ~CXMLElement(); - - virtual HRESULT SetParent(IXMLElement *pParent); - virtual HRESULT PutType(long nType); - virtual HRESULT ReleaseAll(); - -DECLARE_REGISTRY_RESOURCEID(IDR_XMLELEMENT) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLElement) - COM_INTERFACE_ENTRY(IXMLElement) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - -// IXMLElement - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_tagName(/* [out][retval] */ BSTR __RPC_FAR *p); - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_tagName(/* [in] */ BSTR p); - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_parent(/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppParent); - virtual /* [id] */ HRESULT STDMETHODCALLTYPE setAttribute(/* [in] */ BSTR strPropertyName, /* [in] */ VARIANT PropertyValue); - virtual /* [id] */ HRESULT STDMETHODCALLTYPE getAttribute(/* [in] */ BSTR strPropertyName, /* [out][retval] */ VARIANT __RPC_FAR *PropertyValue); - virtual /* [id] */ HRESULT STDMETHODCALLTYPE removeAttribute(/* [in] */ BSTR strPropertyName); - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_children(/* [out][retval] */ IXMLElementCollection __RPC_FAR *__RPC_FAR *pp); - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_type(/* [out][retval] */ long __RPC_FAR *plType); - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_text(/* [out][retval] */ BSTR __RPC_FAR *p); - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_text(/* [in] */ BSTR p); - virtual /* [id] */ HRESULT STDMETHODCALLTYPE addChild(/* [in] */ IXMLElement __RPC_FAR *pChildElem, long lIndex, long lReserved); - virtual /* [id] */ HRESULT STDMETHODCALLTYPE removeChild(/* [in] */ IXMLElement __RPC_FAR *pChildElem); - -public: -}; - -typedef CComObject CXMLElementInstance; - -#endif //__XMLELEMENT_H_ diff --git a/embedding/browser/activex/src/xml/XMLElement.rgs b/embedding/browser/activex/src/xml/XMLElement.rgs deleted file mode 100644 index 11b01748ef6..00000000000 --- a/embedding/browser/activex/src/xml/XMLElement.rgs +++ /dev/null @@ -1,26 +0,0 @@ -HKCR -{ - Mozilla.XMLElement.1 = s 'MozillaXMLElement Class' - { - CLSID = s '{45E5B420-2805-11D3-9425-000000000000}' - } - Mozilla..MLElement = s 'MozillaXMLElement Class' - { - CLSID = s '{45E5B420-2805-11D3-9425-000000000000}' - CurVer = s 'Mozilla.XMLElement.1' - } - NoRemove CLSID - { - ForceRemove {45E5B420-2805-11D3-9425-000000000000} = s 'Mozilla XMLElement Class' - { - ProgID = s 'Mozilla.XMLElement.1' - VersionIndependentProgID = s 'Mozilla.XMLElement' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{45E5B410-2805-11D3-9425-000000000000}' - } - } -} diff --git a/embedding/browser/activex/src/xml/XMLElementCollection.cpp b/embedding/browser/activex/src/xml/XMLElementCollection.cpp deleted file mode 100644 index 4e4752e9a53..00000000000 --- a/embedding/browser/activex/src/xml/XMLElementCollection.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// XMLElementCollection.cpp : Implementation of CXMLElementCollection -#include "stdafx.h" -//#include "Activexml.h" -#include "XMLElementCollection.h" - -CXMLElementCollection::CXMLElementCollection() -{ -} - - -CXMLElementCollection::~CXMLElementCollection() -{ -} - - -HRESULT CXMLElementCollection::Add(IXMLElement *pElement) -{ - if (pElement == NULL) - { - return E_INVALIDARG; - } - - m_cElements.push_back( CComQIPtr(pElement)); - return S_OK; -} - - -///////////////////////////////////////////////////////////////////////////// -// CXMLElementCollection - -HRESULT STDMETHODCALLTYPE CXMLElementCollection::put_length(/* [in] */ long v) -{ - // Why does MS define a method that has no purpose? - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CXMLElementCollection::get_length(/* [out][retval] */ long __RPC_FAR *p) -{ - if (p == NULL) - { - return E_INVALIDARG; - } - *p = m_cElements.size(); - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE CXMLElementCollection::get__newEnum(/* [out][retval] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk) -{ - return E_NOTIMPL; -} - - -// Perhaps the most overly complicated method ever... -HRESULT STDMETHODCALLTYPE CXMLElementCollection::item(/* [in][optional] */ VARIANT var1, /* [in][optional] */ VARIANT var2, /* [out][retval] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp) -{ - if (ppDisp == NULL) - { - return E_INVALIDARG; - } - - *ppDisp; - - CComVariant vIndex; - - // If var1 is a number, the caller wants the element at the specified index - - if (vIndex.ChangeType(VT_I4, &var1) == S_OK) - { - long nIndex = vIndex.intVal; - if (nIndex < 0 || nIndex >= m_cElements.size()) - { - return E_INVALIDARG; - } - // Get the element at the specified index - m_cElements[nIndex]->QueryInterface(IID_IDispatch, (void **) ppDisp); - return S_OK; - } - - // If var1 is a string, the caller wants a collection of all elements with - // the matching tagname, unless var2 contains an index or if there is only - // one in which case just the element is returned. - - CComVariant vName; - if (FAILED(vName.ChangeType(VT_BSTR, &var1))) - { - return E_INVALIDARG; - } - - // Compile a list of elements matching the name - ElementList cElements; - ElementList::iterator i; - - for (i = m_cElements.begin(); i != m_cElements.end(); i++) - { - CComQIPtr spElement; - BSTR bstrTagName = NULL; - (*i)->get_tagName(&bstrTagName); - if (bstrTagName) - { - if (wcscmp(bstrTagName, vName.bstrVal) == 0) - { - cElements.push_back(*i); - } - SysFreeString(bstrTagName); - } - } - - // Are there any matching elements? - if (cElements.empty()) - { - return S_OK; - } - - // Does var2 contain an index? - if (var2.vt == VT_I4) - { - long nIndex = var2.vt; - if (nIndex < 0 || nIndex >= cElements.size()) - { - return E_INVALIDARG; - } - - // Get the element at the specified index - cElements[nIndex]->QueryInterface(IID_IDispatch, (void **) ppDisp); - return S_OK; - } - - // Is there more than one element? - if (cElements.size() > 1) - { - // Create another collection - CXMLElementCollectionInstance *pCollection = NULL; - CXMLElementCollectionInstance::CreateInstance(&pCollection); - if (pCollection == NULL) - { - return E_OUTOFMEMORY; - } - - if (FAILED(pCollection->QueryInterface(IID_IDispatch, (void **) ppDisp))) - { - pCollection->Release(); - return E_FAIL; - } - - // Add elements to the collection - for (i = cElements.begin(); i != cElements.end(); i++) - { - pCollection->Add(*i); - } - - return S_OK; - } - - // Return the pointer to the element - if (FAILED(cElements[0]->QueryInterface(IID_IDispatch, (void **) ppDisp))) - { - return E_FAIL; - } - - return S_OK; -} - diff --git a/embedding/browser/activex/src/xml/XMLElementCollection.h b/embedding/browser/activex/src/xml/XMLElementCollection.h deleted file mode 100644 index 0f1f815c94f..00000000000 --- a/embedding/browser/activex/src/xml/XMLElementCollection.h +++ /dev/null @@ -1,43 +0,0 @@ -// XMLElementCollection.h : Declaration of the CXMLElementCollection - -#ifndef __XMLELEMENTCOLLECTION_H_ -#define __XMLELEMENTCOLLECTION_H_ - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CXMLElementCollection -class ATL_NO_VTABLE CXMLElementCollection : - public CComObjectRootEx, - public CComCoClass, - public IDispatchImpl -{ - // List of elements - ElementList m_cElements; - -public: - CXMLElementCollection(); - virtual ~CXMLElementCollection(); - -DECLARE_REGISTRY_RESOURCEID(IDR_XMLELEMENTCOLLECTION) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLElementCollection) - COM_INTERFACE_ENTRY(IXMLElementCollection) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - -// IXMLElementCollection - virtual HRESULT STDMETHODCALLTYPE put_length(/* [in] */ long v); - virtual HRESULT STDMETHODCALLTYPE get_length(/* [out][retval] */ long __RPC_FAR *p); - virtual HRESULT STDMETHODCALLTYPE get__newEnum(/* [out][retval] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk); - virtual HRESULT STDMETHODCALLTYPE item(/* [in][optional] */ VARIANT var1, /* [in][optional] */ VARIANT var2, /* [out][retval] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); - -public: - HRESULT Add(IXMLElement *pElement); -}; - -typedef CComObject CXMLElementCollectionInstance; - -#endif //__XMLELEMENTCOLLECTION_H_ diff --git a/embedding/browser/activex/src/xml/XMLElementCollection.rgs b/embedding/browser/activex/src/xml/XMLElementCollection.rgs deleted file mode 100644 index 83957c617c9..00000000000 --- a/embedding/browser/activex/src/xml/XMLElementCollection.rgs +++ /dev/null @@ -1,26 +0,0 @@ -HKCR -{ - Mozilla.XMLElementCollection.1 = s 'Mozilla XMLElementCollection Class' - { - CLSID = s '{45E5B422-2805-11D3-9425-000000000000}' - } - Mozilla.XMLElementCollection = s 'Mozilla XMLElementCollection Class' - { - CLSID = s '{45E5B422-2805-11D3-9425-000000000000}' - CurVer = s 'Mozilla.XMLElementCollection.1' - } - NoRemove CLSID - { - ForceRemove {45E5B422-2805-11D3-9425-000000000000} = s 'Mozilla XMLElementCollection Class' - { - ProgID = s 'Mozilla.XMLElementCollection.1' - VersionIndependentProgID = s 'Mozilla.XMLElementCollection' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{45E5B410-2805-11D3-9425-000000000000}' - } - } -} diff --git a/embedding/browser/activex/src/xml/activexml.cpp b/embedding/browser/activex/src/xml/activexml.cpp deleted file mode 100644 index 3422bc8cfe2..00000000000 --- a/embedding/browser/activex/src/xml/activexml.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// activexml.cpp : Implementation of DLL Exports. - - -// Note: Proxy/Stub Information -// To build a separate proxy/stub DLL, -// run nmake -f activexmlps.mk in the project directory. - -#include "stdafx.h" -#include "resource.h" -//#include -//#include "activexml.h" - -#include "activexml_i.c" -#include "XMLDocument.h" -#include "XMLElement.h" -#include "XMLElementCollection.h" - - -CComModule _Module; - -BEGIN_OBJECT_MAP(ObjectMap) -OBJECT_ENTRY(CLSID_MozXMLDocument, CXMLDocument) -//OBJECT_ENTRY(CLSID_MozXMLElement, CXMLElement) -//OBJECT_ENTRY(CLSID_MozXMLElementCollection, CXMLElementCollection) -END_OBJECT_MAP() - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - _Module.Init(ObjectMap, hInstance, &LIBID_MozActiveXMLLib); - DisableThreadLibraryCalls(hInstance); - } - else if (dwReason == DLL_PROCESS_DETACH) - _Module.Term(); - return TRUE; // ok -} - -///////////////////////////////////////////////////////////////////////////// -// Used to determine whether the DLL can be unloaded by OLE - -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ - return _Module.GetClassObject(rclsid, riid, ppv); -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -STDAPI DllRegisterServer(void) -{ - // registers object, typelib and all interfaces in typelib - return _Module.RegisterServer(TRUE); -} - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry - -STDAPI DllUnregisterServer(void) -{ - return _Module.UnregisterServer(TRUE); -} - - diff --git a/embedding/browser/activex/src/xml/activexml.def b/embedding/browser/activex/src/xml/activexml.def deleted file mode 100644 index 13f5afdb56d..00000000000 --- a/embedding/browser/activex/src/xml/activexml.def +++ /dev/null @@ -1,9 +0,0 @@ -; activexml.def : Declares the module parameters. - -LIBRARY "activexml.DLL" - -EXPORTS - DllCanUnloadNow @1 PRIVATE - DllGetClassObject @2 PRIVATE - DllRegisterServer @3 PRIVATE - DllUnregisterServer @4 PRIVATE diff --git a/embedding/browser/activex/src/xml/activexml.dsp b/embedding/browser/activex/src/xml/activexml.dsp deleted file mode 100644 index a62c105446b..00000000000 --- a/embedding/browser/activex/src/xml/activexml.dsp +++ /dev/null @@ -1,360 +0,0 @@ -# Microsoft Developer Studio Project File - Name="activexml" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=activexml - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "activexml.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "activexml.mak" CFG="activexml - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "activexml - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "activexml - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "activexml - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "activexml - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "activexml - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "activexml - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "activexml - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "M:\moz\mozilla\dist\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib Urlmon.lib M:\moz\mozilla\dist\WIN32_D.OBJ\lib\expat.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# Begin Custom Build - Performing registration -OutDir=.\Debug -TargetPath=.\Debug\activexml.dll -InputPath=.\Debug\activexml.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "activexml - Win32 Unicode Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "DebugU" -# PROP BASE Intermediate_Dir "DebugU" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "DebugU" -# PROP Intermediate_Dir "DebugU" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# Begin Custom Build - Performing registration -OutDir=.\DebugU -TargetPath=.\DebugU\activexml.dll -InputPath=.\DebugU\activexml.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - if "%OS%"=="" goto NOTNT - if not "%OS%"=="Windows_NT" goto NOTNT - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - goto end - :NOTNT - echo Warning : Cannot register Unicode DLL on Windows 95 - :end - -# End Custom Build - -!ELSEIF "$(CFG)" == "activexml - Win32 Release MinSize" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseMinSize" -# PROP BASE Intermediate_Dir "ReleaseMinSize" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseMinSize" -# PROP Intermediate_Dir "ReleaseMinSize" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseMinSize -TargetPath=.\ReleaseMinSize\activexml.dll -InputPath=.\ReleaseMinSize\activexml.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "activexml - Win32 Release MinDependency" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseMinDependency" -# PROP BASE Intermediate_Dir "ReleaseMinDependency" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseMinDependency" -# PROP Intermediate_Dir "ReleaseMinDependency" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseMinDependency -TargetPath=.\ReleaseMinDependency\activexml.dll -InputPath=.\ReleaseMinDependency\activexml.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "activexml - Win32 Unicode Release MinSize" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseUMinSize" -# PROP BASE Intermediate_Dir "ReleaseUMinSize" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseUMinSize" -# PROP Intermediate_Dir "ReleaseUMinSize" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseUMinSize -TargetPath=.\ReleaseUMinSize\activexml.dll -InputPath=.\ReleaseUMinSize\activexml.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - if "%OS%"=="" goto NOTNT - if not "%OS%"=="Windows_NT" goto NOTNT - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - goto end - :NOTNT - echo Warning : Cannot register Unicode DLL on Windows 95 - :end - -# End Custom Build - -!ELSEIF "$(CFG)" == "activexml - Win32 Unicode Release MinDependency" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseUMinDependency" -# PROP BASE Intermediate_Dir "ReleaseUMinDependency" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseUMinDependency" -# PROP Intermediate_Dir "ReleaseUMinDependency" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseUMinDependency -TargetPath=.\ReleaseUMinDependency\activexml.dll -InputPath=.\ReleaseUMinDependency\activexml.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - if "%OS%"=="" goto NOTNT - if not "%OS%"=="Windows_NT" goto NOTNT - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - goto end - :NOTNT - echo Warning : Cannot register Unicode DLL on Windows 95 - :end - -# End Custom Build - -!ENDIF - -# Begin Target - -# Name "activexml - Win32 Debug" -# Name "activexml - Win32 Unicode Debug" -# Name "activexml - Win32 Release MinSize" -# Name "activexml - Win32 Release MinDependency" -# Name "activexml - Win32 Unicode Release MinSize" -# Name "activexml - Win32 Unicode Release MinDependency" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\activexml.cpp -# End Source File -# Begin Source File - -SOURCE=.\activexml.def -# End Source File -# Begin Source File - -SOURCE=.\activexml.idl -# ADD MTL /tlb ".\activexml.tlb" /h "activexml.h" /iid "activexml_i.c" /Oicf -# End Source File -# Begin Source File - -SOURCE=.\activexml.rc -# End Source File -# Begin Source File - -SOURCE=.\ParseExpat.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# Begin Source File - -SOURCE=.\XMLDocument.cpp -# End Source File -# Begin Source File - -SOURCE=.\XMLElement.cpp -# End Source File -# Begin Source File - -SOURCE=.\XMLElementCollection.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\XMLDocument.h -# End Source File -# Begin Source File - -SOURCE=.\XMLElement.h -# End Source File -# Begin Source File - -SOURCE=.\XMLElementCollection.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\XMLDocument.rgs -# End Source File -# Begin Source File - -SOURCE=.\XMLElement.rgs -# End Source File -# Begin Source File - -SOURCE=.\XMLElementCollection.rgs -# End Source File -# End Group -# Begin Group "Expat" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\..\expat\xmlparse\xmlparse.h -# End Source File -# End Group -# End Target -# End Project diff --git a/embedding/browser/activex/src/xml/activexml.idl b/embedding/browser/activex/src/xml/activexml.idl deleted file mode 100644 index 04e1fe9bf38..00000000000 --- a/embedding/browser/activex/src/xml/activexml.idl +++ /dev/null @@ -1,143 +0,0 @@ -// activexml.idl : IDL source for activexml.dll -// - -// This file will be processed by the MIDL tool to -// produce the type library (activexml.tlb) and marshalling code. - -#include "msxmldid.h" - -//import "oaidl.idl"; -//import "ocidl.idl"; - -[ - uuid(45E5B410-2805-11D3-9425-000000000000), - version(1.0), - helpstring("Mozilla XML 1.0 Type Library") -] -library MozActiveXMLLib -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - - typedef enum mozxmlelemTYPE { - XMLELEMTYPE_ELEMENT, - XMLELEMTYPE_TEXT, - XMLELEMTYPE_COMMENT, - XMLELEMTYPE_DOCUMENT, - XMLELEMTYPE_DTD, - XMLELEMTYPE_PI, - XMLELEMTYPE_OTHER - } XMLELEM_TYPE; - - interface IXMLElement; - - [ - object, - local, - uuid(65725580-9B5D-11d0-9BFE-00C04FC99C8E) // IID_IXMLElementCollection - ] - interface IXMLElementCollection : IDispatch - { - [propput, id(DISPID_XMLELEMENTCOLLECTION_LENGTH)] HRESULT length([in] long v); - [propget, id(DISPID_XMLELEMENTCOLLECTION_LENGTH)] HRESULT length([retval, out] long * p); - [propget, restricted, hidden, id(DISPID_XMLELEMENTCOLLECTION_NEWENUM)] HRESULT _newEnum([retval, out] IUnknown ** ppUnk); - [id(DISPID_XMLELEMENTCOLLECTION_ITEM)] HRESULT item([optional, in] VARIANT var1,[optional, in] VARIANT var2,[retval, out] IDispatch ** ppDisp); - }; - - [ - object, - local, - uuid(F52E2B61-18A1-11d1-B105-00805F49916B) // IID_IXMLDocument - ] - interface IXMLDocument : IDispatch - { - [propget, id(DISPID_XMLDOCUMENT_ROOT)] HRESULT root ([retval, out] IXMLElement * * p); - [propget, id(DISPID_XMLDOCUMENT_FILESIZE)] HRESULT fileSize([retval, out] BSTR * p); - [propget, id(DISPID_XMLDOCUMENT_FILEMODIFIEDDATE)] HRESULT fileModifiedDate([retval, out] BSTR * p); - [propget, id(DISPID_XMLDOCUMENT_FILEUPDATEDDATE)] HRESULT fileUpdatedDate([retval, out] BSTR * p); - [propget, id(DISPID_XMLDOCUMENT_URL)] HRESULT URL([retval, out] BSTR * p); - [propput, id(DISPID_XMLDOCUMENT_URL)] HRESULT URL([in] BSTR p); - [propget, id(DISPID_XMLDOCUMENT_MIMETYPE)] HRESULT mimeType([retval, out] BSTR * p); - [propget, id(DISPID_XMLDOCUMENT_READYSTATE)] HRESULT readyState([retval, out]long *pl); - [propget, id(DISPID_XMLDOCUMENT_CHARSET)] HRESULT charset([retval, out]BSTR *p); - [propput, id(DISPID_XMLDOCUMENT_CHARSET)] HRESULT charset([in]BSTR p); - [propget, id(DISPID_XMLDOCUMENT_VERSION)] HRESULT version([retval, out]BSTR *p); - [propget, id(DISPID_XMLDOCUMENT_DOCTYPE)] HRESULT doctype([retval, out]BSTR *p); - [propget, id(DISPID_XMLDOCUMENT_DTDURL)] HRESULT dtdURL([retval, out]BSTR *p); - [id(DISPID_XMLDOCUMENT_CREATEELEMENT)] HRESULT createElement([in] VARIANT vType, [optional, in] VARIANT var1, [retval, out] IXMLElement * * ppElem); - }; - - - [ - object, - local, - uuid(3F7F31AC-E15F-11d0-9C25-00C04FC99C8E) // IID_IXMLElement - ] - interface IXMLElement : IDispatch - { - [propget, id(DISPID_XMLELEMENT_TAGNAME)] HRESULT tagName([retval, out] BSTR * p); - [propput, id(DISPID_XMLELEMENT_TAGNAME)] HRESULT tagName([in] BSTR p); - [propget, id(DISPID_XMLELEMENT_PARENT)] HRESULT parent([retval, out]IXMLElement **ppParent); - [id(DISPID_XMLELEMENT_SETATTRIBUTE)] HRESULT setAttribute([in] BSTR strPropertyName,[in] VARIANT PropertyValue); - [id(DISPID_XMLELEMENT_GETATTRIBUTE)] HRESULT getAttribute([in] BSTR strPropertyName,[retval, out] VARIANT* PropertyValue); - [id(DISPID_XMLELEMENT_REMOVEATTRIBUTE)] HRESULT removeAttribute([in] BSTR strPropertyName); - [propget, id(DISPID_XMLELEMENT_CHILDREN)] HRESULT children([retval, out] IXMLElementCollection * * pp); - [propget, id(DISPID_XMLELEMENT_TYPE)] HRESULT type([retval, out] long *plType); - [propget, id(DISPID_XMLELEMENT_TEXT)] HRESULT text([retval, out] BSTR *p); - [propput, id(DISPID_XMLELEMENT_TEXT)] HRESULT text([in] BSTR p); - [id(DISPID_XMLELEMENT_ADDCHILD)] HRESULT addChild([in] IXMLElement *pChildElem, long lIndex, long lReserved); // lReserved must be -1 - [id(DISPID_XMLELEMENT_REMOVECHILD)] HRESULT removeChild([in]IXMLElement *pChildElem); - } - - typedef struct __xml_error { - unsigned _nLine; // line number - BSTR _pchBuf; // current input buffer - unsigned _cchBuf; // number of chars in buffer - unsigned _ich; // index of the char when error occurred - BSTR _pszFound; // token found - BSTR _pszExpected; // token expected - DWORD _reserved1; // reserved - DWORD _reserved2; // reserved - } XML_ERROR; - - [ - object, - local, - uuid(948C5AD3-C58D-11d0-9C0B-00C04FC99C8E) // IID_IXMLError - ] - - interface IXMLError : IUnknown - { - HRESULT GetErrorInfo(XML_ERROR *pErrorReturn); - } - - - - [ - uuid(45E5B41D-2805-11D3-9425-000000000000), - helpstring("MozXMLDocument Class") - ] - coclass MozXMLDocument - { - interface IDispatch; - [default] interface IXMLDocument; - }; - [ - uuid(45E5B420-2805-11D3-9425-000000000000), - helpstring("MozXMLElement Class") - ] - coclass MozXMLElement - { - interface IDispatch; - [default] interface IXMLElement; - }; - [ - uuid(45E5B422-2805-11D3-9425-000000000000), - helpstring("MozXMLElementCollection Class") - ] - coclass MozXMLElementCollection - { - interface IDispatch; - [default] interface IXMLElementCollection; - }; -}; diff --git a/embedding/browser/activex/src/xml/activexml.rc b/embedding/browser/activex/src/xml/activexml.rc deleted file mode 100644 index cb2dd1cf6dc..00000000000 --- a/embedding/browser/activex/src/xml/activexml.rc +++ /dev/null @@ -1,142 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "1 TYPELIB ""activexml.tlb""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "\0" - VALUE "CompanyName", "\0" - VALUE "FileDescription", "Mozilla XML Module\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "activexml\0" - VALUE "LegalCopyright", "Copyright 1999\0" - VALUE "LegalTrademarks", "\0" - VALUE "OLESelfRegister", "\0" - VALUE "OriginalFilename", "activexml.DLL\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "activexml Module\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_PROJNAME "activexml" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.K.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_XMLDOCUMENT REGISTRY DISCARDABLE "XMLDocument.rgs" -IDR_XMLELEMENT REGISTRY DISCARDABLE "XMLElement.rgs" -IDR_XMLELEMENTCOLLECTION REGISTRY DISCARDABLE "XMLElementCollection.rgs" -#endif // English (U.K.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "activexml.tlb" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/embedding/browser/activex/src/xml/activexmlps.def b/embedding/browser/activex/src/xml/activexmlps.def deleted file mode 100644 index dd90ac20c65..00000000000 --- a/embedding/browser/activex/src/xml/activexmlps.def +++ /dev/null @@ -1,11 +0,0 @@ - -LIBRARY "activexmlPS" - -DESCRIPTION 'Proxy/Stub DLL' - -EXPORTS - DllGetClassObject @1 PRIVATE - DllCanUnloadNow @2 PRIVATE - GetProxyDllInfo @3 PRIVATE - DllRegisterServer @4 PRIVATE - DllUnregisterServer @5 PRIVATE diff --git a/embedding/browser/activex/src/xml/resource.h b/embedding/browser/activex/src/xml/resource.h deleted file mode 100644 index 0a0d95a8af5..00000000000 --- a/embedding/browser/activex/src/xml/resource.h +++ /dev/null @@ -1,19 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by activexml.rc -// -#define IDS_PROJNAME 100 -#define IDR_XMLDOCUMENT 101 -#define IDR_XMLELEMENT 102 -#define IDR_XMLELEMENTCOLLECTION 103 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 201 -#define _APS_NEXT_COMMAND_VALUE 32768 -#define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 104 -#endif -#endif diff --git a/embedding/browser/activex/tests/IEPatcher/DlgProxy.cpp b/embedding/browser/activex/tests/IEPatcher/DlgProxy.cpp deleted file mode 100644 index d53b68447aa..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/DlgProxy.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// DlgProxy.cpp : implementation file -// - -#include "stdafx.h" -#include "IEPatcher.h" -#include "DlgProxy.h" -#include "IEPatcherDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CIEPatcherDlgAutoProxy - -IMPLEMENT_DYNCREATE(CIEPatcherDlgAutoProxy, CCmdTarget) - -CIEPatcherDlgAutoProxy::CIEPatcherDlgAutoProxy() -{ - EnableAutomation(); - - // To keep the application running as long as an OLE automation - // object is active, the constructor calls AfxOleLockApp. - AfxOleLockApp(); - - // Get access to the dialog through the application's - // main window pointer. Set the proxy's internal pointer - // to point to the dialog, and set the dialog's back pointer to - // this proxy. - ASSERT (AfxGetApp()->m_pMainWnd != NULL); - ASSERT_VALID (AfxGetApp()->m_pMainWnd); - ASSERT_KINDOF(CIEPatcherDlg, AfxGetApp()->m_pMainWnd); - m_pDialog = (CIEPatcherDlg*) AfxGetApp()->m_pMainWnd; - m_pDialog->m_pAutoProxy = this; -} - -CIEPatcherDlgAutoProxy::~CIEPatcherDlgAutoProxy() -{ - // To terminate the application when all objects created with - // with OLE automation, the destructor calls AfxOleUnlockApp. - // Among other things, this will destroy the main dialog - AfxOleUnlockApp(); -} - -void CIEPatcherDlgAutoProxy::OnFinalRelease() -{ - // When the last reference for an automation object is released - // OnFinalRelease is called. The base class will automatically - // deletes the object. Add additional cleanup required for your - // object before calling the base class. - - CCmdTarget::OnFinalRelease(); -} - -BEGIN_MESSAGE_MAP(CIEPatcherDlgAutoProxy, CCmdTarget) - //{{AFX_MSG_MAP(CIEPatcherDlgAutoProxy) - // NOTE - the ClassWizard will add and remove mapping macros here. - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -BEGIN_DISPATCH_MAP(CIEPatcherDlgAutoProxy, CCmdTarget) - //{{AFX_DISPATCH_MAP(CIEPatcherDlgAutoProxy) - // NOTE - the ClassWizard will add and remove mapping macros here. - //}}AFX_DISPATCH_MAP -END_DISPATCH_MAP() - -// Note: we add support for IID_IIEPatcher to support typesafe binding -// from VBA. This IID must match the GUID that is attached to the -// dispinterface in the .ODL file. - -// {A6031677-3B36-11D2-B44D-00600819607E} -static const IID IID_IIEPatcher = -{ 0xa6031677, 0x3b36, 0x11d2, { 0xb4, 0x4d, 0x0, 0x60, 0x8, 0x19, 0x60, 0x7e } }; - -BEGIN_INTERFACE_MAP(CIEPatcherDlgAutoProxy, CCmdTarget) - INTERFACE_PART(CIEPatcherDlgAutoProxy, IID_IIEPatcher, Dispatch) -END_INTERFACE_MAP() - -// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project -// {A6031675-3B36-11D2-B44D-00600819607E} -IMPLEMENT_OLECREATE2(CIEPatcherDlgAutoProxy, "IEPatcher.Application", 0xa6031675, 0x3b36, 0x11d2, 0xb4, 0x4d, 0x0, 0x60, 0x8, 0x19, 0x60, 0x7e) - -///////////////////////////////////////////////////////////////////////////// -// CIEPatcherDlgAutoProxy message handlers diff --git a/embedding/browser/activex/tests/IEPatcher/DlgProxy.h b/embedding/browser/activex/tests/IEPatcher/DlgProxy.h deleted file mode 100644 index f90ba1d322a..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/DlgProxy.h +++ /dev/null @@ -1,61 +0,0 @@ -// DlgProxy.h : header file -// - -#if !defined(AFX_DLGPROXY_H__A603167E_3B36_11D2_B44D_00600819607E__INCLUDED_) -#define AFX_DLGPROXY_H__A603167E_3B36_11D2_B44D_00600819607E__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -class CIEPatcherDlg; - -///////////////////////////////////////////////////////////////////////////// -// CIEPatcherDlgAutoProxy command target - -class CIEPatcherDlgAutoProxy : public CCmdTarget -{ - DECLARE_DYNCREATE(CIEPatcherDlgAutoProxy) - - CIEPatcherDlgAutoProxy(); // protected constructor used by dynamic creation - -// Attributes -public: - CIEPatcherDlg* m_pDialog; - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CIEPatcherDlgAutoProxy) - public: - virtual void OnFinalRelease(); - //}}AFX_VIRTUAL - -// Implementation -protected: - virtual ~CIEPatcherDlgAutoProxy(); - - // Generated message map functions - //{{AFX_MSG(CIEPatcherDlgAutoProxy) - // NOTE - the ClassWizard will add and remove member functions here. - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() - DECLARE_OLECREATE(CIEPatcherDlgAutoProxy) - - // Generated OLE dispatch map functions - //{{AFX_DISPATCH(CIEPatcherDlgAutoProxy) - // NOTE - the ClassWizard will add and remove member functions here. - //}}AFX_DISPATCH - DECLARE_DISPATCH_MAP() - DECLARE_INTERFACE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_DLGPROXY_H__A603167E_3B36_11D2_B44D_00600819607E__INCLUDED_) diff --git a/embedding/browser/activex/tests/IEPatcher/IEPatcher.cpp b/embedding/browser/activex/tests/IEPatcher/IEPatcher.cpp deleted file mode 100644 index 349dea4eca6..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/IEPatcher.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// IEPatcher.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" -#include "IEPatcher.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CIEPatcherApp - -BEGIN_MESSAGE_MAP(CIEPatcherApp, CWinApp) - //{{AFX_MSG_MAP(CIEPatcherApp) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG - ON_COMMAND(ID_HELP, CWinApp::OnHelp) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CIEPatcherApp construction - -CIEPatcherApp::CIEPatcherApp() -{ - m_pIEPatcherDlg = NULL; -} - -///////////////////////////////////////////////////////////////////////////// -// The one and only CIEPatcherApp object - -CIEPatcherApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// CIEPatcherApp initialization - -BOOL CIEPatcherApp::InitInstance() -{ - // Initialize OLE libraries - if (!AfxOleInit()) - { - AfxMessageBox(IDP_OLE_INIT_FAILED); - return FALSE; - } - - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need. - -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif - - // Parse the command line to see if launched as OLE server - if (RunEmbedded() || RunAutomated()) - { - // Register all OLE server (factories) as running. This enables the - // OLE libraries to create objects from other applications. - COleTemplateServer::RegisterAll(); - } - else - { - // When a server application is launched stand-alone, it is a good idea - // to update the system registry in case it has been damaged. - COleObjectFactory::UpdateRegistryAll(); - } - - // Now the scanner window - m_pIEPatcherDlg = new CIEPatcherDlg; - m_pMainWnd = m_pIEPatcherDlg; - int nResponse = m_pIEPatcherDlg->DoModal(); - if (nResponse == IDOK) - { - // TODO: Place code here to handle when the dialog is - // dismissed with OK - } - else if (nResponse == IDCANCEL) - { - // TODO: Place code here to handle when the dialog is - // dismissed with Cancel - } - delete m_pIEPatcherDlg; - - // Since the dialog has been closed, return FALSE so that we exit the - // application, rather than start the application's message pump. - return FALSE; -} diff --git a/embedding/browser/activex/tests/IEPatcher/IEPatcher.dsp b/embedding/browser/activex/tests/IEPatcher/IEPatcher.dsp deleted file mode 100644 index 53b943b34f4..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/IEPatcher.dsp +++ /dev/null @@ -1,203 +0,0 @@ -# Microsoft Developer Studio Project File - Name="IEPatcher" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=IEPatcher - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "IEPatcher.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "IEPatcher.mak" CFG="IEPatcher - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "IEPatcher - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "IEPatcher - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "IEPatcher - Win32 Release" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 5 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x1809 /d "NDEBUG" /d "_AFXDLL" -# ADD RSC /l 0x1809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "IEPatcher - Win32 Debug" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 5 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x1809 /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x1809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "IEPatcher - Win32 Release" -# Name "IEPatcher - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\DlgProxy.cpp -# End Source File -# Begin Source File - -SOURCE=.\IEPatcher.cpp -# End Source File -# Begin Source File - -SOURCE=.\IEPatcher.odl -# End Source File -# Begin Source File - -SOURCE=.\IEPatcher.rc -# End Source File -# Begin Source File - -SOURCE=.\IEPatcherDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\ScanForFilesDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\ScannerThread.cpp -# End Source File -# Begin Source File - -SOURCE=.\ScannerWnd.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\DlgProxy.h -# End Source File -# Begin Source File - -SOURCE=.\IEPatcher.h -# End Source File -# Begin Source File - -SOURCE=.\IEPatcherDlg.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\ScanForFilesDlg.h -# End Source File -# Begin Source File - -SOURCE=.\ScannerThread.h -# End Source File -# Begin Source File - -SOURCE=.\ScannerWnd.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\res\containsie.ico -# End Source File -# Begin Source File - -SOURCE=.\res\containsmozilla.ico -# End Source File -# Begin Source File - -SOURCE=.\res\doesntcontainie.ico -# End Source File -# Begin Source File - -SOURCE=.\res\IEPatcher.ico -# End Source File -# Begin Source File - -SOURCE=.\res\IEPatcher.rc2 -# End Source File -# Begin Source File - -SOURCE=.\res\unknownstatus.ico -# End Source File -# End Group -# Begin Source File - -SOURCE=.\IEPatcher.reg -# End Source File -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/embedding/browser/activex/tests/IEPatcher/IEPatcher.h b/embedding/browser/activex/tests/IEPatcher/IEPatcher.h deleted file mode 100644 index 802c4a30264..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/IEPatcher.h +++ /dev/null @@ -1,53 +0,0 @@ -// IEPatcher.h : main header file for the IEPATCHER application -// - -#if !defined(AFX_IEPATCHER_H__A603167A_3B36_11D2_B44D_00600819607E__INCLUDED_) -#define AFX_IEPATCHER_H__A603167A_3B36_11D2_B44D_00600819607E__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "resource.h" // main symbols - -#include "IEPatcherDlg.h" - -///////////////////////////////////////////////////////////////////////////// -// CIEPatcherApp: -// See IEPatcher.cpp for the implementation of this class -// - -class CIEPatcherApp : public CWinApp -{ -public: - CIEPatcherApp(); - - CIEPatcherDlg *m_pIEPatcherDlg; - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CIEPatcherApp) - public: - virtual BOOL InitInstance(); - //}}AFX_VIRTUAL - -// Implementation - - //{{AFX_MSG(CIEPatcherApp) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_IEPATCHER_H__A603167A_3B36_11D2_B44D_00600819607E__INCLUDED_) diff --git a/embedding/browser/activex/tests/IEPatcher/IEPatcher.odl b/embedding/browser/activex/tests/IEPatcher/IEPatcher.odl deleted file mode 100644 index f50dabc6e76..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/IEPatcher.odl +++ /dev/null @@ -1,41 +0,0 @@ -// IEPatcher.odl : type library source for IEPatcher.exe - -// This file will be processed by the MIDL compiler to produce the -// type library (IEPatcher.tlb). - -[ uuid(A6031676-3B36-11D2-B44D-00600819607E), version(1.0) ] -library IEPatcher -{ - importlib("stdole32.tlb"); - - - // Primary dispatch interface for CIEPatcherDoc - - [ uuid(A6031677-3B36-11D2-B44D-00600819607E) ] - dispinterface IIEPatcher - { - properties: - // NOTE - ClassWizard will maintain property information here. - // Use extreme caution when editing this section. - //{{AFX_ODL_PROP(CIEPatcherDlgAutoProxy) - //}}AFX_ODL_PROP - - methods: - // NOTE - ClassWizard will maintain method information here. - // Use extreme caution when editing this section. - //{{AFX_ODL_METHOD(CIEPatcherDlgAutoProxy) - //}}AFX_ODL_METHOD - - }; - - // Class information for CIEPatcherDoc - - [ uuid(A6031675-3B36-11D2-B44D-00600819607E) ] - coclass IEPatcher - { - [default] dispinterface IIEPatcher; - }; - - //{{AFX_APPEND_ODL}} - //}}AFX_APPEND_ODL}} -}; diff --git a/embedding/browser/activex/tests/IEPatcher/IEPatcher.rc b/embedding/browser/activex/tests/IEPatcher/IEPatcher.rc deleted file mode 100644 index 8c793670a7e..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/IEPatcher.rc +++ /dev/null @@ -1,236 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_IEPATCHER_DIALOG DIALOGEX 0, 0, 323, 202 -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "IE to Mozilla Patcher" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "&Scan...",IDC_SCAN,266,6,50,14 - CONTROL "List1",IDC_FILELIST,"SysListView32",LVS_REPORT | - LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | - WS_TABSTOP,7,59,309,136 - PUSHBUTTON "&Patch",IDC_PATCH,266,26,50,14 - LTEXT "Add files to the source list by selecting ""Scan"". Files containing references to Internet Explorer or Mozilla will be highlighted.", - IDC_STATIC,7,6,257,18 - LTEXT "Choose ""Patch"" to apply the Mozilla patch to any selected files. The patching process does not overwrite the original file but creates a new file prepended with ""moz_"" which you may test at your leisure.", - IDC_STATIC,7,30,257,26 -END - -IDD_SCANFORFILES DIALOG DISCARDABLE 0, 0, 227, 63 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Scan for files" -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "Type a filename or wildcard pattern or use ""Pick File..."" or ""Pick Folder...""", - IDC_STATIC,7,7,155,18 - EDITTEXT IDC_FILEPATTERN,5,25,158,13,ES_AUTOHSCROLL - PUSHBUTTON "Pick File...",IDC_SELECTFILE,29,43,55,13 - DEFPUSHBUTTON "OK",IDOK,170,5,50,14 - PUSHBUTTON "Cancel",IDCANCEL,170,25,50,14 - PUSHBUTTON "Pick Folder...",IDC_SELECTFOLDER,89,43,55,13 -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "IEPatcher MFC Application\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "IEPatcher\0" - VALUE "LegalCopyright", "Copyright (C) 1998\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "IEPatcher.EXE\0" - VALUE "ProductName", "IEPatcher Application\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_IEPATCHER_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 6 - BOTTOMMARGIN, 195 - END - - IDD_SCANFORFILES, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 220 - TOPMARGIN, 7 - BOTTOMMARGIN, 56 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_CONTAINSIE ICON DISCARDABLE "res\\containsie.ico" -IDI_DOESNTCONTAINIE ICON DISCARDABLE "res\\doesntcontainie.ico" -IDI_CONTAINSMOZILLA ICON DISCARDABLE "res\\containsmozilla.ico" -IDI_UNKNOWNSTATUS ICON DISCARDABLE "res\\unknownstatus.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDP_OLE_INIT_FAILED "OLE initialization failed. Make sure that the OLE libraries are the correct version." -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (Ireland) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENI) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_EIRE -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif\r\n" - "#include ""res\\IEPatcher.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON DISCARDABLE "res\\IEPatcher.ico" -#endif // English (Ireland) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif -#include "res\IEPatcher.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/embedding/browser/activex/tests/IEPatcher/IEPatcher.reg b/embedding/browser/activex/tests/IEPatcher/IEPatcher.reg deleted file mode 100644 index 026ae7bef0b..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/IEPatcher.reg +++ /dev/null @@ -1,13 +0,0 @@ -REGEDIT -; This .REG file may be used by your SETUP program. -; If a SETUP program is not available, the entries below will be -; registered in your InitInstance automatically with a call to -; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll. - - -HKEY_CLASSES_ROOT\IEPatcher.Application = IEPatcher Application -HKEY_CLASSES_ROOT\IEPatcher.Application\CLSID = {A6031675-3B36-11D2-B44D-00600819607E} - -HKEY_CLASSES_ROOT\CLSID\{A6031675-3B36-11D2-B44D-00600819607E} = IEPatcher Application -HKEY_CLASSES_ROOT\CLSID\{A6031675-3B36-11D2-B44D-00600819607E}\ProgId = IEPatcher.Application -HKEY_CLASSES_ROOT\CLSID\{A6031675-3B36-11D2-B44D-00600819607E}\LocalServer32 = IEPATCHER.EXE diff --git a/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.cpp b/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.cpp deleted file mode 100644 index b4cece53424..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.cpp +++ /dev/null @@ -1,622 +0,0 @@ -// IEPatcherDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "IEPatcher.h" -#include "IEPatcherDlg.h" -#include "ScanForFilesDlg.h" -#include "ScannerThread.h" -#include "DlgProxy.h" - -#include -#include - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -const CLSID CLSID_WebBrowser_V1 = { 0xEAB22AC3, 0x30C1, 0x11CF, { 0xA7, 0xEB, 0x00, 0x00, 0xC0, 0x5B, 0xAE, 0x0B } }; -const CLSID CLSID_WebBrowser = { 0x8856F961, 0x340A, 0x11D0, { 0xA9, 0x6B, 0x00, 0xC0, 0x4F, 0xD7, 0x05, 0xA2 } }; -const CLSID CLSID_InternetExplorer = { 0x0002DF01, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }; -const CLSID CLSID_MozillaBrowser = {0x1339B54C,0x3453,0x11D2,{0x93,0xB9,0x00,0x00,0x00,0x00,0x00,0x00}}; -const IID IID_IWebBrowser = { 0xEAB22AC1, 0x30C1, 0x11CF, { 0xA7, 0xEB, 0x00, 0x00, 0xC0, 0x5B, 0xAE, 0x0B } }; -const IID IID_IWebBrowser2 = { 0xD30C1661, 0xCDAF, 0x11d0, { 0x8A, 0x3E, 0x00, 0xC0, 0x4F, 0xC9, 0xE2, 0x6E } }; -const IID IID_IWebBrowserApp = { 0x0002DF05, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }; - - -#define ITEM_PATCHSTATUS 1 - -#define IMG_DOESNTCONTAINIE 0 -#define IMG_CONTAINSIE 1 -#define IMG_CONTAINSMOZILLA 2 -#define IMG_UNKNOWNSTATUS 3 - -///////////////////////////////////////////////////////////////////////////// -// CIEPatcherDlg dialog - -IMPLEMENT_DYNAMIC(CIEPatcherDlg, CDialog); - -CIEPatcherDlg::CIEPatcherDlg(CWnd* pParent /*=NULL*/) - : CDialog(CIEPatcherDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(CIEPatcherDlg) - //}}AFX_DATA_INIT - // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); - m_pAutoProxy = NULL; -} - - -CIEPatcherDlg::~CIEPatcherDlg() -{ - // If there is an automation proxy for this dialog, set - // its back pointer to this dialog to NULL, so it knows - // the dialog has been deleted. - if (m_pAutoProxy != NULL) - m_pAutoProxy->m_pDialog = NULL; -} - - -void CIEPatcherDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CIEPatcherDlg) - DDX_Control(pDX, IDC_PATCH, m_btnPatch); - DDX_Control(pDX, IDC_FILELIST, m_cFileList); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CIEPatcherDlg, CDialog) - //{{AFX_MSG_MAP(CIEPatcherDlg) - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - ON_WM_CLOSE() - ON_BN_CLICKED(IDC_SCAN, OnScan) - ON_NOTIFY(NM_CLICK, IDC_FILELIST, OnClickFilelist) - ON_BN_CLICKED(IDC_PATCH, OnPatch) - //}}AFX_MSG_MAP - ON_MESSAGE(WM_UPDATEFILESTATUS, OnUpdateFileStatus) -END_MESSAGE_MAP() - - -///////////////////////////////////////////////////////////////////////////// -// CIEPatcherDlg message handlers - -BOOL CIEPatcherDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // Start the scanner thread - AfxBeginThread(RUNTIME_CLASS(CScannerThread), 0); - - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon - - // Add icons to image list - m_cImageList.Create(16, 16, ILC_MASK, 0, 5); - m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_DOESNTCONTAINIE)); - m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CONTAINSIE)); - m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CONTAINSMOZILLA)); - m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_UNKNOWNSTATUS)); - - // Associate image list with file list - m_cFileList.SetImageList(&m_cImageList, LVSIL_SMALL); - - struct ColumnData - { - TCHAR *sColumnTitle; - int nPercentageWidth; - int nFormat; - }; - - ColumnData aColData[] = - { - { _T("File"), 70, LVCFMT_LEFT }, - { _T("Patch Status"), 30, LVCFMT_LEFT } - }; - - // Get the size of the file list control and neatly - // divide it into columns - - CRect rcFileList; - m_cFileList.GetClientRect(&rcFileList); - - int nColTotal = sizeof(aColData) / sizeof(aColData[0]); - int nWidthRemaining = rcFileList.Width(); - - for (int nCol = 0; nCol < nColTotal; nCol++) - { - ColumnData *pData = &aColData[nCol]; - - int nColWidth = (rcFileList.Width() * pData->nPercentageWidth) / 100; - if (nCol == nColTotal - 1) - { - nColWidth = nWidthRemaining; - } - else if (nColWidth > nWidthRemaining) - { - nColWidth = nWidthRemaining; - } - - m_cFileList.InsertColumn(nCol, pData->sColumnTitle, pData->nFormat, nColWidth); - - nWidthRemaining -= nColWidth; - if (nColWidth <= 0) - { - break; - } - } - - return TRUE; // return TRUE unless you set the focus to a control -} - - -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. - -void CIEPatcherDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - - -// The system calls this to obtain the cursor to display while the user drags -// the minimized window. -HCURSOR CIEPatcherDlg::OnQueryDragIcon() -{ - return (HCURSOR) m_hIcon; -} - - -// Automation servers should not exit when a user closes the UI -// if a controller still holds on to one of its objects. These -// message handlers make sure that if the proxy is still in use, -// then the UI is hidden but the dialog remains around if it -// is dismissed. - -void CIEPatcherDlg::OnClose() -{ - if (CanExit()) - CDialog::OnClose(); -} - - -LONG CIEPatcherDlg::OnUpdateFileStatus(WPARAM wParam, LPARAM lParam) -{ - PatchStatus ps = (PatchStatus) wParam; - TCHAR *pszFile = (TCHAR *) lParam; - UpdateFileStatus(pszFile, ps); - return 0; -} - - -void CIEPatcherDlg::OnScan() -{ - CScanForFilesDlg dlg; - - if (dlg.DoModal() == IDOK) - { - CWaitCursor wc; - - CFileFind op; - if (op.FindFile(dlg.m_sFilePattern)) - { - op.FindNextFile(); - do { - if (!op.IsDirectory()) - { - AddFileToList(op.GetFilePath()); - } - } while (op.FindNextFile()); - op.Close(); - } - } -} - - -void CIEPatcherDlg::OnPatch() -{ - int nItem = -1; - do { - nItem = m_cFileList.GetNextItem(nItem, LVNI_ALL | LVNI_SELECTED); - if (nItem != -1) - { - m_cQueuedFileDataList[nItem]->ps = psPatchPending; - UpdateFileStatus(nItem, m_cQueuedFileDataList[nItem]->sFileName, m_cQueuedFileDataList[nItem]->ps); - } - } while (nItem != -1); -} - - -void CIEPatcherDlg::OnClickFilelist(NMHDR* pNMHDR, LRESULT* pResult) -{ - // Check if files are selected - - *pResult = 0; -} - - -/////////////////////////////////////////////////////////////////////////////// - - -BOOL CIEPatcherDlg::CanExit() -{ - // If the proxy object is still around, then the automation - // controller is still holding on to this application. Leave - // the dialog around, but hide its UI. - if (m_pAutoProxy != NULL) - { - ShowWindow(SW_HIDE); - return FALSE; - } - - return TRUE; -} - - -PatchStatus CIEPatcherDlg::ScanFile(const CString &sFileName) -{ - char *pszBuffer = NULL; - long nBufferSize = 0; - if (!ReadFileToBuffer(sFileName, &pszBuffer, &nBufferSize)) - { - return psFileError; - } - - PatchStatus ps = ScanBuffer(pszBuffer, nBufferSize, FALSE); - delete []pszBuffer; - return ps; -} - - -BOOL CIEPatcherDlg::WriteBufferToFile(const CString &sFileName, char *pszBuffer, long nBufferSize) -{ - CString sMessage; - sMessage.Format("Saving patched file \"%s\"", sFileName); - TraceProgress(sMessage); - - FILE *fDest = fopen(sFileName, "wb"); - if (fDest == NULL) - { - TraceProgress("Error: Could not open destination file"); - return FALSE; - } - - fwrite(pszBuffer, 1, nBufferSize, fDest); - fclose(fDest); - TraceProgress("File saved"); - - return TRUE; -} - - -BOOL CIEPatcherDlg::ReadFileToBuffer(const CString &sFileName, char **ppszBuffer, long *pnBufferSize) -{ - CString sProcessing; - sProcessing.Format("Processing file \"%s\"", sFileName); - TraceProgress(sProcessing); - - // Allocate a memory buffer to slurp up the whole file - struct _stat srcStat; - _stat(sFileName, &srcStat); - - char *pszBuffer = new char[srcStat.st_size / sizeof(char)]; - if (pszBuffer == NULL) - { - TraceProgress("Error: Could not allocate buffer for file"); - return FALSE; - } - FILE *fSrc = fopen(sFileName, "rb"); - if (fSrc == NULL) - { - TraceProgress("Error: Could not open file"); - delete []pszBuffer; - return FALSE; - } - size_t sizeSrc = srcStat.st_size; - size_t sizeRead = 0; - - // Dumb but effective - sizeRead = fread(pszBuffer, 1, sizeSrc, fSrc); - fclose(fSrc); - - if (sizeRead != sizeSrc) - { - TraceProgress("Error: Could not read all of file"); - delete []pszBuffer; - return FALSE; - } - - *ppszBuffer = pszBuffer; - *pnBufferSize = sizeRead; - - return TRUE; -} - - -PatchStatus CIEPatcherDlg::ScanBuffer(char *pszBuffer, long nBufferSize, BOOL bApplyPatch) -{ - if (nBufferSize < sizeof(CLSID)) - { - return psNotPatchable; - } - - TraceProgress("Scanning for IE..."); - - BOOL bPatchApplied = FALSE; - PatchStatus ps = psUnknownStatus; - - // Scan through buffer, one byte at a time doing a memcmp - for (size_t i = 0; i < nBufferSize - sizeof(CLSID); i++) - { - if (memcmp(&pszBuffer[i], &CLSID_MozillaBrowser, sizeof(CLSID)) == 0) - { - TraceProgress("Found CLSID_MozillaBrowser"); - if (ps == psUnknownStatus) - { - ps = psAlreadyPatched; - } - } - else if (memcmp(&pszBuffer[i], &CLSID_WebBrowser_V1, sizeof(CLSID)) == 0) - { - TraceProgress("Found CLSID_WebBrowser_V1"); - if (ps == psUnknownStatus) - { - ps = psPatchable; - } - if (bApplyPatch) - { - TraceProgress("Patching with CLSID_MozillaBrowser"); - memcpy(&pszBuffer[i], &CLSID_MozillaBrowser, sizeof(CLSID)); - bPatchApplied = TRUE; - } - } - else if (memcmp(&pszBuffer[i], &CLSID_WebBrowser, sizeof(CLSID)) == 0) - { - TraceProgress("Found CLSID_WebBrowser"); - if (ps == psUnknownStatus) - { - ps = psPatchable; - } - if (bApplyPatch) - { - TraceProgress("Patching with CLSID_MozillaBrowser"); - memcpy(&pszBuffer[i], &CLSID_MozillaBrowser, sizeof(CLSID)); - TraceProgress("Patching with CLSID_MozillaBrowser"); - bPatchApplied = TRUE; - } - } - else if (memcmp(&pszBuffer[i], &IID_IWebBrowser, sizeof(CLSID)) == 0) - { - TraceProgress("Found IID_IWebBrowser"); - if (ps == psUnknownStatus) - { - ps = psPatchable; - } - } - else if (memcmp(&pszBuffer[i], &CLSID_InternetExplorer, sizeof(CLSID)) == 0) - { - TraceProgress("Warning: Found CLSID_InternetExplorer, patching might not work"); - if (ps == psUnknownStatus) - { - ps = psMayBePatchable; - } - } - else if (memcmp(&pszBuffer[i], &IID_IWebBrowser2, sizeof(CLSID)) == 0) - { - TraceProgress("Found IID_IWebBrowser2"); - if (ps == psUnknownStatus) - { - ps = psPatchable; - } - } - else if (memcmp(&pszBuffer[i], &IID_IWebBrowserApp, sizeof(CLSID)) == 0) - { - TraceProgress("Found IID_IWebBrowserApp"); - if (ps == psUnknownStatus) - { - ps = psPatchable; - } - } - } - - if (ps == psUnknownStatus) - { - ps = psNotPatchable; - } - if (bApplyPatch) - { - ps = (bPatchApplied) ? psAlreadyPatched : psNotPatchable; - } - - TraceProgress("Scan completed"); - - return ps; -} - - -BOOL CIEPatcherDlg::PatchFile(const CString & sFileFrom, const CString & sFileTo, PatchStatus *pPatchStatus) -{ - if (sFileTo.IsEmpty()) - { - return FALSE; - } - if (sFileTo == sFileFrom) - { - TraceProgress("Warning: Patching disabled for safety reasons, source and destination names must differ"); - return FALSE; - } - - char *pszBuffer = NULL; - long nBufferSize = 0; - - if (!ReadFileToBuffer(sFileFrom, &pszBuffer, &nBufferSize)) - { - return FALSE; - } - - // Scan and patch the buffer - *pPatchStatus = ScanBuffer(pszBuffer, nBufferSize, TRUE); - if (*pPatchStatus == psNotPatchable) - { - TraceProgress("Error: Nothing was found to patch"); - } - else - { - // Write out the patch file - WriteBufferToFile(sFileTo, pszBuffer, nBufferSize); - } - - delete []pszBuffer; - return FALSE; -} - - -void CIEPatcherDlg::TraceProgress(const CString &sProgress) -{ - // TODO -} - - -void CIEPatcherDlg::AddFileToList(const CString & sFile) -{ - CSingleLock sl(&m_csQueuedFileDataList, TRUE); - - int nIndex = m_cFileList.GetItemCount(); - m_cFileList.InsertItem(nIndex, sFile, IMG_UNKNOWNSTATUS); - - QueuedFileData *pData = new QueuedFileData; - pData->ps = psUnknownStatus; - pData->sFileName = sFile; - pData->sPatchedFileName = sFile; - m_cQueuedFileDataList.Add(pData); - - UpdateFileStatus(nIndex, pData->ps); -} - - -void CIEPatcherDlg::UpdateFileStatus(int nFileIndex, const CString &sFile, PatchStatus ps) -{ - CString sStatus; - int nIconStatus = -1; - - switch (ps) - { - case psFileError: - sStatus = _T("File error"); - break; - - case psNotPatchable: - sStatus = _T("Nothing to patch"); - nIconStatus = IMG_DOESNTCONTAINIE; - break; - - case psPatchable: - sStatus = _T("Patchable"); - nIconStatus = IMG_CONTAINSIE; - break; - - case psMayBePatchable: - sStatus = _T("Maybe patchable"); - nIconStatus = IMG_CONTAINSIE; - break; - - case psAlreadyPatched: - sStatus = _T("Already patched"); - nIconStatus = IMG_CONTAINSMOZILLA; - break; - - case psUnknownStatus: - sStatus = _T("Status pending"); - nIconStatus = IMG_UNKNOWNSTATUS; - break; - - case psPatchPending: - sStatus = _T("Patch pending"); - break; - - default: - sStatus = _T("*** ERROR ***"); - break; - } - - if (nIconStatus != -1) - { - m_cFileList.SetItem(nFileIndex, -1, LVIF_IMAGE, NULL, nIconStatus, 0, 0, 0); - } - m_cFileList.SetItemText(nFileIndex, ITEM_PATCHSTATUS, sStatus); -} - - -void CIEPatcherDlg::UpdateFileStatus(const CString &sFile, PatchStatus ps) -{ - CSingleLock sl(&m_csQueuedFileDataList, TRUE); - - for (int n = 0; n < m_cQueuedFileDataList.GetSize(); n++) - { - if (m_cQueuedFileDataList[n]->sFileName == sFile) - { - UpdateFileStatus(n, sFile, ps); - m_cQueuedFileDataList[n]->ps = ps; - return; - } - } -} - - -BOOL CIEPatcherDlg::GetPendingFileToScan(CString & sFileToScan) -{ - CSingleLock sl(&m_csQueuedFileDataList, TRUE); - - for (int n = 0; n < m_cQueuedFileDataList.GetSize(); n++) - { - if (m_cQueuedFileDataList[n]->ps == psUnknownStatus) - { - sFileToScan = m_cQueuedFileDataList[n]->sFileName; - return TRUE; - } - } - return FALSE; -} - - -BOOL CIEPatcherDlg::GetPendingFileToPatch(CString & sFileToPatch) -{ - CSingleLock sl(&m_csQueuedFileDataList, TRUE); - - for (int n = 0; n < m_cQueuedFileDataList.GetSize(); n++) - { - if (m_cQueuedFileDataList[n]->ps == psPatchPending) - { - sFileToPatch = m_cQueuedFileDataList[n]->sFileName; - return TRUE; - } - } - return FALSE; -} diff --git a/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.h b/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.h deleted file mode 100644 index 56bcd63b181..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.h +++ /dev/null @@ -1,105 +0,0 @@ -// IEPatcherDlg.h : header file -// - -#if !defined(AFX_IEPATCHERDLG_H__A603167C_3B36_11D2_B44D_00600819607E__INCLUDED_) -#define AFX_IEPATCHERDLG_H__A603167C_3B36_11D2_B44D_00600819607E__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -class CIEPatcherDlgAutoProxy; - -enum PatchStatus -{ - psFileError, - psUnknownStatus, - psPatchPending, - psNotPatchable, - psPatchable, - psMayBePatchable, - psAlreadyPatched -}; - -struct QueuedFileData -{ - CString sFileName; - CString sPatchedFileName; - PatchStatus ps; -}; - -#define WM_UPDATEFILESTATUS WM_USER+1 - -///////////////////////////////////////////////////////////////////////////// -// CIEPatcherDlg dialog - -class CIEPatcherDlg : public CDialog -{ - DECLARE_DYNAMIC(CIEPatcherDlg); - friend class CIEPatcherDlgAutoProxy; - -// Construction -public: - void AddFileToList(const CString &sFile); - BOOL GetPendingFileToScan(CString &sFileToScan); - BOOL GetPendingFileToPatch(CString &sFileToPatch); - - static PatchStatus ScanFile(const CString &sFileName); - static PatchStatus ScanBuffer(char *pszBuffer, long nBufferSize, BOOL bApplyPatches); - static BOOL PatchFile(const CString & sFileFrom, const CString & sFileTo, PatchStatus *pPatchStatus); - - static BOOL WriteBufferToFile(const CString &sFileName, char *pszBuffer, long nBufferSize); - static BOOL ReadFileToBuffer(const CString &sFileName, char **ppszBuffer, long *pnBufferSize); - static void TraceProgress(const CString &sProgress); - - void UpdateFileStatus(const CString &sFile, PatchStatus ps); - void UpdateFileStatus(int nFileIndex, const CString &sFile, PatchStatus ps); - - - CIEPatcherDlg(CWnd* pParent = NULL); // standard constructor - virtual ~CIEPatcherDlg(); - - CImageList m_cImageList; - - CArray m_cQueuedFileDataList; - CCriticalSection m_csQueuedFileDataList; - -// Dialog Data - //{{AFX_DATA(CIEPatcherDlg) - enum { IDD = IDD_IEPATCHER_DIALOG }; - CButton m_btnPatch; - CListCtrl m_cFileList; - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CIEPatcherDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - CIEPatcherDlgAutoProxy* m_pAutoProxy; - HICON m_hIcon; - - BOOL CanExit(); - - // Generated message map functions - //{{AFX_MSG(CIEPatcherDlg) - virtual BOOL OnInitDialog(); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - afx_msg void OnClose(); - afx_msg void OnScan(); - afx_msg void OnClickFilelist(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg void OnPatch(); - //}}AFX_MSG - afx_msg LONG OnUpdateFileStatus(WPARAM, LPARAM); - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_IEPATCHERDLG_H__A603167C_3B36_11D2_B44D_00600819607E__INCLUDED_) - diff --git a/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.cpp b/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.cpp deleted file mode 100644 index 87cde37c11e..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// ScanForFilesDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "IEPatcher.h" -#include "ScanForFilesDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CScanForFilesDlg dialog - - -CScanForFilesDlg::CScanForFilesDlg(CWnd* pParent /*=NULL*/) - : CDialog(CScanForFilesDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(CScanForFilesDlg) - m_sFilePattern = _T(""); - //}}AFX_DATA_INIT -} - - -void CScanForFilesDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CScanForFilesDlg) - DDX_Text(pDX, IDC_FILEPATTERN, m_sFilePattern); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CScanForFilesDlg, CDialog) - //{{AFX_MSG_MAP(CScanForFilesDlg) - ON_BN_CLICKED(IDC_SELECTFILE, OnSelectFile) - ON_BN_CLICKED(IDC_SELECTFOLDER, OnSelectFolder) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CScanForFilesDlg message handlers - -void CScanForFilesDlg::OnOK() -{ - UpdateData(); - CDialog::OnOK(); -} - -void CScanForFilesDlg::OnSelectFile() -{ - CFileDialog dlg(TRUE, NULL, _T("*.*")); - - if (dlg.DoModal() == IDOK) - { - m_sFilePattern = dlg.GetPathName(); - UpdateData(FALSE); - } -} - -void CScanForFilesDlg::OnSelectFolder() -{ - BROWSEINFO bi; - TCHAR szFolder[MAX_PATH + 1]; - - memset(szFolder, 0, sizeof(szFolder)); - - memset(&bi, 0, sizeof(bi)); - bi.hwndOwner = GetSafeHwnd(); - bi.pidlRoot = NULL; - bi.pszDisplayName = szFolder; - bi.lpszTitle = _T("Pick a folder to scan"); - - // Open the folder browser dialog - LPITEMIDLIST pItemList = SHBrowseForFolder(&bi); - if (pItemList) - { - IMalloc *pShellAllocator = NULL; - - SHGetMalloc(&pShellAllocator); - if (pShellAllocator) - { - char szPath[MAX_PATH + 1]; - - if (SHGetPathFromIDList(pItemList, szPath)) - { - // Chop off the end path separator - int nPathSize = strlen(szPath); - if (nPathSize > 0) - { - if (szPath[nPathSize - 1] == '\\') - { - szPath[nPathSize - 1] = '\0'; - } - } - - // Form the file pattern - USES_CONVERSION; - m_sFilePattern.Format(_T("%s\\*.*"), A2T(szPath)); - UpdateData(FALSE); - } - - pShellAllocator->Free(pItemList); - pShellAllocator->Release(); - } - - } -} diff --git a/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.h b/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.h deleted file mode 100644 index eefcf3384f3..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.h +++ /dev/null @@ -1,48 +0,0 @@ -#if !defined(AFX_SCANFORFILESDLG_H__2CAAFC02_6C47_11D2_A1F5_000000000000__INCLUDED_) -#define AFX_SCANFORFILESDLG_H__2CAAFC02_6C47_11D2_A1F5_000000000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// ScanForFilesDlg.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CScanForFilesDlg dialog - -class CScanForFilesDlg : public CDialog -{ -// Construction -public: - CScanForFilesDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CScanForFilesDlg) - enum { IDD = IDD_SCANFORFILES }; - CString m_sFilePattern; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CScanForFilesDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CScanForFilesDlg) - virtual void OnOK(); - afx_msg void OnSelectFile(); - afx_msg void OnSelectFolder(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_SCANFORFILESDLG_H__2CAAFC02_6C47_11D2_A1F5_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/IEPatcher/ScannerThread.cpp b/embedding/browser/activex/tests/IEPatcher/ScannerThread.cpp deleted file mode 100644 index b837d908b87..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/ScannerThread.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// ScannerThread.cpp : implementation file -// - -#include "stdafx.h" -#include "iepatcher.h" -#include "ScannerThread.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CScannerThread - -IMPLEMENT_DYNCREATE(CScannerThread, CWinThread) - -CScannerThread::CScannerThread() -{ -} - -CScannerThread::~CScannerThread() -{ -} - -BOOL CScannerThread::InitInstance() -{ - m_cScannerWnd.Create(AfxRegisterWndClass(0), _T("Scanner"), 0L, CRect(0, 0, 0, 0), AfxGetMainWnd(), 1); - return TRUE; -} - -int CScannerThread::ExitInstance() -{ - // TODO: perform any per-thread cleanup here - return CWinThread::ExitInstance(); -} - -BEGIN_MESSAGE_MAP(CScannerThread, CWinThread) - //{{AFX_MSG_MAP(CScannerThread) - // NOTE - the ClassWizard will add and remove mapping macros here. - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CScannerThread message handlers diff --git a/embedding/browser/activex/tests/IEPatcher/ScannerThread.h b/embedding/browser/activex/tests/IEPatcher/ScannerThread.h deleted file mode 100644 index 430240664f3..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/ScannerThread.h +++ /dev/null @@ -1,54 +0,0 @@ -#if !defined(AFX_SCANNERTHREAD_H__2CAAFC04_6C47_11D2_A1F5_000000000000__INCLUDED_) -#define AFX_SCANNERTHREAD_H__2CAAFC04_6C47_11D2_A1F5_000000000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// ScannerThread.h : header file -// - -#include "ScannerWnd.h" - - -///////////////////////////////////////////////////////////////////////////// -// CScannerThread thread - -class CScannerThread : public CWinThread -{ - DECLARE_DYNCREATE(CScannerThread) -protected: - CScannerThread(); // protected constructor used by dynamic creation - -// Attributes -public: - CScannerWnd m_cScannerWnd; - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CScannerThread) - public: - virtual BOOL InitInstance(); - virtual int ExitInstance(); - //}}AFX_VIRTUAL - -// Implementation -protected: - virtual ~CScannerThread(); - - // Generated message map functions - //{{AFX_MSG(CScannerThread) - // NOTE - the ClassWizard will add and remove member functions here. - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_SCANNERTHREAD_H__2CAAFC04_6C47_11D2_A1F5_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/IEPatcher/ScannerWnd.cpp b/embedding/browser/activex/tests/IEPatcher/ScannerWnd.cpp deleted file mode 100644 index db95aa64a05..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/ScannerWnd.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// ScannerWnd.cpp : implementation file -// - -#include "stdafx.h" -#include "iepatcher.h" -#include "ScannerWnd.h" -#include "IEPatcherDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CScannerWnd - -CScannerWnd::CScannerWnd() -{ -} - -CScannerWnd::~CScannerWnd() -{ -} - - -BEGIN_MESSAGE_MAP(CScannerWnd, CWnd) - //{{AFX_MSG_MAP(CScannerWnd) - ON_WM_TIMER() - ON_WM_CREATE() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - - -///////////////////////////////////////////////////////////////////////////// -// CScannerWnd message handlers - - -int CScannerWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CWnd::OnCreate(lpCreateStruct) == -1) - return -1; - - SetTimer(1, 500, NULL); - - return 0; -} - - -void CScannerWnd::OnTimer(UINT nIDEvent) -{ - CIEPatcherDlg * pDlg = ((CIEPatcherApp *) AfxGetApp())->m_pIEPatcherDlg; - if (pDlg) - { - CString sFileToProcess; - if (pDlg->GetPendingFileToScan(sFileToProcess)) - { - PatchStatus ps = CIEPatcherDlg::ScanFile(sFileToProcess); - AfxGetMainWnd()->SendMessage(WM_UPDATEFILESTATUS, (WPARAM) ps, (LPARAM) (const TCHAR *) sFileToProcess); - } - else if (pDlg->GetPendingFileToPatch(sFileToProcess)) - { - TCHAR szDrive[_MAX_DRIVE]; - TCHAR szDir[_MAX_DIR]; - TCHAR szFile[_MAX_FNAME]; - TCHAR szExt[_MAX_EXT]; - - _tsplitpath(sFileToProcess, szDrive, szDir, szFile, szExt); - - CString sFileOut; - TCHAR szPath[_MAX_PATH]; - sFileOut.Format(_T("moz_%s"), szFile); - _tmakepath(szPath, szDrive, szDir, sFileOut, szExt); - - PatchStatus ps; - CIEPatcherDlg::PatchFile(sFileToProcess, szPath, &ps); - AfxGetMainWnd()->SendMessage(WM_UPDATEFILESTATUS, (WPARAM) ps, (LPARAM) (const TCHAR *) sFileToProcess); - } - } - - CWnd::OnTimer(nIDEvent); -} diff --git a/embedding/browser/activex/tests/IEPatcher/ScannerWnd.h b/embedding/browser/activex/tests/IEPatcher/ScannerWnd.h deleted file mode 100644 index 7c4c02d63ef..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/ScannerWnd.h +++ /dev/null @@ -1,48 +0,0 @@ -#if !defined(AFX_SCANNERWND_H__2CAAFC05_6C47_11D2_A1F5_000000000000__INCLUDED_) -#define AFX_SCANNERWND_H__2CAAFC05_6C47_11D2_A1F5_000000000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// ScannerWnd.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CScannerWnd window - -class CScannerWnd : public CWnd -{ -// Construction -public: - CScannerWnd(); - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CScannerWnd) - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CScannerWnd(); - - // Generated message map functions -protected: - //{{AFX_MSG(CScannerWnd) - afx_msg void OnTimer(UINT nIDEvent); - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_SCANNERWND_H__2CAAFC05_6C47_11D2_A1F5_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/IEPatcher/StdAfx.cpp b/embedding/browser/activex/tests/IEPatcher/StdAfx.cpp deleted file mode 100644 index ee987d4d8c7..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/StdAfx.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// IEPatcher.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - diff --git a/embedding/browser/activex/tests/IEPatcher/StdAfx.h b/embedding/browser/activex/tests/IEPatcher/StdAfx.h deleted file mode 100644 index 59b4a1767e6..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/StdAfx.h +++ /dev/null @@ -1,42 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__A6031681_3B36_11D2_B44D_00600819607E__INCLUDED_) -#define AFX_STDAFX_H__A6031681_3B36_11D2_B44D_00600819607E__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -#include // MFC core and standard components -#include // MFC extensions -#include // MFC OLE automation classes -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT -#include -#include -#include - -#include - -// This macro is the same as IMPLEMENT_OLECREATE, except it passes TRUE -// for the bMultiInstance parameter to the COleObjectFactory constructor. -// We want a separate instance of this application to be launched for -// each OLE automation proxy object requested by automation controllers. -#ifndef IMPLEMENT_OLECREATE2 -#define IMPLEMENT_OLECREATE2(class_name, external_name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - AFX_DATADEF COleObjectFactory class_name::factory(class_name::guid, \ - RUNTIME_CLASS(class_name), TRUE, _T(external_name)); \ - const AFX_DATADEF GUID class_name::guid = \ - { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }; -#endif // IMPLEMENT_OLECREATE2 - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__A6031681_3B36_11D2_B44D_00600819607E__INCLUDED_) diff --git a/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.ico b/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.ico deleted file mode 100644 index 7eef0bcbe65..00000000000 Binary files a/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.rc2 b/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.rc2 deleted file mode 100644 index 227cb5a3f68..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// IEPATCHER.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/embedding/browser/activex/tests/IEPatcher/res/containsie.ico b/embedding/browser/activex/tests/IEPatcher/res/containsie.ico deleted file mode 100644 index 68cdc082517..00000000000 Binary files a/embedding/browser/activex/tests/IEPatcher/res/containsie.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/IEPatcher/res/containsmozilla.ico b/embedding/browser/activex/tests/IEPatcher/res/containsmozilla.ico deleted file mode 100644 index 34e29d003f9..00000000000 Binary files a/embedding/browser/activex/tests/IEPatcher/res/containsmozilla.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/IEPatcher/res/doesntcontainie.ico b/embedding/browser/activex/tests/IEPatcher/res/doesntcontainie.ico deleted file mode 100644 index 811358fb803..00000000000 Binary files a/embedding/browser/activex/tests/IEPatcher/res/doesntcontainie.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/IEPatcher/res/unknownstatus.ico b/embedding/browser/activex/tests/IEPatcher/res/unknownstatus.ico deleted file mode 100644 index 893350f1028..00000000000 Binary files a/embedding/browser/activex/tests/IEPatcher/res/unknownstatus.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/IEPatcher/resource.h b/embedding/browser/activex/tests/IEPatcher/resource.h deleted file mode 100644 index 3c1baaaa51e..00000000000 --- a/embedding/browser/activex/tests/IEPatcher/resource.h +++ /dev/null @@ -1,35 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by IEPatcher.rc -// -#define IDP_OLE_INIT_FAILED 100 -#define IDD_IEPATCHER_DIALOG 102 -#define IDR_MAINFRAME 128 -#define IDI_CONTAINSIE 129 -#define IDI_DOESNTCONTAINIE 130 -#define IDI_CONTAINSMOZILLA 131 -#define IDD_SCANFORFILES 132 -#define IDI_UNKNOWNSTATUS 133 -#define IDC_FILENAME 1000 -#define IDC_SCAN 1001 -#define IDC_PROGRESS 1002 -#define IDC_PATCHFILE 1003 -#define IDC_DESTINATION_FILENAME 1004 -#define IDC_PICKSOURCE 1005 -#define IDC_PICKDESTINATION 1006 -#define IDC_FILELIST 1007 -#define IDC_PATCH 1008 -#define IDC_FILEPATTERN 1009 -#define IDC_SELECTFILE 1011 -#define IDC_SELECTFOLDER 1012 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 134 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1012 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/embedding/browser/activex/tests/RegMozCtl/MozillaBrowser.ico b/embedding/browser/activex/tests/RegMozCtl/MozillaBrowser.ico deleted file mode 100644 index 01c6f785d3e..00000000000 Binary files a/embedding/browser/activex/tests/RegMozCtl/MozillaBrowser.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/RegMozCtl/ReadMe.txt b/embedding/browser/activex/tests/RegMozCtl/ReadMe.txt deleted file mode 100644 index 76a553ecfc2..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/ReadMe.txt +++ /dev/null @@ -1,88 +0,0 @@ -======================================================================== - MICROSOFT FOUNDATION CLASS LIBRARY : RegMozCtl -======================================================================== - - -AppWizard has created this RegMozCtl application for you. This application -not only demonstrates the basics of using the Microsoft Foundation classes -but is also a starting point for writing your application. - -This file contains a summary of what you will find in each of the files that -make up your RegMozCtl application. - -RegMozCtl.dsp - This file (the project file) contains information at the project level and - is used to build a single project or subproject. Other users can share the - project (.dsp) file, but they should export the makefiles locally. - -RegMozCtl.h - This is the main header file for the application. It includes other - project specific headers (including Resource.h) and declares the - CRegMozCtlApp application class. - -RegMozCtl.cpp - This is the main application source file that contains the application - class CRegMozCtlApp. - -RegMozCtl.rc - This is a listing of all of the Microsoft Windows resources that the - program uses. It includes the icons, bitmaps, and cursors that are stored - in the RES subdirectory. This file can be directly edited in Microsoft - Visual C++. - -RegMozCtl.clw - This file contains information used by ClassWizard to edit existing - classes or add new classes. ClassWizard also uses this file to store - information needed to create and edit message maps and dialog data - maps and to create prototype member functions. - -res\RegMozCtl.ico - This is an icon file, which is used as the application's icon. This - icon is included by the main resource file RegMozCtl.rc. - -res\RegMozCtl.rc2 - This file contains resources that are not edited by Microsoft - Visual C++. You should place all resources not editable by - the resource editor in this file. - - - - -///////////////////////////////////////////////////////////////////////////// - -AppWizard creates one dialog class: - -RegMozCtlDlg.h, RegMozCtlDlg.cpp - the dialog - These files contain your CRegMozCtlDlg class. This class defines - the behavior of your application's main dialog. The dialog's - template is in RegMozCtl.rc, which can be edited in Microsoft - Visual C++. - - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named RegMozCtl.pch and a precompiled types file named StdAfx.obj. - -Resource.h - This is the standard header file, which defines new resource IDs. - Microsoft Visual C++ reads and updates this file. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" to indicate parts of the source code you -should add to or customize. - -If your application uses MFC in a shared DLL, and your application is -in a language other than the operating system's current language, you -will need to copy the corresponding localized resources MFC42XXX.DLL -from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, -and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. -For example, MFC42DEU.DLL contains resources translated to German.) If you -don't do this, some of the UI elements of your application will remain in the -language of the operating system. - -///////////////////////////////////////////////////////////////////////////// diff --git a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.cpp b/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.cpp deleted file mode 100644 index ab0e4da9b4a..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// RegMozCtl.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" -#include "RegMozCtl.h" -#include "RegMozCtlDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CRegMozCtlApp - -BEGIN_MESSAGE_MAP(CRegMozCtlApp, CWinApp) - //{{AFX_MSG_MAP(CRegMozCtlApp) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG - ON_COMMAND(ID_HELP, CWinApp::OnHelp) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CRegMozCtlApp construction - -CRegMozCtlApp::CRegMozCtlApp() -{ - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - -///////////////////////////////////////////////////////////////////////////// -// The one and only CRegMozCtlApp object - -CRegMozCtlApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// CRegMozCtlApp initialization - -BOOL CRegMozCtlApp::InitInstance() -{ - AfxEnableControlContainer(); - - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need. - -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif - - CRegMozCtlDlg dlg; - m_pMainWnd = &dlg; - int nResponse = dlg.DoModal(); - if (nResponse == IDOK) - { - // TODO: Place code here to handle when the dialog is - // dismissed with OK - } - else if (nResponse == IDCANCEL) - { - // TODO: Place code here to handle when the dialog is - // dismissed with Cancel - } - - // Since the dialog has been closed, return FALSE so that we exit the - // application, rather than start the application's message pump. - return FALSE; -} diff --git a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.dsp b/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.dsp deleted file mode 100644 index 4687c62dacf..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.dsp +++ /dev/null @@ -1,166 +0,0 @@ -# Microsoft Developer Studio Project File - Name="RegMozCtl" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=RegMozCtl - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "RegMozCtl.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "RegMozCtl.mak" CFG="RegMozCtl - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "RegMozCtl - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "RegMozCtl - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "RegMozCtl - Win32 Release" - -# PROP BASE Use_MFC 5 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 5 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "RegMozCtl - Win32 Debug" - -# PROP BASE Use_MFC 5 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 5 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "RegMozCtl - Win32 Release" -# Name "RegMozCtl - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\RegMozCtl.cpp -# End Source File -# Begin Source File - -SOURCE=.\RegMozCtl.rc -# End Source File -# Begin Source File - -SOURCE=.\RegMozCtlDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\RegTask.cpp -# End Source File -# Begin Source File - -SOURCE=.\RegTaskManager.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\RegMozCtl.h -# End Source File -# Begin Source File - -SOURCE=.\RegMozCtlDlg.h -# End Source File -# Begin Source File - -SOURCE=.\RegTask.h -# End Source File -# Begin Source File - -SOURCE=.\RegTaskManager.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\MozillaBrowser.ico -# End Source File -# Begin Source File - -SOURCE=.\res\RegMozCtl.ico -# End Source File -# Begin Source File - -SOURCE=.\res\RegMozCtl.rc2 -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.h b/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.h deleted file mode 100644 index 02b0c5831ec..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.h +++ /dev/null @@ -1,50 +0,0 @@ -// RegMozCtl.h : main header file for the REGMOZCTL application -// - -#if !defined(AFX_REGMOZCTL_H__C7C0A786_F424_11D2_A27B_000000000000__INCLUDED_) -#define AFX_REGMOZCTL_H__C7C0A786_F424_11D2_A27B_000000000000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CRegMozCtlApp: -// See RegMozCtl.cpp for the implementation of this class -// - -class CRegMozCtlApp : public CWinApp -{ -public: - CRegMozCtlApp(); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CRegMozCtlApp) - public: - virtual BOOL InitInstance(); - //}}AFX_VIRTUAL - -// Implementation - - //{{AFX_MSG(CRegMozCtlApp) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -static const TCHAR *c_szValueBinDirPath = _T("BinDirPath"); - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_REGMOZCTL_H__C7C0A786_F424_11D2_A27B_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.rc b/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.rc deleted file mode 100644 index 7c10366fe87..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.rc +++ /dev/null @@ -1,197 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_REGMOZCTL_DIALOG DIALOGEX 0, 0, 270, 241 -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "RegMozCtl" -FONT 8, "MS Sans Serif" -BEGIN - ICON IDI_MOZILLA,IDC_STATIC,7,7,21,20 - LTEXT "This application registers/deregisters the Mozilla Control and ensures that Mozilla path and registry values are set so the control can be used by other applications.", - IDC_STATIC,35,7,228,30 - LTEXT "You must choose the directory containing the Mozilla control and click on the Register or Deregister as appropriate.", - IDC_STATIC,7,36,256,17 - EDITTEXT IDC_MOZILLADIR,7,55,242,14,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_PICKDIR,250,55,13,14 - DEFPUSHBUTTON "&Register",IDC_REGISTER,7,220,50,14 - PUSHBUTTON "&Unregister",IDC_UNREGISTER,80,220,50,14 - PUSHBUTTON "&Close",IDCANCEL,213,220,50,14 - CONTROL "List1",IDC_TASKLIST,"SysListView32",LVS_REPORT | - WS_BORDER | WS_TABSTOP,7,75,256,134 -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "RegMozCtl MFC Application\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "RegMozCtl\0" - VALUE "LegalCopyright", "Copyright (C) 1999\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "RegMozCtl.EXE\0" - VALUE "ProductName", "RegMozCtl Application\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_REGMOZCTL_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 263 - TOPMARGIN, 7 - BOTTOMMARGIN, 234 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.K.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif //_WIN32\r\n" - "#include ""res\\RegMozCtl.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON DISCARDABLE "res\\RegMozCtl.ico" -IDI_MOZILLA ICON DISCARDABLE "MozillaBrowser.ico" -#endif // English (U.K.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif //_WIN32 -#include "res\RegMozCtl.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.cpp b/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.cpp deleted file mode 100644 index 31a2df45695..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.cpp +++ /dev/null @@ -1,258 +0,0 @@ -// RegMozCtlDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "RegMozCtl.h" -#include "RegMozCtlDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CRegMozCtlDlg dialog - -CRegMozCtlDlg::CRegMozCtlDlg(CWnd* pParent /*=NULL*/) - : CDialog(CRegMozCtlDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(CRegMozCtlDlg) - m_szMozillaDir = _T(""); - //}}AFX_DATA_INIT - // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 - m_hIcon = AfxGetApp()->LoadIcon(IDI_MOZILLA); - - GetCurrentDirectory(1024, m_szMozillaDir.GetBuffer(1024)); - m_szMozillaDir.ReleaseBuffer(); -} - -void CRegMozCtlDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CRegMozCtlDlg) - DDX_Control(pDX, IDC_TASKLIST, m_cTaskList); - DDX_Text(pDX, IDC_MOZILLADIR, m_szMozillaDir); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CRegMozCtlDlg, CDialog) - //{{AFX_MSG_MAP(CRegMozCtlDlg) - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - ON_BN_CLICKED(IDC_REGISTER, OnRegister) - ON_BN_CLICKED(IDC_UNREGISTER, OnUnregister) - ON_BN_CLICKED(IDC_PICKDIR, OnPickDir) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CRegMozCtlDlg message handlers - -BOOL CRegMozCtlDlg::OnInitDialog() -{ - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon - - // Get values from the registry - TCHAR szValue[1024]; - DWORD dwSize = sizeof(szValue) / sizeof(szValue[0]); - CRegKey cKey; - cKey.Create(HKEY_LOCAL_MACHINE, MOZ_CONTROL_REG_KEY); - - memset(szValue, 0, sizeof(szValue)); - if (cKey.QueryValue(szValue, MOZ_CONTROL_REG_VALUE_BIN_DIR_PATH, &dwSize) == ERROR_SUCCESS) - { - m_szMozillaDir = CString(szValue); - } - - CDialog::OnInitDialog(); - - CRegTask::PopulateTasks(m_cTaskMgr); - - // Add icons to image list -// m_cImageList.Create(16, 16, ILC_MASK, 0, 5); -// m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_DOESNTCONTAINIE)); -// m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CONTAINSIE)); -// m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CONTAINSMOZILLA)); -// m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_UNKNOWNSTATUS)); - - // Associate image list with file list -// m_cFileList.SetImageList(&m_cImageList, LVSIL_SMALL); - - struct ColumnData - { - TCHAR *sColumnTitle; - int nPercentageWidth; - int nFormat; - }; - - ColumnData aColData[] = - { - { _T("Task"), 70, LVCFMT_LEFT }, - { _T("Status"), 30, LVCFMT_LEFT } - }; - - // Get the size of the file list control and neatly - // divide it into columns - - CRect rcList; - m_cTaskList.GetClientRect(&rcList); - - int nColTotal = sizeof(aColData) / sizeof(aColData[0]); - int nWidthRemaining = rcList.Width(); - - for (int nCol = 0; nCol < nColTotal; nCol++) - { - ColumnData *pData = &aColData[nCol]; - - int nColWidth = (rcList.Width() * pData->nPercentageWidth) / 100; - if (nCol == nColTotal - 1) - { - nColWidth = nWidthRemaining; - } - else if (nColWidth > nWidthRemaining) - { - nColWidth = nWidthRemaining; - } - - m_cTaskList.InsertColumn(nCol, pData->sColumnTitle, pData->nFormat, nColWidth); - - nWidthRemaining -= nColWidth; - if (nColWidth <= 0) - { - break; - } - } - - for (int i = 0; i < m_cTaskMgr.GetTaskCount(); i++) - { - CRegTask *pTask = m_cTaskMgr.GetTask(i); - m_cTaskList.InsertItem(i, pTask->GetDescription()); - } - - return TRUE; // return TRUE unless you set the focus to a control -} - -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. - -void CRegMozCtlDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - -// The system calls this to obtain the cursor to display while the user drags -// the minimized window. -HCURSOR CRegMozCtlDlg::OnQueryDragIcon() -{ - return (HCURSOR) m_hIcon; -} - -void CRegMozCtlDlg::OnRegister() -{ - RegisterMozillaControl(TRUE); -} - -void CRegMozCtlDlg::OnUnregister() -{ - RegisterMozillaControl(FALSE); -} - -void CRegMozCtlDlg::RegisterMozillaControl(BOOL bRegister) -{ - UpdateData(); - - m_cTaskMgr.SetValue(c_szValueBinDirPath, m_szMozillaDir); - - for (int i = 0; i < m_cTaskMgr.GetTaskCount(); i++) - { - CRegTask *pTask = m_cTaskMgr.GetTask(i); - pTask->DoTask(); - } - - AfxMessageBox(bRegister ? _T("Register completed") : _T("Unregister completed")); -} - -void CRegMozCtlDlg::OnPickDir() -{ - BROWSEINFO bi; - TCHAR szFolder[MAX_PATH + 1]; - - memset(szFolder, 0, sizeof(szFolder)); - - memset(&bi, 0, sizeof(bi)); - bi.hwndOwner = GetSafeHwnd(); - bi.pidlRoot = NULL; - bi.pszDisplayName = szFolder; - bi.lpszTitle = _T("Pick a folder to scan"); - - // Open the folder browser dialog - LPITEMIDLIST pItemList = SHBrowseForFolder(&bi); - if (pItemList) - { - IMalloc *pShellAllocator = NULL; - - SHGetMalloc(&pShellAllocator); - if (pShellAllocator) - { - char szPath[MAX_PATH + 1]; - - if (SHGetPathFromIDList(pItemList, szPath)) - { - // Chop off the end path separator - int nPathSize = strlen(szPath); - if (nPathSize > 0) - { - if (szPath[nPathSize - 1] == '\\') - { - szPath[nPathSize - 1] = '\0'; - } - } - - m_szMozillaDir = CString(szPath); - - UpdateData(FALSE); - } - - pShellAllocator->Free(pItemList); - pShellAllocator->Release(); - } - } -} - - -CString CRegMozCtlDlg::GetSystemPath() -{ - // TODO - return _T(""); -} - -BOOL CRegMozCtlDlg::SetSystemPath(const CString &szNewPath) -{ - // TODO - return TRUE; -} diff --git a/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.h b/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.h deleted file mode 100644 index cb35aac0308..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.h +++ /dev/null @@ -1,60 +0,0 @@ -// RegMozCtlDlg.h : header file -// - -#if !defined(AFX_REGMOZCTLDLG_H__C7C0A788_F424_11D2_A27B_000000000000__INCLUDED_) -#define AFX_REGMOZCTLDLG_H__C7C0A788_F424_11D2_A27B_000000000000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "RegTaskManager.h" - -///////////////////////////////////////////////////////////////////////////// -// CRegMozCtlDlg dialog - -class CRegMozCtlDlg : public CDialog -{ -// Construction -public: - CRegMozCtlDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CRegMozCtlDlg) - enum { IDD = IDD_REGMOZCTL_DIALOG }; - CListCtrl m_cTaskList; - CString m_szMozillaDir; - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CRegMozCtlDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - HICON m_hIcon; - CRegTaskManager m_cTaskMgr; - - - // Generated message map functions - //{{AFX_MSG(CRegMozCtlDlg) - virtual BOOL OnInitDialog(); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - afx_msg void OnRegister(); - afx_msg void OnUnregister(); - afx_msg void OnPickDir(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - - void RegisterMozillaControl(BOOL bRegister); - BOOL SetSystemPath(const CString &szNewPath); - CString GetSystemPath(); -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_REGMOZCTLDLG_H__C7C0A788_F424_11D2_A27B_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/RegMozCtl/RegTask.cpp b/embedding/browser/activex/tests/RegMozCtl/RegTask.cpp deleted file mode 100644 index a36bca274c6..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/RegTask.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// RegTask.cpp: implementation of the CRegTask class. -// -////////////////////////////////////////////////////////////////////// - -#include "stdafx.h" -#include "regmozctl.h" -#include "RegTask.h" -#include "RegTaskManager.h" - -#ifdef _DEBUG -#undef THIS_FILE -static char THIS_FILE[]=__FILE__; -#define new DEBUG_NEW -#endif - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CRegTask::CRegTask() -{ - -} - -CRegTask::CRegTask(CRegTaskManager *pMgr) -{ - m_pTaskMgr = pMgr; -} - -CRegTask::~CRegTask() -{ - -} - -////////////////////////////////////////////////////////////////////// - -class CRegTaskRegistry : public CRegTask -{ -public: - CRegTaskRegistry(CRegTaskManager *pMgr) : CRegTask(pMgr) - { - m_szDesc = _T("Set BinDirectoryPath registry entry"); - } - HRESULT DoTask(); -}; - - -HRESULT CRegTaskRegistry::DoTask() -{ - CString szBinDirPath; - m_pTaskMgr->GetValue(c_szValueBinDirPath, szBinDirPath); - // Create registry key - CRegKey cKey; - cKey.Create(HKEY_LOCAL_MACHINE, MOZ_CONTROL_REG_KEY); - cKey.SetValue(szBinDirPath, MOZ_CONTROL_REG_VALUE_BIN_DIR_PATH); - cKey.Close(); - return S_OK; -} - -////////////////////////////////////////////////////////////////////// - -class CRegTaskRegSvr : public CRegTask -{ -public: - CRegTaskRegSvr(CRegTaskManager *pMgr) : CRegTask(pMgr) - { - m_szDesc = _T("Register Mozilla Control"); - } - HRESULT DoTask(); -}; - - -HRESULT CRegTaskRegSvr::DoTask() -{ - BOOL bRegister = TRUE; - CString szBinDirPath; - m_pTaskMgr->GetValue(c_szValueBinDirPath, szBinDirPath); - SetCurrentDirectory(szBinDirPath); - - // Now register the mozilla control - CString szMozCtl = szBinDirPath + CString(_T("\\mozctl.dll")); - HINSTANCE hMod = LoadLibrary(szMozCtl); - if (hMod == NULL) - { - AfxMessageBox(_T("Can't find mozctl.dll in current directory")); - return E_FAIL; - } - - HRESULT hr = E_FAIL; - FARPROC pfn = GetProcAddress(hMod, bRegister ? _T("DllRegisterServer") : _T("DllUnregisterServer")); - if (pfn) - { - hr = pfn(); - } - FreeLibrary(hMod); - return hr; -} - -////////////////////////////////////////////////////////////////////// - -class CRegTaskPATH : public CRegTask -{ -public: - CRegTaskPATH(CRegTaskManager *pMgr) : CRegTask(pMgr) - { - m_szDesc = _T("Set PATH environment variable"); - } - HRESULT DoTask(); -}; - - -HRESULT CRegTaskPATH::DoTask() -{ - CString szBinDirPath; - m_pTaskMgr->GetValue(c_szValueBinDirPath, szBinDirPath); - - return S_OK; -} - -////////////////////////////////////////////////////////////////////// - -HRESULT CRegTask::PopulateTasks(CRegTaskManager &cMgr) -{ - cMgr.AddTask(new CRegTaskRegistry(&cMgr)); - cMgr.AddTask(new CRegTaskPATH(&cMgr)); - cMgr.AddTask(new CRegTaskRegSvr(&cMgr)); - return S_OK; -} - diff --git a/embedding/browser/activex/tests/RegMozCtl/RegTask.h b/embedding/browser/activex/tests/RegMozCtl/RegTask.h deleted file mode 100644 index 19e88a77d12..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/RegTask.h +++ /dev/null @@ -1,36 +0,0 @@ -// RegTask.h: interface for the CRegTask class. -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_REGTASK_H__28D3BD27_F767_4412_B00B_236E3562B214__INCLUDED_) -#define AFX_REGTASK_H__28D3BD27_F767_4412_B00B_236E3562B214__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -class CRegTaskManager; - -class CRegTask -{ -protected: - CRegTaskManager *m_pTaskMgr; - CString m_szDesc; - -public: - static HRESULT PopulateTasks(CRegTaskManager &cMgr); - -public: - CRegTask(); - CRegTask(CRegTaskManager *pMgr); - virtual ~CRegTask(); - - CString GetDescription() - { - return m_szDesc; - } - - virtual HRESULT DoTask() = 0; -}; - -#endif // !defined(AFX_REGTASK_H__28D3BD27_F767_4412_B00B_236E3562B214__INCLUDED_) diff --git a/embedding/browser/activex/tests/RegMozCtl/RegTaskManager.cpp b/embedding/browser/activex/tests/RegMozCtl/RegTaskManager.cpp deleted file mode 100644 index c010841a1da..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/RegTaskManager.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// RegTaskManager.cpp: implementation of the CRegTaskManager class. -// -////////////////////////////////////////////////////////////////////// - -#include "stdafx.h" -#include "regmozctl.h" -#include "RegTaskManager.h" - -#include -#include - -#ifdef _DEBUG -#undef THIS_FILE -static char THIS_FILE[]=__FILE__; -#define new DEBUG_NEW -#endif - - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CRegTaskManager::CRegTaskManager() -{ - m_bNeedReboot = FALSE; -} - -CRegTaskManager::~CRegTaskManager() -{ - -} - -void CRegTaskManager::SetNeedReboot() -{ - m_bNeedReboot = TRUE; -} - -void CRegTaskManager::AddTask(CRegTask *pTask) -{ - m_cTasks.push_back(pTask); -} - - -void CRegTaskManager::SetValue(const TCHAR *szName, const TCHAR *szValue) -{ - if (_tcscmp(szName, c_szValueBinDirPath) == 0) - { - m_szBinDirPath = szValue; - } -} - -void CRegTaskManager::GetValue(const TCHAR *szName, CString &szValue) -{ - if (_tcscmp(szName, c_szValueBinDirPath) == 0) - { - szValue = m_szBinDirPath; - } -} diff --git a/embedding/browser/activex/tests/RegMozCtl/RegTaskManager.h b/embedding/browser/activex/tests/RegMozCtl/RegTaskManager.h deleted file mode 100644 index 3e30f1d5fd3..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/RegTaskManager.h +++ /dev/null @@ -1,37 +0,0 @@ -// RegTaskManager.h: interface for the CRegTaskManager class. -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_REGTASKMANAGER_H__516D62F5_00EC_4450_B965_003425CF33E1__INCLUDED_) -#define AFX_REGTASKMANAGER_H__516D62F5_00EC_4450_B965_003425CF33E1__INCLUDED_ - -#include - -#include "RegTask.h" - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -class CRegTaskManager -{ - std::vector m_cTasks; - BOOL m_bNeedReboot; - - CString m_szBinDirPath; - -public: - CRegTaskManager(); - virtual ~CRegTaskManager(); - - void SetValue(const TCHAR *szName, const TCHAR *szValue); - void GetValue(const TCHAR *szName, CString &szValue); - void SetNeedReboot(); - - void AddTask(CRegTask *pTask); - int GetTaskCount() const { return m_cTasks.size(); } - CRegTask *GetTask(int nIndex) { return m_cTasks[nIndex]; } -}; - - -#endif // !defined(AFX_REGTASKMANAGER_H__516D62F5_00EC_4450_B965_003425CF33E1__INCLUDED_) diff --git a/embedding/browser/activex/tests/RegMozCtl/StdAfx.cpp b/embedding/browser/activex/tests/RegMozCtl/StdAfx.cpp deleted file mode 100644 index aeedd8dd8eb..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/StdAfx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// RegMozCtl.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - - - diff --git a/embedding/browser/activex/tests/RegMozCtl/StdAfx.h b/embedding/browser/activex/tests/RegMozCtl/StdAfx.h deleted file mode 100644 index d568d24e0f5..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/StdAfx.h +++ /dev/null @@ -1,30 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__C7C0A78A_F424_11D2_A27B_000000000000__INCLUDED_) -#define AFX_STDAFX_H__C7C0A78A_F424_11D2_A27B_000000000000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -#include // MFC core and standard components -#include // MFC extensions -#include // MFC Automation classes -#include // MFC support for Internet Explorer 4 Common Controls -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT -#include - -#define MOZ_CONTROL_REG_KEY _T("Software\\Mozilla\\") -#define MOZ_CONTROL_REG_VALUE_BIN_DIR_PATH _T("BinDirectoryPath") - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__C7C0A78A_F424_11D2_A27B_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.ico b/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.ico deleted file mode 100644 index 7eef0bcbe65..00000000000 Binary files a/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.rc2 b/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.rc2 deleted file mode 100644 index 57afbe6e741..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// REGMOZCTL.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/embedding/browser/activex/tests/RegMozCtl/resource.h b/embedding/browser/activex/tests/RegMozCtl/resource.h deleted file mode 100644 index 15a4ac1334c..00000000000 --- a/embedding/browser/activex/tests/RegMozCtl/resource.h +++ /dev/null @@ -1,28 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by RegMozCtl.rc -// -#define IDD_REGMOZCTL_DIALOG 102 -#define IDR_MAINFRAME 128 -#define IDI_MOZILLA 130 -#define IDC_REGISTER 1001 -#define IDC_UNREGISTER 1002 -#define IDC_MOZILLADIR 1003 -#define IDC_PICKDIR 1004 -#define IDC_COMPONENTFILE 1005 -#define IDC_PICKCOMPONENTFILE 1006 -#define IDC_COMPONENTPATH 1007 -#define IDC_PICKCOMPONENTPATH 1008 -#define IDC_AUTOMATIC 1009 -#define IDC_TASKLIST 1010 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 131 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1011 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/embedding/browser/activex/tests/cbrowse/CBrowseDlg.cpp b/embedding/browser/activex/tests/cbrowse/CBrowseDlg.cpp deleted file mode 100644 index 780fdd54c93..00000000000 --- a/embedding/browser/activex/tests/cbrowse/CBrowseDlg.cpp +++ /dev/null @@ -1,983 +0,0 @@ -// CBrowseDlg.cpp : implementation file -// - -#include "stdafx.h" - -#include "cbrowse.h" -#include "CBrowseDlg.h" -#include "ControlEventSink.h" -#include "..\..\src\control\DHTMLCmdIds.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -#include -#include -#include - -#include - -#include - -void __cdecl fperr(int sig) -{ - CString sError; - sError.Format("FP Error %08x", sig); - AfxMessageBox(sError); -} - -TCHAR *aURLs[] = -{ - _T("http://whippy/calendar.html"), - _T("http://www.mozilla.org"), - _T("http://www.yahoo.com"), - _T("http://www.netscape.com"), - _T("http://www.microsoft.com") -}; - -CBrowseDlg *CBrowseDlg::m_pBrowseDlg = NULL; - -///////////////////////////////////////////////////////////////////////////// -// CBrowseDlg dialog - -CBrowseDlg::CBrowseDlg(CWnd* pParent /*=NULL*/) - : CDialog(CBrowseDlg::IDD, pParent) -{ - signal(SIGFPE, fperr); - double x = 0.0; - double y = 1.0/x; - - //{{AFX_DATA_INIT(CBrowseDlg) - //}}AFX_DATA_INIT - // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 - m_pBrowseDlg = this; - m_pControlSite = NULL; - m_clsid = CLSID_NULL; - m_bUseCustomPopupMenu = FALSE; - m_bUseCustomDropTarget = FALSE; - m_bEditMode = FALSE; - m_bNewWindow = FALSE; - m_bCanGoBack = FALSE; - m_bCanGoForward = FALSE; -} - -void CBrowseDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CBrowseDlg) - DDX_Control(pDX, IDC_STOP, m_btnStop); - DDX_Control(pDX, IDC_FORWARD, m_btnForward); - DDX_Control(pDX, IDC_BACKWARD, m_btnBack); - DDX_Control(pDX, IDC_URL, m_cmbURLs); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CBrowseDlg, CDialog) - //{{AFX_MSG_MAP(CBrowseDlg) - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - ON_BN_CLICKED(IDC_GO, OnGo) - ON_BN_CLICKED(IDC_BACKWARD, OnBackward) - ON_BN_CLICKED(IDC_FORWARD, OnForward) - ON_WM_CLOSE() - ON_WM_DESTROY() - ON_WM_SIZE() - ON_COMMAND(ID_FILE_EXIT, OnFileExit) - ON_COMMAND(ID_VIEW_GOTO_BACK, OnViewGotoBack) - ON_COMMAND(ID_VIEW_GOTO_FORWARD, OnViewGotoForward) - ON_COMMAND(ID_VIEW_GOTO_HOME, OnViewGotoHome) - ON_COMMAND(ID_EDIT_COPY, OnEditCopy) - ON_COMMAND(ID_EDIT_CUT, OnEditCut) - ON_COMMAND(ID_EDIT_PASTE, OnEditPaste) - ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout) - ON_UPDATE_COMMAND_UI(ID_VIEW_GOTO_BACK, OnUpdateViewGotoBack) - ON_UPDATE_COMMAND_UI(ID_VIEW_GOTO_FORWARD, OnUpdateViewGotoForward) - ON_COMMAND(ID_EDIT_SELECTALL, OnEditSelectAll) - ON_COMMAND(ID_VIEW_REFRESH, OnViewRefresh) - ON_COMMAND(ID_VIEW_VIEWSOURCE, OnViewViewSource) - ON_BN_CLICKED(IDC_STOP, OnStop) - ON_COMMAND(ID_FILE_SAVEAS, OnFileSaveAs) - ON_COMMAND(ID_FILE_PRINT, OnFilePrint) - ON_COMMAND(ID_DEBUG_VISIBLE, OnDebugVisible) - ON_UPDATE_COMMAND_UI(ID_DEBUG_VISIBLE, OnUpdateDebugVisible) - ON_COMMAND(ID_DEBUG_POSTDATATEST, OnDebugPostDataTest) - ON_BN_CLICKED(IDC_RELOAD, OnReload) - ON_COMMAND(ID_VIEW_EDITMODE, OnViewEditmode) - ON_COMMAND(ID_VIEW_OPENLINKSINNEWWINDOWS, OnViewOpenInNewWindow) - ON_UPDATE_COMMAND_UI(ID_VIEW_EDITMODE, OnUpdateViewEditmode) - ON_UPDATE_COMMAND_UI(ID_VIEW_OPENLINKSINNEWWINDOWS, OnUpdateViewOpenInNewWindow) - ON_COMMAND(ID_FILE_PAGESETUP, OnFilePagesetup) - //}}AFX_MSG_MAP - ON_COMMAND(IDB_BOLD, OnEditBold) - ON_COMMAND(IDB_ITALIC, OnEditItalic) - ON_COMMAND(IDB_UNDERLINE, OnEditUnderline) -END_MESSAGE_MAP() - -#define IL_CLOSEDFOLDER 0 -#define IL_OPENFOLDER 1 -#define IL_TEST 2 -#define IL_TESTFAILED 3 -#define IL_TESTPASSED 4 -#define IL_TESTPARTIAL 5 -#define IL_NODE IL_TEST - -///////////////////////////////////////////////////////////////////////////// -// CBrowseDlg message handlers - -BOOL CBrowseDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - CWinApp *pApp = AfxGetApp(); - m_szTestURL = pApp->GetProfileString(SECTION_TEST, KEY_TESTURL, KEY_TESTURL_DEFAULTVALUE); - m_szTestCGI = pApp->GetProfileString(SECTION_TEST, KEY_TESTCGI, KEY_TESTCGI_DEFAULTVALUE); - - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon - - CRect rcTabMarker; - GetDlgItem(IDC_TAB_MARKER)->GetWindowRect(&rcTabMarker); - ScreenToClient(rcTabMarker); - - m_dlgPropSheet.AddPage(&m_TabMessages); - m_dlgPropSheet.AddPage(&m_TabTests); - m_dlgPropSheet.AddPage(&m_TabDOM); - - m_TabMessages.m_pBrowseDlg = this; - m_TabTests.m_pBrowseDlg = this; - m_TabDOM.m_pBrowseDlg = this; - - m_dlgPropSheet.Create(this, WS_CHILD | WS_VISIBLE, 0); - m_dlgPropSheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT); - m_dlgPropSheet.ModifyStyle( 0, WS_TABSTOP ); - m_dlgPropSheet.SetWindowPos( NULL, rcTabMarker.left-7, rcTabMarker.top-7, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE ); - - // Image list - m_cImageList.Create(16, 16, ILC_COLOR | ILC_MASK, 0, 10); - m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CLOSEDFOLDER)); - m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_OPENFOLDER)); - m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_TEST)); - m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_TESTFAILED)); - m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_TESTPASSED)); - m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_TESTPARTIAL)); - - // Set up the editor bar - CRect rcEditBarMarker; - GetDlgItem(IDC_EDITBAR_MARKER)->GetWindowRect(&rcEditBarMarker); - ScreenToClient(rcEditBarMarker); - GetDlgItem(IDC_EDITBAR_MARKER)->DestroyWindow(); - - m_EditBar.Create(this); - m_EditBar.LoadToolBar(IDR_DHTMLEDIT); - m_EditBar.SetWindowPos(&wndTop, rcEditBarMarker.left, rcEditBarMarker.top, - rcEditBarMarker.Width(), rcEditBarMarker.Height(), SWP_SHOWWINDOW); - - // Set up some URLs. The first couple are internal - m_cmbURLs.AddString(m_szTestURL); - for (int i = 0; i < sizeof(aURLs) / sizeof(aURLs[0]); i++) - { - m_cmbURLs.AddString(aURLs[i]); - } - m_cmbURLs.SetCurSel(0); - - // Create the contained web browser - CreateWebBrowser(); - - // Load the menu - m_menu.LoadMenu(IDR_MAIN); - SetMenu(&m_menu); - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); - - return TRUE; // return TRUE unless you set the focus to a control -} - - -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. - -void CBrowseDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CPaintDC dc(this); - - m_pControlSite->Draw(dc.m_hDC); - } -} - -// The system calls this to obtain the cursor to display while the user drags -// the minimized window. -HCURSOR CBrowseDlg::OnQueryDragIcon() -{ - return (HCURSOR) m_hIcon; -} - -struct EnumData -{ - CBrowseDlg *pBrowseDlg; - CSize sizeDelta; -}; - -BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) -{ - EnumData *pData = (EnumData *) lParam; - CBrowseDlg *pThis = pData->pBrowseDlg; - - switch (::GetDlgCtrlID(hwnd)) - { - case IDC_BROWSER_MARKER: - { - CWnd *pMarker = pThis->GetDlgItem(IDC_BROWSER_MARKER); - CRect rcMarker; - pMarker->GetWindowRect(&rcMarker); - pThis->ScreenToClient(rcMarker); - - rcMarker.right += pData->sizeDelta.cx; - rcMarker.bottom += pData->sizeDelta.cy; - - if (rcMarker.Width() > 10 && rcMarker.Height() > 10) - { - pMarker->SetWindowPos(&CWnd::wndBottom, 0, 0, rcMarker.Width(), rcMarker.Height(), - SWP_NOMOVE | SWP_NOACTIVATE | SWP_HIDEWINDOW); - pThis->m_pControlSite->SetPosition(rcMarker); - } - } - break; - case IDC_TAB_MARKER: - { - CWnd *pMarker = pThis->GetDlgItem(IDC_TAB_MARKER); - CRect rcMarker; - pMarker->GetWindowRect(&rcMarker); - pThis->ScreenToClient(rcMarker); - - rcMarker.top += pData->sizeDelta.cy; - - if (rcMarker.top > 70) - { - pMarker->SetWindowPos(&CWnd::wndBottom, rcMarker.left, rcMarker.top, 0, 0, - SWP_NOSIZE | SWP_NOACTIVATE | SWP_HIDEWINDOW); - pThis->m_dlgPropSheet.SetWindowPos(NULL, rcMarker.left - 7, rcMarker.top - 7, 0, 0, - SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOACTIVATE); - } - } - - } - - return TRUE; -} - -void CBrowseDlg::OnSize(UINT nType, int cx, int cy) -{ - CDialog::OnSize(nType, cx, cy); - - if (m_hWnd == NULL) - { - return; - } - - static CSize sizeOld(-1, -1); - CSize sizeNew(cx, cy); - - if (sizeOld.cx != -1) - { - EnumData data; - data.pBrowseDlg = this; - data.sizeDelta = sizeNew - sizeOld; - ::EnumChildWindows(GetSafeHwnd(), EnumChildProc, (LPARAM) &data); - } - sizeOld = sizeNew; -} - -HRESULT CBrowseDlg::CreateWebBrowser() -{ - // Get the position of the browser marker - CRect rcMarker; - GetDlgItem(IDC_BROWSER_MARKER)->GetWindowRect(&rcMarker); - ScreenToClient(rcMarker); - GetDlgItem(IDC_BROWSER_MARKER)->ShowWindow(FALSE); - -// GetDlgItem(IDC_BROWSER_MARKER)->DestroyWindow(); - - CBrowserCtlSiteInstance::CreateInstance(&m_pControlSite); - if (m_pControlSite == NULL) - { - OutputString(_T("Error: could not create control site")); - return E_OUTOFMEMORY; - } - - CBrowseEventSinkInstance *pEventSink = NULL; - CBrowseEventSinkInstance::CreateInstance(&pEventSink); - if (pEventSink == NULL) - { - m_pControlSite->Release(); - m_pControlSite = NULL; - OutputString(_T("Error: could not create event sink")); - return E_OUTOFMEMORY; - } - pEventSink->m_pBrowseDlg = this; - - HRESULT hr; - - PropertyList pl; - m_pControlSite->AddRef(); - m_pControlSite->m_bUseCustomPopupMenu = m_bUseCustomPopupMenu; - m_pControlSite->m_bUseCustomDropTarget = m_bUseCustomDropTarget; - m_pControlSite->Create(m_clsid, pl); - hr = m_pControlSite->Attach(GetSafeHwnd(), rcMarker, NULL); - if (hr != S_OK) - { - OutputString(_T("Error: Cannot attach to browser control, hr = 0x%08x"), hr); - } - else - { - OutputString(_T("Successfully attached to browser control")); - } - - m_pControlSite->SetPosition(rcMarker); - hr = m_pControlSite->Advise(pEventSink, DIID_DWebBrowserEvents2, &m_dwCookie); - if (hr != S_OK) - { - OutputString(_T("Error: Cannot subscribe to DIID_DWebBrowserEvents2 events, hr = 0x%08x"), hr); - } - else - { - OutputString(_T("Successfully subscribed to events")); - } - - CComPtr spUnkBrowser; - m_pControlSite->GetControlUnknown(&spUnkBrowser); - - CIPtr(IWebBrowser2) spWebBrowser = spUnkBrowser; - if (spWebBrowser) - { - spWebBrowser->put_RegisterAsDropTarget(VARIANT_TRUE); - } - - return S_OK; -} - - -HRESULT CBrowseDlg::DestroyWebBrowser() -{ - if (m_pControlSite) - { - m_pControlSite->Unadvise(DIID_DWebBrowserEvents2, m_dwCookie); - m_pControlSite->Detach(); - m_pControlSite->Release(); - m_pControlSite = NULL; - } - - return S_OK; -} - -void CBrowseDlg::PopulateTests() -{ - // Create the test tree - CTreeCtrl &tc = m_TabTests.m_tcTests; - - tc.SetImageList(&m_cImageList, TVSIL_NORMAL); - for (int i = 0; i < nTestSets; i++) - { - TestSet *pTestSet = &aTestSets[i]; - HTREEITEM hParent = tc.InsertItem(pTestSet->szName, IL_CLOSEDFOLDER, IL_CLOSEDFOLDER); - m_TabTests.m_tcTests.SetItemData(hParent, (DWORD) pTestSet); - - if (pTestSet->pfnPopulator) - { - pTestSet->pfnPopulator(pTestSet); - } - - for (int j = 0; j < pTestSet->nTests; j++) - { - Test *pTest = &pTestSet->aTests[j]; - HTREEITEM hTest = tc.InsertItem(pTest->szName, IL_TEST, IL_TEST, hParent); - if (hTest) - { - tc.SetItemData(hTest, (DWORD) pTest); - } - } - } -} - - -void CBrowseDlg::UpdateURL() -{ - CIPtr(IWebBrowser) spBrowser; - - GetWebBrowser(&spBrowser); - if (spBrowser) - { - USES_CONVERSION; - BSTR szLocation = NULL; - spBrowser->get_LocationURL(&szLocation); - m_cmbURLs.SetWindowText(W2T(szLocation)); - SysFreeString(szLocation); - } -} - - -HRESULT CBrowseDlg::GetWebBrowser(IWebBrowser **pWebBrowser) -{ - if (pWebBrowser == NULL) - { - return E_INVALIDARG; - } - - *pWebBrowser = NULL; - - if (m_pControlSite) - { - IUnknown *pIUnkBrowser = NULL; - m_pControlSite->GetControlUnknown(&pIUnkBrowser); - if (pIUnkBrowser) - { - pIUnkBrowser->QueryInterface(IID_IWebBrowser, (void **) pWebBrowser); - pIUnkBrowser->Release(); - if (*pWebBrowser) - { - return S_OK; - } - } - } - - return E_FAIL; -} - -void CBrowseDlg::OnGo() -{ - UpdateData(); - - CComPtr webBrowser; - if (SUCCEEDED(GetWebBrowser(&webBrowser))) - { - CString szURL; - m_cmbURLs.GetWindowText(szURL); - CComVariant vFlags(m_bNewWindow ? navOpenInNewWindow : 0); - BSTR bstrURL = szURL.AllocSysString(); - HRESULT hr = webBrowser->Navigate(bstrURL, &vFlags, NULL, NULL, NULL); - if (FAILED(hr)) - { - OutputString("Navigate failed (hr=0x%08x)", hr); - } - ::SysFreeString(bstrURL); - } -} - - -void CBrowseDlg::OnStop() -{ - CComPtr webBrowser; - if (SUCCEEDED(GetWebBrowser(&webBrowser))) - { - webBrowser->Stop(); - } -} - -void CBrowseDlg::OnReload() -{ - CComPtr webBrowser; - if (SUCCEEDED(GetWebBrowser(&webBrowser))) - { - CComVariant vValue(REFRESH_COMPLETELY); - webBrowser->Refresh2(&vValue); - } -} - -void CBrowseDlg::OnBackward() -{ - CComPtr webBrowser; - if (SUCCEEDED(GetWebBrowser(&webBrowser))) - { - webBrowser->GoBack(); - } -} - -void CBrowseDlg::OnForward() -{ - CComPtr webBrowser; - if (SUCCEEDED(GetWebBrowser(&webBrowser))) - { - webBrowser->GoForward(); - } -} - -void CBrowseDlg::RunTestSet(TestSet *pTestSet) -{ - ASSERT(pTestSet); - if (pTestSet == NULL) - { - return; - } - - for (int j = 0; j < pTestSet->nTests; j++) - { - Test *pTest = &pTestSet->aTests[j]; - RunTest(pTest); - } -} - - -TestResult CBrowseDlg::RunTest(Test *pTest) -{ - ASSERT(pTest); - TestResult nResult = trFailed; - - CString szMsg; - szMsg.Format(_T("Running test \"%s\""), pTest->szName); - OutputString(szMsg); - - if (pTest && pTest->pfn) - { - BrowserInfo cInfo; - - cInfo.pTest = pTest; - cInfo.clsid = m_clsid; - cInfo.pControlSite = m_pControlSite; - cInfo.pIUnknown = NULL; - cInfo.pBrowseDlg = this; - cInfo.szTestURL = m_szTestURL; - cInfo.szTestCGI = m_szTestCGI; - if (cInfo.pControlSite) - { - cInfo.pControlSite->GetControlUnknown(&cInfo.pIUnknown); - } - nResult = pTest->pfn(cInfo); - pTest->nLastResult = nResult; - if (cInfo.pIUnknown) - { - cInfo.pIUnknown->Release(); - } - } - - switch (nResult) - { - case trFailed: - OutputString(_T("Test failed")); - break; - case trPassed: - OutputString(_T("Test passed")); - break; - case trPartial: - OutputString(_T("Test partial")); - break; - default: - break; - } - - return nResult; -} - -void CBrowseDlg::OutputString(const TCHAR *szMessage, ...) -{ - if (m_pBrowseDlg == NULL) - { - return; - } - - TCHAR szBuffer[256]; - - va_list cArgs; - va_start(cArgs, szMessage); - _vstprintf(szBuffer, szMessage, cArgs); - va_end(cArgs); - - CString szOutput; - szOutput.Format(_T("%s"), szBuffer); - - m_TabMessages.m_lbMessages.AddString(szOutput); - m_TabMessages.m_lbMessages.SetTopIndex(m_TabMessages.m_lbMessages.GetCount() - 1); -} - -void CBrowseDlg::UpdateTest(HTREEITEM hItem, TestResult nResult) -{ - if (nResult == trPassed) - { - m_TabTests.m_tcTests.SetItemImage(hItem, IL_TESTPASSED, IL_TESTPASSED); - } - else if (nResult == trFailed) - { - m_TabTests.m_tcTests.SetItemImage(hItem, IL_TESTFAILED, IL_TESTFAILED); - } - else if (nResult == trPartial) - { - m_TabTests.m_tcTests.SetItemImage(hItem, IL_TESTPARTIAL, IL_TESTPARTIAL); - } -} - -void CBrowseDlg::UpdateTestSet(HTREEITEM hItem) -{ - // Examine the results - HTREEITEM hTest = m_TabTests.m_tcTests.GetNextItem(hItem, TVGN_CHILD); - while (hTest) - { - Test *pTest = (Test *) m_TabTests.m_tcTests.GetItemData(hTest); - UpdateTest(hTest, pTest->nLastResult); - hTest = m_TabTests.m_tcTests.GetNextItem(hTest, TVGN_NEXT); - } -} - -void CBrowseDlg::OnRunTest() -{ - HTREEITEM hItem = m_TabTests.m_tcTests.GetNextItem(NULL, TVGN_FIRSTVISIBLE); - while (hItem) - { - UINT nState = m_TabTests.m_tcTests.GetItemState(hItem, TVIS_SELECTED); - if (!(nState & TVIS_SELECTED)) - { - hItem = m_TabTests.m_tcTests.GetNextItem(hItem, TVGN_NEXTVISIBLE); - continue; - } - - if (m_TabTests.m_tcTests.ItemHasChildren(hItem)) - { - // Run complete set of tests - TestSet *pTestSet = (TestSet *) m_TabTests.m_tcTests.GetItemData(hItem); - RunTestSet(pTestSet); - UpdateTestSet(hItem); - } - else - { - // Find the test - Test *pTest = (Test *) m_TabTests.m_tcTests.GetItemData(hItem); - TestResult nResult = RunTest(pTest); - UpdateTest(hItem, nResult); - } - - hItem = m_TabTests.m_tcTests.GetNextItem(hItem, TVGN_NEXTVISIBLE); - } -} - -struct _ElementPos -{ - HTREEITEM m_htiParent; - CIPtr(IHTMLElementCollection) m_cpElementCollection; - int m_nIndex; - - _ElementPos(HTREEITEM htiParent, IHTMLElementCollection *pElementCollection, int nIndex) - { - m_htiParent = htiParent; - m_cpElementCollection = pElementCollection; - m_nIndex = nIndex; - } - _ElementPos() - { - } -}; - -void CBrowseDlg::OnRefreshDOM() -{ - m_TabDOM.m_tcDOM.DeleteAllItems(); - - std::stack<_ElementPos> cStack; - - CComPtr cpUnkPtr; - m_pControlSite->GetControlUnknown(&cpUnkPtr); - CIPtr(IWebBrowserApp) cpWebBrowser = cpUnkPtr; - if (cpWebBrowser == NULL) - { - return; - } - - CIPtr(IDispatch) cpDispDocument; - cpWebBrowser->get_Document(&cpDispDocument); - if (cpDispDocument == NULL) - { - return; - } - - // Recurse the DOM, building a tree - - CIPtr(IHTMLDocument2) cpDocElement = cpDispDocument; - - CIPtr(IHTMLElementCollection) cpColl; - HRESULT hr = cpDocElement->get_all( &cpColl ); - - cStack.push(_ElementPos(NULL, cpColl, 0)); - while (!cStack.empty()) - { - // Pop next position from stack - _ElementPos pos = cStack.top(); - cStack.pop(); - - // Iterate through elemenets in collection - LONG nElements = 0;; - pos.m_cpElementCollection->get_length(&nElements); - for (int i = pos.m_nIndex; i < nElements; i++ ) - { - CComVariant vName(i); - CComVariant vIndex; - CIPtr(IDispatch) cpDisp; - - hr = pos.m_cpElementCollection->item( vName, vIndex, &cpDisp ); - if ( hr != S_OK ) - { - continue; - } - CIPtr(IHTMLElement) cpElem = cpDisp; - if (cpElem == NULL) - { - continue; - } - - // Get tag name - BSTR bstrTagName = NULL; - hr = cpElem->get_tagName(&bstrTagName); - CString szTagName = bstrTagName; - SysFreeString(bstrTagName); - - // Add an icon to the tree - HTREEITEM htiParent = m_TabDOM.m_tcDOM.InsertItem(szTagName, IL_CLOSEDFOLDER, IL_CLOSEDFOLDER, pos.m_htiParent); - - CIPtr(IDispatch) cpDispColl; - hr = cpElem->get_children(&cpDispColl); - if (hr == S_OK) - { - CIPtr(IHTMLElementCollection) cpChildColl = cpDispColl; - cStack.push(_ElementPos(pos.m_htiParent, pos.m_cpElementCollection, pos.m_nIndex + 1)); - cStack.push(_ElementPos(htiParent, cpChildColl, 0)); - break; - } - } - } -} - - -void CBrowseDlg::OnClose() -{ - DestroyWebBrowser(); - DestroyWindow(); -} - - -void CBrowseDlg::OnDestroy() -{ - CDialog::OnDestroy(); - delete this; -} - -void CBrowseDlg::ExecOleCommand(const GUID *pguidGroup, DWORD nCmdId) -{ - CComPtr spUnkBrowser; - m_pControlSite->GetControlUnknown(&spUnkBrowser); - - CIPtr(IOleCommandTarget) spCommandTarget = spUnkBrowser; - if (spCommandTarget) - { - HRESULT hr = spCommandTarget->Exec(&CGID_MSHTML, nCmdId, 0, NULL, NULL); - OutputString(_T("Exec(%d), returned %08x"), (int) nCmdId, hr); - } - else - { - OutputString(_T("Error: Browser does not support IOleCommandTarget")); - } -} - - -void CBrowseDlg::OnEditBold() -{ - ExecOleCommand(&CGID_MSHTML, IDM_BOLD); -} - -void CBrowseDlg::OnEditItalic() -{ - ExecOleCommand(&CGID_MSHTML, IDM_ITALIC); -} - -void CBrowseDlg::OnEditUnderline() -{ - ExecOleCommand(&CGID_MSHTML, IDM_UNDERLINE); -} - -void CBrowseDlg::OnFileExit() -{ - OnClose(); -} - -void CBrowseDlg::OnViewRefresh() -{ - OnReload(); -} - -void CBrowseDlg::OnViewGotoBack() -{ - OnBackward(); -} - -void CBrowseDlg::OnViewGotoForward() -{ - OnForward(); -} - -void CBrowseDlg::OnUpdateViewGotoBack(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_bCanGoBack); -} - -void CBrowseDlg::OnUpdateViewGotoForward(CCmdUI* pCmdUI) -{ - pCmdUI->Enable(m_bCanGoForward); -} - -void CBrowseDlg::OnViewGotoHome() -{ - CComPtr webBrowser; - if (SUCCEEDED(GetWebBrowser(&webBrowser))) - { - webBrowser->GoHome(); - } -} - -void CBrowseDlg::OnEditCopy() -{ - ExecOleCommand(NULL, OLECMDID_COPY); -} - -void CBrowseDlg::OnEditCut() -{ - ExecOleCommand(NULL, OLECMDID_CUT); -} - -void CBrowseDlg::OnEditPaste() -{ - ExecOleCommand(NULL, OLECMDID_PASTE); -} - -void CBrowseDlg::OnEditSelectAll() -{ - ExecOleCommand(NULL, OLECMDID_SELECTALL); -} - -void CBrowseDlg::OnHelpAbout() -{ - AfxMessageBox(_T("CBrowse - Browser Control Test Harness")); -} - -void CBrowseDlg::OnViewViewSource() -{ - ExecOleCommand(&CGID_MSHTML, 3); -} - -void CBrowseDlg::OnFileSaveAs() -{ - ExecOleCommand(NULL, OLECMDID_SAVEAS); -} - -void CBrowseDlg::OnFilePrint() -{ - ExecOleCommand(NULL, OLECMDID_PRINT); -} - -void CBrowseDlg::OnFilePagesetup() -{ - ExecOleCommand(NULL, OLECMDID_PAGESETUP); -} - -void CBrowseDlg::OnDebugVisible() -{ - VARIANT_BOOL visible = VARIANT_TRUE; - CComPtr webBrowser; - if (SUCCEEDED(GetWebBrowser(&webBrowser))) - { - CIPtr(IWebBrowserApp) cpWebBrowser = webBrowser; - cpWebBrowser->get_Visible(&visible); - cpWebBrowser->put_Visible(visible == VARIANT_TRUE ? VARIANT_FALSE : VARIANT_TRUE); - } -} - -void CBrowseDlg::OnUpdateDebugVisible(CCmdUI* pCmdUI) -{ - VARIANT_BOOL visible = VARIANT_TRUE; - CComPtr webBrowser; - if (SUCCEEDED(GetWebBrowser(&webBrowser))) - { - CIPtr(IWebBrowserApp) cpWebBrowser = webBrowser; - cpWebBrowser->get_Visible(&visible); - } - - pCmdUI->SetCheck(visible == VARIANT_TRUE ? 1 : 0); -} - -void CBrowseDlg::OnDebugPostDataTest() -{ - CComPtr webBrowser; - if (SUCCEEDED(GetWebBrowser(&webBrowser))) - { - CIPtr(IWebBrowser2) cpWebBrowser = webBrowser; - - CComVariant vURL(L"http://www.mozilla.org/htdig-cgi/htsearch"); - const char *szPostData="config=htdig&restrict=&exclude=&words=embedding&method=and&format=builtin-long"; - - size_t nSize = strlen(szPostData); - SAFEARRAY *psa = SafeArrayCreateVector(VT_UI1, 0, nSize); - - LPSTR pPostData; - SafeArrayAccessData(psa, (LPVOID*) &pPostData); - memcpy(pPostData, szPostData, nSize); - SafeArrayUnaccessData(psa); - - CComVariant vPostData; - vPostData.vt = VT_ARRAY | VT_UI1; - vPostData.parray = psa; - - CComVariant vHeaders(L"Content-Type: application/x-www-form-urlencoded\r\n"); - - cpWebBrowser->Navigate2( - &vURL, - NULL, // Flags - NULL, // Target - &vPostData, - &vHeaders // Headers - ); - } -} - -void CBrowseDlg::OnViewEditmode() -{ - m_bEditMode = m_bEditMode ? FALSE : TRUE; - DWORD nCmdID = m_bEditMode ? IDM_EDITMODE : IDM_BROWSEMODE; - ExecOleCommand(&CGID_MSHTML, nCmdID); - -// if (m_pControlSite) -// { -// m_pControlSite->SetAmbientUserMode((m_btnEditMode.GetCheck() == 0) ? FALSE : TRUE); -// } -} - -void CBrowseDlg::OnViewOpenInNewWindow() -{ - m_bNewWindow = m_bNewWindow ? FALSE : TRUE; -} - -void CBrowseDlg::OnUpdateViewEditmode(CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck(m_bEditMode ? 1 : 0); -} - -void CBrowseDlg::OnUpdateViewOpenInNewWindow(CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck(1); //m_bNewWindow ? 1 : 0); -} - diff --git a/embedding/browser/activex/tests/cbrowse/CBrowseDlg.h b/embedding/browser/activex/tests/cbrowse/CBrowseDlg.h deleted file mode 100644 index b1148b8f5c8..00000000000 --- a/embedding/browser/activex/tests/cbrowse/CBrowseDlg.h +++ /dev/null @@ -1,127 +0,0 @@ -// CBrowseDlg.h : header file -// - -#if !defined(AFX_CBROWSEDLG_H__5121F5E6_5324_11D2_93E1_000000000000__INCLUDED_) -#define AFX_CBROWSEDLG_H__5121F5E6_5324_11D2_93E1_000000000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#include "TabMessages.h" -#include "TabTests.h" -#include "TabDOM.h" - -///////////////////////////////////////////////////////////////////////////// -// CBrowseDlg dialog - -class CBrowseDlg : public CDialog -{ -// Construction -public: - CBrowserCtlSiteInstance *m_pControlSite; - CLSID m_clsid; - BOOL m_bUseCustomPopupMenu; - BOOL m_bUseCustomDropTarget; - CMenu m_menu; - BOOL m_bNewWindow; - BOOL m_bEditMode; - BOOL m_bCanGoBack; - BOOL m_bCanGoForward; - CBrowseDlg(CWnd* pParent = NULL); // standard constructor - - static CBrowseDlg *m_pBrowseDlg; - - HRESULT CreateWebBrowser(); - HRESULT DestroyWebBrowser(); - HRESULT GetWebBrowser(IWebBrowser **pWebBrowser); - - void RunTestSet(TestSet *pTestSet); - TestResult RunTest(Test *pTest); - void UpdateTest(HTREEITEM hItem, TestResult nResult); - void UpdateTestSet(HTREEITEM hItem); - void UpdateURL(); - void OutputString(const TCHAR *szMessage, ...); - void ExecOleCommand(const GUID *pguidGroup, DWORD nCmdId); - -// Dialog Data - //{{AFX_DATA(CBrowseDlg) - enum { IDD = IDD_CBROWSE_DIALOG }; - CButton m_btnStop; - CButton m_btnForward; - CButton m_btnBack; - CComboBox m_cmbURLs; - //}}AFX_DATA - - CToolBar m_EditBar; - CPropertySheet m_dlgPropSheet; - CTabMessages m_TabMessages; - CTabTests m_TabTests; - CTabDOM m_TabDOM; - CImageList m_cImageList; - - void OnRefreshDOM(); - void OnRunTest(); - void PopulateTests(); - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CBrowseDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - HICON m_hIcon; - CString m_szTestURL; - CString m_szTestCGI; - DWORD m_dwCookie; - - // Generated message map functions - //{{AFX_MSG(CBrowseDlg) - virtual BOOL OnInitDialog(); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - afx_msg void OnGo(); - afx_msg void OnBackward(); - afx_msg void OnForward(); - afx_msg void OnClose(); - afx_msg void OnDestroy(); - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void OnFileExit(); - afx_msg void OnViewGotoBack(); - afx_msg void OnViewGotoForward(); - afx_msg void OnViewGotoHome(); - afx_msg void OnEditCopy(); - afx_msg void OnEditCut(); - afx_msg void OnEditPaste(); - afx_msg void OnHelpAbout(); - afx_msg void OnUpdateViewGotoBack(CCmdUI* pCmdUI); - afx_msg void OnUpdateViewGotoForward(CCmdUI* pCmdUI); - afx_msg void OnEditSelectAll(); - afx_msg void OnViewRefresh(); - afx_msg void OnViewViewSource(); - afx_msg void OnStop(); - afx_msg void OnFileSaveAs(); - afx_msg void OnFilePrint(); - afx_msg void OnDebugVisible(); - afx_msg void OnUpdateDebugVisible(CCmdUI* pCmdUI); - afx_msg void OnDebugPostDataTest(); - afx_msg void OnReload(); - afx_msg void OnViewEditmode(); - afx_msg void OnViewOpenInNewWindow(); - afx_msg void OnUpdateViewEditmode(CCmdUI* pCmdUI); - afx_msg void OnUpdateViewOpenInNewWindow(CCmdUI* pCmdUI); - afx_msg void OnFilePagesetup(); - //}}AFX_MSG - afx_msg void OnEditBold(); - afx_msg void OnEditItalic(); - afx_msg void OnEditUnderline(); - - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_CBROWSEDLG_H__5121F5E6_5324_11D2_93E1_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.cpp b/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.cpp deleted file mode 100644 index ab150087944..00000000000 --- a/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// CBrowserCtlSite.cpp : Implementation of CBrowserCtlSite -#include "stdafx.h" -#include "Cbrowse.h" -#include "CBrowserCtlSite.h" - -#include -#include - -///////////////////////////////////////////////////////////////////////////// -// CBrowserCtlSite - -CBrowserCtlSite::CBrowserCtlSite() -{ - m_bUseCustomPopupMenu = TRUE; - m_bUseCustomDropTarget = FALSE; -} - -static void _InsertMenuItem(HMENU hmenu, int nPos, int nID, const TCHAR *szItemText) -{ - MENUITEMINFO mii; - memset(&mii, 0, sizeof(mii)); - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_TYPE; - mii.fType = MFT_STRING; - mii.fState = MFS_ENABLED; - mii.dwTypeData = (LPTSTR) szItemText; - mii.cch = _tcslen(szItemText); - InsertMenuItem(hmenu, nPos, TRUE, &mii); -} - -static void _InsertMenuSeparator(HMENU hmenu, int nPos) -{ - MENUITEMINFO mii; - memset(&mii, 0, sizeof(mii)); - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_TYPE; - mii.fType = MFT_SEPARATOR; - mii.fState = MFS_ENABLED; - InsertMenuItem(hmenu, nPos, TRUE, &mii); -} - -///////////////////////////////////////////////////////////////////////////// -// IDocHostUIHandler - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::ShowContextMenu(/* [in] */ DWORD dwID, /* [in] */ POINT __RPC_FAR *ppt, /* [in] */ IUnknown __RPC_FAR *pcmdtReserved, /* [in] */ IDispatch __RPC_FAR *pdispReserved) -{ - if (m_bUseCustomPopupMenu) - { - tstring szMenuText(_T("Unknown context")); - HMENU hmenu = CreatePopupMenu(); - _InsertMenuItem(hmenu, 0, 1, _T("CBrowse context popup")); - _InsertMenuSeparator(hmenu, 1); - switch (dwID) - { - case CONTEXT_MENU_DEFAULT: - szMenuText = _T("Default context"); - break; - case CONTEXT_MENU_IMAGE: - szMenuText = _T("Image context"); - break; - case CONTEXT_MENU_CONTROL: - szMenuText = _T("Control context"); - break; - case CONTEXT_MENU_TABLE: - szMenuText = _T("Table context"); - break; - case CONTEXT_MENU_TEXTSELECT: - szMenuText = _T("TextSelect context"); - break; - case CONTEXT_MENU_ANCHOR: - szMenuText = _T("Anchor context"); - break; - case CONTEXT_MENU_UNKNOWN: - szMenuText = _T("Unknown context"); - break; - } - - _InsertMenuItem(hmenu, 2, 2, szMenuText.c_str()); - - POINT pt; - GetCursorPos(&pt); - TrackPopupMenu(hmenu, TPM_RETURNCMD, pt.x, pt.y, 0, AfxGetMainWnd()->GetSafeHwnd(), NULL); - DestroyMenu(hmenu); - return S_OK; - } - return S_FALSE; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::GetHostInfo(/* [out][in] */ DOCHOSTUIINFO __RPC_FAR *pInfo) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::ShowUI(/* [in] */ DWORD dwID, /* [in] */ IOleInPlaceActiveObject __RPC_FAR *pActiveObject, /* [in] */ IOleCommandTarget __RPC_FAR *pCommandTarget, /* [in] */ IOleInPlaceFrame __RPC_FAR *pFrame, /* [in] */ IOleInPlaceUIWindow __RPC_FAR *pDoc) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::HideUI(void) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::UpdateUI(void) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::EnableModeless(/* [in] */ BOOL fEnable) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::OnDocWindowActivate(/* [in] */ BOOL fActivate) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::OnFrameWindowActivate(/* [in] */ BOOL fActivate) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::ResizeBorder(/* [in] */ LPCRECT prcBorder, /* [in] */ IOleInPlaceUIWindow __RPC_FAR *pUIWindow, /* [in] */ BOOL fRameWindow) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::TranslateAccelerator(/* [in] */ LPMSG lpMsg, /* [in] */ const GUID __RPC_FAR *pguidCmdGroup, /* [in] */ DWORD nCmdID) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::GetOptionKeyPath(/* [out] */ LPOLESTR __RPC_FAR *pchKey, /* [in] */ DWORD dw) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::GetDropTarget(/* [in] */ IDropTarget __RPC_FAR *pDropTarget, /* [out] */ IDropTarget __RPC_FAR *__RPC_FAR *ppDropTarget) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::GetExternal(/* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDispatch) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::TranslateUrl(/* [in] */ DWORD dwTranslate, /* [in] */ OLECHAR __RPC_FAR *pchURLIn, /* [out] */ OLECHAR __RPC_FAR *__RPC_FAR *ppchURLOut) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::FilterDataObject(/* [in] */ IDataObject __RPC_FAR *pDO, /* [out] */ IDataObject __RPC_FAR *__RPC_FAR *ppDORet) -{ - return E_NOTIMPL; -} - - -/////////////////////////////////////////////////////////////////////////////// -// IDocHostShowUI - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::ShowMessage(/* [in] */ HWND hwnd, /* [in] */ LPOLESTR lpstrText, /* [in] */ LPOLESTR lpstrCaption, /* [in] */ DWORD dwType, /* [in] */ LPOLESTR lpstrHelpFile, /* [in] */ DWORD dwHelpContext,/* [out] */ LRESULT __RPC_FAR *plResult) -{ - return S_FALSE; -} - -HRESULT STDMETHODCALLTYPE CBrowserCtlSite::ShowHelp(/* [in] */ HWND hwnd, /* [in] */ LPOLESTR pszHelpFile, /* [in] */ UINT uCommand, /* [in] */ DWORD dwData, /* [in] */ POINT ptMouse, /* [out] */ IDispatch __RPC_FAR *pDispatchObjectHit) -{ - return S_FALSE; -} - diff --git a/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.h b/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.h deleted file mode 100644 index f4b911e2fd7..00000000000 --- a/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.h +++ /dev/null @@ -1,56 +0,0 @@ -// CBrowserCtlSite.h : Declaration of the CBrowserCtlSite - -#ifndef __CBROWSERCTLSITE_H_ -#define __CBROWSERCTLSITE_H_ - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CBrowserCtlSite -class ATL_NO_VTABLE CBrowserCtlSite : - public CControlSite, - public IDocHostUIHandler, - public IDocHostShowUI -{ -public: - CBrowserCtlSite(); - -DECLARE_REGISTRY_RESOURCEID(IDR_CBROWSERCTLSITE) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CBrowserCtlSite) - CCONTROLSITE_INTERFACES() - COM_INTERFACE_ENTRY(IDocHostUIHandler) - COM_INTERFACE_ENTRY(IDocHostShowUI) -END_COM_MAP() - - BOOL m_bUseCustomPopupMenu; - BOOL m_bUseCustomDropTarget; - -public: -// IDocHostUIHandler - virtual HRESULT STDMETHODCALLTYPE ShowContextMenu(/* [in] */ DWORD dwID, /* [in] */ POINT __RPC_FAR *ppt, /* [in] */ IUnknown __RPC_FAR *pcmdtReserved, /* [in] */ IDispatch __RPC_FAR *pdispReserved); - virtual HRESULT STDMETHODCALLTYPE GetHostInfo(/* [out][in] */ DOCHOSTUIINFO __RPC_FAR *pInfo); - virtual HRESULT STDMETHODCALLTYPE ShowUI(/* [in] */ DWORD dwID, /* [in] */ IOleInPlaceActiveObject __RPC_FAR *pActiveObject, /* [in] */ IOleCommandTarget __RPC_FAR *pCommandTarget, /* [in] */ IOleInPlaceFrame __RPC_FAR *pFrame, /* [in] */ IOleInPlaceUIWindow __RPC_FAR *pDoc); - virtual HRESULT STDMETHODCALLTYPE HideUI(void); - virtual HRESULT STDMETHODCALLTYPE UpdateUI(void); - virtual HRESULT STDMETHODCALLTYPE EnableModeless(/* [in] */ BOOL fEnable); - virtual HRESULT STDMETHODCALLTYPE OnDocWindowActivate(/* [in] */ BOOL fActivate); - virtual HRESULT STDMETHODCALLTYPE OnFrameWindowActivate(/* [in] */ BOOL fActivate); - virtual HRESULT STDMETHODCALLTYPE ResizeBorder(/* [in] */ LPCRECT prcBorder, /* [in] */ IOleInPlaceUIWindow __RPC_FAR *pUIWindow, /* [in] */ BOOL fRameWindow); - virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(/* [in] */ LPMSG lpMsg, /* [in] */ const GUID __RPC_FAR *pguidCmdGroup, /* [in] */ DWORD nCmdID); - virtual HRESULT STDMETHODCALLTYPE GetOptionKeyPath(/* [out] */ LPOLESTR __RPC_FAR *pchKey, /* [in] */ DWORD dw); - virtual HRESULT STDMETHODCALLTYPE GetDropTarget(/* [in] */ IDropTarget __RPC_FAR *pDropTarget, /* [out] */ IDropTarget __RPC_FAR *__RPC_FAR *ppDropTarget); - virtual HRESULT STDMETHODCALLTYPE GetExternal(/* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDispatch); - virtual HRESULT STDMETHODCALLTYPE TranslateUrl(/* [in] */ DWORD dwTranslate, /* [in] */ OLECHAR __RPC_FAR *pchURLIn, /* [out] */ OLECHAR __RPC_FAR *__RPC_FAR *ppchURLOut); - virtual HRESULT STDMETHODCALLTYPE FilterDataObject(/* [in] */ IDataObject __RPC_FAR *pDO, /* [out] */ IDataObject __RPC_FAR *__RPC_FAR *ppDORet); - -// IDocHostShowUI - virtual HRESULT STDMETHODCALLTYPE ShowMessage(/* [in] */ HWND hwnd, /* [in] */ LPOLESTR lpstrText, /* [in] */ LPOLESTR lpstrCaption, /* [in] */ DWORD dwType, /* [in] */ LPOLESTR lpstrHelpFile, /* [in] */ DWORD dwHelpContext,/* [out] */ LRESULT __RPC_FAR *plResult); - virtual HRESULT STDMETHODCALLTYPE ShowHelp(/* [in] */ HWND hwnd, /* [in] */ LPOLESTR pszHelpFile, /* [in] */ UINT uCommand, /* [in] */ DWORD dwData, /* [in] */ POINT ptMouse, /* [out] */ IDispatch __RPC_FAR *pDispatchObjectHit); -}; - -typedef CComObject CBrowserCtlSiteInstance; - -#endif //__CBROWSERCTLSITE_H_ diff --git a/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.rgs b/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.rgs deleted file mode 100644 index 1e1f11f1d40..00000000000 --- a/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.rgs +++ /dev/null @@ -1,24 +0,0 @@ -HKCR -{ - Cbrowse.CBrowserCtlSite.1 = s 'CBrowserCtlSite Class' - { - CLSID = s '{8EC06081-21DE-11D3-941E-000000000000}' - } - Cbrowse.CBrowserCtlSite = s 'CBrowserCtlSite Class' - { - CLSID = s '{8EC06081-21DE-11D3-941E-000000000000}' - CurVer = s 'Cbrowse.CBrowserCtlSite.1' - } - NoRemove CLSID - { - ForceRemove {8EC06081-21DE-11D3-941E-000000000000} = s 'CBrowserCtlSite Class' - { - ProgID = s 'Cbrowse.CBrowserCtlSite.1' - VersionIndependentProgID = s 'Cbrowse.CBrowserCtlSite' - ForceRemove 'Programmable' - LocalServer32 = s '%MODULE%' - val AppID = s '{5B209214-F756-11D2-A27F-000000000000}' - 'TypeLib' = s '{5B209213-F756-11D2-A27F-000000000000}' - } - } -} diff --git a/embedding/browser/activex/tests/cbrowse/Cbrowse.idl b/embedding/browser/activex/tests/cbrowse/Cbrowse.idl deleted file mode 100644 index e5317514209..00000000000 --- a/embedding/browser/activex/tests/cbrowse/Cbrowse.idl +++ /dev/null @@ -1,64 +0,0 @@ -// Cbrowse.idl : IDL source for Cbrowse.exe - -import "oaidl.idl"; - -typedef enum -{ - trNotRun, - trFailed, - trPassed, - trPartial -} TestResult; - -[ - object, - uuid(95AF1AB1-FA66-11D2-A284-000000000000), - dual, - helpstring("DITestScriptHelper Interface"), - pointer_default(unique) -] -interface DITestScriptHelper : IDispatch -{ - [id(1), helpstring("method OutputString")] HRESULT OutputString(BSTR bstrMessage); - [propget, id(2), helpstring("property WebBrowser")] HRESULT WebBrowser([out, retval] LPDISPATCH *pVal); - [propput, id(3), helpstring("property Result")] HRESULT Result([in] TestResult newVal); - [propget, id(4), helpstring("property TestURL")] HRESULT TestURL([out, retval] BSTR *pVal); - [propget, id(5), helpstring("property TestCGI")] HRESULT TestCGI([out, retval] BSTR *pVal); -}; - -[ - uuid(5B209213-F756-11D2-A27F-000000000000), - version(1.0), - helpstring("Cbrowse 1.0 Type Library") -] -library CbrowseLib -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - [ - uuid(95AF1AB2-FA66-11D2-A284-000000000000), - helpstring("TestScriptHelper Class") - ] - coclass TestScriptHelper - { - [default] interface DITestScriptHelper; - }; - [ - uuid(31204F42-FCE8-11D2-A289-000000000000), - helpstring("ControlEventSink Class") - ] - coclass ControlEventSink - { - [default] interface IDispatch; - }; - [ - uuid(8EC06081-21DE-11D3-941E-000000000000), - helpstring("CBrowserCtlSite Class") - ] - coclass CBrowserCtlSite - { - [default] interface IUnknown; - }; -}; - - \ No newline at end of file diff --git a/embedding/browser/activex/tests/cbrowse/Cbrowse.rgs b/embedding/browser/activex/tests/cbrowse/Cbrowse.rgs deleted file mode 100644 index e3325c9c8e3..00000000000 --- a/embedding/browser/activex/tests/cbrowse/Cbrowse.rgs +++ /dev/null @@ -1,11 +0,0 @@ -HKCR -{ - NoRemove AppID - { - {5B209214-F756-11D2-A27F-000000000000} = s 'Cbrowse' - 'Cbrowse.EXE' - { - val AppID = s {5B209214-F756-11D2-A27F-000000000000} - } - } -} diff --git a/embedding/browser/activex/tests/cbrowse/ControlEventSink.cpp b/embedding/browser/activex/tests/cbrowse/ControlEventSink.cpp deleted file mode 100644 index 1139eaecf5a..00000000000 --- a/embedding/browser/activex/tests/cbrowse/ControlEventSink.cpp +++ /dev/null @@ -1,169 +0,0 @@ -// ControlEventSink.cpp : Implementation of CBrowseEventSink -#include "stdafx.h" -#include "Cbrowse.h" -#include "ControlEventSink.h" - -///////////////////////////////////////////////////////////////////////////// -// CBrowseEventSink - -HRESULT STDMETHODCALLTYPE CBrowseEventSink::GetTypeInfoCount( - /* [out] */ UINT __RPC_FAR *pctinfo) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowseEventSink::GetTypeInfo( - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowseEventSink::GetIDsOfNames( - /* [in] */ REFIID riid, - /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, - /* [in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ DISPID __RPC_FAR *rgDispId) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBrowseEventSink:: Invoke( - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, - /* [out] */ VARIANT __RPC_FAR *pVarResult, - /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, - /* [out] */ UINT __RPC_FAR *puArgErr) -{ - CString szEvent; - - switch (dispIdMember) - { - case 0x66: - { - USES_CONVERSION; - CString szText(OLE2T(pDispParams->rgvarg[0].bstrVal)); - szEvent.Format(_T("StatusTextChange: \"%s\""), szText); - m_pBrowseDlg->m_TabMessages.m_szStatus = szText; - m_pBrowseDlg->m_TabMessages.UpdateData(FALSE); - } - break; - case 0x6c: - { - LONG nProgress = pDispParams->rgvarg[1].lVal; - LONG nProgressMax = pDispParams->rgvarg[0].lVal; - szEvent.Format("ProgressChange(%d of %d)", nProgress, nProgressMax); - CProgressCtrl &pc = m_pBrowseDlg->m_TabMessages.m_pcProgress; - pc.SetRange(0, nProgressMax); - pc.SetPos(nProgress); - } - break; - case 0x69: - { - BOOL enable = pDispParams->rgvarg[0].boolVal == VARIANT_TRUE ? TRUE : FALSE; - LONG commandState = pDispParams->rgvarg[1].lVal; - if (commandState == CSC_NAVIGATEBACK) - { - m_pBrowseDlg->m_bCanGoBack = enable; - m_pBrowseDlg->m_btnBack.EnableWindow(enable); - } - else if (commandState == CSC_NAVIGATEFORWARD) - { - m_pBrowseDlg->m_bCanGoForward = enable; - m_pBrowseDlg->m_btnForward.EnableWindow(enable); - } - szEvent.Format(_T("CommandStateChange(%ld, %d)"), commandState, enable); - } - break; - case 0x6a: - szEvent = _T("DownloadBegin"); - m_pBrowseDlg->m_btnStop.EnableWindow(TRUE); - break; - case 0x68: - szEvent = _T("DownloadComplete"); - m_pBrowseDlg->m_btnStop.EnableWindow(FALSE); - break; - case 0x71: - { - USES_CONVERSION; - CString szText(OLE2T(pDispParams->rgvarg[0].bstrVal)); - szEvent.Format(_T("TitleChange: \"%s\""), szText); - CString szTitle; - szTitle.Format(_T("CBrowse - %s"), szText); - m_pBrowseDlg->SetWindowText(szTitle); - } - break; - case 0x70: - szEvent = _T("PropertyChange"); - break; - case 0xfa: - szEvent = _T("BeforeNavigate2"); - break; - case 0xfb: - { - szEvent = _T("NewWindow2"); - - VARIANTARG *pvars = pDispParams->rgvarg; - CBrowseDlg *pDlg = new CBrowseDlg; - if (pDlg) - { - pDlg->m_clsid = m_pBrowseDlg->m_clsid; - pDlg->Create(IDD_CBROWSE_DIALOG); - - if (pDlg->m_pControlSite) - { - CIUnkPtr spUnkBrowser; - pDlg->m_pControlSite->GetControlUnknown(&spUnkBrowser); - - pvars[0].byref = (void *) VARIANT_FALSE; - spUnkBrowser->QueryInterface(IID_IDispatch, (void **) pvars[1].byref); - } - } - } - break; - case 0xfc: - szEvent = _T("NavigateComplete2"); - break; - case 0x103: - szEvent = _T("DocumentComplete"); - if (m_pBrowseDlg) - { - m_pBrowseDlg->UpdateURL(); - } - break; - case 0xfd: - szEvent = _T("OnQuit"); - break; - case 0xfe: - szEvent = _T("OnVisible"); - break; - case 0xff: - szEvent = _T("OnToolBar"); - break; - case 0x100: - szEvent = _T("OnMenuBar"); - break; - case 0x101: - szEvent = _T("OnStatusBar"); - break; - case 0x102: - szEvent = _T("OnFullScreen"); - break; - case 0x104: - szEvent = _T("OnTheaterMode"); - break; - default: - szEvent.Format(_T("%d"), dispIdMember); - } - - if (m_pBrowseDlg) - { - m_pBrowseDlg->OutputString(_T("Event %s"), szEvent); - } - return S_OK; -} diff --git a/embedding/browser/activex/tests/cbrowse/ControlEventSink.h b/embedding/browser/activex/tests/cbrowse/ControlEventSink.h deleted file mode 100644 index 648c37e4bf1..00000000000 --- a/embedding/browser/activex/tests/cbrowse/ControlEventSink.h +++ /dev/null @@ -1,60 +0,0 @@ -// ControlEventSink.h : Declaration of the CBrowseEventSink - -#ifndef __CONTROLEVENTSINK_H_ -#define __CONTROLEVENTSINK_H_ - -#include "CBrowseDlg.h" -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CBrowseEventSink -class ATL_NO_VTABLE CBrowseEventSink : - public CComObjectRootEx, - public CComCoClass, - public IDispatch -{ -public: - CBrowseEventSink() - { - m_pBrowseDlg = NULL; - } - - CBrowseDlg *m_pBrowseDlg; - -DECLARE_REGISTRY_RESOURCEID(IDR_CONTROLEVENTSINK) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CBrowseEventSink) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents2, IDispatch) -END_COM_MAP() - -// IDispatch -public: - virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount( - /* [out] */ UINT __RPC_FAR *pctinfo); - virtual HRESULT STDMETHODCALLTYPE GetTypeInfo( - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); - virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames( - /* [in] */ REFIID riid, - /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, - /* [in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Invoke( - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, - /* [out] */ VARIANT __RPC_FAR *pVarResult, - /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, - /* [out] */ UINT __RPC_FAR *puArgErr); -}; - -typedef CComObject CBrowseEventSinkInstance; - -#endif //__CONTROLEVENTSINK_H_ diff --git a/embedding/browser/activex/tests/cbrowse/ControlEventSink.rgs b/embedding/browser/activex/tests/cbrowse/ControlEventSink.rgs deleted file mode 100644 index b6504637115..00000000000 --- a/embedding/browser/activex/tests/cbrowse/ControlEventSink.rgs +++ /dev/null @@ -1,24 +0,0 @@ -HKCR -{ - Cbrowse.ControlEventSink.1 = s 'ControlEventSink Class' - { - CLSID = s '{31204F42-FCE8-11D2-A289-000000000000}' - } - Cbrowse.ControlEventSink = s 'ControlEventSink Class' - { - CLSID = s '{31204F42-FCE8-11D2-A289-000000000000}' - CurVer = s 'Cbrowse.ControlEventSink.1' - } - NoRemove CLSID - { - ForceRemove {31204F42-FCE8-11D2-A289-000000000000} = s 'ControlEventSink Class' - { - ProgID = s 'Cbrowse.ControlEventSink.1' - VersionIndependentProgID = s 'Cbrowse.ControlEventSink' - ForceRemove 'Programmable' - LocalServer32 = s '%MODULE%' - val AppID = s '{5B209214-F756-11D2-A27F-000000000000}' - 'TypeLib' = s '{5B209213-F756-11D2-A27F-000000000000}' - } - } -} diff --git a/embedding/browser/activex/tests/cbrowse/EditToolBar.cpp b/embedding/browser/activex/tests/cbrowse/EditToolBar.cpp deleted file mode 100644 index 7bfafcaab42..00000000000 --- a/embedding/browser/activex/tests/cbrowse/EditToolBar.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// EditToolBar.cpp : implementation file -// - -#include "stdafx.h" -#include "cbrowse.h" -#include "EditToolBar.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CEditToolBar - -CEditToolBar::CEditToolBar() -{ -} - -CEditToolBar::~CEditToolBar() -{ -} - - -BEGIN_MESSAGE_MAP(CEditToolBar, CToolBarCtrl) - //{{AFX_MSG_MAP(CEditToolBar) - // NOTE - the ClassWizard will add and remove mapping macros here. - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CEditToolBar message handlers diff --git a/embedding/browser/activex/tests/cbrowse/EditToolBar.h b/embedding/browser/activex/tests/cbrowse/EditToolBar.h deleted file mode 100644 index 06de03dd395..00000000000 --- a/embedding/browser/activex/tests/cbrowse/EditToolBar.h +++ /dev/null @@ -1,48 +0,0 @@ -#if !defined(AFX_EDITTOOLBAR_H__39B3B0A1_5412_11D3_9441_000000000000__INCLUDED_) -#define AFX_EDITTOOLBAR_H__39B3B0A1_5412_11D3_9441_000000000000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 -// EditToolBar.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CEditToolBar window - -class CEditToolBar : public CToolBarCtrl -{ -// Construction -public: - CEditToolBar(); - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CEditToolBar) - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CEditToolBar(); - - // Generated message map functions -protected: - //{{AFX_MSG(CEditToolBar) - // NOTE - the ClassWizard will add and remove member functions here. - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_EDITTOOLBAR_H__39B3B0A1_5412_11D3_9441_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/cbrowse/Html/main.htm b/embedding/browser/activex/tests/cbrowse/Html/main.htm deleted file mode 100644 index 825ae19eb44..00000000000 --- a/embedding/browser/activex/tests/cbrowse/Html/main.htm +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - -This is the main test page for the Mozilla control - - - - -

This is the main test page for the Mozilla control

-

Try out some links:

-

http://www.yahoo.com

-

http://www.netscape.com

-

http://www.excite.com

-

http://www.mozilla.org

-

How about a nice form to test out the PostData value in BeforeNavigate2?

-

Ok then! An Altavista Search -

-
- - - - -
-

 

-

 

- - - - diff --git a/embedding/browser/activex/tests/cbrowse/PickerDlg.cpp b/embedding/browser/activex/tests/cbrowse/PickerDlg.cpp deleted file mode 100644 index 6c0f7d42045..00000000000 --- a/embedding/browser/activex/tests/cbrowse/PickerDlg.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// PickerDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "cbrowse.h" -#include "PickerDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -// CLSIDs for the Mozilla and IE browser controls - -static const CLSID CLSID_Mozilla = -{ 0x1339B54C, 0x3453, 0x11D2, { 0x93, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; - -// XX is a hack to avoid linker errors with some Platform SDKs defining -// a GUID with the same name -static const CLSID CLSID_XXInternetExplorer = -{ 0x8856F961, 0x340A, 0x11D0, { 0xA9, 0x6B, 0x00, 0xC0, 0x4F, 0xD7, 0x05, 0xA2 } }; - -static const CLSID CLSID_MSHTML = -{ 0x2D360200, 0xFFF5, 0x11D1, { 0x8D, 0x03, 0x00, 0xA0, 0xC9, 0x59, 0xBC, 0x0A } }; - -struct BrowserControl -{ - TCHAR *szName; - const CLSID *clsid; -}; - -BrowserControl aControls[] = -{ - { _T("Mozilla Control"), &CLSID_Mozilla }, - { _T("Internet Explorer Control"), &CLSID_XXInternetExplorer } -}; - - -///////////////////////////////////////////////////////////////////////////// -// CPickerDlg dialog - - -CPickerDlg::CPickerDlg(CWnd* pParent /*=NULL*/) - : CDialog(CPickerDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(CPickerDlg) - m_szTestURL = _T(""); - m_szTestCGI = _T(""); - m_bDebugging = FALSE; - m_sDebugFlags = _T(""); - m_bUseCustom = FALSE; - //}}AFX_DATA_INIT - m_clsid = CLSID_NULL; - - CWinApp *pApp = AfxGetApp(); - m_szTestURL = pApp->GetProfileString(SECTION_TEST, KEY_TESTURL, KEY_TESTURL_DEFAULTVALUE); - m_szTestCGI = pApp->GetProfileString(SECTION_TEST, KEY_TESTCGI, KEY_TESTCGI_DEFAULTVALUE); - m_sDebugFlags = _T("NSPR_LOG_MODULES=nsComponentManager:5"); -} - -void CPickerDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPickerDlg) - DDX_Control(pDX, IDC_LISTBROWSER, m_lbPicker); - DDX_Text(pDX, IDC_TESTURL, m_szTestURL); - DDX_Text(pDX, IDC_TESTCGI, m_szTestCGI); - DDX_Check(pDX, IDC_CHECK1, m_bDebugging); - DDX_Text(pDX, IDC_EDIT1, m_sDebugFlags); - DDX_Check(pDX, IDC_OVERRIDE, m_bUseCustom); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CPickerDlg, CDialog) - //{{AFX_MSG_MAP(CPickerDlg) - ON_BN_CLICKED(IDOK, OnOk) - ON_LBN_DBLCLK(IDC_LISTBROWSER, OnDblclkListbrowser) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CPickerDlg message handlers - -BOOL CPickerDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - for (int i = 0; i < sizeof(aControls) / sizeof(aControls[0]); i++) - { - m_lbPicker.AddString(aControls[i].szName); - } - m_lbPicker.SetCurSel(0); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - - -void CPickerDlg::OnOk() -{ - UpdateData(); - - int nItem = m_lbPicker.GetCurSel(); - if (nItem == LB_ERR) - { - AfxMessageBox(IDS_CHOOSEBROWSER); - return; - } - - m_clsid = *aControls[nItem].clsid; - - CWinApp *pApp = AfxGetApp(); - pApp->WriteProfileString(SECTION_TEST, KEY_TESTURL, m_szTestURL); - pApp->WriteProfileString(SECTION_TEST, KEY_TESTCGI, m_szTestCGI); - - if (m_bDebugging) - { - putenv("NSPR_LOG_FILE=.\\mozilla.log"); - putenv(m_sDebugFlags); - } - - EndDialog(IDOK); -} - - -void CPickerDlg::OnDblclkListbrowser() -{ - OnOk(); -} diff --git a/embedding/browser/activex/tests/cbrowse/PickerDlg.h b/embedding/browser/activex/tests/cbrowse/PickerDlg.h deleted file mode 100644 index 36663e2b262..00000000000 --- a/embedding/browser/activex/tests/cbrowse/PickerDlg.h +++ /dev/null @@ -1,54 +0,0 @@ -#if !defined(AFX_PICKERDLG_H__648FC652_D34B_11D2_A255_000000000000__INCLUDED_) -#define AFX_PICKERDLG_H__648FC652_D34B_11D2_A255_000000000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// PickerDlg.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CPickerDlg dialog - -class CPickerDlg : public CDialog -{ -// Construction -public: - CPickerDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CPickerDlg) - enum { IDD = IDD_PICKBROWSER }; - CListBox m_lbPicker; - CString m_szTestURL; - CString m_szTestCGI; - BOOL m_bDebugging; - CString m_sDebugFlags; - BOOL m_bUseCustom; - //}}AFX_DATA - - CLSID m_clsid; - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CPickerDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CPickerDlg) - afx_msg void OnOk(); - virtual BOOL OnInitDialog(); - afx_msg void OnDblclkListbrowser(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_PICKERDLG_H__648FC652_D34B_11D2_A255_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/cbrowse/Scripts/Basic.vbs b/embedding/browser/activex/tests/cbrowse/Scripts/Basic.vbs deleted file mode 100644 index 4b722c11997..00000000000 --- a/embedding/browser/activex/tests/cbrowse/Scripts/Basic.vbs +++ /dev/null @@ -1,4 +0,0 @@ -' A simple test just to prove things are sane - -OutputString "Simple Navigation Test" -WebBrowser.Navigate TestURL diff --git a/embedding/browser/activex/tests/cbrowse/Scripts/NewWindow.vbs b/embedding/browser/activex/tests/cbrowse/Scripts/NewWindow.vbs deleted file mode 100644 index 69e4ddb8068..00000000000 --- a/embedding/browser/activex/tests/cbrowse/Scripts/NewWindow.vbs +++ /dev/null @@ -1,4 +0,0 @@ -' Opens a new window - -OutputString "Navigate in new window" -WebBrowser.Navigate TestURL, 1 diff --git a/embedding/browser/activex/tests/cbrowse/Scripts/Post.vbs b/embedding/browser/activex/tests/cbrowse/Scripts/Post.vbs deleted file mode 100644 index 80d77dcf8c1..00000000000 --- a/embedding/browser/activex/tests/cbrowse/Scripts/Post.vbs +++ /dev/null @@ -1,6 +0,0 @@ -' Opens a URL and POST data - - -sPostData = "name1=value1" -OutputString "CGI script POST test to URL " + TestCGI + sPostData -WebBrowser.Navigate TestCGI, 0, , sPostData diff --git a/embedding/browser/activex/tests/cbrowse/StdAfx.cpp b/embedding/browser/activex/tests/cbrowse/StdAfx.cpp deleted file mode 100644 index d1706d0e211..00000000000 --- a/embedding/browser/activex/tests/cbrowse/StdAfx.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// cbrowse.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -#ifdef _ATL_STATIC_REGISTRY -#include -#endif -#include -#include -#include - diff --git a/embedding/browser/activex/tests/cbrowse/StdAfx.h b/embedding/browser/activex/tests/cbrowse/StdAfx.h deleted file mode 100644 index aa2d85c9b47..00000000000 --- a/embedding/browser/activex/tests/cbrowse/StdAfx.h +++ /dev/null @@ -1,78 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__5121F5E8_5324_11D2_93E1_000000000000__INCLUDED_) -#define AFX_STDAFX_H__5121F5E8_5324_11D2_93E1_000000000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -#include // MFC core and standard components -#include // MFC extensions -#include // MFC OLE automation classes -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - -#define _ATL_APARTMENT_THREADED -#define _ATL_DEBUG_INTERFACES - -// ATL headers -#include - -class CBrowseModule : public CComModule -{ -public: - DWORD dwThreadID; - - LPCTSTR FindOneOf(LPCTSTR p1, LPCTSTR p2); - virtual LONG Unlock(); - virtual LONG Lock(); -}; - -extern CBrowseModule _Module; - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "..\..\src\control\ActiveXTypes.h" -#include "..\..\src\control\BrowserDiagnostics.h" -#include "..\..\src\control\ActiveScriptSite.h" - -#include "..\..\src\common\PropertyList.h" -#include "..\..\src\common\PropertyBag.h" -#include "..\..\src\common\ControlSiteIPFrame.h" -#include "..\..\src\common\ControlSite.h" - -#include "CBrowserCtlSite.h" -#include "Tests.h" - -#define SECTION_TEST _T("Test") -#define KEY_TESTURL _T("TestURL") -#define KEY_TESTCGI _T("TestCGI") -#define KEY_TESTURL_DEFAULTVALUE _T("http://www.mozilla.org") -#define KEY_TESTCGI_DEFAULTVALUE _T("http://www.mozilla.org") - -#define NS_ASSERTION(x,y) -#define TRACE_METHOD(x) - - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__5121F5E8_5324_11D2_93E1_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/cbrowse/TabDOM.cpp b/embedding/browser/activex/tests/cbrowse/TabDOM.cpp deleted file mode 100644 index efd6a25b3e0..00000000000 --- a/embedding/browser/activex/tests/cbrowse/TabDOM.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// TabDOM.cpp : implementation file -// - -#include "stdafx.h" -#include "cbrowse.h" -#include "TabDOM.h" -#include "CBrowseDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CTabDOM property page - -IMPLEMENT_DYNCREATE(CTabDOM, CPropertyPage) - -CTabDOM::CTabDOM() : CPropertyPage(CTabDOM::IDD, CTabDOM::IDD) -{ - //{{AFX_DATA_INIT(CTabDOM) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT -} - - -CTabDOM::~CTabDOM() -{ -} - - -void CTabDOM::DoDataExchange(CDataExchange* pDX) -{ - CPropertyPage::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CTabDOM) - DDX_Control(pDX, IDC_DOMLIST, m_tcDOM); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CTabDOM, CPropertyPage) - //{{AFX_MSG_MAP(CTabDOM) - ON_BN_CLICKED(IDC_REFRESHDOM, OnRefreshDOM) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CTabDOM message handlers - -void CTabDOM::OnRefreshDOM() -{ - if (m_pBrowseDlg) - { - m_pBrowseDlg->OnRefreshDOM(); - } -} - - -BOOL CTabDOM::OnInitDialog() -{ - CPropertyPage::OnInitDialog(); - - // Create the DOM tree - m_tcDOM.SetImageList(&m_pBrowseDlg->m_cImageList, TVSIL_NORMAL); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} diff --git a/embedding/browser/activex/tests/cbrowse/TabDOM.h b/embedding/browser/activex/tests/cbrowse/TabDOM.h deleted file mode 100644 index ed301d22553..00000000000 --- a/embedding/browser/activex/tests/cbrowse/TabDOM.h +++ /dev/null @@ -1,54 +0,0 @@ -#if !defined(AFX_TABDOM_H__5216DE08_12D4_11D3_9407_000000000000__INCLUDED_) -#define AFX_TABDOM_H__5216DE08_12D4_11D3_9407_000000000000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 -// TabDOM.h : header file -// - -class CBrowseDlg; - -///////////////////////////////////////////////////////////////////////////// -// CTabDOM dialog - -class CTabDOM : public CPropertyPage -{ - DECLARE_DYNCREATE(CTabDOM) - -// Construction -public: - CTabDOM(); - ~CTabDOM(); - - CBrowseDlg *m_pBrowseDlg; - -// Dialog Data - //{{AFX_DATA(CTabDOM) - enum { IDD = IDD_TAB_DOM }; - CTreeCtrl m_tcDOM; - //}}AFX_DATA - - -// Overrides - // ClassWizard generate virtual function overrides - //{{AFX_VIRTUAL(CTabDOM) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - // Generated message map functions - //{{AFX_MSG(CTabDOM) - afx_msg void OnRefreshDOM(); - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_TABDOM_H__5216DE08_12D4_11D3_9407_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/cbrowse/TabMessages.cpp b/embedding/browser/activex/tests/cbrowse/TabMessages.cpp deleted file mode 100644 index ae72388141b..00000000000 --- a/embedding/browser/activex/tests/cbrowse/TabMessages.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// TabMessages.cpp : implementation file -// - -#include "stdafx.h" -#include "cbrowse.h" -#include "TabMessages.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CTabMessages property page - -IMPLEMENT_DYNCREATE(CTabMessages, CPropertyPage) - -CTabMessages::CTabMessages() : CPropertyPage(CTabMessages::IDD, CTabMessages::IDD) -{ - //{{AFX_DATA_INIT(CTabMessages) - m_szStatus = _T(""); - //}}AFX_DATA_INIT -} - - -CTabMessages::~CTabMessages() -{ -} - - -void CTabMessages::DoDataExchange(CDataExchange* pDX) -{ - CPropertyPage::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CTabMessages) - DDX_Control(pDX, IDC_PROGRESS, m_pcProgress); - DDX_Control(pDX, IDC_OUTPUT, m_lbMessages); - DDX_Text(pDX, IDC_STATUS, m_szStatus); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CTabMessages, CPropertyPage) - //{{AFX_MSG_MAP(CTabMessages) - // NOTE: the ClassWizard will add message map macros here - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CTabMessages message handlers diff --git a/embedding/browser/activex/tests/cbrowse/TabMessages.h b/embedding/browser/activex/tests/cbrowse/TabMessages.h deleted file mode 100644 index 629401ef94a..00000000000 --- a/embedding/browser/activex/tests/cbrowse/TabMessages.h +++ /dev/null @@ -1,55 +0,0 @@ -#if !defined(AFX_TABMESSAGES_H__33D0A350_12E1_11D3_9407_000000000000__INCLUDED_) -#define AFX_TABMESSAGES_H__33D0A350_12E1_11D3_9407_000000000000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 -// TabMessages.h : header file -// - -class CBrowseDlg; - -///////////////////////////////////////////////////////////////////////////// -// CTabMessages dialog - -class CTabMessages : public CPropertyPage -{ - DECLARE_DYNCREATE(CTabMessages) - -// Construction -public: - CTabMessages(); - ~CTabMessages(); - - CBrowseDlg *m_pBrowseDlg; - -// Dialog Data - //{{AFX_DATA(CTabMessages) - enum { IDD = IDD_TAB_MESSAGES }; - CProgressCtrl m_pcProgress; - CListBox m_lbMessages; - CString m_szStatus; - //}}AFX_DATA - - -// Overrides - // ClassWizard generate virtual function overrides - //{{AFX_VIRTUAL(CTabMessages) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - // Generated message map functions - //{{AFX_MSG(CTabMessages) - // NOTE: the ClassWizard will add member functions here - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_TABMESSAGES_H__33D0A350_12E1_11D3_9407_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/cbrowse/TabTests.cpp b/embedding/browser/activex/tests/cbrowse/TabTests.cpp deleted file mode 100644 index 4f1e355075e..00000000000 --- a/embedding/browser/activex/tests/cbrowse/TabTests.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// TabTests.cpp : implementation file -// - -#include "stdafx.h" -#include "cbrowse.h" -#include "TabTests.h" -#include "CBrowseDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CTabTests property page - -IMPLEMENT_DYNCREATE(CTabTests, CPropertyPage) - -CTabTests::CTabTests() : CPropertyPage(CTabTests::IDD, CTabTests::IDD) -{ - //{{AFX_DATA_INIT(CTabTests) - m_szTestDescription = _T(""); - //}}AFX_DATA_INIT -} - - -CTabTests::~CTabTests() -{ -} - - -void CTabTests::DoDataExchange(CDataExchange* pDX) -{ - CPropertyPage::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CTabTests) - DDX_Control(pDX, IDC_RUNTEST, m_btnRunTest); - DDX_Control(pDX, IDC_TESTLIST, m_tcTests); - DDX_Text(pDX, IDC_TESTDESCRIPTION, m_szTestDescription); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CTabTests, CPropertyPage) - //{{AFX_MSG_MAP(CTabTests) - ON_BN_CLICKED(IDC_RUNTEST, OnRunTest) - ON_NOTIFY(TVN_SELCHANGED, IDC_TESTLIST, OnSelchangedTestlist) - ON_NOTIFY(NM_DBLCLK, IDC_TESTLIST, OnDblclkTestlist) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CTabTests message handlers - -void CTabTests::OnRunTest() -{ - m_pBrowseDlg->OnRunTest(); -} - - -void CTabTests::OnSelchangedTestlist(NMHDR* pNMHDR, LRESULT* pResult) -{ - NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; - - BOOL bItemSelected = FALSE; - m_szTestDescription.Empty(); - - HTREEITEM hItem = m_tcTests.GetNextItem(NULL, TVGN_FIRSTVISIBLE); - while (hItem) - { - UINT nState; - - nState = m_tcTests.GetItemState(hItem, TVIS_SELECTED); - if (nState & TVIS_SELECTED) - { - bItemSelected = TRUE; - if (m_tcTests.ItemHasChildren(hItem)) - { - TestSet *pTestSet = (TestSet *) m_tcTests.GetItemData(hItem); - m_szTestDescription = pTestSet->szDesc; - } - else - { - Test *pTest = (Test *) m_tcTests.GetItemData(hItem); - m_szTestDescription = pTest->szDesc; - } - } - - hItem = m_tcTests.GetNextItem(hItem, TVGN_NEXTVISIBLE); - } - - UpdateData(FALSE); - m_btnRunTest.EnableWindow(bItemSelected); - - *pResult = 0; -} - - -void CTabTests::OnDblclkTestlist(NMHDR* pNMHDR, LRESULT* pResult) -{ - OnRunTest(); - *pResult = 0; -} - - -BOOL CTabTests::OnInitDialog() -{ - CPropertyPage::OnInitDialog(); - - m_pBrowseDlg->PopulateTests(); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} diff --git a/embedding/browser/activex/tests/cbrowse/TabTests.h b/embedding/browser/activex/tests/cbrowse/TabTests.h deleted file mode 100644 index 97ad46c87c4..00000000000 --- a/embedding/browser/activex/tests/cbrowse/TabTests.h +++ /dev/null @@ -1,58 +0,0 @@ -#if !defined(AFX_TABTESTS_H__33D0A351_12E1_11D3_9407_000000000000__INCLUDED_) -#define AFX_TABTESTS_H__33D0A351_12E1_11D3_9407_000000000000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 -// TabTests.h : header file -// - -class CBrowseDlg; - -///////////////////////////////////////////////////////////////////////////// -// CTabTests dialog - -class CTabTests : public CPropertyPage -{ - DECLARE_DYNCREATE(CTabTests) - -// Construction -public: - CTabTests(); - ~CTabTests(); - - CBrowseDlg *m_pBrowseDlg; - -// Dialog Data - //{{AFX_DATA(CTabTests) - enum { IDD = IDD_TAB_TESTS }; - CButton m_btnRunTest; - CTreeCtrl m_tcTests; - CString m_szTestDescription; - //}}AFX_DATA - - -// Overrides - // ClassWizard generate virtual function overrides - //{{AFX_VIRTUAL(CTabTests) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - // Generated message map functions - //{{AFX_MSG(CTabTests) - afx_msg void OnRunTest(); - afx_msg void OnSelchangedTestlist(NMHDR* pNMHDR, LRESULT* pResult); - afx_msg void OnDblclkTestlist(NMHDR* pNMHDR, LRESULT* pResult); - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_TABTESTS_H__33D0A351_12E1_11D3_9407_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/cbrowse/TestScriptHelper.cpp b/embedding/browser/activex/tests/cbrowse/TestScriptHelper.cpp deleted file mode 100644 index 0cecabdd2d6..00000000000 --- a/embedding/browser/activex/tests/cbrowse/TestScriptHelper.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// TestScriptHelper.cpp : Implementation of CTestScriptHelper -#include "stdafx.h" -#include "Cbrowse.h" -#include "TestScriptHelper.h" - -///////////////////////////////////////////////////////////////////////////// -// CTestScriptHelper - - -STDMETHODIMP CTestScriptHelper::OutputString(BSTR bstrMessage) -{ - AFX_MANAGE_STATE(AfxGetStaticModuleState()) - - if (bstrMessage == NULL) - { - return E_INVALIDARG; - } - if (m_pBrowserInfo == NULL) - { - return E_UNEXPECTED; - } - - USES_CONVERSION; - m_pBrowserInfo->OutputString(OLE2T(bstrMessage)); - return S_OK; -} - - -STDMETHODIMP CTestScriptHelper::get_WebBrowser(LPDISPATCH *pVal) -{ - AFX_MANAGE_STATE(AfxGetStaticModuleState()) - - if (pVal == NULL) - { - return E_INVALIDARG; - } - - *pVal = NULL; - if (m_pBrowserInfo == NULL) - { - return E_UNEXPECTED; - } - - CIPtr(IWebBrowserApp) spWebBrowserApp; - m_pBrowserInfo->GetWebBrowser(&spWebBrowserApp); - return spWebBrowserApp->QueryInterface(IID_IDispatch, (void **) pVal); -} - - -STDMETHODIMP CTestScriptHelper::put_Result(TestResult newVal) -{ - AFX_MANAGE_STATE(AfxGetStaticModuleState()) - - if (m_pBrowserInfo == NULL) - { - return E_UNEXPECTED; - } - - m_pBrowserInfo->nResult = newVal; - - return S_OK; -} - - -STDMETHODIMP CTestScriptHelper::get_TestURL(BSTR *pVal) -{ - AFX_MANAGE_STATE(AfxGetStaticModuleState()) - - if (pVal == NULL) - { - return E_INVALIDARG; - } - if (m_pBrowserInfo) - { - USES_CONVERSION; - *pVal = SysAllocString(T2OLE(m_pBrowserInfo->szTestURL)); - } - - return S_OK; -} - - -STDMETHODIMP CTestScriptHelper::get_TestCGI(BSTR *pVal) -{ - AFX_MANAGE_STATE(AfxGetStaticModuleState()) - - if (pVal == NULL) - { - return E_INVALIDARG; - } - if (m_pBrowserInfo) - { - USES_CONVERSION; - *pVal = SysAllocString(T2OLE(m_pBrowserInfo->szTestCGI)); - } - - return S_OK; -} diff --git a/embedding/browser/activex/tests/cbrowse/TestScriptHelper.h b/embedding/browser/activex/tests/cbrowse/TestScriptHelper.h deleted file mode 100644 index 8dfffebd791..00000000000 --- a/embedding/browser/activex/tests/cbrowse/TestScriptHelper.h +++ /dev/null @@ -1,43 +0,0 @@ -// TestScriptHelper.h : Declaration of the CTestScriptHelper - -#ifndef __TESTSCRIPTHELPER_H_ -#define __TESTSCRIPTHELPER_H_ - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CTestScriptHelper -class ATL_NO_VTABLE CTestScriptHelper : - public CComObjectRootEx, - public CComCoClass, - public IDispatchImpl -{ -public: - CTestScriptHelper() - { - m_pBrowserInfo = NULL; - } - - BrowserInfo *m_pBrowserInfo; - -DECLARE_REGISTRY_RESOURCEID(IDR_TESTSCRIPTHELPER) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CTestScriptHelper) - COM_INTERFACE_ENTRY(DITestScriptHelper) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - -// DITestScriptHelper -public: - STDMETHOD(get_TestCGI)(/*[out, retval]*/ BSTR *pVal); - STDMETHOD(get_TestURL)(/*[out, retval]*/ BSTR *pVal); - STDMETHOD(put_Result)(/*[in]*/ TestResult newVal); - STDMETHOD(get_WebBrowser)(/*[out, retval]*/ LPDISPATCH *pVal); - STDMETHOD(OutputString)(BSTR bstrMessage); -}; - -typedef CComObject CTestScriptHelperInstance; - -#endif //__TESTSCRIPTHELPER_H_ diff --git a/embedding/browser/activex/tests/cbrowse/TestScriptHelper.rgs b/embedding/browser/activex/tests/cbrowse/TestScriptHelper.rgs deleted file mode 100644 index 591f8eb0bdd..00000000000 --- a/embedding/browser/activex/tests/cbrowse/TestScriptHelper.rgs +++ /dev/null @@ -1,24 +0,0 @@ -HKCR -{ - Cbrowse.TestScriptHelper.1 = s 'TestScriptHelper Class' - { - CLSID = s '{95AF1AB2-FA66-11D2-A284-000000000000}' - } - Cbrowse.TestScriptHelper = s 'TestScriptHelper Class' - { - CLSID = s '{95AF1AB2-FA66-11D2-A284-000000000000}' - CurVer = s 'Cbrowse.TestScriptHelper.1' - } - NoRemove CLSID - { - ForceRemove {95AF1AB2-FA66-11D2-A284-000000000000} = s 'TestScriptHelper Class' - { - ProgID = s 'Cbrowse.TestScriptHelper.1' - VersionIndependentProgID = s 'Cbrowse.TestScriptHelper' - ForceRemove 'Programmable' - LocalServer32 = s '%MODULE%' - val AppID = s '{5B209214-F756-11D2-A27F-000000000000}' - 'TypeLib' = s '{5B209213-F756-11D2-A27F-000000000000}' - } - } -} diff --git a/embedding/browser/activex/tests/cbrowse/Tests.cpp b/embedding/browser/activex/tests/cbrowse/Tests.cpp deleted file mode 100644 index 97eb6d7b6de..00000000000 --- a/embedding/browser/activex/tests/cbrowse/Tests.cpp +++ /dev/null @@ -1,610 +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 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 "stdafx.h" - -#include "resource.h" -#include "Cbrowse.h" -#include "CBrowseDlg.h" -#include "TestScriptHelper.h" - -#define BEGIN_TESTSET() \ - TestSet aTestSets[] = { -#define DECL_SET(name, descr) \ - { _T(#name), _T(descr), sizeof(a##name)/sizeof(a##name[0]), a##name, NULL }, -#define DECL_SET_DYNAMIC(name, descr, pop) \ - { _T(#name), _T(descr), 0, NULL, pop }, -#define END_TESTSET() \ - { NULL, NULL, 0, NULL } }; \ - int nTestSets = sizeof(aTestSets) / sizeof(aTestSets[0]) - 1; - -/////////////////////////////////////////////////////////////////////////////// - -void BrowserInfo::OutputString(const TCHAR *szMessage, ...) -{ - TCHAR szBuffer[256]; - - va_list cArgs; - va_start(cArgs, szMessage); - _vstprintf(szBuffer, szMessage, cArgs); - va_end(cArgs); - - CString szOutput; - szOutput.Format(_T(" Test: %s"), szBuffer); - - pBrowseDlg->OutputString(szOutput); -} - - -HRESULT BrowserInfo::GetWebBrowser(IWebBrowserApp **pWebBrowser) -{ - if (pIUnknown == NULL) - { - return E_FAIL; - } - return pIUnknown->QueryInterface(IID_IWebBrowserApp, (void **) pWebBrowser); -} - - -HRESULT BrowserInfo::GetDocument(IHTMLDocument2 **pDocument) -{ - CIPtr(IWebBrowserApp) cpWebBrowser; - if (FAILED(GetWebBrowser(&cpWebBrowser))) - { - return E_FAIL; - } - - CIPtr(IDispatch) cpDispDocument; - cpWebBrowser->get_Document(&cpDispDocument); - if (cpDispDocument == NULL) - { - return E_FAIL; - } - - return cpDispDocument->QueryInterface(IID_IHTMLDocument2, (void **) pDocument); -} - -/////////////////////////////////////////////////////////////////////////////// - -struct InterfaceInfo -{ - const IID *piid; - const TCHAR *szName; -}; - - -static InterfaceInfo aDocIIDs[] = -{ - { &IID_IOleCommandTarget, _T("IOleCommandTarget") }, - { &IID_IHTMLDocument, _T("IHTMLDocument") }, - { &IID_IHTMLDocument2, _T("IHTMLDocument2") }, - { &IID_IHTMLElementCollection, _T("IHTMLElementCollection") }, - { &IID_IHTMLElement, _T("IHTMLElement") } -}; - - -TestResult __cdecl tstDocument(BrowserInfo &cInfo) -{ - CIPtr(IHTMLDocument2) cpDocElement; - cInfo.GetDocument(&cpDocElement); - if (cpDocElement == NULL) - { - cInfo.OutputString(_T("Error: No document")); - return trFailed; - } - - // Dump out all the interfaces supported by the document element - for (int i = 0; i < sizeof(aDocIIDs) / sizeof(aDocIIDs[0]); i++) - { - IUnknown *pUnkI = NULL; - if (SUCCEEDED(cpDocElement->QueryInterface(*(aDocIIDs[i].piid), (void **) &pUnkI))) - { - cInfo.OutputString(_T("Info: Document supports interface %s"), aDocIIDs[i].szName); - pUnkI->Release(); - } - else - { - cInfo.OutputString(_T("Info: Document doesn't support interface %s"), aDocIIDs[i].szName); - } - } - - return trPassed; -} - - -TestResult __cdecl tstBody(BrowserInfo &cInfo) -{ - CIPtr(IHTMLDocument2) cpDocElement; - cInfo.GetDocument(&cpDocElement); - if (cpDocElement == NULL) - { - cInfo.OutputString(_T("Error: No document")); - return trFailed; - } - - CIPtr(IHTMLElement) cpBody; - cpDocElement->get_body(&cpBody); - if (cpBody == NULL) - { - cInfo.OutputString(_T("Error: No Body")); - return trFailed; - } - - return trPassed; -} - -TestResult __cdecl tstPutInnerHTML(BrowserInfo &cInfo) -{ - CIPtr(IHTMLDocument2) cpDocElement; - cInfo.GetDocument(&cpDocElement); - if (cpDocElement == NULL) - { - cInfo.OutputString(_T("Error: No document")); - return trFailed; - } - - CIPtr(IHTMLElement) cpBody; - cpDocElement->get_body(&cpBody); - if (cpBody == NULL) - { - cInfo.OutputString(_T("Error: No Body")); - return trFailed; - } - - CComBSTR bstr("

Hello world!

Click here to visit our sponsor"); - if (FAILED(cpBody->put_innerHTML(bstr))) - { - cInfo.OutputString(_T("Error: put_innerHTML returned error")); - return trFailed; - } - - return trPassed; -} - -TestResult __cdecl tstGetInnerHTML(BrowserInfo &cInfo) -{ - CIPtr(IHTMLDocument2) cpDocElement; - cInfo.GetDocument(&cpDocElement); - if (cpDocElement == NULL) - { - cInfo.OutputString(_T("Error: No document")); - return trFailed; - } - - CIPtr(IHTMLElement) cpBody; - HRESULT hr = cpDocElement->get_body( &cpBody ); - if (hr == S_OK) - { - CComBSTR html; - if (FAILED(cpBody->get_innerHTML(&html))) - { - cInfo.OutputString(_T("Error: get_innerHTML returned error")); - return trFailed; - } - } - - return trPassed; -} - -TestResult __cdecl tstSetBgColor(BrowserInfo &cInfo) -{ - CIPtr(IHTMLDocument2) cpDocElement; - cInfo.GetDocument(&cpDocElement); - if (cpDocElement == NULL) - { - cInfo.OutputString(_T("Error: No document")); - return trFailed; - } - - CComVariant v("red"); - if (FAILED(cpDocElement->put_bgColor(v))) - { - cInfo.OutputString(_T("Error: put_bgColor returned an error")); - return trFailed; - } - - return trPassed; -} - -TestResult __cdecl tstCollectionEnum(BrowserInfo &cInfo) -{ - CIPtr(IHTMLDocument2) cpDocElement; - cInfo.GetDocument(&cpDocElement); - if (cpDocElement == NULL) - { - cInfo.OutputString(_T("Error: No document")); - return trFailed; - } - - CIPtr(IHTMLElementCollection) cpColl; - HRESULT hr = cpDocElement->get_all( &cpColl ); - if (hr == S_OK) - { - CComPtr cpUnkEnum; - cpColl->get__newEnum(&cpUnkEnum); - if (cpUnkEnum == NULL) - { - cInfo.OutputString(_T("Error: No collection")); - return trFailed; - } - - CIPtr(IEnumVARIANT) cpEnumVARIANT = cpUnkEnum; - if (cpEnumVARIANT) - { - cInfo.OutputString(_T("Collection has IEnumVARIANT")); - } - CIPtr(IEnumUnknown) cpEnumUnknown = cpUnkEnum; - if (cpEnumUnknown) - { - cInfo.OutputString(_T("Collection has IEnumUnknown")); - } - } - else - { - cInfo.OutputString(_T("Error: No collection from document")); - return trFailed; - } - - return trPassed; -} - - -void tstDrillerLevel(BrowserInfo &cInfo, IHTMLElementCollection *pCollection, int nLevel) -{ - if (pCollection == NULL) - { - return; - } - - LONG nElements = 0;; - HRESULT hr = pCollection->get_length( &nElements ); - if (FAILED(hr)) - { - cInfo.OutputString(_T("Error: Collection failed to return number of elements!")); - return; - } - - USES_CONVERSION; - char szLevel[256]; - memset(szLevel, 0, sizeof(szLevel)); - memset(szLevel, ' ', nLevel); - TCHAR *szIndent = A2T(szLevel); - - cInfo.OutputString(_T("%sParsing collection..."), szIndent); - cInfo.OutputString(_T("%sCollection with %d elements"), szIndent, (int) nElements); - - for ( int i=0; i< nElements; i++ ) - { - VARIANT varIndex; - varIndex.vt = VT_UINT; - varIndex.lVal = i; - - VARIANT var2; - VariantInit( &var2 ); - CIPtr(IDispatch) cpDisp; - - hr = pCollection->item( varIndex, var2, &cpDisp ); - if ( hr != S_OK ) - { - continue; - } - - CIPtr(IHTMLElement) cpElem; - - hr = cpDisp->QueryInterface( IID_IHTMLElement, (void **)&cpElem ); - if ( hr == S_OK ) - { - - BSTR bstrTagName = NULL; - hr = cpElem->get_tagName(&bstrTagName); - CString szTagName = bstrTagName; - SysFreeString(bstrTagName); - - BSTR bstrID = NULL; - hr = cpElem->get_id(&bstrID); - CString szID = bstrID; - SysFreeString(bstrID); - - BSTR bstrClassName = NULL; - hr = cpElem->get_className(&bstrClassName); - CString szClassName = bstrClassName; - SysFreeString(bstrClassName); - - cInfo.OutputString(_T("%sElement at %d is %s"), szIndent, i, szTagName); - cInfo.OutputString(_T("%s id=%s"), szIndent, szID); - cInfo.OutputString(_T("%s classname=%s"), szIndent, szClassName); - - CIPtr(IHTMLImgElement) cpImgElem; - hr = cpDisp->QueryInterface( IID_IHTMLImgElement, (void **)&cpImgElem ); - if ( hr == S_OK ) - { -// cpImgElem->get_href(&bstr); - } - else - { - CIPtr(IHTMLAnchorElement) cpAnchElem; - hr = cpDisp->QueryInterface( IID_IHTMLAnchorElement, (void **)&cpAnchElem ); - if ( hr == S_OK ) - { -// cpAnchElem->get_href(&bstr); - } - } - - CIPtr(IDispatch) cpDispColl; - hr = cpElem->get_children(&cpDispColl); - if (hr == S_OK) - { - CIPtr(IHTMLElementCollection) cpColl = cpDispColl; - tstDrillerLevel(cInfo, cpColl, nLevel + 1); - } - } - } - - cInfo.OutputString(_T("%sEnd collection"), szIndent); -} - - -TestResult __cdecl tstDriller(BrowserInfo &cInfo) -{ - CIPtr(IHTMLDocument2) cpDocElement; - cInfo.GetDocument(&cpDocElement); - if (cpDocElement == NULL) - { - cInfo.OutputString(_T("Error: No document")); - return trFailed; - } - - CIPtr(IHTMLElementCollection) cpColl; - HRESULT hr = cpDocElement->get_all( &cpColl ); - if (hr == S_OK) - { - tstDrillerLevel(cInfo, cpColl, 0); - } - - return trPassed; -} - - -TestResult __cdecl tstTesters(BrowserInfo &cInfo) -{ - cInfo.OutputString("Test architecture is reasonably sane!"); - return trPassed; -} - - -TestResult __cdecl tstControlActive(BrowserInfo &cInfo) -{ - CBrowserCtlSiteInstance *pControlSite = cInfo.pControlSite; - if (pControlSite == NULL) - { - cInfo.OutputString(_T("Error: No control site")); - return trFailed; - } - - if (!pControlSite->IsInPlaceActive()) - { - cInfo.OutputString(_T("Error: Control is not in-place active")); - return trFailed; - } - - return trPassed; -} - - -TestResult __cdecl tstIWebBrowser(BrowserInfo &cInfo) -{ - if (cInfo.pIUnknown == NULL) - { - cInfo.OutputString(_T("Error: No control")); - return trFailed; - } - - CIPtr(IWebBrowser) cpIWebBrowser = cInfo.pIUnknown; - if (cpIWebBrowser) - { - return trPassed; - } - - cInfo.OutputString(_T("Error: No IWebBrowser")); - return trFailed; -} - - -TestResult __cdecl tstIWebBrowser2(BrowserInfo &cInfo) -{ - if (cInfo.pIUnknown == NULL) - { - cInfo.OutputString(_T("Error: No control")); - return trFailed; - } - CIPtr(IWebBrowser2) cpIWebBrowser = cInfo.pIUnknown; - if (cpIWebBrowser) - { - return trPassed; - } - - cInfo.OutputString(_T("Error: No IWebBrowser2")); - return trFailed; -} - - -TestResult __cdecl tstIWebBrowserApp(BrowserInfo &cInfo) -{ - if (cInfo.pIUnknown == NULL) - { - cInfo.OutputString(_T("Error: No control")); - return trFailed; - } - - CIPtr(IWebBrowserApp) cpIWebBrowser = cInfo.pIUnknown; - if (cpIWebBrowser) - { - return trPassed; - } - - cInfo.OutputString(_T("Error: No IWebBrowserApp")); - return trFailed; -} - - -TestResult __cdecl tstNavigate2(BrowserInfo &cInfo) -{ - return trFailed; -} - - -TestResult __cdecl tstScriptTest(BrowserInfo &cInfo) -{ - cInfo.nResult = trFailed; - - CTestScriptHelperInstance *pHelper = NULL; - CTestScriptHelperInstance::CreateInstance(&pHelper); - if (pHelper) - { - pHelper->m_pBrowserInfo = &cInfo; - - CActiveScriptSiteInstance *pSite = NULL; - CActiveScriptSiteInstance::CreateInstance(&pSite); - if (pSite) - { - // TODO read from registry - CString szScript; - szScript.Format(_T("Scripts\\%s"), cInfo.pTest->szName); - - pSite->AddRef(); - pSite->AttachVBScript(); - pSite->AddNamedObject(_T("BrowserInfo"), pHelper, TRUE); - pSite->ParseScriptFile(szScript); - pSite->PlayScript(); - pSite->Detach(); - pSite->Release(); - } - } - - return cInfo.nResult; -} - - -Test aScripts[] = -{ - { _T("Script test"), _T("Test that the scripting engine is sane"), tstScriptTest } -}; - - -void __cdecl ScriptSetPopulator(TestSet *pTestSet) -{ - // TODO read from registry - CString szTestDir(_T("Scripts")); - - CStringList cStringList; - CFileFind cFinder; - CString szPattern; - - - szPattern.Format(_T("%s\\*.vbs"), szTestDir); - BOOL bWorking = cFinder.FindFile(szPattern); - while (bWorking) - { - bWorking = cFinder.FindNextFile(); - cStringList.AddTail(cFinder.GetFileName()); - } - - szPattern.Format(_T("%s\\*.js"), szTestDir); - bWorking = cFinder.FindFile(szPattern); - while (bWorking) - { - bWorking = cFinder.FindNextFile(); - cStringList.AddTail(cFinder.GetFileName()); - } - - // Create a set of tests from the scripts found - Test *pTests = (Test *) malloc(sizeof(Test) * cStringList.GetCount()); - for (int i = 0; i < cStringList.GetCount(); i++) - { - CString szScript = cStringList.GetAt(cStringList.FindIndex(i)); - _tcscpy(pTests[i].szName, szScript); - _tcscpy(pTests[i].szDesc, _T("Run the specified script")); - pTests[i].pfn = tstScriptTest; - } - - pTestSet->nTests = cStringList.GetCount(); - pTestSet->aTests = pTests; -} - -/////////////////////////////////////////////////////////////////////////////// - -Test aBasic[] = -{ - { _T("Test Tester"), _T("Ensure that the testing architecture is working"), tstTesters, trNotRun }, - { _T("Control basics"), _T("Ensure that the browser control is active"), tstControlActive, trNotRun }, - { _T("IWebBrowser"), _T("Test if control has an IWebBrowser interface"), tstIWebBrowser, trNotRun }, - { _T("IWebBrowser2"), _T("Test if control has an IWebBrowser2 interface"), tstIWebBrowser2, trNotRun }, - { _T("IWebBrowserApp"), _T("Test if control has an IWebBrowserApp interface"), tstIWebBrowserApp, trNotRun } -}; - - -Test aBrowsing[] = -{ - { _T("IWebBrowser2::Navigate2"), _T("Test if browser can navigate to the test URL"), NULL } -}; - - -Test aDHTML[] = -{ - { _T("IWebBrowser::get_Document"), _T("Test if browser has a top level element"), tstDocument }, - { _T("IHTMLDocument::get_Body"), _T("Test if the body element can be retrieved"), tstBody}, - { _T("IHTMLElement::put_innerHTML"), _T("Test if the innerHTML attribute works"), tstPutInnerHTML }, - { _T("IHTMLElement::get_innerHTML"), _T("Dump the innerHTML for the BODY element"), tstGetInnerHTML }, - { _T("IHTMLElement::put_bgColor"), _T("Set the document background color to red"), tstSetBgColor }, - { _T("IHTMLElementCollection::get__newEnum"), _T("Test if element collections return enumerations"), tstCollectionEnum }, - { _T("Parse DOM"), _T("Parse the document DOM"), tstDriller } -}; - - -Test aOther[] = -{ - { _T("Print Page"), _T("Print the test URL page"), NULL } -}; - -BEGIN_TESTSET() - DECL_SET(Basic, "Basic sanity tests") - DECL_SET(Browsing, "Browsing and navigation tests") - DECL_SET(DHTML, "Test the DOM") - DECL_SET(Other, "Other tests") - DECL_SET_DYNAMIC(Scripts, "Script tests", ScriptSetPopulator) -END_TESTSET() - diff --git a/embedding/browser/activex/tests/cbrowse/Tests.h b/embedding/browser/activex/tests/cbrowse/Tests.h deleted file mode 100644 index 8b25074e6b8..00000000000 --- a/embedding/browser/activex/tests/cbrowse/Tests.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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 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 TESTS_H -#define TESTS_H - -#include "CBrowse_i.h" - -class CBrowseDlg; -struct Test; - -class BrowserInfo -{ -public: - Test *pTest; - TestResult nResult; - CBrowserCtlSiteInstance *pControlSite; - IUnknown *pIUnknown; - CLSID clsid; - CBrowseDlg *pBrowseDlg; - CString szTestURL; - CString szTestCGI; - - void OutputString(const TCHAR *szMessage, ...); - HRESULT GetWebBrowser(IWebBrowserApp **pWebBrowser); - HRESULT GetDocument(IHTMLDocument2 **pDocument); -}; - - -typedef TestResult (__cdecl *TestProc)(BrowserInfo &cInfo); - -struct Test -{ - TCHAR szName[256]; - TCHAR szDesc[256]; - TestProc pfn; - TestResult nLastResult; -}; - -struct TestSet; -typedef void (__cdecl *SetPopulatorProc)(TestSet *pTestSet); - -struct TestSet -{ - TCHAR *szName; - TCHAR *szDesc; - int nTests; - Test *aTests; - SetPopulatorProc pfnPopulator; -}; - -extern TestSet aTestSets[]; -extern int nTestSets; - -#endif \ No newline at end of file diff --git a/embedding/browser/activex/tests/cbrowse/cbrowse.cpp b/embedding/browser/activex/tests/cbrowse/cbrowse.cpp deleted file mode 100644 index 0143114d141..00000000000 --- a/embedding/browser/activex/tests/cbrowse/cbrowse.cpp +++ /dev/null @@ -1,227 +0,0 @@ -// cbrowse.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" -#include "cbrowse.h" -#include "PickerDlg.h" -#include -#include "Cbrowse_i.c" -#include "TestScriptHelper.h" -#include "ControlEventSink.h" -#include "CBrowserCtlSite.h" - - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CBrowseApp - -BEGIN_MESSAGE_MAP(CBrowseApp, CWinApp) - //{{AFX_MSG_MAP(CBrowseApp) - //}}AFX_MSG_MAP - ON_COMMAND(ID_HELP, CWinApp::OnHelp) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CBrowseApp construction - -CBrowseApp::CBrowseApp() -{ - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - -///////////////////////////////////////////////////////////////////////////// -// The one and only CBrowseApp object - -CBrowseApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// CBrowseApp initialization - -BOOL CBrowseApp::InitInstance() -{ - // Initialize OLE libraries - if (!AfxOleInit()) - { - return FALSE; - } -// if (!InitATL()) -// return FALSE; - - AfxEnableControlContainer(); - _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, - REGCLS_MULTIPLEUSE); - - - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need. - -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif - - int nResponse; - - CPickerDlg pickerDlg; - nResponse = pickerDlg.DoModal(); - if (nResponse != IDOK) - { - return FALSE; - } - - m_pDlg = new CBrowseDlg; - m_pDlg->m_clsid = pickerDlg.m_clsid; - m_pDlg->m_bUseCustomDropTarget = pickerDlg.m_bUseCustom; - m_pDlg->m_bUseCustomPopupMenu = pickerDlg.m_bUseCustom; - m_pDlg->Create(IDD_CBROWSE_DIALOG); - m_pMainWnd = m_pDlg; - - // Since the dialog has been closed, return FALSE so that we exit the - // application, rather than start the application's message pump. - return TRUE; -} - -CBrowseModule _Module; - -BEGIN_OBJECT_MAP(ObjectMap) - OBJECT_ENTRY(CLSID_TestScriptHelper, CTestScriptHelper) -// OBJECT_ENTRY(CLSID_ControlEventSink, CControlEventSink) -// OBJECT_ENTRY(CLSID_CBrowserCtlSite, CCBrowserCtlSite) -END_OBJECT_MAP() - -LONG CBrowseModule::Unlock() -{ - AfxOleUnlockApp(); - return 0; -} - -LONG CBrowseModule::Lock() -{ - AfxOleLockApp(); - return 1; -} - -LPCTSTR CBrowseModule::FindOneOf(LPCTSTR p1, LPCTSTR p2) -{ - while (*p1 != NULL) - { - LPCTSTR p = p2; - while (*p != NULL) - { - if (*p1 == *p) - return CharNext(p1); - p = CharNext(p); - } - p1++; - } - return NULL; -} - - -int CBrowseApp::ExitInstance() -{ - if (m_bATLInited) - { - _Module.RevokeClassObjects(); - _Module.Term(); - CoUninitialize(); - } - return CWinApp::ExitInstance(); -} - - -BOOL CBrowseApp::InitATL() -{ - m_bATLInited = TRUE; - - HRESULT hRes; - -#if _WIN32_WINNT >= 0x0400 - // hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED); -#else - // hRes = CoInitialize(NULL); -#endif - if (!AfxOleInit()) - { - return FALSE; - } - - - //if (FAILED(hRes)) - //{ - // m_bATLInited = FALSE; - // return FALSE; - //} - - _Module.Init(ObjectMap, AfxGetInstanceHandle()); - _Module.dwThreadID = GetCurrentThreadId(); - - LPTSTR lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT - TCHAR szTokens[] = _T("-/"); - - BOOL bRun = TRUE; - LPCTSTR lpszToken = _Module.FindOneOf(lpCmdLine, szTokens); - while (lpszToken != NULL) - { - if (lstrcmpi(lpszToken, _T("UnregServer"))==0) - { - _Module.UpdateRegistryFromResource(IDR_CBROWSE, FALSE); - _Module.UnregisterServer(TRUE); //TRUE means typelib is unreg'd - bRun = FALSE; - break; - } - if (lstrcmpi(lpszToken, _T("RegServer"))==0) - { - _Module.UpdateRegistryFromResource(IDR_CBROWSE, TRUE); - _Module.RegisterServer(TRUE); - bRun = FALSE; - break; - } - lpszToken = _Module.FindOneOf(lpszToken, szTokens); - } - - if (!bRun) - { - m_bATLInited = FALSE; - _Module.Term(); - CoUninitialize(); - return FALSE; - } - - hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, - REGCLS_MULTIPLEUSE); - if (FAILED(hRes)) - { - m_bATLInited = FALSE; - CoUninitialize(); - return FALSE; - } - - return TRUE; -} - -int CBrowseApp::Run() -{ - int rv = 1; - try { - rv = CWinApp::Run(); - } - catch (CException *e) - { - ASSERT(0); - } - catch (...) - { - ASSERT(0); - } - return rv; -} diff --git a/embedding/browser/activex/tests/cbrowse/cbrowse.dsp b/embedding/browser/activex/tests/cbrowse/cbrowse.dsp deleted file mode 100644 index 7796bc8703f..00000000000 --- a/embedding/browser/activex/tests/cbrowse/cbrowse.dsp +++ /dev/null @@ -1,331 +0,0 @@ -# Microsoft Developer Studio Project File - Name="cbrowse" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=cbrowse - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "cbrowse.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "cbrowse.mak" CFG="cbrowse - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cbrowse - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "cbrowse - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cbrowse - Win32 Release" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "NDEBUG" /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "cbrowse - Win32 Debug" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /FR /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "_DEBUG" /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "cbrowse - Win32 Release" -# Name "cbrowse - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\src\control\ActiveScriptSite.cpp -# End Source File -# Begin Source File - -SOURCE=.\cbrowse.cpp -# End Source File -# Begin Source File - -SOURCE=.\Cbrowse.idl -# ADD MTL /h "Cbrowse_i.h" /iid "Cbrowse_i.c" /Oicf -# End Source File -# Begin Source File - -SOURCE=.\cbrowse.rc -# End Source File -# Begin Source File - -SOURCE=.\CBrowseDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\CBrowserCtlSite.cpp -# End Source File -# Begin Source File - -SOURCE=.\ControlEventSink.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\src\common\ControlSite.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\src\common\ControlSiteIPFrame.cpp -# End Source File -# Begin Source File - -SOURCE=.\EditToolBar.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\MozActiveX.java -# End Source File -# Begin Source File - -SOURCE=.\PickerDlg.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\src\common\PropertyBag.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# Begin Source File - -SOURCE=.\TabDOM.cpp -# End Source File -# Begin Source File - -SOURCE=.\TabMessages.cpp -# End Source File -# Begin Source File - -SOURCE=.\TabTests.cpp -# End Source File -# Begin Source File - -SOURCE=.\Tests.cpp -# End Source File -# Begin Source File - -SOURCE=.\TestScriptHelper.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\ActiveScriptSite.h -# End Source File -# Begin Source File - -SOURCE=.\cbrowse.h -# End Source File -# Begin Source File - -SOURCE=.\Cbrowse_i.h -# End Source File -# Begin Source File - -SOURCE=.\CBrowseDlg.h -# End Source File -# Begin Source File - -SOURCE=.\CBrowserCtlSite.h -# End Source File -# Begin Source File - -SOURCE=.\ControlEventSink.h -# End Source File -# Begin Source File - -SOURCE=..\..\src\common\ControlSite.h -# End Source File -# Begin Source File - -SOURCE=..\..\src\common\ControlSiteIPFrame.h -# End Source File -# Begin Source File - -SOURCE=.\EditToolBar.h -# End Source File -# Begin Source File - -SOURCE=.\PickerDlg.h -# End Source File -# Begin Source File - -SOURCE=..\..\src\common\PropertyBag.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\TabDOM.h -# End Source File -# Begin Source File - -SOURCE=.\TabMessages.h -# End Source File -# Begin Source File - -SOURCE=.\TabTests.h -# End Source File -# Begin Source File - -SOURCE=.\Tests.h -# End Source File -# Begin Source File - -SOURCE=.\TestScriptHelper.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\res\cbrowse.ico -# End Source File -# Begin Source File - -SOURCE=.\res\cbrowse.rc2 -# End Source File -# Begin Source File - -SOURCE=.\res\closedfolder.ico -# End Source File -# Begin Source File - -SOURCE=.\res\openfold.ico -# End Source File -# Begin Source File - -SOURCE=.\res\openfolder.ico -# End Source File -# Begin Source File - -SOURCE=.\res\test.ico -# End Source File -# Begin Source File - -SOURCE=.\res\testfailed.ico -# End Source File -# Begin Source File - -SOURCE=.\res\testpartial.ico -# End Source File -# Begin Source File - -SOURCE=.\res\testpassed.ico -# End Source File -# Begin Source File - -SOURCE=.\res\toolbar1.bmp -# End Source File -# End Group -# Begin Group "Scripts" - -# PROP Default_Filter "js;vbs" -# Begin Source File - -SOURCE=.\Scripts\Basic.vbs -# End Source File -# Begin Source File - -SOURCE=.\Scripts\NewWindow.vbs -# End Source File -# Begin Source File - -SOURCE=.\Scripts\Post.vbs -# End Source File -# End Group -# Begin Source File - -SOURCE=.\Cbrowse.rgs -# End Source File -# Begin Source File - -SOURCE=.\CBrowserCtlSite.rgs -# End Source File -# Begin Source File - -SOURCE=.\ControlEventSink.rgs -# End Source File -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# Begin Source File - -SOURCE=.\TestScriptHelper.rgs -# End Source File -# End Target -# End Project -# Section cbrowse : {10404710-0021-001E-1B00-1B00EAA80000} -# 1:11:IDR_CBROWSE:103 -# End Section diff --git a/embedding/browser/activex/tests/cbrowse/cbrowse.h b/embedding/browser/activex/tests/cbrowse/cbrowse.h deleted file mode 100644 index 8ee106ad389..00000000000 --- a/embedding/browser/activex/tests/cbrowse/cbrowse.h +++ /dev/null @@ -1,58 +0,0 @@ -// cbrowse.h : main header file for the CBROWSE application -// - -#if !defined(AFX_CBROWSE_H__5121F5E4_5324_11D2_93E1_000000000000__INCLUDED_) -#define AFX_CBROWSE_H__5121F5E4_5324_11D2_93E1_000000000000__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "resource.h" // main symbols -#include "Cbrowse_i.h" -#include "CBrowseDlg.h" - -///////////////////////////////////////////////////////////////////////////// -// CBrowseApp: -// See cbrowse.cpp for the implementation of this class -// - -class CBrowseApp : public CWinApp -{ -public: - CBrowseApp(); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CBrowseApp) - public: - virtual BOOL InitInstance(); - virtual int ExitInstance(); - virtual int Run(); - //}}AFX_VIRTUAL - -// Implementation - - //{{AFX_MSG(CBrowseApp) - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -private: - - CBrowseDlg *m_pDlg; - BOOL m_bATLInited; -private: - BOOL InitATL(); - -}; - - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_CBROWSE_H__5121F5E4_5324_11D2_93E1_000000000000__INCLUDED_) diff --git a/embedding/browser/activex/tests/cbrowse/cbrowse.rc b/embedding/browser/activex/tests/cbrowse/cbrowse.rc deleted file mode 100644 index 6e44669d48c..00000000000 --- a/embedding/browser/activex/tests/cbrowse/cbrowse.rc +++ /dev/null @@ -1,464 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Neutral resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) -#ifdef _WIN32 -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_CLOSEDFOLDER ICON DISCARDABLE "res\\closedfolder.ico" -IDI_OPENFOLDER ICON DISCARDABLE "res\\openfolder.ico" -IDI_TESTPASSED ICON DISCARDABLE "res\\testpassed.ico" -IDI_TESTFAILED ICON DISCARDABLE "res\\testfailed.ico" -IDI_TESTPARTIAL ICON DISCARDABLE "res\\testpartial.ico" -#endif // Neutral resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON DISCARDABLE "res\\cbrowse.ico" - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif\r\n" - "#include ""res\\cbrowse.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_CBROWSE_DIALOG DIALOGEX 0, 0, 558, 349 -STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU | WS_THICKFRAME -EXSTYLE WS_EX_APPWINDOW -CAPTION "CBrowse" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - PUSHBUTTON "<",IDC_BACKWARD,7,7,10,13 - PUSHBUTTON ">",IDC_FORWARD,20,7,10,13 - PUSHBUTTON "Reload",IDC_RELOAD,33,7,30,13 - PUSHBUTTON "&Stop",IDC_STOP,66,7,25,13 - DEFPUSHBUTTON "&Go",IDC_GO,526,7,25,13 - RTEXT "&URL:",IDC_STATIC,94,9,18,8 - COMBOBOX IDC_URL,116,7,405,52,CBS_DROPDOWN | CBS_AUTOHSCROLL | - WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_TAB_MARKER,"Static",SS_BLACKFRAME,7,252,544,89 - CONTROL "",IDC_BROWSER_MARKER,"Static",SS_BLACKFRAME,7,44,544, - 202 - CONTROL "",IDC_EDITBAR_MARKER,"Static",SS_BLACKFRAME,7,23,544,19 -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "cbrowse MFC Application\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "cbrowse\0" - VALUE "LegalCopyright", "Copyright (C) 1998\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "cbrowse.EXE\0" - VALUE "ProductName", "cbrowse Application\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_CBROWSE_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 551 - TOPMARGIN, 7 - BOTTOMMARGIN, 341 - HORZGUIDE, 246 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_CBROWSE REGISTRY DISCARDABLE "Cbrowse.rgs" -IDR_TESTSCRIPTHELPER REGISTRY DISCARDABLE "TestScriptHelper.rgs" -IDR_CONTROLEVENTSINK REGISTRY DISCARDABLE "ControlEventSink.rgs" - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_MAIN MENU DISCARDABLE -BEGIN - POPUP "&File" - BEGIN - MENUITEM "Sa&ve As...", ID_FILE_SAVEAS - MENUITEM SEPARATOR - MENUITEM "Page Setup...", ID_FILE_PAGESETUP - MENUITEM "&Print Page", ID_FILE_PRINT - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_FILE_EXIT - END - POPUP "&Edit" - BEGIN - MENUITEM "Cu&t", ID_EDIT_CUT - MENUITEM "&Copy", ID_EDIT_COPY - MENUITEM "&Paste", ID_EDIT_PASTE - MENUITEM SEPARATOR - MENUITEM "Select &All", ID_EDIT_SELECTALL - END - POPUP "&View" - BEGIN - POPUP "&Go To" - BEGIN - MENUITEM "&Back", ID_VIEW_GOTO_BACK - MENUITEM "&Forward", ID_VIEW_GOTO_FORWARD - MENUITEM SEPARATOR - MENUITEM "&Home Page", ID_VIEW_GOTO_HOME - END - MENUITEM "&Stop", ID_VIEW_STOP - MENUITEM "&Refresh", ID_VIEW_REFRESH - MENUITEM SEPARATOR - MENUITEM "Sour&ce", ID_VIEW_VIEWSOURCE - MENUITEM SEPARATOR - MENUITEM "Edit Mode", ID_VIEW_EDITMODE - MENUITEM "Open Links in New Windows", ID_VIEW_OPENLINKSINNEWWINDOWS - - END - POPUP "&Help" - BEGIN - MENUITEM "&About...", ID_HELP_ABOUT - END - POPUP "&Debug" - BEGIN - MENUITEM "&Visible", ID_DEBUG_VISIBLE - MENUITEM "Post Data Test", ID_DEBUG_POSTDATATEST - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.K.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_TEST ICON DISCARDABLE "res\\test.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_PICKBROWSER DIALOG DISCARDABLE 0, 0, 284, 232 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Welcome to CBrowse!" -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "This is a browser/test application written in MFC that exercises the IE browser interface of the control that you choose from the list below.", - IDC_STATIC,7,7,213,27 - LTEXT "Whatever control you choose, the exact same code is run upon it. Discrepancies in behaviour or test results may indicate a bug!", - IDC_STATIC,7,33,213,20 - LTEXT "Pick the browser to test:",IDC_STATIC,7,56,77,8 - LISTBOX IDC_LISTBROWSER,7,65,213,50,LBS_NOINTEGRALHEIGHT | - WS_VSCROLL | WS_TABSTOP - LTEXT "Some of the tests require a test URL. You may change the default one if you want. Ensure that the URL is valid otherwise the tests might fail!", - IDC_STATIC,7,120,213,18 - EDITTEXT IDC_TESTURL,7,138,213,13,ES_AUTOHSCROLL - LTEXT "Some tests also need a CGI URL, enter that here:", - IDC_STATIC,7,157,157,8 - EDITTEXT IDC_TESTCGI,7,167,213,13,ES_AUTOHSCROLL - CONTROL "Override default drop target and popup menus", - IDC_OVERRIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,185, - 207,10 - CONTROL "Turn on Mozilla debugging (creates a mozilla.log file)", - IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,197, - 172,10 - EDITTEXT IDC_EDIT1,7,210,213,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",IDOK,227,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,227,24,50,14 -END - -IDD_TAB_MESSAGES DIALOG DISCARDABLE 0, 0, 275, 75 -STYLE WS_CHILD | WS_VISIBLE -FONT 8, "MS Sans Serif" -BEGIN - LISTBOX IDC_OUTPUT,5,5,265,50,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | - WS_TABSTOP - LTEXT "Static",IDC_STATUS,5,59,197,11,SS_SUNKEN - CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER, - 205,59,65,11 -END - -IDD_TAB_TESTS DIALOG DISCARDABLE 0, 0, 275, 75 -STYLE WS_CHILD | WS_VISIBLE -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "Run",IDC_RUNTEST,212,56,50,14,WS_DISABLED - CONTROL "Tree1",IDC_TESTLIST,"SysTreeView32",TVS_HASBUTTONS | - TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | - TVS_TRACKSELECT | WS_BORDER | WS_TABSTOP,5,5,196,65 - GROUPBOX "Test Description",IDC_STATIC,203,5,66,47 - LTEXT "",IDC_TESTDESCRIPTION,208,15,56,32 -END - -IDD_TAB_DOM DIALOG DISCARDABLE 0, 0, 275, 80 -STYLE WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "Tree1",IDC_DOMLIST,"SysTreeView32",TVS_HASBUTTONS | - TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | - TVS_TRACKSELECT | WS_BORDER | WS_TABSTOP,5,5,212,70 - PUSHBUTTON "Refresh",IDC_REFRESHDOM,220,5,50,14 - PUSHBUTTON "&Delete",IDC_BUTTON1,220,61,50,14,WS_DISABLED -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_PICKBROWSER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 277 - TOPMARGIN, 7 - BOTTOMMARGIN, 225 - END - - IDD_TAB_MESSAGES, DIALOG - BEGIN - LEFTMARGIN, 5 - RIGHTMARGIN, 270 - TOPMARGIN, 5 - BOTTOMMARGIN, 70 - END - - IDD_TAB_TESTS, DIALOG - BEGIN - LEFTMARGIN, 5 - RIGHTMARGIN, 270 - TOPMARGIN, 5 - BOTTOMMARGIN, 70 - END - - IDD_TAB_DOM, DIALOG - BEGIN - LEFTMARGIN, 5 - RIGHTMARGIN, 270 - TOPMARGIN, 5 - BOTTOMMARGIN, 75 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_CBROWSERCTLSITE REGISTRY DISCARDABLE "CBrowserCtlSite.rgs" - -///////////////////////////////////////////////////////////////////////////// -// -// Toolbar -// - -IDR_DHTMLEDIT TOOLBAR DISCARDABLE 16, 15 -BEGIN - BUTTON IDB_BOLD - BUTTON IDB_ITALIC - BUTTON IDB_UNDERLINE - SEPARATOR - BUTTON IDB_H1 - BUTTON IDB_H2 - BUTTON IDB_PARAGRAPH - SEPARATOR - BUTTON ID_ORDEREDLIST - BUTTON IDB_UNORDEREDLIST -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDR_DHTMLEDIT BITMAP DISCARDABLE "res\\toolbar1.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_CHOOSEBROWSER "You must choose a browser control from the list to proceed." -END - -STRINGTABLE DISCARDABLE -BEGIN - IDD_TAB_MESSAGES "Messages" - IDD_TAB_TESTS "Tests" - IDD_TAB_DOM "DOM" -END - -STRINGTABLE DISCARDABLE -BEGIN - IDB_BOLD "Bold" - IDB_ITALIC "Italic" - IDB_UNDERLINE "Underline" -END - -#endif // English (U.K.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif -#include "res\cbrowse.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/embedding/browser/activex/tests/cbrowse/cbrowse.sln b/embedding/browser/activex/tests/cbrowse/cbrowse.sln deleted file mode 100644 index 2decf7be3d5..00000000000 --- a/embedding/browser/activex/tests/cbrowse/cbrowse.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cbrowse", "cbrowse.vcproj", "{5A3FE53C-9A16-44B8-B942-47E352354280}" -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = Debug - ConfigName.1 = Release - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {5A3FE53C-9A16-44B8-B942-47E352354280}.Debug.ActiveCfg = Debug|Win32 - {5A3FE53C-9A16-44B8-B942-47E352354280}.Debug.Build.0 = Debug|Win32 - {5A3FE53C-9A16-44B8-B942-47E352354280}.Release.ActiveCfg = Release|Win32 - {5A3FE53C-9A16-44B8-B942-47E352354280}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/embedding/browser/activex/tests/cbrowse/res/cbrowse.ico b/embedding/browser/activex/tests/cbrowse/res/cbrowse.ico deleted file mode 100644 index 7eef0bcbe65..00000000000 Binary files a/embedding/browser/activex/tests/cbrowse/res/cbrowse.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/cbrowse/res/cbrowse.rc2 b/embedding/browser/activex/tests/cbrowse/res/cbrowse.rc2 deleted file mode 100644 index 0cbf00b0037..00000000000 --- a/embedding/browser/activex/tests/cbrowse/res/cbrowse.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// CBROWSE.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/embedding/browser/activex/tests/cbrowse/res/closedfolder.ico b/embedding/browser/activex/tests/cbrowse/res/closedfolder.ico deleted file mode 100644 index 387080ef43b..00000000000 Binary files a/embedding/browser/activex/tests/cbrowse/res/closedfolder.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/cbrowse/res/openfolder.ico b/embedding/browser/activex/tests/cbrowse/res/openfolder.ico deleted file mode 100644 index ccd80d5c174..00000000000 Binary files a/embedding/browser/activex/tests/cbrowse/res/openfolder.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/cbrowse/res/test.ico b/embedding/browser/activex/tests/cbrowse/res/test.ico deleted file mode 100644 index abc72557732..00000000000 Binary files a/embedding/browser/activex/tests/cbrowse/res/test.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/cbrowse/res/testfailed.ico b/embedding/browser/activex/tests/cbrowse/res/testfailed.ico deleted file mode 100644 index 9e64c59c106..00000000000 Binary files a/embedding/browser/activex/tests/cbrowse/res/testfailed.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/cbrowse/res/testpartial.ico b/embedding/browser/activex/tests/cbrowse/res/testpartial.ico deleted file mode 100644 index 3cf170115af..00000000000 Binary files a/embedding/browser/activex/tests/cbrowse/res/testpartial.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/cbrowse/res/testpassed.ico b/embedding/browser/activex/tests/cbrowse/res/testpassed.ico deleted file mode 100644 index 410d03ffb4b..00000000000 Binary files a/embedding/browser/activex/tests/cbrowse/res/testpassed.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/cbrowse/res/toolbar1.bmp b/embedding/browser/activex/tests/cbrowse/res/toolbar1.bmp deleted file mode 100644 index 736967c8776..00000000000 Binary files a/embedding/browser/activex/tests/cbrowse/res/toolbar1.bmp and /dev/null differ diff --git a/embedding/browser/activex/tests/cbrowse/resource.h b/embedding/browser/activex/tests/cbrowse/resource.h deleted file mode 100644 index 3796aaf384b..00000000000 --- a/embedding/browser/activex/tests/cbrowse/resource.h +++ /dev/null @@ -1,84 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by cbrowse.rc -// -#define IDS_CHOOSEBROWSER 1 -#define IDD_CBROWSE_DIALOG 102 -#define IDR_CBROWSE 103 -#define IDR_TESTSCRIPTHELPER 104 -#define IDR_CONTROLEVENTSINK 105 -#define IDR_CBROWSERCTLSITE 106 -#define IDR_MAINFRAME 128 -#define IDD_PICKBROWSER 129 -#define IDI_CLOSEDFOLDER 130 -#define IDI_OPENFOLDER 131 -#define IDI_TEST 132 -#define IDI_TESTPASSED 133 -#define IDI_TESTFAILED 134 -#define IDD_TAB_MESSAGES 135 -#define IDD_TAB_TESTS 136 -#define IDD_TAB_DOM 137 -#define IDR_DHTMLEDIT 138 -#define IDI_TESTPARTIAL 140 -#define IDR_MAIN 141 -#define IDC_URL 1000 -#define IDC_GO 1001 -#define IDC_BROWSER_MARKER 1002 -#define IDC_LISTBROWSER 1003 -#define IDC_STOP 1003 -#define IDC_RUNTEST 1004 -#define IDC_LISTMESSAGES 1005 -#define IDC_TESTLIST 1006 -#define IDC_BACKWARD 1008 -#define IDC_FORWARD 1009 -#define IDC_TESTDESCRIPTION 1010 -#define IDC_TESTURL 1011 -#define IDC_DOMLIST 1012 -#define IDC_TESTCGI 1012 -#define IDC_REFRESHDOM 1013 -#define IDC_NEWWINDOW 1014 -#define IDC_OUTPUT 1016 -#define IDC_TAB_MARKER 1017 -#define IDC_STATUS 1019 -#define IDC_PROGRESS 1020 -#define IDC_CHECK1 1021 -#define IDC_EDIT1 1022 -#define IDC_EDITMODE 1023 -#define IDC_EDITBAR_MARKER 1025 -#define IDC_OVERRIDE 1026 -#define IDC_BUTTON1 1027 -#define IDC_RELOAD 1028 -#define IDB_BOLD 32771 -#define IDB_ITALIC 32772 -#define IDB_UNDERLINE 32773 -#define IDB_H1 32774 -#define IDB_H2 32775 -#define IDB_PARAGRAPH 32776 -#define ID_ORDEREDLIST 32777 -#define IDB_UNORDEREDLIST 32778 -#define ID_FILE_EXIT 32779 -#define ID_VIEW_VIEWSOURCE 32783 -#define ID_HELP_ABOUT 32784 -#define ID_VIEW_GOTO_BACK 32786 -#define ID_VIEW_GOTO_FORWARD 32787 -#define ID_VIEW_STOP 32788 -#define ID_VIEW_GOTO_HOME 32789 -#define ID_EDIT_SELECTALL 32790 -#define ID_VIEW_REFRESH 32791 -#define ID_FILE_SAVEAS 32793 -#define ID_DEBUG_VISIBLE 32794 -#define ID_DEBUG_POSTDATATEST 32795 -#define ID_VIEW_EDITMODE 32796 -#define ID_VIEW_OPENLINKSINNEWWINDOWS 32797 -#define ID_FILE_PAGESETUP 32798 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 142 -#define _APS_NEXT_COMMAND_VALUE 32799 -#define _APS_NEXT_CONTROL_VALUE 1029 -#define _APS_NEXT_SYMED_VALUE 107 -#endif -#endif diff --git a/embedding/browser/activex/tests/csbrowse/App.ico b/embedding/browser/activex/tests/csbrowse/App.ico deleted file mode 100644 index 3a5525fd794..00000000000 Binary files a/embedding/browser/activex/tests/csbrowse/App.ico and /dev/null differ diff --git a/embedding/browser/activex/tests/csbrowse/AssemblyInfo.cs b/embedding/browser/activex/tests/csbrowse/AssemblyInfo.cs deleted file mode 100644 index 9f89a3282c5..00000000000 --- a/embedding/browser/activex/tests/csbrowse/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly: AssemblyVersion("1.0.*")] - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyKeyName("")] diff --git a/embedding/browser/activex/tests/csbrowse/CSBrowse.csproj b/embedding/browser/activex/tests/csbrowse/CSBrowse.csproj deleted file mode 100644 index 59f609df76d..00000000000 --- a/embedding/browser/activex/tests/csbrowse/CSBrowse.csproj +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/embedding/browser/activex/tests/csbrowse/CSBrowse.sln b/embedding/browser/activex/tests/csbrowse/CSBrowse.sln deleted file mode 100644 index 3c375d35827..00000000000 --- a/embedding/browser/activex/tests/csbrowse/CSBrowse.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSBrowse", "CSBrowse.csproj", "{41468AF6-24B5-4807-8AF4-7A41FBD2904F}" -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = Debug - ConfigName.1 = Release - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {41468AF6-24B5-4807-8AF4-7A41FBD2904F}.Debug.ActiveCfg = Debug|.NET - {41468AF6-24B5-4807-8AF4-7A41FBD2904F}.Debug.Build.0 = Debug|.NET - {41468AF6-24B5-4807-8AF4-7A41FBD2904F}.Release.ActiveCfg = Release|.NET - {41468AF6-24B5-4807-8AF4-7A41FBD2904F}.Release.Build.0 = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/embedding/browser/activex/tests/csbrowse/Form1.cs b/embedding/browser/activex/tests/csbrowse/Form1.cs deleted file mode 100644 index 0be864db132..00000000000 --- a/embedding/browser/activex/tests/csbrowse/Form1.cs +++ /dev/null @@ -1,444 +0,0 @@ -using System; -using System.Drawing; -using System.Collections; -using System.ComponentModel; -using System.Windows.Forms; -using System.Data; - -namespace CSBrowse -{ - ///

- /// Summary description for Form1. - /// - public class Form1 : System.Windows.Forms.Form - { - private AxMOZILLACONTROLLib.AxMozillaBrowser axMozillaBrowser1; - private System.Windows.Forms.StatusBar statusBar1; - private System.Windows.Forms.Button goBtn; - private System.Windows.Forms.StatusBarPanel statusMessagePane; - private System.Windows.Forms.ToolBar toolBar1; - private System.Windows.Forms.ToolBarButton btnBack; - private System.Windows.Forms.ToolBarButton btnForward; - private System.Windows.Forms.StatusBarPanel statusProgressPane; - private System.Windows.Forms.ImageList imageList1; - private System.Windows.Forms.ToolBarButton btnSep1; - private System.Windows.Forms.ToolBarButton btnStop; - private System.Windows.Forms.ToolBarButton btnReload; - private System.Windows.Forms.ToolBarButton btnHome; - private System.Windows.Forms.MainMenu mainMenu1; - private System.Windows.Forms.MenuItem menuItem1; - private System.Windows.Forms.MenuItem menuExit; - private System.Windows.Forms.MenuItem menuItem2; - private System.Windows.Forms.MenuItem menuAbout; - private System.Windows.Forms.ComboBox url; - private System.Windows.Forms.ToolBarButton btnSep2; - private System.ComponentModel.IContainer components; - - public Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - /// - /// Clean up any resources being used. - /// - protected override void Dispose( bool disposing ) - { - if( disposing ) - { - if (components != null) - { - components.Dispose(); - } - } - base.Dispose( disposing ); - } - - #region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); - this.axMozillaBrowser1 = new AxMOZILLACONTROLLib.AxMozillaBrowser(); - this.goBtn = new System.Windows.Forms.Button(); - this.statusBar1 = new System.Windows.Forms.StatusBar(); - this.statusMessagePane = new System.Windows.Forms.StatusBarPanel(); - this.statusProgressPane = new System.Windows.Forms.StatusBarPanel(); - this.toolBar1 = new System.Windows.Forms.ToolBar(); - this.btnBack = new System.Windows.Forms.ToolBarButton(); - this.btnForward = new System.Windows.Forms.ToolBarButton(); - this.btnSep1 = new System.Windows.Forms.ToolBarButton(); - this.btnStop = new System.Windows.Forms.ToolBarButton(); - this.btnReload = new System.Windows.Forms.ToolBarButton(); - this.btnHome = new System.Windows.Forms.ToolBarButton(); - this.imageList1 = new System.Windows.Forms.ImageList(this.components); - this.mainMenu1 = new System.Windows.Forms.MainMenu(); - this.menuItem1 = new System.Windows.Forms.MenuItem(); - this.menuExit = new System.Windows.Forms.MenuItem(); - this.menuItem2 = new System.Windows.Forms.MenuItem(); - this.menuAbout = new System.Windows.Forms.MenuItem(); - this.url = new System.Windows.Forms.ComboBox(); - this.btnSep2 = new System.Windows.Forms.ToolBarButton(); - ((System.ComponentModel.ISupportInitialize)(this.axMozillaBrowser1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.statusMessagePane)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.statusProgressPane)).BeginInit(); - this.SuspendLayout(); - // - // axMozillaBrowser1 - // - this.axMozillaBrowser1.Enabled = true; - this.axMozillaBrowser1.Location = new System.Drawing.Point(24, 112); - this.axMozillaBrowser1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axMozillaBrowser1.OcxState"))); - this.axMozillaBrowser1.Size = new System.Drawing.Size(640, 400); - this.axMozillaBrowser1.TabIndex = 3; - this.axMozillaBrowser1.DownloadComplete += new System.EventHandler(this.axMozillaBrowser1_DownloadComplete); - this.axMozillaBrowser1.StatusTextChange += new AxMOZILLACONTROLLib.DWebBrowserEvents2_StatusTextChangeEventHandler(this.axMozillaBrowser1_StatusTextChange); - this.axMozillaBrowser1.NavigateComplete2 += new AxMOZILLACONTROLLib.DWebBrowserEvents2_NavigateComplete2EventHandler(this.axMozillaBrowser1_NavigateComplete2); - this.axMozillaBrowser1.CommandStateChange += new AxMOZILLACONTROLLib.DWebBrowserEvents2_CommandStateChangeEventHandler(this.axMozillaBrowser1_CommandStateChange); - this.axMozillaBrowser1.LocationChanged += new System.EventHandler(this.axMozillaBrowser1_LocationChanged); - this.axMozillaBrowser1.BeforeNavigate2 += new AxMOZILLACONTROLLib.DWebBrowserEvents2_BeforeNavigate2EventHandler(this.axMozillaBrowser1_BeforeNavigate2); - this.axMozillaBrowser1.NewWindow2 += new AxMOZILLACONTROLLib.DWebBrowserEvents2_NewWindow2EventHandler(this.axMozillaBrowser1_NewWindow2); - this.axMozillaBrowser1.DownloadBegin += new System.EventHandler(this.axMozillaBrowser1_DownloadBegin); - // - // goBtn - // - this.goBtn.Location = new System.Drawing.Point(616, 72); - this.goBtn.Name = "goBtn"; - this.goBtn.Size = new System.Drawing.Size(48, 21); - this.goBtn.TabIndex = 4; - this.goBtn.Text = "Go"; - this.goBtn.Click += new System.EventHandler(this.button1_Click); - // - // statusBar1 - // - this.statusBar1.Location = new System.Drawing.Point(0, 539); - this.statusBar1.Name = "statusBar1"; - this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { - this.statusMessagePane, - this.statusProgressPane}); - this.statusBar1.ShowPanels = true; - this.statusBar1.Size = new System.Drawing.Size(696, 22); - this.statusBar1.TabIndex = 5; - this.statusBar1.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar1_PanelClick); - this.statusBar1.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar1_DrawItem); - // - // statusMessagePane - // - this.statusMessagePane.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; - this.statusMessagePane.BorderStyle = System.Windows.Forms.StatusBarPanelBorderStyle.None; - this.statusMessagePane.Width = 580; - // - // statusProgressPane - // - this.statusProgressPane.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; - this.statusProgressPane.Text = "statusBarPanel1"; - // - // toolBar1 - // - this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; - this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { - this.btnBack, - this.btnForward, - this.btnSep1, - this.btnReload, - this.btnStop, - this.btnSep2, - this.btnHome}); - this.toolBar1.ButtonSize = new System.Drawing.Size(32, 32); - this.toolBar1.DropDownArrows = true; - this.toolBar1.ImageList = this.imageList1; - this.toolBar1.Name = "toolBar1"; - this.toolBar1.ShowToolTips = true; - this.toolBar1.Size = new System.Drawing.Size(696, 55); - this.toolBar1.TabIndex = 6; - this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick); - // - // btnBack - // - this.btnBack.Enabled = false; - this.btnBack.ImageIndex = 0; - this.btnBack.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; - this.btnBack.Tag = "Back"; - this.btnBack.Text = "Back"; - this.btnBack.ToolTipText = "Back one page"; - // - // btnForward - // - this.btnForward.Enabled = false; - this.btnForward.ImageIndex = 1; - this.btnForward.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; - this.btnForward.Text = "Forward"; - this.btnForward.ToolTipText = "Forward one page"; - // - // btnSep1 - // - this.btnSep1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; - // - // btnStop - // - this.btnStop.Enabled = false; - this.btnStop.ImageIndex = 4; - this.btnStop.Text = "Stop"; - this.btnStop.ToolTipText = "Stop loading"; - // - // btnReload - // - this.btnReload.ImageIndex = 3; - this.btnReload.Text = "Reload"; - this.btnReload.ToolTipText = "Reload this page"; - // - // btnHome - // - this.btnHome.ImageIndex = 2; - this.btnHome.Text = "Home"; - this.btnHome.ToolTipText = "Go Home"; - // - // imageList1 - // - this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit; - this.imageList1.ImageSize = new System.Drawing.Size(32, 32); - this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); - this.imageList1.TransparentColor = System.Drawing.Color.Black; - // - // mainMenu1 - // - this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.menuItem1, - this.menuItem2}); - // - // menuItem1 - // - this.menuItem1.Index = 0; - this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.menuExit}); - this.menuItem1.Text = "&File"; - // - // menuExit - // - this.menuExit.Index = 0; - this.menuExit.Text = "E&xit"; - this.menuExit.Click += new System.EventHandler(this.menuExit_Click); - // - // menuItem2 - // - this.menuItem2.Index = 1; - this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.menuAbout}); - this.menuItem2.Text = "&Help"; - // - // menuAbout - // - this.menuAbout.Index = 0; - this.menuAbout.Text = "&About..."; - this.menuAbout.Click += new System.EventHandler(this.menuAbout_Click); - // - // url - // - this.url.Items.AddRange(new object[] { - "http://127.0.0.1/", - "http://127.0.0.1:8080/", - "http://www.mozilla.org/", - "http://www.cnn.com/", - "http://www.yahoo.com/", - "http://www.slashdot.org/", - "http://www.amazon.com/"}); - this.url.Location = new System.Drawing.Point(24, 72); - this.url.MaxLength = 1024; - this.url.Name = "url"; - this.url.Size = new System.Drawing.Size(568, 21); - this.url.TabIndex = 0; - // - // btnSep2 - // - this.btnSep2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; - // - // Form1 - // - this.AcceptButton = this.goBtn; - this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.ClientSize = new System.Drawing.Size(696, 561); - this.Controls.AddRange(new System.Windows.Forms.Control[] { - this.url, - this.toolBar1, - this.statusBar1, - this.goBtn, - this.axMozillaBrowser1}); - this.Menu = this.mainMenu1; - this.Name = "Form1"; - this.Text = "CSBrowse"; - this.Load += new System.EventHandler(this.Form1_Load); - this.Layout += new System.Windows.Forms.LayoutEventHandler(this.Form1_Layout); - ((System.ComponentModel.ISupportInitialize)(this.axMozillaBrowser1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.statusMessagePane)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.statusProgressPane)).EndInit(); - this.ResumeLayout(false); - - } - #endregion - - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.Run(new Form1()); - } - - private void Form1_Load(object sender, System.EventArgs e) - { - - } - - private void button1_Click(object sender, System.EventArgs e) - { - object n = null; - axMozillaBrowser1.Navigate(url.Text, ref n, ref n, ref n, ref n); - } - - private void statusBar1_PanelClick(object sender, System.Windows.Forms.StatusBarPanelClickEventArgs e) - { - - } - - private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) - { - if (e.Button.Equals(btnBack)) - { - axMozillaBrowser1.GoBack(); - } - else if (e.Button.Equals(btnForward)) - { - axMozillaBrowser1.GoForward(); - } - else if (e.Button.Equals(btnStop)) - { - axMozillaBrowser1.Stop(); - } - else if (e.Button.Equals(btnReload)) - { - axMozillaBrowser1.Refresh(); - } - else if (e.Button.Equals(btnHome)) - { - axMozillaBrowser1.GoHome(); - } - } - - private void statusBar1_DrawItem(object sender, System.Windows.Forms.StatusBarDrawItemEventArgs sbdevent) - { - if (sbdevent.Panel.Equals(statusProgressPane)) - { - - } - } - - private void axMozillaBrowser1_StatusTextChange(object sender, AxMOZILLACONTROLLib.DWebBrowserEvents2_StatusTextChangeEvent e) - { - statusMessagePane.Text = e.text; - } - - private void axMozillaBrowser1_CommandStateChange(object sender, AxMOZILLACONTROLLib.DWebBrowserEvents2_CommandStateChangeEvent e) - { - if ((e.command & 0x1) != 0) // Forward - { - btnForward.Enabled = e.enable; - } - if ((e.command & 0x2) != 0) // Backward - { - btnBack.Enabled = e.enable; - } - } - - private void axMozillaBrowser1_NewWindow2(object sender, AxMOZILLACONTROLLib.DWebBrowserEvents2_NewWindow2Event e) - { - Form1 f = new Form1(); - f.Show(); - object n = null; - f.axMozillaBrowser1.Navigate("about:blank", ref n, ref n, ref n, ref n); - e.ppDisp = f.axMozillaBrowser1.Application; - } - - private void axMozillaBrowser1_DownloadBegin(object sender, System.EventArgs e) - { - btnStop.Enabled = true; - } - - private void axMozillaBrowser1_DownloadComplete(object sender, System.EventArgs e) - { - btnStop.Enabled = false; - } - - private void axMozillaBrowser1_BeforeNavigate2(object sender, AxMOZILLACONTROLLib.DWebBrowserEvents2_BeforeNavigate2Event e) - { - } - - private void axMozillaBrowser1_NavigateComplete2(object sender, AxMOZILLACONTROLLib.DWebBrowserEvents2_NavigateComplete2Event e) - { - this.Text = axMozillaBrowser1.LocationName + " - CSBrowse"; - url.Text = axMozillaBrowser1.LocationURL; - } - - private void axMozillaBrowser1_LocationChanged(object sender, System.EventArgs e) - { - url.Text = axMozillaBrowser1.LocationURL; - } - - private void Form1_Layout(object sender, System.Windows.Forms.LayoutEventArgs e) - { - // Resize the browser to fit the new available space - toolBar1.Location = - new Point(this.ClientRectangle.Left, this.ClientRectangle.Top); - - goBtn.Location = new Point( - this.ClientRectangle.Right - goBtn.Width, - toolBar1.Left + toolBar1.Height); - - url.Location = new Point( - this.ClientRectangle.Left, - toolBar1.Left + toolBar1.Height); - url.Size = new Size( - goBtn.Left - url.Left, goBtn.Height); - - statusBar1.Location = new Point( - this.ClientRectangle.Left, - this.ClientRectangle.Bottom - statusBar1.Height); - - axMozillaBrowser1.Location = new Point( - this.ClientRectangle.Left, url.Bottom); - axMozillaBrowser1.Size = new Size( - this.ClientSize.Width, - statusBar1.Top - axMozillaBrowser1.Top); - } - - private void url_TextChanged(object sender, System.EventArgs e) - { - - } - - // Menu handlers - private void menuExit_Click(object sender, System.EventArgs e) - { - this.Close(); - } - - private void menuAbout_Click(object sender, System.EventArgs e) - { - // TODO about message box - MessageBox.Show(this, "CSBrowse Test Application", "CSBrowse"); - } - - - } -} diff --git a/embedding/browser/activex/tests/csbrowse/Form1.resx b/embedding/browser/activex/tests/csbrowse/Form1.resx deleted file mode 100644 index 73648d23e29..00000000000 --- a/embedding/browser/activex/tests/csbrowse/Form1.resx +++ /dev/null @@ -1,724 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuMzMw - MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFT - eXN0ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAIQAA - AAIBAAAAAQAAAAAAAAAAAAAAAAwAAAAAAwAAkjYAAEkbAAAL - - - - 41, 26 - - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuMzMw - MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZT - eXN0ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMA - AADUjAAAAk1TRnQBSQFMAgEBBQEAAQoBAAEEAQABIAEAASABAAT/ASEBEAj/AUIBTQE2BwABNgMAASgD - AAGAAwABYAMAAQEBAAEgBgABwP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/ - AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/ - AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8AXgABzwEEAQIBDAGvASgBGgGJAawBPgEvArcBTgE+ArcB - TgE+AbcBtQFKATkBtwGwAUMBNAG3AasBPgEuAbcBkQEuASABtwF4AR8BFgG3AWgBFwEQAbcBZgEWAQ4B - twFmARYBDgG3AWYBFgEOAbcBZgEWAQ4BtwFmARMBDgG3AW0CDQGsAbgCBAEu/wC5AAHPAQUBAwEQAaIB - OgEnAb8BqQFpAVMB/wHIAY4BegH/AcsBlAGAAf8ByQGRAX0B/wHEAYsBdgH/Ab4BhAFvAf8BqAF0AWIB - /wGSAWQBVgH/AYEBWQFLAf8BewFTAUQB/wF3AUwBPgH/AXEBRwE4Af8BbAFAATAB/wFpATgBKgH/AWgB - LAEkAfYBmQEhARgBlAGqARwBEwFwAaoBHAEUAXABqwEcARMBcAGqARwBEwFwAbIBFgEPAVsBzgEEAQIB - Dv8AoQABzwEFAQQBEAGnAT0BKwG/AbsBgAFqAf8B6wG8AasB/wH0AckBuAH/AfUBywG6Af8B8gHHAbYB - /wHvAcEBsAH/AeoBugGpAf8B5QGyAaEB/wHcAagBlQH/AcsBlgGHAf8BvgGIAXsB/wG6AYEBcAH/AbcB - egFlAf8BsQFvAVoB/wGoAWIBTwH/AZIBWAFEAf8BiQFSAT4B/wGHAVABPQH/AYUBTQE5Af8BgQFIATQB - /wGFATcBKAHXAawBCQESAUMBswEBAQ4BKAGzAQEBCwEoAbIBAAEDASgBxwEAAQEBD/8AkQAB0AEFAQQB - EAGqAUABLgK/AYYBcQH/Ae8BxQG0Af8B+QHSAcEB/wH9AdcByAH/AfwB2AHIAf8B+wHSAcIB/wH5Ac0B - vQH/AfYBxgG2Af8B8QG/Aa8B/wG7AZcBpQH/AagBigGiAf8BxQGhAakB/wHjAbgBrwH/AfEBwwGzAf8B - 8AHDAbIB/wHkAbMBoQH/AdkBpQGSAf8BzwGYAYUB/wHDAYoBdQH/AbABcQFbAf8BhwFKAUYB+QEsAQ0B - TQHjAR0BAwFNAd8BHQEDATwB3wEbAQEBEQHfAY0BAAEEAVT/AJEAAdABBgEFARABrgFGATQBvwHEAYwB - dwH/AfEByQG5Af8B+wHUAcUB/wH9AdkBywH/Af0B2gHKAf8B/QHUAcUB/wH6AcMBsQH/AecBqwGfAf8B - ugGLAZkB/wGCAWoBqAH/AWcBXQGvAf8BcwFlAawB/wG0AZgBtAH/AeIBvgG9Af8B/AHVAcQB/wH5Ac0B - vAH/AfMBxAGzAf8B7QG7AakB/wHmAakBkwH/Ab4BfwFwAf8BfgFLAVkB/wEfARgBbgH/AREBEgF6Af8C - EAFwAf8CBQE+Af8BNwEBAR4BvgF+AQEBCgFo/wCNAAHQAQYBBQEQAbQBTAE6Ab8ByQGRAX4B/wHzAcwB - vQH/AfsB1gHIAf8B/QHaAcwB/wH9AdcByAH/AfwBzAG7Af8B5wGpAZ8B/wG9AYEBjwH/AXoBWQGXAf8B - WQFPAbcB/wFHAUkBxQH/AUQBRQG9Af8BeAFrAbUB/wG1AZoBtwH/AfEBywHCAf8B+gHRAcMB/wH8Ac8B - vgH/AfkBxgGzAf8B7wGrAZYB/wGvAXUBfAH/AWMBQAFzAf8BKwEnAZkB/wEiASQBqgH/AR8BIAGjAf8C - EAF2Af8CBwFFAf8BQwEBAR0Br/8AjQAB0QEHAQUBEAG3AU8BPwG/AcwBlgGDAf8B9AHPAcEB/wH7AdgB - ygH/Af0B2wHNAf8B/QHSAcIB/wH7AboBowH/Ab0BhAGPAf8BegFWAZMB/wFDAUIBuQH/AVEBVgHbAf8B - XAFiAe0B/wFbAWAB7AH/AkkBwgH/AXcBaQGzAf8B1AGyAbsB/wHyAcoBwgH/AfsBywG5Af8B9QG5AaQB - /wHYAY8BggH/AYMBVgGCAf8BNgEuAZsB/wE5AToB1gH/ATcBOQHiAf8BMAExAdYB/wEhASIBsQH/AhAB - dwH/AUUBAwE6Aa//AI0AAdEBBwEGARABvAFXAUUBvwHRAZ4BigH/AfYB1AHFAf8B/AHaAcwB/wH9AdIB - wQH/AfwBwgGtAf8B9QGqAZIB/wGvAXgBjgH/AW4BVAGgAf8BTwFQAc0B/wFcAWEB5AH/AWQBagHvAf8B - YwFoAe8B/wFZAVwB3gH/AVoBWAHHAf8BbAFgAa8B/wG4AZUBrwH/AdcBogGhAf8BzQKRAf8BgQFcAY8B - /wFWAUUBqgH/AT8BPgHLAf8BQQFDAeIB/wE9AUAB5gH/ATUBNwHbAf8BKAEqAcAB/wIVAYQB/wFJAQcB - QwGv/wCNAAHRAQcBBgEQAcABWwFLAb8B1AGiAY8B/wH2AdUBxgH/AfwB2gHNAf8B/QHUAcQB/wH8AcYB - sQH/AfgBsAGXAf8BywGNAZEB/wGWAW0BnAH/AWIBVQG8Af8BXwFeAdcB/wFjAWkB6QH/AWoBcAHxAf8B - ZQFrAewB/wFbAV8B3QH/AlIBxQH/AXwBaAGwAf8BjAFrAZ4B/wGFAWEBlwH/AVcBSwGxAf8BSgFIAc0B - /wFJAUsB4wH/AUcBSgHoAf8BPwFCAeAB/wEyATQBygH/AR8BIAGjAf8BDwEQAW8B/wFHAQUBOAGv/wCN - AAHSAQgBBwEQAcUBYQFRAb8B1wGlAZQB/wH3AdUByAH/AfsB2wHPAf8B/QHbAc0B/wH9AdUBxAH/Af0B - xQGsAf8B8wGwAZoB/wHRAZIBkwH/AYoBZAGdAf8BagFeAb8B/wFhAWQB3AH/AW4BdQHxAf8BbQF0AfIB - /wFpAW8B7wH/AWIBZwHmAf8BUwFQAcMB/wFLAUUBsQH/AUgBQwGyAf8BTwFRAdYB/wFRAVUB5gH/AVEB - VAHqAf8BSgFNAecB/wE7AT4BzwH/ASgBKgGpAf8CEgF1Af8BHwEGAUcB4QFfAQEBIQGO/wCNAAHSAQkB - BwEQAckBZwFXAb8B2wGqAZkB/wH5AdcBywH/Af0B3wHTAf8B/gHiAdYB/wH+AeMB1gL/AeAB0AH/AfwB - xgGwAf8B9AGtAZcB/wHmAZ4BkgH/AZUBcwGnAf8BZwFgAcYB/wFqAXEB6wH/AXEBeAHxAf8BcgF5AfMB - /wFuAXQB8QH/AWQBagHnAf8BXgFjAeMB/wFcAWEB5AH/AV0BYgHrAf8BWgFfAe0B/wFUAVgB6QH/AUcB - SwHcAf8BLwExAa4B/wIZAX8B/wIOAVgB/wF8AQUBIwFvAcYBAAEEARD/AI0AAdMBCQEIARABzgFtAV4B - vwHgAbIBogH/AfsB3QHTAf8B/gHkAdkC/wHnAdsC/wHnAdsB/wH+AeUB2QH/Af4B1gHFAf8B/AHEAbAB - /wH5AbYBnwH/Ac0BmwGkAf8BmwF9AbMB/wFlAV8BygH/AWkBbAHgAf8BbwF2Ae4B/wF1AXwB9AH/AW8B - dgHxAf8BagFwAe8B/wFnAW0B7wH/AWMBagHwAf8BWgFfAekB/wFLAU8B2AH/ATQBNQG2Af8CHwGGAf8B - LgENAVMB1wGBAQYBIwFqAbcBAgELAST/AI0AAcsBDAEJASEBvwEoAR8BYgHNAXwBbQHVAeUBuwGsAf8B - /QHkAdoB/wH+AecB3QL/AeoB3wL/AekB3gH/Af4B5gHbAf8B/gHfAdMB/wH+AdYBxgH/Af0ByQG1Af8B - 8QG7AasB/wHPAaABqgH/AZMBdgGwAf8BbgFnAc0B/wFoAWwB5AH/AXkBgAH1Af8BdgF9AfUB/wFyAXkB - 9AH/AW0BdAHyAf8BZwFuAfAB/wFVAVkB3QH/ATwBPwG+Af8CIgGTAf8CEgFcAf8BOwEGASgBvwHHAQEB - AwEQ/wCRAAG9ASQBGgFgAZsBZQFMAf8ByAGWAYIB/wHpAcUBtgH/Af4B6gHgAf8B/gHoAd4C/wHrAeAC - /wHsAeEB/wH+AeUB2wH/Af0B4wHYAf8B/QHgAdQB/wH8AdoBzQH/AfwBzQG6Af8B9gG/AawB/wHpAbEB - pwH/AYEBbQG+Af8CYgHZAf8BfQGEAfQB/wF7AYMB9gH/AXcBfgH1Af8BcQF4AfIB/wFpAXAB7QH/AUwB - TwHNAf8BKgEsAaMB/wIYAYAB/wIKAToB/wE2AQEBBgG/AcYCAAEQ/wCRAAHDASkBHwFgAawBcQFaAf8B - 0wGkAZIB/wHuAc4BwQH/Af4B7AHjAf8B/gHqAeEC/wHsAeIC/wHsAeIB/wH+AekB3wH/Af0B5gHcAf8B - /QHiAdgB/wH9Ad0B0gH/AfIBygHCAf8BzQGmAboB/wGIAW8BvAH/AXMBbwHXAf8BdAF6AeoB/wGFAY0B - 9wH/AYABiQH3Af8BfAGDAfYB/wF2AX0B9AH/AXEBdwHyAf8BXwFkAeIB/wFGAUkBxgH/AicBnAH/AhQB - YwH/ATwBBwEuAb8BxwEBAQQBEP8AkQABxgErASIBYAG0AXcBYQH/AdsBsQGhAf8B8gHYAcwB/wH+Ae8B - 5gH/Af4B7AHjAv8B7AHjAv8B7AHiAf8B/gHrAeEB/wH9AegB3QH/AfwB4gHXAf8B+gHXAcwB/wHNAa8B - yAH/AaABiwHMAf8BdwFzAdoB/wF/AYQB6wH/AYUBjwH1Af8BigGTAfkB/wGBAYoB9QH/AXsBgwH0Af8B - dwF+AfMB/wF0AXsB8wH/AWsBcgHuAf8BWwFhAd8B/wFBAUQBwQH/ASgBKQGTAf8BLAESAWIB3wFpAQcB - MAGIAa4BAwERATD/AIkAAbYCAAEmAawBLAEjAYMBuQF7AWUB/wHhAb4BrwH/AfUB4gHYAf8B/gHwAegB - /wH+Ae0B5AH/Af4B7AHjAf8B/gHrAeIB/wH+AesB4QH/AfwB5gHbAf8B8wHZAdQB/wHcAbwByAH/AaEB - kAHSAf8BgwF/AeAB/wGJAZIB9AH/AZIBnAH5Af8BkgGdAfsB/wGMAZYB+AH/AXkBgAHtAf8BbgF0AegB - /wFrAXEB6AH/AXIBegHwAf8BcQF5AfMB/wFqAXEB7wH/AVsBYAHhAf8BPwFDAb8B/wIlAZUB/wIRAWYB - /wFuAQcBLgGDAbYBAgEKASb/AIUAAVECAAGkAVMBLAElAfUBvwGAAWoB/wHnAcsBvgH/AfoB7AHjAf8B - /gHyAeoB/wH+Ae4B5gH/Af4B7QHkAf8B/gHsAeIB/wH+AeoB4AH/AfoB4QHWAf8B2QHBAdIB/wGHAXoB - 1wH/AYMBggHoAf8BjgGWAfUB/wGiAa0B/QH/AZ0BqAH+Af8BlwGhAfwB/wGLAZUB9gH/AWQBZQHaAf8B - TwFNAcsB/wFMAUoBygH/AWkBbwHnAf8BcQF4AfEB/wFvAXYB8wH/AWgBbgHwAf8BVwFcAd4B/wE+AUEB - vgH/AhwBjAH/ARYBDgFXAfUBUQEGASkBpP8AhQABcwEOAQsBrwF6AT4BMwH/Ac8BiwF1Af8B7wHTAcgB - /wH8AfAB5wH/Af4B8QHqAf8B/gHuAecB/wH+Ae0B5QH/Af0B6gHhAf8B+gHhAdcB/wHRAboB1wH/AaYB - mAHdAf8CiQHqAf8BmgGhAfYB/wGnAbIB/AH/AaoBtgL/AZ0BpwH8Af8BiAGQAfMB/wFyAXUB5AH/AZEB - gwHOAf8BmwGFAb8B/wGVAX0BugH/AWwBZAHJAf8BZgFoAd0B/wFqAXEB7gH/AWoBcAHxAf8BYQFnAesB - /wFRAVUB2gH/ATkBOwG6Af8BIAEiAYgB/wFQAQ4BSQGv/wCFAAGHAR4BFwGvAZIBUwFHAf8B3QGcAYgB - /wH1AdwB0gH/Af0B8gHrAf8B/gHwAekB/wH+Ae4B6AH/Af4B7gHlAf8B/QHrAeAB/wH6AeMB2AH/AcEB - rgHaAf8BkgGHAeQB/wGIAY4B9gH/AacBsQH8Af8BtwHDAv8BsAG8Av8BkgGaAfYB/wGGAYoB7AH/AY8B - iwHfAf8BxQGxAdEB/wHaAbkBwQH/AdEBpwGyAf8BiQFtAasB/wFmAVwBwAH/AVoBXwHcAf8BZwFuAe4B - /wFlAWsB8AH/AVoBXwHmAf8BRAFHAcwB/wEnASkBnQH/AVIBEAFZAa//AIUAAYQBLAEkAa8BkgFpAVwB - /wHlAbMBoQH/AfgB5gHcAf8B/gHzAe0B/wH9Ae4B6AH/Af4B8AHqAv8B8AHnAf8B/gHuAeMB/wH8AfAB - 4AH/Ac8BvwHgAf8BoAGUAeYB/wGBAYQB9gH/AaUBrQH8Af8BtwHDAf4B/wGuAbkB/QH/AYQBiAHuAf8B - lwGVAecB/wHaAdAB5gH/AfQB5QHhAf8B/QHdAc4B/wHxAcABsQH/AbYBhQGQAf8BbwFWAZoB/wE/AUAB - ugH/AV0BYwHiAf8BYQFnAesB/wFXAVsB4QH/ATwBPwHAAf8BIgEjAZIB/wFOAQwBUgGv/wCFAAGGAS4B - JgGvAZYBcwFnAf8B7QHIAboB/wH6AewB5QL/AfUB8QH/Af4B8wHtAv8B9gHwAv8B+AHxAv8B+AHwAf8B - /gH2AekB/wH0AeEB3gH/AdYBwAHbAf8BmQGOAekB/wKUAfQB/wGMAZMB+AH/AXsBfwHyAf8BnAGaAewB - /wHHAcEB7AH/AfcB7gHtAf8B/QHyAesB/wH9AeUB2gH/Ae8ByAG5Af8BsgGBAXcB/wFeAUQBZwH/AiAB - ewH/ATgBOwG1Af8BQwFGAccB/wE+AUEBvgH/ASEBIgGVAf8CEQFcAf8BRwEFASgBr/8AhQABowFCATcB - rwGzAY0BfwH/AfQB2gHQAf8B/AHyAewB/wH+AfgB9AH/Af4B9wHyAf8B/gH5AfMC/wH7AfUC/wH7AfUB - /wH+AfYB7QH/Af4B7AHhAf8B8QLZAf8BzgG4AdwB/wGrAaMB6wH/ApgB8gH/AZoBmAHuAf8ByAHDAe0B - /wHqAeMB7wL/AfgB8QH/Af4B9AHtAf8B+wHjAdoB/wHrAcUBtgH/AbEBgAFvAf8BjAE7AUIBvAFoAQ0B - OQGRASkBHQFxAe4BJwEpAZYB/wElAScBlQH/AhEBWwH/AU0BBwEuAasBkAEBAQ4BUv8AhQABxAFbAU0B - rwHVAaoBmwH/AfkB6QHiAf8B/QH2AfIB/wH+AfoB9wH/Af4B+wH3Af8B/gH5AfUC/wH7AfcC/wH7AfcB - /wH+AfcB8QH/Af4B8QHoAf8B/QHpAeAB/wH5AeEB2gH/AdEBxgHoAf8BvwG5Ae0B/wHLAcMB5gH/AeUB - 2gHgAf8B8wHnAeAB/wH3Ae0B5wH/AfgB7AHlAf8B9QHaAdAB/wHmAboBqwH/AbEBfwFtAf8BugE4AS8B - gAG3AQIBCwEkAVIBCgEwAacBRQEQAVUBvwFFARABWwG/ATwBBwElAb8BmQECAQ0BSP8AiQAB3gFyAWMB - rwHtAcIBtAH/AfwB8wHuAf8B/gH4AfYB/wH+AfsB+AL/AfwB+QH/Af4B+gH3Av8B+wH5Av8B/AH5Af8B - /gH7AfcB/wH+AfgB9AH/Af4B9QHvAf8B/gHyAesB/wH9AfUB8QH/AfYB7gHpAf8B6AHaAdMB/wHXAcEB - twH/AdQBvQGzAf8B3gHLAcMB/wHoAdYBzwH/AekByQG9Af8B3gGqAZgB/wGwAXoBaAH/AbsBNwEuAYAB - 0QIAAQIBzQEAAQIBBwHNAQEBBAEIAc0BAQEEAQgBzAEAAQIBCAHRAQABAQED/wCJAAHkAXwBbgGvAfIB - zQHAAf8B/QH3AfQB/wH+AfsB+QH/Af4B/AH7Af8B/gH8AfoB/wH+AfsB+AH/Af4B+wH4Af8B/gH7AfgB - /wH+AfoB9wH/Af4B+AH1Af8B/gH3AfMB/wH+AfgB9AH/Af4B+gH3Af8B7gHjAd0B/wHLAa4BogH/AcgB - mgGJAf8ByQGUAYEB/wHOAZoBhwH/Ac4BmwGKAf8BzwGZAYUB/wHFAYUBcgH/AYsBNwEvAf8BpwERAQ4B - gP8AnQABzQE5AS4BaAHmAZgBiAHQAfYB2AHMAf8B/gH7AfkB/wH+Av0B/wL+Af0B/wH+Af0B/AH/Af4B - +wH5Af8B/gH7AfgB/wH+AfsB+AH/Af4B+wH5Af8B/gH6AfgB/wH+AfoB+AH/Af4B/AH5Af8B/gH7AfoB - /wHoAdkB0wH/AboBjgF9Af8BzAGUAYAB/wHWAZgBggH/AdgBmQGDAf8B1QGTAX0B/wG4AX8BagH/AZUB - WAFJAfIBlAETAQ8BqwGzAgABTP8AnQABygGRAXUB/wHoAb0BqgH/AfkB4QHZAv8B/gH9B/8B/gH/Av4B - /QH/Af4B/AH6Av8B/AH5Av8B/AH5Av8B/QH7Av8C/AL/Af0B/AH/Av4B/QH/AfwB+gH5Af8B5gHUAcsB - /wG3AYEBawH/Ad4BqAGUAf8B8QG5AaYB/wHwAbYBowH/AeUBpgGRAf8BpwFvAV8B8QFtASkBIgHDAbwB - CQEIASr/AKEAAekBpwGPAf8B9AHNAb4B/wH8AekB4wH/Av4B/QH/Af4B/QH8Af8B/gH9AfwC/wH+Af0B - /wH+AfwB+wL/Af0B+wL/Af0B+wH/Af4B/AH6Af8B/gH7AfkB/wH+AfsB+QH/Af4B/AH6Af8B+AHxAe0B - /wHoAdEBxgH/AcsBmgGEAf8B6AG8Aa0B/wH0AcUBswH/AesBsAGcAf8BogF2AWcB/wGfATkBMwGhAcAB - BwEGASMBzgECAQEBCP8AoQAB8wGuAZcB/wH4AcgBtwH/AfsB2gHPAf8B/QHmAd4B/wH9AegB4AH/Af0B - 6QHjAf8B/QHrAeUB/wH9AewB5gH/Af4B7wHpAf8B/gHxAewB/wH+AfIB7gH/Af0B9AHvAf8B/QH1AfEB - /wH+AfYB8wH/AfYB5wHfAf8B6wHSAcUB/wHgAbgBpgH/AfABwgGxAf8B2QGrAZoB/wGlAXYBZQH2AakB - OwEyAZQBvAEVARIBP/8AqQAB7QF+AW4BtwHaAZoBjAHpAeMBswGlAf8B+QHIAbgB/wH6Ac0BvAH/AfsB - zwHAAf8B+wHRAcMB/wH8AdQBxgH/Af0B1wHJAf8B/QHZAc0B/wH9AdwB0QH/Af0B3gHTAf8B/QHfAdQB - /wH9AeEB1wH/AfUB1AHFAf8B8AHKAbgB/wHxAcUBtAH/AeEBsAGdAf8BuwF8AW4B5AGMATQBLQGsAcAB - DgEMAS7/ALEAAZICNQGvAaQBcAFnAf8B8wGrAZMB/wH0AbABlgH/AfYBswGZAf8B+AG0AZwB/wH5AbQB - nAH/AfoBtAGcAf8B+wG0AZwB/wH7AbYBnQH/AfwBtQGdAf8B/AG1AZ0B/wH8AbYBngH/AfYBsgGYAf8B - 9QGyAZcB/wH6AbYBnwH/Aa4BfwFrAf8BpgFAATQBn/8AzQABwQIBARcBXgIGAZUBUgETARIBtwFmASUB - IgG3AYIBQQE5AbcBkQFKAUMBtwGZAU8BSwG3AZ4BUwFPAbcBoAFVAVABtwGjAVcBUgG3AaUBVwFQAbcB - oAFTAU4BtwGbAU4BRgG3AZUBRgFAAbcBjwFBATkBtwF8ATEBKgG3AWMBHQEYAbcBVAETAREBtwGSAQkB - CAFcNAABwQIBARcBXgIGAZUBUgETARIBtwFmASUBIgG3AYIBQQE5AbcBkQFKAUMBtwGZAU8BSwG3AZ4B - UwFPAbcBoAFVAVABtwGjAVcBUgG3AaUBVwFQAbcBoAFTAU4BtwGbAU4BRgG3AZUBRgFAAbcBjwFBATkB - twF8ATEBKgG3AWMBHQEYAbcBVAETAREBtwGSAQkBCAFcPAABhwIBAVwBQAIGAbcBTwEXARgBtwFuATgB - OQG3AY4BWgFcAbcBqAF2AXkBtwGTAV8BYgG3AXoBRQFGAbcBYwIsAbcBVwEdASIBtwFNARIBGwG3AUUB - CQETAbcBQgEGAQsBtwGAAQIBBQFnQAABzQEIAQYBFwGrATMBKAGVAagBRgE4AbcBsAFLAT4BtwGrAUgB - OwG3AaUBQwE2AbcBoAE+ATEBtwGYATQBKgG3AXUBIgEbAbcBYQEXAREBtwFjARcBEgG3AWMBFwESAbcB - YwEXARIBtwFhARYBEQG3AVcBEAELAbcBjAEIAQYBZzwAAbMCCQExAYACFwGCAUQBKwEoAeQBRQE9AToB - /wFdAVIBTQH/AXwBcAFoAf8BkgGBAXoB/wGhAY0BhwH/AakBlAGOAf8BrgGXAZEB/wGyAZkBkgH/AbQB - mgGSAf8BsgGXAY8B/wGuAZMBiQH/AacBigGBAf8BlwF7AXAB/wF5AWABVgH/AVYBQgE6Af8BRgE0AS4B - /wFrASIBHgG4AaIBDwEOAVsBywICAQ4oAAGzAgkBMQGAAhcBggFEASsBKAHkAUUBPQE6Af8BXQFSAU0B - /wF8AXABaAH/AZIBgQF6Af8BoQGNAYcB/wGpAZQBjgH/Aa4BlwGRAf8BsgGZAZIB/wG0AZoBkgH/AbIB - lwGPAf8BrgGTAYkB/wGnAYoBgQH/AZcBewFwAf8BeQFgAVYB/wFWAUIBOgH/AUYBNAEuAf8BawEiAR4B - uAGiAQ8BDgFbAcsCAgEOLAABxwIAAQ4BiAIAAVsBRAIMAbgBGwEgASEB/wE3AUABQwH/AVYBYAFjAf8B - ewGGAYoB/wGqAbkBvAH/AZgBpgGqAf8BgQGNAZAB/wFqAXUBeAH/AUwBUwFkAf8BMwE2AVMB/wIhAUMB - /wIbATcB/wFHARMBKAHAAYIBDAEaAXABfQEHARABcAF6AQQBBwFwAYgCAAFbAccCAAEOLAABzAEMAQoB - IAGjAU8BPwHPAa4BdwFjAf8BxAGMAXgB/wHAAYgBdQH/AbsBgwFvAf8BtQF9AWkB/wGrAXMBYQH/AY0B - XwFRAf8BeAFTAUYB/wF1AU8BQgH/AW8BSgE9Af8BagFEATgB/wFjAT8BMgH/AVMBMwEoAf8BdQEmAR0B - wAGmAR0BFwFwAaYBHQEXAXABpgEdARcBcAGmAR0BFwFwAaUBHQEXAXABlAESAQ4BcAGaAQgBBgFUAc4B - AQEAAQcUAAHSAgABAwHBAgYBHgGCAR4BHQGGAUIBPwE+Af8BZwFdAVoB/wF+AXEBbQH/AZIBggF9Af8B - pQGVAZAB/wG5AagBowH/AcoBuAGxAf8B0wG+AbgB/wHXAcIBuwH/AdsBwwG9Af8B3gHFAb4B/wHhAcUB - vQH/AeIBxQG8Af8B4AHCAbgB/wHKAawBowH/Aa4BkAGGAf8BkAFzAWgB/wF9AWABVQH/AWUBRgFAAf8B - ZAEpAScB1wGyAQ8BDQFDAbkBBQEEASgBuwEBAQABHgHRAgABAxQAAdICAAEDAcECBgEeAYIBHgEdAYYB - QgE/AT4B/wFnAV0BWgH/AX4BcQFtAf8BkgGCAX0B/wGlAZUBkAH/AbkBqAGjAf8BygG4AbEB/wHTAb4B - uAH/AdcBwgG7Af8B2wHDAb0B/wHeAcUBvgH/AeEBxQG9Af8B4gHFAbwB/wHgAcIBuAH/AcoBrAGjAf8B - rgGQAYYB/wGQAXMBaAH/AX0BYAFVAf8BZQFGAUAB/wFkASkBJwHXAbIBDwENAUMBuQEFAQQBKAG7AQEB - AAEeAdECAAEDIAABugIBASABLQIFAc8BHwEjASQB/wFAAUoBTAH/AV0BbQFyAf8BawF4AXwB/wGIAZMB - lwH/AcMB0gHXAf8BwQHRAdYB/wG4AcgBzQH/Aa0BvgHDAf8BgAGKAacB/wFaAV4BjwH/AjwBeQH/AjYB - bQH/AiwBWgH/AiEBRgH/AhkBMgH/ARIBEwEeAf8BLAEMAQ0B1wGgAgUBQwG0AgIBKAG6AgEBHgHRAgAB - AyAAAc4BDgELASABrwFZAUoBzwHMAZQBfwH/AfIBuQGkAf8B8gG5AaQB/wHwAbYBoQH/AewBsgGcAf8B - 5gGrAZUB/wHeAaIBjgH/AdUBmwGGAf8BzQGUAX8B/wHDAYkBdQH/AbkBfwFrAf8BrQF1AWEB/wGdAWgB - VAH/AY4BXAFLAf8BgQFTAUQB/wF/AVIBQgH/AX0BUAFAAf8BewFOAT4B/wF3AUsBPAH/AUsBLgElAf8B - VAETAQ8BvwHIAQIBAQEQFAABywIDAQ4BbgEhAR8BpwFfAUgBRgHtAXkBcAFrAf8BiwF+AXoB/wGlAZcB - lAH/Ab0BrwGsAf8BygG8AbkB/wHOAcEBvQH/Ac8BwwHAAf8B0AHEAcAB/wHSAcUBwQH/AdQBxgHBAf8B - 1wHHAcEB/wHbAcgBwgH/AeABygHFAf8B5gHNAcYB/wHrAc4BxQH/AekBywHAAf8B3AG+AbEB/wGvAZEB - hQH/AYwBbQFiAf8BcwFPAUUB+QFqATwBMgHjAUABGgEWAd8BTQEEAQMBpwHHAgABDhQAAcsCAwEOAW4B - IQEfAacBXwFIAUYB7QF5AXABawH/AYsBfgF6Af8BpQGXAZQB/wG9Aa8BrAH/AcoBvAG5Af8BzgHBAb0B - /wHPAcMBwAH/AdABxAHAAf8B0gHFAcEB/wHUAcYBwQH/AdcBxwHBAf8B2wHIAcIB/wHgAcoBxQH/AeYB - zQHGAf8B6wHOAcUB/wHpAcsBwAH/AdwBvgGxAf8BrwGRAYUB/wGMAW0BYgH/AXMBTwFFAfkBagE8ATIB - 4wFAARoBFgHfAU0BBAEDAacBxwIAAQ4gAAG9AgQBIAE8ARcBGAHPAUQBTQFQAf8BbQF9AYEB/wFsAX0B - ggH/AXIBfwGDAf8BjAGXAZsB/wHJAdgB3AH/AccB1gHbAf8BvwHOAdQB/wG2AccBzAH/AYkBkwGyAf8B - YwFnAZsB/wJFAYgB/wJBAYMB/wI9AXwB/wI7AXcB/wE/AUABcQH/AUABRgFgAf8BPAE/AUMB+QEtAhsB - 4wEkAgoB3wFMAgQBpwHHAgABDiAAAc4BDgEMASABsQFdAUwBzwHRAZoBhgH/AfkBwgGtAf8B+wHEAa8B - /wH8AcUBsAH/AfsBwgGtAf8B9wG9AagB/wH0AboBpQH/AfMBuQGjAf8B8wG4AaMB/wH0AbkBogH/AfIB - twGhAf8B8AGzAZ0B/wHtAbMBnAH/AecBrAGVAf8B3QGiAYwB/wHQAZYBgQH/AcUBjAF3Af8BuQGAAWsB - /wGqAXIBXgH/AWYBQwE2Af8BXAEWARIBvwHJAgIBEBAAAbACDAE5AXYBJQEjAZ4BagFNAUsB5QF5AXEB - bgH/AZcBjgGKAf8BqwGhAZ4B/wG6AbIBsAH/AcUBvgG8Af8ByAHCAcEB/wHIAcMBwgH/AcgBwwHCAf8B - yAHDAcIB/wHIAcMBwgH/AcoBwwHBAf8BzAHEAcIB/wHPAcUBwgH/AdUBxwHEAf8B2wHKAcQB/wHjAc0B - xwH/AekB0AHIAf8B6gHPAcQB/wHaAbwBsQH/AcABoQGVAf8BngF+AXIB/wF1AVYBSgH/AUsBNgEuAf8B - WQEZARYBvwHJAgIBEBAAAbACDAE5AXYBJQEjAZ4BagFNAUsB5QF5AXEBbgH/AZcBjgGKAf8BqwGhAZ4B - /wG6AbIBsAH/AcUBvgG8Af8ByAHCAcEB/wHIAcMBwgH/AcgBwwHCAf8ByAHDAcIB/wHJAcMBwgH/AcoB - xAHBAf8BywHEAcEB/wHPAcUBwgH/AdUBxwHEAf8B2wHKAcQB/wHjAc0BxwH/AekB0AHIAf8B6gHPAcQB - /wHaAbwBsQH/AcABoQGVAf8BngF+AXIB/wF1AVYBSgH/AUsBNgEuAf8BWQEZARYBvwHJAgIBEBwAAaQC - CgFDAWcCHwGkAVcBUQFTAewBaQF2AXsB/wF8AYwBkQH/AXQBhAGJAf8BdgGDAYYB/wGPAZoBngH/AcwB - 2gHeAf8BygHZAd4B/wHEAdMB2AH/Ab0BzQHSAf8BjwGZAbkB/wFoAWwBoQH/AkgBjwH/AkUBiwH/AkIB - hgH/AkMBgwH/AU0BUQGGAf8BZgFxAY8B/wF2AYgBjwH/AWIBcgF3Af8BUAFdAWEB/wFLAT8BQQHlAVwB - DgEPAZ4BpwIEATkYAAGtAQoBBwFDAYIBIwEaAqQBZQFUAewB1AGfAYsB/wH7AcYBsgH/Af0ByAGzAf8B - /QHIAbMB/wH9AcYBsgH/AfsBxAGvAf8B+gHCAa0B/wH5AcABqwH/AfkBwAGrAf8B/AHFAa4B/wH9AcIB - qwH/AfoBugGiAf8B+AG3AZ0B/wHwAawBkwH/AecBogGIAf8B5wGmAY4B/wHmAagBkQH/AeEBpQGOAf8B - 0AGUAX8B/wF4AVIBRQH/AV0BGQETAb8ByQICARAMAAGsAgcBNwF9ASMBIgGSAVIBUAFMAf8BewF1AXIB - /wGYAZEBjwH/Aa0BpwGmAf8BvQK4Af8BwwLAAf8DwwH/AcIBwwHEAf8BwgLEAf8BvwHCAcAB/wG0AbwB - tgH/AZsBrgGcAf8BjwGnAY0B/wGSAagBkAH/Aa8BtwGsAf8BwwHAAbwB/wHNAcUBwgH/AdQBxgHDAf8B - 3AHKAcUB/wHlAc4BxgH/Ae0B0gHIAf8B4wHFAbsB/wHKAasBnwH/AZ4BfQFxAf8BdAFXAU4B/wFuATMB - LQHTAaQCDgFbAcMCBAEeCAABrAIHATcBfQEjASIBkgFSAVABTAH/AXsBdQFyAf8BmAGRAY8B/wGtAacB - pgH/Ab0CuAH/AcMCwAH/A8MB/wHCAcMBxAH/AcICxAH/AcICxAH/AcACwwH/AawBtwGsAf8BmAGsAZcB - /wGKAaQBhwH/AZ8BrgGaAf8BtgG5Aa4B/wHNAcQBwQH/AdQBxgHDAf8B3AHKAcUB/wHlAc4BxgH/Ae0B - 0gHIAf8B4wHFAbsB/wHKAasBnwH/AZ4BfQFxAf8BdAFXAU4B/wFuATMBLQHTAaQCDgFbAcMCBAEeEAAB - 0AIBAQUBpwIHATwBcgElASYBnQFKAVIBVAH/AXgBhgGKAf8BhAGVAZoB/wGCAZIBlwH/AXkBiAGMAf8B - egGGAYkB/wGTAZ4BoQH/AdEB3gHjAf8BzwHdAeIB/wHJAdgB3AH/AcUB1AHZAf8BmQGjAcEB/wF9AYEB - sAH/Am0BpgH/AmABnQH/AlEBkgH/AUcBSAGJAf8BVQFZAY8B/wF9AYsBqQH/AZ8BtgG+Af8BmAGvAbcB - /wGHAZ0BpAH/AWEBcQF2Af8BFwEbAR0B/wGKAQcBCAFgGAABmgEWAQ8BcAFeATsBLAH/AaIBcAFdAf8B - 2AGkAZEB/wH8AckBtgH/AfwByQG2Af8B/QHIAbUB/wH9AcgBtAH/AfwByAGzAf8B+wHGAbEB/wH7AcUB - sAH/AfoBxAGvAf8B/QHEAawB/wH8AbcBnAH/AfYBoQGBAf8B6AGUAXUB/wHgAYsBbAH/Ad0BhwFnAf8B - 4AGRAXQB/wHsAacBjQH/AfMBtgGfAf8B5AGoAZMB/wGCAVwBTwH/AV0BGQETAb8ByQICARAMAAFZAhcB - rwFEAUIBQQH/AX8BegF3Af8BlAGPAYwB/wGsAagBpwH/AcABvgHAAf8BvwHAAcIB/wHAAcMBxAH/AcAB - xAHGAf8BwQHGAcgB/wHBAccByAH/AbUBwAG7Af8BkAGuAZQB/wFFAYUBRwH/ARwBbwEcAf8BIQFwASEB - /wF2AZwBeAH/AasBtgGsAf8BwwLCAf8ByAHDAcIB/wHPAcQBwgH/AdcBxwHDAf8B4QHMAcUB/wHtAdMB - ygH/AfAB0gHGAf8B1gG4AawB/wGgAYABdAH/AW4BTQFDAf8BTgIoAf8BnAIPAWUBzwIAAQUEAAFZAhcB - rwFEAUIBQQH/AX8BegF3Af8BlAGPAYwB/wGsAagBpwH/AcABvgHAAf8BvwHAAcIB/wHAAcMBxAH/AcAB - xAHGAf8BwQHGAcgB/wHCAccByQH/AcEBxwHJAf8BugHEAcIB/wF2AaABegH/ATgBfgE6Af8BCgFjAQoB - /wFDAX8BQwH/AYABnwGBAf8BvgG/AbsB/wHHAcEBwAH/Ac4BxAHCAf8B1wHHAcMB/wHhAcwBxQH/Ae0B - 0wHKAf8B8AHSAcYB/wHWAbgBrAH/AaABgAF0Af8BbgFNAUMB/wFOAigB/wGcAg8BZQHPAgABBQgAAdEC - AAEDAcICAgEXAUkBGQEaAcEBTgFVAVgB/wGOAZwBoQH/AZgBqAGtAf8BkgGjAagB/wGGAZYBmwH/AXwB - iwGPAf8BfQGIAYsB/wGXAaEBpAH/AdkB5wHrAf8B1gHjAegB/wHPAd0B4gH/Ac4B3QHiAf8BqQGyAc0B - /wGlAakBygH/ArcB1AH/ApcBvwH/Am8BpQH/AUwBTQGOAf8BWAFcAZQB/wGBAY4BrQH/AaUBuwHDAf8B - oAG4Ab8B/wGZAbEBuAH/AXUBiAGNAf8BHwEjASUB/wGNAQoBCwFgGAABqwEgARkBcAGAAVABPwH/Aa4B - egFnAf8B3AGpAZYB/wH9AcwBuQH/AfsBygG3Af8B/AHJAbYB/wH8AckBtgH/Af0BygG2Af8B/AHKAbYB - /wH8AcoBtgH/Af0ByAG0Af8B/QG6AZ8B/wH4AZoBdgH/AewBbgFAAf8BygFYAS4B/wHHAVgBLwH/AdEB - YgE5Af8BxAFdATcB/wHZAYcBagH/Ae8BsQGaAf8B5QGpAZQB/wGDAV0BUAH/AV8BGQEVAb8BygICARAM - AAFxAi4BrwFfAVsBWgH/AYwBhwGFAf8BpwKlAf8CuAG5Af8BwQHEAcUB/wHDAccByQH/AcUBygHMAf8B - xQHMAc4B/wHGAc0BzwH/AaoBwAGyAf8BfQGrAYMB/wE6AZABPQH/ASkBkAEtAf8BIQGRASYB/wEgAY8B - JAH/AUgBkgFMAf8BfwGlAYMB/wG9AcIBwQH/AsIBwwH/AccCwwH/Ac0BxAHCAf8B1QHHAcMB/wHhAc0B - xgH/AesB0QHIAf8B7AHNAcMB/wHAAaABlQH/AZABcQFlAf8BaQFKAUIB/wFPAR8BHQHXAXACBgGDBAAB - cQIuAa8BXwFbAVoB/wGMAYcBhQH/AacCpQH/ArgBuQH/AcEBxAHFAf8BwwHHAckB/wHFAcoBzAH/AcYB - zAHPAf8ByAHOAdEB/wHJAc8B0wH/AboByQHFAf8BkwG1AZkB/wFNAZoBUgH/ASMBjQEnAf8BHgGSASIB - /wElAYoBKAH/AUUBjwFHAf8BeAGeAXoB/wGqAbUBqgH/AcIBwAG+Af8BzQHEAcIB/wHVAccBwwH/AeEB - zQHGAf8B6wHRAcgB/wHsAc0BwwH/AcABoAGVAf8BkAFxAWUB/wFpAUoBQgH/AU8BHwEdAdcBcAIGAYMI - AAGZAgIBSAE+AgwBwwFcAVQBVwHvAX8BiwGOAf8BnQGsAbEB/wGaAaoBrgH/AZYBpQGqAf8BjgGeAaMB - /wGCAZEBlgH/AYIBjQGQAf8BnAGmAagB/wHhAe0B8QH/AeIB8AHzAf8B3QHrAe8B/wHaAekB7gH/AacB - sQHPAf8BhwGMAbwB/wJ6AbEB/wJ5AbAB/wJlAaEB/wFOAU8BkQH/AVoBXgGXAf8BgwGQAa8B/wGpAb8B - xwH/AagBwAHHAf8BpAG8AcMB/wF+AZEBmAH/ASEBJgEnAf8BjQILAWAYAAGtASIBGwFwAYcBVgFFAf8B - twGDAXEB/wHhAbABnQH/AfwBzgG8Af8B+gHMAbkB/wH8AcsBuAH/Af0BywG4Af8B/AHKAbgB/wH9AckB - tgH/Af0BxAGtAf8B/QG6AZ0B/wHwAZYBcQH/AeABdwFOAf8B0AFfATUB/wHaAWsBQAH/AeUBdAFJAf8B - 6gF5AUwB/wHXAWoBQgH/Ad8BiAFpAf8B6QGqAZMB/wHiAaoBlQH/AYIBXwFSAf8BYAEbARYBvwHKAgIB - EAwAAYkCRQGvAXwCeQH/AZ4CnAH/AbUBtgG3Af8BwAHEAcYB/wHEAcoBzAH/AccBzgHRAf8BygHRAdUB - /wHGAtEB/wGzAckBvgH/AX8BswGHAf8BTAGgAVIB/wEnAZgBLAH/ASkBoQEvAf8BKwGmATEB/wEoAaIB - LQH/ATcBlAE7Af8BbQGiAXIB/wG8AcUBwwH/AcEBxAHFAf8CwwHEAf8BxQHDAcIB/wHMAcUBwgH/AdYB - yQHEAf8B4gHNAcYB/wHuAdIByQH/AdkBugGvAf8BsgGUAYgB/wF6AVwBUgH/AUEBMAErAf8BWQIQAa8E - AAGJAkUBrwF8AnkB/wGeApwB/wG1AbYBtwH/AcABxAHGAf8BxAHKAcwB/wHHAc4B0QH/AcoB0QHVAf8B - zAHVAdgB/wHOAdcB2gH/Ac8B2AHcAf8BuAHNAcMB/wF2AawBfQH/AT4BnQFEAf8BIwGbASgB/wErAacB - MAH/ASMBmgEnAf8BKgGRAS4B/wFBAY8BRAH/AXcBoQF5Af8BogGyAaMB/wHCAcEBwAH/AcsBxAHCAf8B - 1gHJAcQB/wHiAc0BxgH/Ae4B0gHJAf8B2QG6Aa8B/wGyAZQBiAH/AXoBXAFSAf8BQQEwASsB/wFZAhAB - rwQAAZUCBgFSAWEBHgEfAasBQwFHAUgB/wF/AYgBiwH/AZMBngGhAf8BkgGdAaAB/wGUAaIBpQH/AZUB - pAGoAf8BkgGhAaYB/wGGAZUBmQH/AYQBjwGSAf8BngGnAakB/wHlAfEB9AH/AeoB9wH5Af8B5wH1AfgB - /wHkAfMB9wH/AaoBswHUAf8BfQGBAbgB/wJdAaQB/wJiAaQB/wJaAZ0B/wFPAVABlAH/AV0BYAGaAf8B - hgGTAbIB/wGsAcEByQH/Aa4BxAHLAf8BqwHCAckB/wGFAZgBngH/ASMBKAEqAf8BjQILAWAYAAGuASMB - HAFwAYsBWgFJAf8BvgGLAXkB/wHkAbQBogH/AfwBzwG9Af8B+gHMAbsB/wH8Ac0BuwH/Af0BzQG7Af8B - /AHLAbkB/wH7AbwBpgH/AfQBqAGKAf8B6AGOAWoB/wHeAXgBTwH/AdoBbwFEAf8B2wFwAUYB/wHrAX8B - UgH/AfEBggFVAf8B7AF9AVAB/wHVAWsBQwH/Ad0BiQFrAf8B6QGsAZYB/wHfAagBkwH/AYIBXgFRAf8B - YAEcARYBvwHKAgIBEAgAAb4CEwEwAZgCXwG+AZYClQH/AbICtAH/Ab8BwwHFAf8BxgHMAc8B/wHKAdEB - 1AH/AcwB1QHZAf8BygHXAdgB/wG5AdEBxgH/AYcBugGRAf8BUAGnAVcB/wEvAaIBNgH/ATcBsAE+Af8B - NwGyAT8B/wE1AbEBOwH/ATABrAE2Af8BOwGcAT8B/wFwAakBdgH/AcABywHKAf8BxAHJAcoB/wHDAccB - yAH/AcEBwwHEAf8BxgHEAcIB/wHNAcUBwwH/AdgByAHEAf8B5QHPAcYB/wHoAc0BwwH/AdABsQGnAf8B - jAFtAWMB/wFZAUMBPQH/AW0BIAEdAa8BvgITATABmAJfAb4BlgKVAf8BsgK0Af8BvwHDAcUB/wHGAcwB - zwH/AcoB0QHUAf8BzQHVAdkB/wHQAdkB3QH/AdIB3QHhAf8B1AHgAeQB/wHVAeIB5gH/AbwB1QHLAf8B - cwGyAX0B/wFBAaYBSQH/ASsBpQExAf8BMwGvATkB/wEuAaoBNAH/AScBnwEsAf8BIAGQASUB/wFAAY8B - QwH/AXUBoAF4Af8BrgG5AbEB/wLBAb4B/wHNAcUBwgH/AdgByAHEAf8B5QHPAcYB/wHoAc0BwwH/AdAB - sQGnAf8BjAFtAWMB/wFZAUMBPQH/AW0BIAEdAa8EAAFVAhQBrwFDAUcBSQH/AYYBkAGTAf8BngGoAasB - /wGTAZsBngH/AX4BhAGGAf8BjQGYAZsB/wGUAaMBpgH/AZQBpAGoAf8BiQGYAZwB/wGHAZIBlAH/AaEB - qQGrAf8B6QH0AfUB/wHuAfoB/AH/AesB+QH7Af8B6gH3AfoB/wGuAbYB1wH/AXwBgAG6Af8CVgGjAf8C - VAGfAf8CUQGaAf8CUgGYAf8BYAFjAZ4B/wGKAZYBtQH/AbABxAHMAf8BsgHHAc4B/wGvAcYBzAH/AYkB - nAGhAf8BJAEpASwB/wGOAgwBYAgAAbkBAQEAASEBrgEBAQABMAGxAQIBAQEwAcQBCQEDATABrgEqAR0B - iwGTAVoBRwH/AcEBiQF1Af8B4QGsAZkB/wH1AcQBsgH/AfkBywG5Af8B/AHPAb0B/wH9Ac4BuwH/AfwB - xgGxAf8B8wGkAYcB/wHlAYMBXgH/AdEBYwE7Af8B1gFsAUEB/wHjAXsBTgH/AfQBjQFfAf8B9QGMAV0B - /wHtAYEBVAH/Ad4BcwFJAf8BzwFxAU4B/wHeAZQBeQH/AewBswGfAf8B3AGlAZEB/wGBAV0BTwH/AWAB - HAEWAb8BygICARAIAAFvAlsB5wGGAn8B+AGiAaMBpAH/Ab8BxAHFAf8BxgHMAc8B/wHLAdMB1gH/Ac8B - 2AHcAf8B0QHdAeAB/wG9AdYBywH/AY4BwwGZAf8BNQGdATkB/wEzAakBOQH/AT8BuAFHAf8BQwG9AUsB - /wFBAbsBSQH/ATkBswFAAf8BLAGmATIB/wFOAaQBVAH/AYYBtQGPAf8BywHVAdcB/wHJAdEB1AH/AcYB - zAHOAf8BwwHHAcgB/wLCAcMB/wHHAsIB/wHPAcQBwgH/AdoByQHEAf8B6gHQAcgB/wHhAcIBuAH/Aa4B - jwGFAf8BfAFjAVwB/wGGATMBLwGvAW8CWwHnAYYCfwH4AaIBowGkAf8BvwHEAcUB/wHGAcwBzwH/AcsB - 0wHWAf8BzwHYAdwB/wHTAd4B4gH/AdYB4wHnAf8B2QHnAewB/wHcAeoB7wH/Ad0B7AHyAf8B0AHmAeQB - /wGrAdQBvAH/AVYBsQFgAf8BLAGkATIB/wE5AbQBQQH/ATYBsQE+Af8BMgGsATgB/wEsAaUBMgH/ASIB - kQEnAf8BQwGSAUYB/wF8AaIBfwH/Aa8BuQGxAf8BxQHBAcAB/wHPAcQBwgH/AdoByQHEAf8B6gHQAcgB - /wHhAcIBuAH/Aa4BjwGFAf8BfAFjAVwB/wGGATMBLwGvBAABbwIvAa8BawFxAXMB/wGuAbkBvQH/AZgB - oAGhAf8BhAGIAYkB/wF5AnwB/wGQAZoBnQH/AZgBpwGqAf8BmAGnAasB/wGOAZ0BoQH/AYsBlQGYAf8B - pAGrAa0B/wHtAfYB9wH/Ae8B+gH8Af8B6QH2AfkB/wHkAfEB9AH/AaoBsgHTAf8BewF/AboB/wJZAacB - /wJWAaMB/wJUAZ4B/wJVAZwB/wFjAWcBogH/AY4BmgG5Af8BtAHIAc8B/wG1AcoB0AH/AbEBxwHNAf8B - iQGbAZ8B/wEjASgBKgH/AY4BCwEMAWAIAAFVAQIBAQGfASIBBQECAecBLwEKAQQB5wGMASsBDgHnAakB - QQEdAfIBrAFUATMB/wG+AW8BUgH/Ac8BhwFsAf8B4AGgAYgB/wHzAcEBrgH/AfsBzQG7Af8B/QHIAbEB - /wH4AasBigH/AeABfwFaAf8B0QFoAUAB/wHRAWwBQQH/AewBiQFbAf8B+QGXAWcB/wH5AZYBZQH/AesB - hAFWAf8B1AFtAUMB/wHDAWEBPwH/AeEBmwGBAf8B8QG3AaIB/wHxAb0BqgH/AdoBpAGQAf8BgAFcAU8B - /wFjARwBGAG/AcoCAgEQCAABeQJ4Af8BkgGRAZIB/wGsAa4BrwH/AcUBywHNAf8BywHTAdYB/wHQAdoB - 3gH/AdAB3gHgAf8BuwHYAcoB/wGJAcUBlQH/AVUBswFfAf8BPAGxAUMB/wFCAbwBTAH/AUwBxQFWAf8B - TAHGAVYB/wE/AboBSAH/ATwBsQFEAf8BRgGrAU4B/wGGAcEBkgH/AbUB0wHDAf8B0gHeAeEB/wHOAdgB - 2wH/AcoB0QHUAf8BxgHLAc0B/wHCAcUBxwH/AcQBwwHEAf8ByQLDAf8B0wHGAcMB/wHjAc0BxwH/AeYB - yQHAAf8B0AGyAacB/wGVAXoBcQH/AZEBPgE5Aa8BeQJ4Af8BkgGRAZIB/wGsAa4BrwH/AcUBywHNAf8B - ywHTAdYB/wHQAdoB3gH/AdQB4AHlAf8B2QHmAesB/wHdAewB8QH/AeEB8AH2Af8B5AH0AfgB/wHmAfYB - +gH/AeEC9QH/AdMB7QHmAf8BjgHNAZsB/wFSAbQBWwH/ASkBpgEvAf8BNQGwATwB/wE4AbMBQAH/ATMB - rgE7Af8BKQGhAS8B/wEsAZUBMQH/AUABjwFDAf8BdgGfAXkB/wGkAbIBowH/AcYBwQG+Af8B0wHGAcIB - /wHjAc0BxwH/AeYByQHAAf8B0AGyAacB/wGVAXoBcQH/AZEBPgE5Aa8EAAF4AjoBrwFxAXgBegH/AacB - sAGyAf8BfQGBAYIB/wFwAnEB/wF4AnoB/wGUAZ0BoAH/AZ0BqgGuAf8BmwGqAa4B/wGQAZ4BogH/AYkB - kwGWAf8BoAGnAakB/wHpAfEB8wH/Ae0B9gH5Af8B6AH0AfcB/wHkAe8B8gH/AbwBxQHcAf8BlwGeAcgB - /wF2AXoBtwH/AWkBbAGvAf8BYQFiAagB/wFeAV8BpQH/AWsBbgGoAf8BkgGdAbsB/wG1AccBzQH/AbQB - xwHNAf8BsQHFAcsB/wGKAZoBnwH/ASMBKAEqAf8BjgELAQwBYAgAAXoBFQEHAa8BYQEnARAB/wGBATkB - HAH/AbQBWAEvAf8BywFuAUAB/wHSAX4BUQH/AdkBjgFjAf8B3QGYAW8B/wHdAZoBdQH/AdkBkgF0Af8B - 7AGoAYwB/wH0AasBjAH/Ad0BggFcAf8B2QF9AVQB/wHgAYUBWQH/Ae4BmAFpAf8B+QGfAXAB/wH9AaAB - cAH/AfkBmAFoAf8B4wF/AVEB/wHSAW0BQwH/AcgBZwFCAf8B1wGGAWYB/wHeAZUBeQH/AdwBmQGAAf8B - zQGOAXYB/wF8AVMBRAH/AWMBHAEWAb8BygICARAIAAGFAYQBhQH/AZwBnQGeAf8BswG3AbkB/wHKAdEB - 1AH/Ac8B2QHdAf8BzgHdAd4B/wHAAdwB0QH/AYcBxgGTAf8BWgG5AWQB/wFAAbYBSgH/AU0BxgFYAf8B - UwHMAV8B/wFUAc0BXwH/AU0ByQFYAf8BMgGyAToB/wErAaUBMAH/AT0BowFEAf8BcwG6AX4B/wGPAcQB - mwH/AZMBwQGeAf8BjwG7AZkB/wGMAbQBlAH/AYkBrgGPAf8BiAGpAY0B/wGbAa8BnAH/AbMBuQGwAf8B - ygHDAb8B/wHbAcoBxQH/AeUBzAHEAf8B5gHIAb0B/wGmAYkBgAH/AZgBRQE+Aa8BhQGEAYUB/wGcAZ0B - ngH/AbMBtwG5Af8BygHRAdQB/wHPAdkB3QH/Ac8B3gHfAf8ByAHfAdkB/wGrAdUBugH/AaAB0wGvAf8B - nQHVAawB/wGfAdkBrgH/AaEB2gGuAf8BoQHbAa4B/wGfAdkBrAH/AXkBxQGDAf8BSQGuAVAB/wEVAZYB - GAH/ASkBpwEuAf8BNgGyAT0B/wE5AbQBQgH/ATIBrQE5Af8BJwGfAS0B/wEjAZABJgH/AUEBjgFEAf8B - dwGgAXgB/wGsAbQBqAH/AcoBwgG+Af8B2wHKAcUB/wHlAcwBxAH/AeYByAG9Af8BpgGJAYAB/wGYAUUB - PgGvBAABfAI+Aa8BcgF4AXoB/wGfAacBqQH/AWkBawFsAf8DYAH/AXQCdgH/AZYBnwGiAf8BngGqAa4B - /wGYAaQBpwH/AYcBkAGSAf8BggGGAYgB/wGbAZ8BoAH/AeQB6wHtAf8B6wH0AfYB/wHpAfMB9gH/AeYB - 8QH0Af8B0AHaAeYB/wG5AcIB2QH/AaIBqwHNAf8BlwGeAcgB/wGLAZIBwQH/AYIBiAG6Af8BhwGOAbkB - /wGhAawBxAH/AbgByQHPAf8BtQHHAc0B/wGzAcUBywH/AYsBmwGgAf8BJAEpASoB/wGOAQsBDAFgBAAB - vwENAQcBWAGfASsBEgHLAacBSQEkAf8BzgFnATsB/wHdAX0BTgH/AegBkAFeAf8B7gGfAWoB/wHwAaoB - dQH/Ae4BrwF7Af8B5AGjAXQB/wHJAXQBTgH/AeABjAFoAf8B6gGVAXEB/wHJAWkBQgH/AdwBigFfAf8B - 8QGpAXoC/wG5AYkC/wGwAYAB/wH+AacBdwH/AfsBnQFsAf8B6QGIAVkB/wHgAXwBUAH/AdwBeQFPAf8B - 3AF9AVYB/wHcAX8BWwH/AdYBfQFcAf8BxgFzAVUB/wGMAUsBNAH/AXMBJgEVAdUBqgETAQIBYgHGAQcB - AAEhBAABhwGJAYoB/wGhAaUBqAH/AbkBwAHDAf8BzgHWAdkB/wHTAd4B4gH/AcMB3AHTAf8BmwHPAaoB - /wFAAa0BRgH/ATwBtwFDAf8BUgHNAV8B/wFbAdQBaAH/AV4B1gFrAf8BWgHTAWYB/wFKAcgBVQH/ASMB - qQEnAf8BDgGWAQ8B/wESAZMBFQH/ARUBkAEYAf8BFwGMARkB/wEWAYcBGAH/ARUBgQEWAf8BFAF8ARYB - /wEUAXYBFQH/ARsBcwEbAf8BSwGHAUwB/wGIAaQBhwH/Ar4BuAH/AdQBxwHDAf8B4gHLAcUB/wHvAc8B - xgH/Aa8BkgGKAf8BnwFLAUcBrwGHAYkBigH/AaEBpQGoAf8BuQHAAcMB/wHOAdYB2QH/AdMB3gHiAf8B - xgHeAdYB/wGjAdMBsgH/AU0BrgFUAf8BJwGgASsB/wEZAZ0BHAH/ARoBnwEcAf8BGwGfARwB/wEbAZ8B - HQH/ARsBngEcAf8BGAGbARoB/wERAZYBEwH/AQcBjQEHAf8BGgGbAR0B/wEtAasBNAH/AT8BugFIAf8B - OAGzAUEB/wEwAawBOAH/ASgBowEuAf8BHAGLASAB/wFDAY4BRQH/AX4BngF+Af8BvAG+AbYB/wHUAcYB - wwH/AeIBywHFAf8B7wHPAcYB/wGvAZIBigH/AZ8BSwFHAa8EAAF8Aj4BrwFzAXkBewH/AZ8BpwGpAf8B - YgFkAWUB/wFYAVkBWgH/AXACcgH/AZcBoAGjAf8BmQGkAacB/wGMAZMBlQH/AXcBcwFyAf8BeAFyAW8B - /wGWAZIBkAH/Ad0C5AH/AekB8gH0Af8B7AH2AfgB/wHqAfQB9wH/AeAB6wHuAf8B2gHmAekB/wHWAeIB - 5gH/AdgB5QHrAf8BzwHcAeUB/wHAAc0B2wH/AbcBxAHUAf8BugHJAdQB/wG/Ac8B1QH/AbsBywHQAf8B - tgHIAc0B/wGOAZ0BoQH/ASUBKgErAf8BjgIMAWAEAAGcAScBEwH/AbQBRAEiAf8B0QFmATsB/wHxAYoB - WQH/AfYBlgFjAf8B+AGgAWwB/wH5AakBcwH/AfsBswF7Af8B+wG+AYYB/wHwAbIBfwH/AcgBcgFKAf8B - 2gGDAV4B/wHjAYwBZwH/AcIBZQE9Af8B5QGhAXUB/wH9AcgBmQL/AcgBmQL/Ab0BjQH/Af4BsAGAAf8B - /QGjAXIB/wH8AZ0BbAH/AfoBlgFmAf8B+AGQAWEB/wH2AYwBXQH/AfABggFVAf8B5AF0AUkB/wHMAV0B - NgH/AbIBSgEkAf8BlgE7ARMB/wFxATUBAwH/AagBFQEBAWoBzQIBAQsBiAGKAYwB/wGmAaoBrQH/Ab4B - xgHJAf8B0AHaAd4B/wHOAeAB3gH/AZUBzAGjAf8BTQGzAVYB/wFIAb8BUQH/AVMBzAFfAf8BYQHZAW8B - /wFoAdwBdgH/AWsB3gF5Af8BawHeAXkB/wFmAdoBdAH/AVkB0QFkAf8BTwHJAVkB/wFLAcYBVQH/AUcB - wAFQAf8BQgG6AUsB/wE8AbMBRAH/ATUBrQE8Af8BLwGlATUB/wEoAZ4BLgH/ASMBlgEnAf8BJQGIAScB - /wFCAYcBQgH/AaEBsAGdAf8BxwHBAboB/wHdAckBxAH/AeoBzQHFAf8BsgGXAY8B/wGlAVEBSwGvAYgB - igGMAf8BpgGqAa0B/wG+AcYByQH/AdAB2gHeAf8BzwLgAf8BmAHMAaUB/wFPAbMBWAH/AUgBvQFRAf8B - TQHGAVcB/wFUAc0BXwH/AVkBzwFkAf8BWwHRAWYB/wFcAdIBaAH/AVsB0QFmAf8BVgHOAWEB/wFQAckB - WgH/AUgBxAFRAf8BSAHDAVEB/wFHAcEBUQH/AUUBvwFPAf8BPQG4AUYB/wE1AbEBPQH/AS0BqAE0Af8B - JAGcASgB/wEkAYoBJgH/AT4BhQE+Af8BnQGuAZkB/wHFAb8BuAH/Ad0ByQHEAf8B6gHNAcUB/wGyAZcB - jwH/AaUBUQFLAa8EAAF+AkEBrwF4AX4BgAH/AacBrwGxAf8BbwFyAXMB/wFxAXUBdgH/AY8BlgGYAf8B - lAGeAaEB/wGHAokB/wF9AXEBbAH/AY0BawFgAf8BjgFsAWAB/wGcAYUBfQH/A8cB/wHfAuUB/wHrAfMB - 9QH/AeoB8wH2Af8B5AHuAfEB/wHgAesB7gH/Ad4B6gHuAf8B4gHvAfMB/wHeAesB8QH/AdUB4gHpAf8B - zgHdAeMB/wHLAdoB4AH/AccB1wHdAf8BwAHQAdUB/wG7AcwB0QH/AZABnwGjAf8BJgEqASsB/wGPAgwB - YAQAAaQBNwEWAf8BxwFVAS4B/wHiAW8BQwH/AfMBhAFUAf8B7AGEAVUB/wHiAYEBUwH/AdkBgAFTAf8B - 2wGKAV4B/wHZAYsBYQH/AdYBiQFiAf8B1AGGAWYB/wHoAZsBegH/AesBmQF2Af8BxAFmAUAB/wHfAZsB - cQH/AfUBxQGXAv8B1AGlAf8B/gHFAZYB/wH4Aa4BfwH/Ae4BlAFlAf8B7QGMAV0B/wHtAYgBWgH/Ae8B - iAFZAf8B8gGIAVoB/wH0AYYBWAH/AfMBgQFUAf8B6wF3AUsB/wHZAWYBPQH/AcIBVAEsAf8BowFBARgB - /wF+ASMBDgHcAYsBDQEGAokBiwGOAf8BqgGuAbEB/wHCAcoBzgH/AdIB3gHiAf8BxwHgAdgB/wGEAckB - kQH/ATkBsAFAAf8BUwHLAV4B/wFjAdkBcQH/AW8B4AF+Af8BdgHjAYUB/wF6AeQBigH/AXwB5QGMAf8B - eQHkAYkB/wFzAeEBgQH/AWsB3QF4Af8BYgHZAW4B/wFaAdIBZgH/AVIBywFeAf8BSgHEAVUB/wFCAb0B - TAH/AToBtQFCAf8BMQGtATkB/wEoAaQBLgH/ARsBjQEeAf8BKgGBASsB/wGJAaUBhwH/ArsBsAH/AdkB - yAHDAf8B5QHMAcQB/wGzAZoBkgH/AagBVAFPAa8BiQGLAY4B/wGqAa4BsQH/AcIBygHOAf8B0gHeAeIB - /wHKAeAB3AH/AYcByQGTAf8BOAGvAT4B/wFRAcoBXAH/AWIB2AFwAf8BbwHfAX4B/wF2AeIBhQH/AXoB - 5AGKAf8BfAHlAYwB/wF5AeQBiQH/AXMB4QGBAf8BawHdAXgB/wFiAdkBbgH/AVoB0gFmAf8BUgHLAV4B - /wFKAcQBVQH/AUIBvQFMAf8BOgG1AUIB/wEyAa0BOQH/ASkBpAEuAf8BHAGOAR8B/wEpAYIBKgH/AYIB - oQGBAf8BuAG5Aa0B/wHZAcgBwwH/AeUBzAHEAf8BswGaAZIB/wGoAVQBTwGvBAABgAFCAUMBrwF9AYMB - hQH/AbMBugG8Af8BkAGVAZcB/wGMAZIBlAH/AZUBmwGdAf8BigGJAYgB/wGIAXcBcAH/AYwBawFfAf8B - oAFxAWEB/wGjAXMBYwH/AaQBfgFwAf8BqQGXAZEB/wHJAcYBxAH/AeAB5gHnAf8B6QHxAfQB/wHmAe8B - 8gH/Ad8B6QHrAf8B1gHgAeMB/wHcAeYB6gH/AdsB5wHrAf8B1wHkAecB/wHXAeQB6QH/AdMB4QHmAf8B - zQHdAeEB/wHGAdYB2wH/Ab4BzgHTAf8BkQGeAaIB/wElASkBKgH/AY8CDAFgBAABpwE8ARcB/wHTAV8B - NgH/Ae0BdAFIAf8B8gF8AU8B/wHVAW0BQwH/AcoBbwFKAf8BzQGBAWEB/wHdAaEBhAH/AeEBpwGMAf8B - 4gGnAY4B/wHpAbUBnwH/AfUBuQGfAf8B9AGsAY4B/wHcAYcBZAH/AdsBkQFrAf8B5gGrAYEB/wH9AdMB - pQH/Af4BxgGYAf8B9QGtAX4B/wHkAYoBXAH/AdYBcwFIAf8B1gFyAUgB/wHfAXoBUAH/Ad4BdgFMAf8B - 4QF1AUoB/wHnAXYBSgH/AfEBfAFPAf8B7AF1AUoB/wHfAWkBPwH/AcoBVwEvAf8BkAE4ARsB/wGNARsB - CwGvAYkBjQGPAf8BqwGwAbMB/wHEAcwB0AH/AdMB4QHlAf8BxgHiAdkB/wGFAcwBkgH/AT0BtgFDAf8B - WQHRAWYB/wFsAd4BewH/AXsB5AGLAf8BhAHoAZUB/wGKAeoBmwH/AYwB6wGdAf8BhwHpAZgB/wF+AeUB - jQH/AXIB4AGBAf8BZwHcAXQB/wFdAdUBagH/AVQBzgFgAf8BTAHHAVcB/wFEAb8BTgH/ATwBtgFEAf8B - NAGuAToB/wEqAaUBMAH/AR4BjwEhAf8BKwGEASwB/wGDAaIBgwH/AbYBuAGuAf8B1QHHAcIB/wHhAcoB - wwH/AbEBmQGSAf8BpwFWAVABrwGJAY0BjwH/AasBsAGzAf8BxAHMAdAB/wHUAeEB5QH/AcsB4wHdAf8B - iAHNAZUB/wE8AbUBQwH/AVgB0AFjAf8BagHcAXgB/wF3AeMBhwH/AYEB5gGRAf8BhwHpAZgB/wGJAekB - mgH/AYQB6AGWAf8BfQHkAYwB/wFyAeABgQH/AWcB3AF0Af8BXQHVAWoB/wFVAc4BYQH/AU4ByAFZAf8B - RgHAAVAB/wE9AbgBRgH/ATUBrwE8Af8BKwGnATEB/wEdAZEBIQH/ASkBhQErAf8BewGeAXsB/wGyAbcB - qQH/AdUBxwHCAf8B4QHKAcMB/wGxAZkBkgH/AacBVgFQAa8EAAGCAUMBRAGvAYIBhwGJAf8BvQHEAccB - /wGqAbEBsgH/AZwCnwH/AZIBjgGLAf8BjAF3AW8B/wGXAXMBZAH/AaUBdQFjAf8BrAF6AWgB/wGwAXwB - aQH/AasBegFpAf8BlwFyAWQB/wGyAaMBnQH/Ac0CzgH/AeQB7AHuAf8B5QHsAe8B/wHTAdoB3AH/AbQB - ugG8Af8BvQHDAcYB/wHBAckBzAH/AcYBzwHSAf8B1gHhAeYB/wHWAeQB6QH/AdEB4AHkAf8ByQHZAd4B - /wG8AcoBzwH/AY0BmAGcAf8BJgIoAf8BeQEPAQ0BgwG7AQQBAgEmAacBPAEXAf8B2QFjATkB/wHyAXYB - SgH/AfABdgFLAf8BvQFZATQB/wG4AWkBTQH/Ac4BlwGCAf8B7AHLAbsB/wH1AdcByAH/AfcB1gHIAf8B - +wHeAdEB/wH9AdMBwQH/AfsBwgGqAf8B9QGtAY4B/wHeAZABbgH/AdkBkQFqAf8B7QG3AYoB/wH4AbsB - jAH/AfYBqwF8Af8B5QGLAVwB/wHKAWYBPQH/AcgBZgFAAf8B1QF3AVMB/wHTAXMBTwH/AdMBbgFIAf8B - 1gFrAUMB/wHiAXABRQH/AewBdQFKAf8B7wF1AUkB/wHlAWwBQQH/AbcBTgEoAf8BrAEoARABrwGKAZAB - kgH/AaoBsgG1Af8BxAHOAdIB/wHXAeQB6AH/AdgC6wH/AZMB0wGhAf8BQAG1AUUB/wFUAcwBXgH/AW4B - 3QF8Af8BhgHoAZcB/wGTAe0BpQH/AZoB8AGtAf8BmwHxAa4B/wGUAe4BpwH/AYQB5wGUAf8BdAHgAYMB - /wFnAdsBdQH/AVsB1AFoAf8BUgHNAV4B/wFKAcUBVQH/AUIBvQFMAf8BOgG0AUIB/wEyAasBOAH/ASgB - oAEtAf8BIAGKASQB/wE3AYQBOQH/AaEBsgGiAf8BxAHAAb0B/wHTAcYBwgH/Ad4ByAHBAf8BrgGXAZEB - /wGlAVQBUAGvAYoBkAGSAf8BqgGyAbUB/wHEAc4B0gH/AdcB5AHpAf8B2wHsAe8B/wGZAdUBpwH/AUQB - uAFLAf8BTQHIAVYB/wFjAdcBcAH/AXkB4wGJAf8BhgHoAZYB/wGMAesBnQH/AY4B6wGfAf8BiQHpAZsB - /wGAAeUBkAH/AXQB4AGDAf8BZwHbAXUB/wFeAdYBawH/AVcB0AFjAf8BUQHLAV0B/wFIAcMBUwH/AUAB - ugFIAf8BNwGxAT4B/wErAaUBMQH/AR8BjAEjAf8BMgGDATQB/wGaAbABnAH/AcABvwG6Af8B0wHGAcIB - /wHeAcgBwQH/Aa4BlwGRAf8BpQFUAVABrwQAAYICQwGvAYUBiwGNAf8BxAHMAc8B/wGjAaUBpgH/AZMB - iAGDAf8BlAF3AWsB/wGvAYEBcAH/AbkBhgFzAf8BuAGGAXIB/wGvAX4BawH/Aa8BfQFqAf8BrwF8AWkB - /wGrAXgBZgH/AacBiAF+Af8BtgGqAacB/wHcAeIB5AH/AeAB5wHpAf8BtAG4AbkB/wNoAf8BdgJ4Af8B - hAKHAf8BmgGeAaAB/wHOAdgB3AH/AdsB6AHsAf8B1QHjAecB/wHHAdUB2QH/AbABuwG/Af8BggGHAYoB - /wEuAScBJAH/ATMBGgESAfUBawEPAQoBpAGnATwBFwH/AdkBYwE5Af8B8gF2AUoB/wHuAXUBSgH/AbAB - VQE2Af8BtAF0AV4B/wHbAbQBowH/AfcB4QHWAf8B/gHqAd8B/wH9AeYB2gH/Af0B4gHXAf8B/gHgAdMB - /wH+AdcBxwH/AfsBwAGnAf8B7gGqAYsB/wHaAYwBagH/AcEBZgE/Af8B6AGaAW0B/wH8Aa0BfAH/AfoB - oAFuAf8B4AF+AVAB/wHZAX8BWQH/AeABkwF1Af8B8gGlAYYB/wHpAZcBdQH/AdQBeQFVAf8BvwFWATAB - /wHXAWQBOwH/Ae4BdAFJAf8B8QF1AUkB/wHQAV0BNAH/AcIBNQEbAa8BigGQAZMB/wGnAa8BsgH/AcEB - ywHQAf8B2AHlAeoB/wHeAe8B8wH/AcMB6AHVAf8BlQHZAaAB/wFjAc0BawH/AWUB1AFwAf8BfQHjAYwB - /wGZAe8BrAH/AaYB9AG6Af8BpQH0AbgB/wGSAewBpAH/AV8B1AFqAf8BSAHGAU8B/wFaAcgBXwH/AWcB - ygFtAf8BagHIAXEB/wFlAcIBbgH/AWABvAFqAf8BWgGzAWMB/wFVAaoBXQH/AVMBowFaAf8BYwGiAWgB - /wGBAacBhQH/AbQBvAG3Af8BxwHCAcEB/wHSAcUBwQH/AdsBxQG/Af8BqAGSAY0B/wGfAVABSwGvAYoB - kAGTAf8BpwGvAbIB/wHBAcsB0AH/AdgB5QHqAf8B3wHvAfQB/wHIAeoB2gH/AaIB3gGsAf8BgQHVAYgB - /wF5AdYBfgH/AXoB2QGAAf8BfwHdAYQB/wGBAd8BhwH/AYIB3wGHAf8BgAHcAYYB/wF0AdYBeQH/AVcB - ygFcAf8BKAG2AS0B/wE9AcIBRgH/AUsByQFWAf8BUgHMAV4B/wFJAcQBVAH/AT8BuQFIAf8BNAGtATwB - /wEqAZkBLgH/AUYBlwFKAf8BdQGhAXkB/wGwAboBswH/AcYBwgHAAf8B0gHFAcEB/wHbAcUBvwH/AagB - kgGNAf8BnwFQAUsBrwQAAXoCOgGvAXEBdAF1Af8CpAGlAf8BngGKAYIB/wGkAYMBdQH/AbIBhwF1Af8B - wQGPAXsB/wHHAZIBfQH/AcQBkAF6Af8BuAGGAXIB/wGyAYABbAH/Aa4BfAFpAf8BsAF8AWgB/wGnAXoB - awH/AaoBjQGEAf8BugK4Af8B1AHVAdYB/wGuArAB/wNcAf8DXwH/Am8BcAH/AY4BkQGTAf8B0AHaAdwB - /wHcAegB7AH/Ac0B2gHdAf8BrwG5AbwB/wGRAY8BjgH/AXMBYwFdAf8BTwEzASoB/wFOASsBHwH/AXgB - GwESAa8BpwE8ARcB/wHQAV0BNAH/AeoBcAFFAf8B7wF2AUsB/wG1AV0BPgH/Ab0BggFtAf8B5gHEAbUB - /wH5AeMB2QH/Af4B6QHfAf8B/QHmAdwB/wH9AeQB2gH/Af4B5AHaAf8B/gHhAdQB/wH9AdYBxQH/AfgB - wQGqAf8B6gGmAYkB/wHUAYQBYwH/AdwBhwFfAf8B6wGRAWMB/wH8AZ0BbQH/AfABjgFeAf8B3wF+AVQB - /wHTAXkBVwH/AekBowGKAf8B6QGkAYkB/wHbAYwBbwH/Ab0BZAFDAf8B0AFkAT4B/wHnAW0BQwH/AfIB - dgFLAf8B1gFhATgB/wHJATkBHgGvAYkBjwGSAf8BogGqAa4B/wG9AccBzAH/AdgB5QHqAf8B4AHwAfYB - /wHhAfUB9AH/AdIB8gHgAf8BmAHcAZ0B/wFyAdUBeQH/AWgB2QFzAf8BkQHsAaIB/wGmAfQBugH/AaoB - 9gG+Af8BmQHuAasB/wFiAdUBbgH/AUIBwgFHAf8BQQG4AUEB/wF/Ac0BgQH/AZ4B1wGkAf8BoQHYAa0B - /wGbAdEBqgH/AZUByAGkAf8BkQG/AZwB/wGPAbkBmQH/AZ8BuwGnAf8BsgG/AbcB/wG+AsEB/wHIAcMB - wgH/Ac8BwwG/Af8B0QG9AbcB/wGgAYwBhwH/AZsBTQFHAa8BiQGPAZIB/wGiAaoBrgH/Ab0BxwHMAf8B - 2AHlAeoB/wHgAfAB9gH/AeMC9gH/Ad4B9wHrAf8BwAHpAcUB/wGyAeUBswH/Aa0B5AGtAf8BrQHmAa0B - /wGtAecBrQH/AawB5gGsAf8BqgHkAaoB/wF/AdQBfwH/AVEBwwFTAf8BJAGzASgB/wE+AcMBRwH/AU4B - ywFZAf8BUgHMAV4B/wFJAcMBVAH/ATkBsgFBAf8BLgGhATUB/wFJAZ0BTgH/AXkBqgF+Af8BpwG6Aa0B - /wG8AcABvwH/AcgBwwHCAf8BzwHDAb8B/wHRAb0BtwH/AaABjAGHAf8BmwFNAUcBrwGLAQMBAgFgAV0B - MAEvAc0BagFhAVwB/wGhAYwBhAH/AbQBjQF8Af8BwQGRAXwB/wHIAZcBgQH/AckBlwGCAf8BywGXAYIB - /wHLAZYBgAH/AcIBjwF5Af8BuAGFAXEB/wGwAX8BbAH/AbABfQFpAf8BqgF3AWUB/wGmAXsBbQH/AaAB - iwGEAf8BwQG5AbcB/wOwAf8BewF8AX0B/wFyAXMBdAH/AXkBegF8Af8BkgGUAZYB/wHNAdUB2AH/Ac4B - 2AHbAf8BtgG8Ab0B/wGTAY8BjQH/AXoBZwFgAf8BaQFIAT0B/wFfATQBJwH/AVABKgEdAf8BcwEZARAB - rwGoASkBEAH/AcQBTQEpAf8B3QFmAT0B/wHqAXMBSgH/AbkBZAFGAf8BxQGRAXwB/wHvAdMBxwH/AfsB - 5QHcAf8B/gHoAd8B/wH9AecB3QH/Af0B5wHdAf8B/gHpAd8B/wH+AekB3gH/Af4B5QHaAf8B/QHUAcMB - /wH3AcIBqgH/AesBrgGRAf8B2wGLAWgB/wHeAYEBWAH/Ae8BjAFeAf8B9gGSAWIB/wHnAYABVAH/AdIB - cAFIAf8B3wGYAYAB/wHjAaMBjAH/AdsBlAF7Af8BvQFmAUgB/wHOAWQBPgH/AeUBbAFCAf8B8gF2AUsB - /wHWAWEBOAH/AckBOQEeAa8BgQGGAYsB/wGZAaIBpgH/AbcBwgHGAf8B1gHiAecB/wHgAe8B9QH/AegB - +AH8Af8B7QH9AfsB/wHiAfcB5wH/AZgB4AGaAf8BWQHPAV0B/wF7AeMBiAH/AZkB7wGqAf8BqAH2AbwB - /wGjAfMBtwH/AYkB6AGaAf8BYAHTAWsB/wEoAbIBKgH/AZYB2QGaAf8B1wHyAeAB/wHtAf0C/wHlAfYB - +wH/Ad0B7AHyAf8B1gHiAeYB/wHPAdkB3AH/AckB0AHTAf8BwwHIAcoB/wHBAcIBwwH/AcgBwwHCAf8B - ywG/AbsB/wHAAa0BqAH/AZQBggF8Af8BlAFHAUMBrwGBAYYBiwH/AZkBogGmAf8BtwHCAcYB/wHWAeIB - 5wH/AeAB7wH1Af8B6AH4AfwB/wHxAf4C/wH5A/8B/Q//AfwB/gH8Af8B8gH6AfIB/wGZAdwBmQH/AWAB - zAFjAf8BVwHSAWMB/wFeAdYBawH/AVwB1AFpAf8BUgHLAV4B/wFFAb4BTwH/ATMBpwE6Af8BMQGVATYB - /wGEAbMBjAH/Aa8BwgG3Af8BwgHIAckB/wHAAcIBwwH/AcgBwwHCAf8BywG/AbsB/wHAAa0BqAH/AZQB - ggF8Af8BlAFHAUMBrwEcAQwBBwH/AUEBLwEpAf8BeQFaAU4B/wG8AYwBdgH/Ad0BqQGQAf8B4QGtAZMB - /wHUAaIBigH/AcoBmgGEAf8BygGYAYIB/wHNAZgBggH/AcsBlgGAAf8BwQGNAXkB/wG2AYQBcQH/Aa4B - fgFrAf8BsAF9AWsB/wGpAXYBZQH/AZMBZQFTAf8BqwGXAZAB/wG2ArIB/wG0AbcBuQH/AacBqgGsAf8B - nwGiAaQB/wGhAaUBpwH/AcEBxwHKAf8BsgK2Af8BlAGNAYoB/wF4AV0BVQH/AWsBRwE7Af8BYgE2ASkB - /wFYASUBGgH/AUABGAEOAfABZAELAQUBnwGsAQYBAwHnAbQBNQEaAfgByAFXATEB/wHcAWwBRAH/AboB - awFOAf8BzAGfAYwB/wH2AeIB2AH/AfwB6QHhAf8B/gHqAeEB/wH9AekB4AH/Af4B7AHiAv8B7gHkAv8B - 7wHlAv8B7QHkAf8B/gHiAdYB/wH9AdoByAH/Af4B1QG8Af8B5QGjAYcB/wHZAYMBYAH/AdgBdAFJAf8B - 7wGJAVsB/wHrAYQBVwH/AdsBdwFPAf8B2gGPAXUB/wHbAZsBhQH/AdYBkQF6Af8BvgFeAT4B/wHSAWMB - PAH/AekBcAFFAf8B8QF1AUoB/wHSAV0BNQH/AcQBNgEbAa8BWQFaAVsB/wGFAY0BkAH/Aa0BuQG9Af8B - 0QHdAeIB/wHdAewB8gH/AeYB9gH6Af8B7gH8Af4B/wHyAf0B+gH/AdkB9QHdAf8BqgHmAawB/wFfAdIB - YwH/AW8B3QF6Af8BiwHqAZsB/wGWAe4BqAH/AYkB6gGbAf8BcwHfAYIB/wFUAc8BXwH/AWwBzAFzAf8B - ogHdAawB/wHoAvsB/wHjAfQB+AH/AdsB6gHwAf8B1AHgAeQB/wHNAdcB2gH/AccBzgHRAf8BwwHHAcgB - /wLCAcMB/wHJAcIBwQH/AcMBtgGzAf8BowGSAY0B/wF7AWkBZgH/AYcBOgE3Aa8BWQFaAVsB/wGFAY0B - kAH/Aa0BuQG9Af8B0QHdAeIB/wHdAewB8gH/AeYB9gH6Af8B7wH8Av8B9wH+Av8B+wP/Af4L/wHwAfoB - 8QH/AccB7QHIAf8BeAHXAX0B/wFVAdABXgH/AWoB3QF4Af8BYgHYAXAB/wFZAdEBZQH/AU0BxgFYAf8B - OQGvAUEB/wFTAa0BWwH/AYYBuQGQAf8BtAHKAcAB/wHCAcwBywH/AcMBxwHIAf8CwgHDAf8ByQHCAcEB - /wHDAbYBswH/AaMBkgGNAf8BewFpAWYB/wGHAToBNwGvAV0BMAEhAf8BjgFjAVIB/wG3AYoBdgH/AdkB - pwGPAf8B5gGyAZgB/wHnAbMBmQH/AeEBrAGUAf8B1AGgAYoB/wHNAZoBhAH/AcsBmAGBAf8BzQGZAYIB - /wHJAZUBfwH/AcEBjgF5Af8BtAGEAXAB/wGxAX8BbAH/Aa8BfAFpAf8BrAF5AWYB/wGkAYEBdAH/Aa0B - nQGYAf8BxgLJAf8B1QHZAdoB/wHPAdQB1QH/AbsBwAHBAf8BpQGiAaEB/wGPAX8BeQH/AXwBXgFUAf8B - cAFJATwB/wFYATUBKAH/AUEBIAEXAf8BLgEJAQcB/wF/AQUBAwF+AbwBAgEBASEBywECAQEBMAGpAScB - EAG+AaMBQQEgAf8BswFSAS8B/wG4AXABVwH/AdUBqwGbAf8B+gHpAeEB/wH9Ae0B5QH/Af4B7gHmAf8B - /gHvAeYC/wHyAegC/wHyAekC/wHxAegC/wHvAeYB/wH+AeoB4AH/Af4B5wHaAv8B6AHXAf8B9wHIAbMB - /wHkAaABgwH/AcwBcgFQAf8B1QF2AU8B/wHRAXEBSwH/Ac0BdQFUAf8B5QGwAZwB/wHkAbABnQH/AdgB - kwF7Af8B0gFoAUIB/wHjAWwBQgH/Ae8BdQFJAf8B7QFyAUcB/wHJAVYBLgH/Ab4BLwEWAa8BlQIlAXgB - kAF1AXcB1QGgAawBsAH/AcEBzQHSAf8B1gHlAesB/wHiAfIB+AH/AeoB+gH+Af8B8gH9Av8B8AH9AfcB - /wHbAfUB3gH/AZ0B4gGfAf8BeAHZAX0B/wFrAdkBdgH/AX0B4wGNAf8BfAHkAYwB/wFzAeABggH/AWIB - 2AFvAf8BXAHGAWUB/wGNAdQBmAH/AeEC9gH/Ad8B8AH0Af8B2QHmAewB/wHSAd0B4AH/AcwB1AHXAf8B - xgHMAc4B/wHCAcUBxwH/AcMBwgHDAf8BwwG8AboB/wG1AakBpQH/AY8BgAF8Af8BYQFVAVIB/wFzASsB - KAGvAZUCJQF4AZABdQF3AdUBoAGsAbAB/wHBAc0B0gH/AdYB5QHrAf8B4gHyAfgB/wHqAfoB/gH/AfIB - /QL/AfgD/wH8A/8B/gf/AegB9wHoAf8BpwHhAacB/wFrAdMBcgH/AVQB0gFgAf8BaQHdAXcB/wFdAdQB - agH/AUsBxQFVAf8BOAGxAUAB/wFXAbQBYAH/AYYBwAGQAf8BtgHPAcMB/wHGAtEB/wHGAcwBzgH/AcIB - xQHHAf8BwwHCAcMB/wHDAbwBugH/AbUBqQGlAf8BjwGAAXwB/wFhAVUBUgH/AXMBKwEoAa8BbAE4ASYB - /wGrAXcBYQH/AdABnQGFAf8B3wGsAZQB/wHkAbEBmAH/AegBtAGaAf8B6QGzAZoB/wHfAasBkgH/AdQB - oQGKAf8BzAGaAYMB/wHLAZkBggH/AcwBmQGCAf8BygGVAX8B/wHAAY0BeAH/AbYBhAFwAf8BsQF/AWwB - /wGwAX0BagH/AacBeQFpAf8BpgGHAXwB/wGtAaQBoAH/AcUCxAH/AbwBuwG6Af8BogGaAZYB/wGNAXYB - bgH/AX4BXQFRAf8BcAFHAToB/wFfATYBKQH/AToBIAEXAf8BNwEMAQkB3QF5AgEBgAG0AgABLQgAAXsB - FAEIAa8BZAEmARAB/wGHAToBHwH/AbUBdwFiAf8B3QG4AakB/wH8Ae4B5gH/Af4B8gHqAf8B/gHyAesB - /wH+AfIB6gH/Af4B9AHsAv8B9QHsAv8B8wHqAf8B/gHuAeUB/wH9AesB4gH/Af0B6wHhAf8B/gHuAeIB - /wH9AeAB0AH/AfMByAG1Af8B4wGrAZQB/wHhAaQBigH/Ad8BogGJAf8B4AGqAZUB/wHwAcsBvAH/AekB - uAGlAf8B3wGSAXcB/wHlAXQBSwH/AewBcgFHAf8B6gFwAUUB/wHVAV8BNgH/AacBQwEgAf8BowEiAQ4B - rwQAAZIBWAFZAa8BiAGUAZgB/wGsAbkBvgH/AcsB2QHfAf8B3QHsAfIB/wHmAfcB/AH/Ae0B/AL/AfQD - /wHzAf4B+gH/AeIB9wHlAf8BoQHhAaQB/wFrAdEBcAH/AVoB0AFlAf8BYgHXAW8B/wFjAdgBcQH/AVkB - 0QFkAf8BWgHDAWMB/wGLAdEBmQH/Ad0B8gHzAf8B2wHrAfAB/wHWAeIB5wH/AdAB2gHdAf8BygHRAdQB - /wHFAcoBzAH/AcIBxAHFAf8BxAHBAcIB/wG5AbEBrwH/AaMBlwGUAf8BgAFzAW8B/wFoAT8BPgHXAYIB - GQEXAYMEAAGSAVgBWQGvAYgBlAGYAf8BrAG5Ab4B/wHLAdkB3wH/Ad0B7AHyAf8B5gH3AfwB/wHtAfwC - /wH0A/8B+QP/AfwD/wH+A/8B5wH3AegB/wGlAeABpgH/AWgB0AFvAf8BTgHMAVkB/wFeAdYBawH/AU8B - yAFZAf8BRQG6AU0B/wFHAawBTgH/AYkBxAGVAf8BtQHTAcMB/wHNAdkB2wH/AcoB0QHUAf8BxQHKAcwB - /wHCAcQBxQH/AcQBwQHCAf8BuQGxAa8B/wGjAZcBlAH/AYABcwFvAf8BaAE/AT4B1wGCARkBFwGDAYQB - KAEcAb8BrAFsAVgB6wHJAZYBfwH/Ad0BqgGSAf8B4AGuAZUB/wHmAbMBmQH/AesBtgGcAf8B6AGzAZkB - /wHeAaoBkgH/AdEBoAGIAf8BywGaAYMB/wHNAZoBgwH/Ac8BmgGDAf8BywGWAYAB/wG+AYsBdwH/AbQB - gwFwAf8BrwF9AWsB/wGsAXoBaAH/AaQBeAFpAf8BlgF6AXEB/wGkAZYBkgH/AZkBiwGFAf8BhQFrAWEB - /wF7AVQBRgH/AXABRQE2Af8BZwE0ASYB8wFuASABFwHHAVABDQEJAb8BXwECAQEBjwHJAgABDAwAAXUB - BQECAYMBWgEZAQ8B1wGAAUABLAH/Ab4BiAF1Af8B5gHFAbcB/wH9AfEB6gH/Af4B9gHwAf8B/gH2Ae8B - /wH+AfQB7QH/Af4B9gHuAv8B9wHvAv8B9AHtAf8B/gHvAecB/wH9Ae0B5AH/Af0B7QHkAf8B/gHvAeYB - /wH9AewB4QH/AfgB4gHVAf8B7wHRAcMB/wHqAcsBvAH/AewBzgHAAf8B8QHWAcsB/wHzAdgBzAH/AesB - tgGiAf8B5QGOAXAB/wHwAXoBUAH/AekBcAFEAf8B1gFiATgB/wG2AUkBIwH/AZYBLAETAdcBnwESAQcB - gwQAAW4CMQGvAV8BaAFsAf8BlQGjAakB/wG7AckBzwH/AdMB4QHnAf8B4QHxAfcB/wHnAfkB/QH/Ae0B - /QL/AfID/wH2Af8B/gH/AeIB9wHoAf8BpQHfAaoB/wEqAbABLAH/AToBvgFBAf8BRAHEAU4B/wE3AbgB - PwH/AV8BvgFpAf8BmQHSAakB/wHeAe0B8wH/AdkB5gHrAf8B0wHdAeIB/wHNAdUB2QH/AcgBzgHQAf8B - wwHIAckB/wHBAcIBwwH/AcMBvwG9Af8BqgGhAZ8B/wGNAYEBfgH/AXMBZwFjAf8BqgEnASUBZQHQAgEB - BQQAAW4CMQGvAV8BaAFsAf8BlQGjAakB/wG7AckBzwH/AdMB4QHnAf8B4QHxAfcB/wHnAfkB/QH/Ae0B - /QL/AfID/wH3A/8B+gP/AfIB/AH1Af8B1wHxAdsB/wFsAcoBcQH/ATcBuwE+Af8BTgHKAVgB/wE0AbEB - OgH/AVMBtQFcAf8BnwHPAa4B/wHGAd0B1wH/AdIB3QHhAf8BzQHVAdkB/wHIAc4B0AH/AcMByAHJAf8B - wQHCAcMB/wHDAb8BvQH/AaoBoQGfAf8BjQGBAX4B/wFzAWcBYwH/AaoBJwElAWUB0AIBAQUBzwECAQEB - CAGZAToBLQGyAaIBcwFeAf8B2wGlAY4B/wHdAaoBkgH/AeEBrwGWAf8B5gGzAZoB/wHsAbcBnQH/AegB - swGaAf8B3QGqAZIB/wHQAZ4BhwH/AcwBmgGEAf8BzQGaAYQB/wHRAZwBhQH/AcgBlQF/Af8BvQGLAXcB - /wGxAX8BbQH/AbABfgFsAf8BqwF4AWUB/wGgAW0BXAH/AYgBZQFZAf8BgQFeAVEB/wGAAVYBRwH/AXEB - SAE5Af8BWgEyASQB/wFfARkBEAHRAb4BBQEDAScBzQEBAQABCAHOAgABBgHSAgABAQwAAdACAAEFAcUB - LQEoAWUBvQF7AW4B/wHaAagBmAH/AfAB0QHGAf8B/gH1AfAC/wH5AfQC/wH5AfMB/wH+AfcB8QH/Af4B - 9wHxAv8B+AHyAv8B+AHxAf8B/gH2Ae8B/wH+AfEB6gH/Af4B7gHnAf8B/gHvAegB/wH6AewB5QH/AekB - 1QHKAf8BzgGvAaEB/wHVAbkBrAH/Ad0BwwG2Af8B5gHMAcAB/wHoAc0BwAH/AecBqwGVAf8B5gGEAWMB - /wHqAXQBSgH/AdABXQE0Af8BsgFGASEB/wGVATYBFgH/AbgBFAEIAWUB0QEBAQABBQQAAVkCHwGvAUgB - UwFVAf8BiAGWAZsB/wGiAbEBtwH/Ab4BzAHSAf8B1gHlAesB/wHfAfAB9QH/AeYB9wH7Af8B6gH7Af0B - /wHuAf0B/gH/AesB+wH5Af8B0wHzAd8B/wGbAdwBpgH/AX0B0AGIAf8BbgHJAXkB/wFwAcUBfAH/AaAB - 1gGwAf8BwwHiAdYB/wHaAegB7QH/AdQB4AHkAf8BzwHYAdwB/wHKAdEB1AH/AcUBywHMAf8BwQLFAf8B - vAG6AbsB/wGuAagBpgH/AZYBjQGLAf8BdQFsAWkB/wFFAUEBPwH/AZwBFwEWAWAIAAFZAh8BrwFIAVMB - VQH/AYgBlgGbAf8BogGxAbcB/wG+AcwB0gH/AdYB5QHrAf8B3wHwAfUB/wHmAfcB+wH/AeoB+wH9Af8B - 7gH9Af4B/wHxAf4C/wHvAf0B/AH/AeYB+gHzAf8BqQHhAbYB/wF7Ac0BhwH/AWYBxAFyAf8BdQHDAYEB - /wGXAc0BpQH/AcYB3QHWAf8BzwHdAd8B/wHPAdgB3AH/AcoB0QHUAf8BxQHLAcwB/wHBAsUB/wG8AboB - uwH/Aa4BqAGmAf8BlgGNAYsB/wF1AWwBaQH/AUUBQQE/Af8BnAEXARYBYAgAAWYBFwESAa8BYAFBATQB - /wGsAXkBZAH/AdABnQGFAf8B3gGsAZMB/wHgAa4BlgH/AecBtAGaAf8B6gG1AZsB/wHnAbIBmQH/AdwB - qAGQAf8B0gGgAYkB/wHNAZsBhQH/Ac8BmwGEAf8BzgGZAYIB/wHHAZMBfgH/AbwBiQF1Af8BtAGCAW8B - /wGvAX4BawH/AasBeAFlAf8BkgFjAVMB/wGAAVIBQwH/AW0BQgEyAf8BQQEmAR0B/wFtARQBDgGoAa8B - CAEFAUEBzgIBAQocAAHNATEBKgFgAcYBhwF0Af8B4gG5AaoB/wH0Ad4B1QH/Af4B+AH1Av8B/AH4Av8B - +gH2Af8B/gH4AfMB/wH+AfgB8gH/Af4B9wHxAf8B/gH3AfEB/wH+AfcB8QH/Af4B9AHuAf8B/gHzAewB - /wH9AfIB6wH/AfIB5AHdAf8B3AG/AbMB/wG/AYsBeQH/AcoBlAGAAf8BzQGXAYUB/wHNAZgBhgH/AckB - kwF/Af8ByQF9AWIB/wHGAWIBQAH/AboBUAErAf8BlQE7ARwB/wGLASUBEAHTAboBEgEHAVsBywEGAQMB - HggAAYYCDgFoAV0CMAG+AVgBYwFlAf8BhgGUAZoB/wGmAbYBvAH/Ab4BzAHSAf8B0QHgAeYB/wHdAewB - 8QH/AeMB8wH4Af8B5gH2AfoB/wHoAfgB/AH/AeQC9wH/AdcB8QHpAf8BuAHiAcgB/wGnAdkBtwH/AasB - 2AG8Af8ByQHjAdsB/wHVAeUB6AH/AdUB4QHlAf8B0AHZAd0B/wHLAdMB1QH/AcYBzAHOAf8BwAHFAcYB - /wG3ArgB/wGrAacBpgH/AZgBkAGPAf8BeAFwAW4B/wFmAUsBSQHlAW4BHgEdAZ4BrgIKATkIAAGGAg4B - aAFdAjABvgFYAWMBZQH/AYYBlAGaAf8BpgG2AbwB/wG+AcwB0gH/AdEB4AHmAf8B3QHsAfEB/wHjAfMB - +AH/AeYB9gH6Af8B6AH4AfwB/wHpAfkB/AH/AegB+QH7Af8B0AHtAeIB/wG2Ad8BxwH/AZ0B0gGsAf8B - rwHWAb8B/wHCAdsB0wH/AdQB3wHjAf8B0AHZAd0B/wHLAdMB1QH/AcYBzAHOAf8BwAHFAcYB/wG3ArgB - /wGrAacBpgH/AZgBkAGPAf8BeAFwAW4B/wFmAUsBSQHlAW4BHgEdAZ4BrgIKATkIAAGFAQUBBAFoAWkB - HwEVAb4BewFOATMB/wGyAYABZwH/AdABnQGFAf8B3gGsAZMB/wHhAa8BlwH/AegBtAGaAf8B6wG2AZwB - /wHnAbIBmAH/AdsBqAGQAf8B0QGfAYgB/wHMAZoBhAH/Ac8BmwGEAf8BzgGZAYMB/wHIAZQBfgH/AbcB - hAFwAf8BpwF1AWIB/wGZAWcBVAH/AYEBUAE9Af8BZAE6ASoB/wFMASQBGQHyAWEBDQEJAasBnAEEAQMB - TCQAAc4BMwErAWABygGNAXkB/wHpAckBvQH/AfgB6wHlAf8B/gH8AfoC/wH9AfsC/wH8AfkB/wH+AfkB - 9gH/Af4B+AHzAf8B/gH4AfIB/wH+AfgB8wH/Af4B9wHzAf8B/gH4AfMB/wH+AfgB8gH/Af4B+AHzAf8B - 7QHeAdYB/wHaAbgBqwH/AckBjgF7Af8B1gGYAYMB/wHXAZgBggH/AdEBkAF6Af8BxQF/AWYB/wGmAV0B - QgH/AYQBOgEfAf8BbQEqARMB/wF8ARwBCwHFAZ8BDgEFAXEBzwIBAQoQAAGUAggBVAExAhsB4QFpAW4B - cgH3AYkBmAGeAf8BnwGrAbIB/wG8AcgBzgH/Ac0B2gHgAf8B2QHnAewB/wHcAesB8gH/Ad8B7wH1Af8B - 4QHwAfYB/wHhAfAB9gH/Ad8B7gH0Af8B3QHrAfEB/wHbAegB7gH/AdcB5AHpAf8B0wHfAeMB/wHPAdkB - 3QH/AcsB0gHVAf8BxgHMAc4B/wHAAcUBxgH/AbcCuwH/AacCpAH/AZIBiwGKAf8BfwF2AXUB/wFhAUsB - SgHtAW8CIQGnAcsCAwEOEAABlAIIAVQBMQIbAeEBaQFuAXIB9wGJAZgBngH/AZ8BqwGyAf8BvAHIAc4B - /wHNAdoB4AH/AdkB5wHsAf8B3AHrAfIB/wHfAe8B9QH/AeEB8AH2Af8B4QHwAfYB/wHfAe4B9AH/Ad0B - 6wHxAf8B2wHoAe4B/wHXAeQB6QH/AdMB3wHjAf8BzwHZAd0B/wHLAdIB1QH/AcYBzAHOAf8BwAHFAcYB - /wG3ArsB/wGnAqQB/wGSAYsBigH/AX8BdgF1Af8BYQFLAUoB7QFvAiEBpwHLAgMBDhAAAaYBDQEBAVQB - YQEnAQYB4QGMAVUBPwH3AbYBgwFtAf8B2wGnAY4B/wHbAakBkgH/AeIBsAGXAf8B6gG2AZwB/wHuAboB - nwH/AeUBsQGYAf8B2AGlAY4B/wHKAZkBgwH/AckBlgGBAf8ByAGVAX8B/wHFAZEBfAH/AasBeQFlAf8B - iwFcAUsB/wFqAT4BLwH9AWgBLAEZAecBTQEYAQoB3wE+AQcBAQHDAbMBAgEAASokAAHKAQYBBQEWAccB - OwEyAXQB0AGVAYEB/wHvAdcB0AH/AfwB9gH0Av8C/gL/Af4B/QL/Af0B+wH/Af4B+wH4Af8B/gH4AfUC - /wH5AfUC/wH6AfUB/wH+AfgB9QH/Af4B+gH3Af8B/gH8AfkC/wH9AfwB/wHpAdgB0AH/AeABvQGwAf8B - 4wGvAZ0B/wHuAbgBpQH/AewBsgGeAf8B4QGgAYoB+wHTAXkBYgHlAZEBQgEtAd8BTAERAQQB3wEyAQkB - AwHfAYsBBAEBAWIYAAHIAgEBDwGtAQcBCAE1AVQBKwEvAckBVQFfAWIB/wGFAZABlgH/AZgBpQGrAf8B - rQG6Ab8B/wHAAc0B0gH/Ac0B2gHfAf8B1AHhAeYB/wHYAeUB6wH/AdkB5gHrAf8B2AHkAekB/wHWAeIB - 5gH/AdQB3wHjAf8B0AHbAd8B/wHNAdYB2gH/AcgB0AHUAf8BwwHJAcsB/wG7Ab8BwQH/Aa8BsQGyAf8B - nQKbAf8BjgKJAf8BegJ0Af8BWgFUAVMB/wGOAicBhgHBAgYBHgHSAgABAxAAAcgCAQEPAa0BBwEIATUB - VAErAS8ByQFVAV8BYgH/AYUBkAGWAf8BmAGlAasB/wGtAboBvwH/AcABzQHSAf8BzQHaAd8B/wHUAeEB - 5gH/AdgB5QHrAf8B2QHmAesB/wHYAeQB6QH/AdYB4gHmAf8B1AHfAeMB/wHQAdsB3wH/Ac0B1gHaAf8B - yAHQAdQB/wHDAckBywH/AbsBvwHBAf8BrwGxAbIB/wGdApsB/wGOAokB/wF6AnQB/wFaAVQBUwH/AY4C - JwGGAcECBgEeAdICAAEDEAABzAECAQABDwG4AQkBAwE1AXYBKwEcAckBiQFcAUgB/wHEAZABeAH/AdgB - pQGMAf8B3wGtAZQB/wHjAbABlwH/AesBtwGcAf8B6QG1AZoB/wHfAaoBkQH/AccBlAF+Af8BtAGCAW0B - /wGaAWsBWQH/AXYBTwFAAf8BYAE6ASwB/wE/ASMBGgH/ASMBDAEJAfIBlgEJAQYBXgG7AQUBAgEoAbgB - AQEAASMBzAIAAQgkAAGSASoBIwGUAZ0BYgFVAeYB5AGpAZUB/wH2AeQB3gH/Af4B+wH6Af8B/gH9AfwB - /wH+Af0B+wH/Af4B/AH6Af8B/gH7AfkB/wH+AfoB9wH/Af4B+wH3Af8B/gH7AfgB/wH+AfkB9gH/Af4B - +AH1Af8B/gH5AfYB/wH+AfsB+QH/AekB0QHJAf8B5gHEAbcB/wHwAcoBvQH/AfABwgGyAf8B3AGnAZUB - /wHDAXoBaAHkAdABKgEjAVABxwEMAQgBKAG7AQMBAQEoAbYBAgEBASgBxgEBAQABEhwAAc4CAQEHAZgB - DQEOAVQBaAErASwBrwFKAVABUgH/AWQBbQFwAf8BhQGQAZMB/wGhAa0BsQH/Aa0BuAG9Af8BtgHBAcUB - /wG9AcgBzAH/AcIBzAHQAf8BwwHNAdEB/wHDAcwB0AH/AcIBygHOAf8BvgHFAckB/wG5Ab8BwgH/AbIB - tgG5Af8BqwGuAa8B/wGiAaMBpAH/AZUBlAGVAf8BfwF9AXwB/wFlAWIBYQH/AV0CRAHkAY4CJAGCAbgC - DgExHAABzgIBAQcBmAENAQ4BVAFoASsBLAGvAUoBUAFSAf8BZAFtAXAB/wGFAZABkwH/AaEBrQGxAf8B - rQG4Ab0B/wG2AcEBxQH/Ab0ByAHMAf8BwgHMAdAB/wHDAc0B0QH/AcMBzAHQAf8BwgHKAc4B/wG+AcUB - yQH/AbkBvwHCAf8BsgG2AbkB/wGrAa4BrwH/AaIBowGkAf8BlQGUAZUB/wF/AX0BfAH/AWUBYgFhAf8B - XQJEAeQBjgIkAYIBuAIOATEcAAHJAgEBEAFUARABCgG/AVMBMwEmAf8BkQFgAU0B/wHBAY4BdgH/AdYB - ogGKAf8B2wGoAZAB/wHUAaIBiQH/AccBlAF8Af8BswGAAWoB/wGUAWQBUgH/AXABSgE9Af8BcgEyASgB - 0gGiARwBFgFwAZkBEwEOAXABigEKAQcBcAF/AgEBaQG9AgABHDAAAYkBMQEqAa8BmAFuAV4B/wHqAa8B - mQH/AfQB0gHFAf8B+AHgAdcB/wH4AeMB2gH/AfkB5AHdAf8B+gHmAd4B/wH6AecB4AH/AfoB6QHiAf8B - +wHsAeYB/wH7Ae8B6QH/AfwB8AHrAf8B/AHwAesB/wH9AfMB7gH/Af0B9wH0Af8B7AHQAcYB/wHpAcMB - tQH/AfABxwG5Af8B1wGnAZgB/wGbAXQBZgH/AWkBOAEvAd8BvAEMAQoBMDQAAZkCCQFRAVQCGAG3AWsC - NAG3AYkBUwFVAbcBmwFyAXUBxQGNAY4BkgH2AZYBngGiAf8BoAGpAa0B/wGmAa0BsQH/AakBsAGzAf8B - qQGwAbIB/wGpAa4BsQH/AaUBqgGsAf8BoQGjAaUB/wGZAZsBnQH/AZACkQH/A3wB/wFqAmEB9gF/AU0B - TAHFAXABNAEzAbcBcQIYAZUBxAIEARcoAAGZAgkBUQFUAhgBtwFrAjQBtwGJAVMBVQG3AZsBcgF1AcUB - jQGOAZIB9gGWAZ4BogH/AaABqQGtAf8BpgGtAbEB/wGpAbABswH/AakBsAGyAf8BqQGuAbEB/wGlAaoB - rAH/AaEBowGlAf8BmQGbAZ0B/wGQApEB/wN8Af8BagJhAfYBfwFNAUwBxQFwATQBMwG3AXECGAGVAcQC - BAEXIAABygIAAQwBaAEEAQEBiQFeARMBDQG3AYcBLwEjAcABogFmAVMB8gG1AYEBbAH/AboBhwFyAf8B - pAF0AWEB/wGlAVwBSgHXAaMBQwE2AbcBigEsASIBtwFoARgBEwG3AX0BCgEHAX5EAAGfASQBHwF+AasB - UAFDAbcB4QF/AW8BvAHNAZYBiAHtAdcBrQGeAf8B8AHAAbAB/wHxAcQBtAH/AfIBxwG3Af8B8gHJAboB - /wH0AcwBvQH/AfQB0AHCAf8B9QHTAccB/wH2AdYBygH/AfcB1wHLAf8B9wHZAc4B/wH4Ad4B1QH/Ae4B - xAG2Af8B6wG6AacB/wHrAbQBogH7AcoBdAFmAckBigE3AS8BtwFYAQcBBgGgAbgCAQEjRAABvwEUARUB - MAF4AV4BXwHfAXsBgAGDAf8BiAGPAZMB/wGLAZABlAH/AYoBjwGSAf8BiQGNAY8B/wGIAYsBjQH/AYgB - igGMAf8ChwGJAf8CgwGFAf8DeQH/A0oB/wErAhEB3wGvAgQBMEQAAb8BFAEVATABeAFeAV8B3wF7AYAB - gwH/AYgBjwGTAf8BiwGQAZQB/wGKAY8BkgH/AYkBjQGPAf8BiAGLAY0B/wGIAYoBjAH/AocBiQH/AoMB - hQH/A3kB/wNKAf8BKwIRAd8BrwIEATA4AAHHAQcBBQEgAYABLQEgAc8BdAFBATAB/wFzAUEBMQH/AVQB - KQEdAf8BmAEQAQsBcFwAAcsCAwEQAW8BKAEiAb8BkQFiAVUB/wHmAZ0BhgH/AegBowGIAf8B6QGkAYoB - /wHpAaQBiwH/AesBpAGLAf8B6wGkAYsB/wHsAaUBiwH/Ae0BpgGMAf8B7AGlAYwB/wHrAaQBjAH/AesB - pQGNAf8B6gGkAYwB/wHqAaQBigH/AekBmQF/Ae8B2QEpASIBQCwAAUIBTQE+BwABPgMAASgDAAGAAwAB - YAMAAQEBAAEBBgABBhYAA///AP8AAwAB4AEAAQcB/wwAAeACAAEfDAAB4AIAAQEMAAHgAgABAQwAAeAP - AAHgDwAB4A8AAeAPAAHgDwAB4A8AAeAPAAHgAgABAQwAAcACAAEDDAABwAIAAQMMAAHAAgABAwwAAcAC - AAEBDAABgA8AAYAPAAGADwABgA8AAYAPAAGADwABgA8AAYACAAEBDAABgAIAAQEMAAGAAgABfw8AAX8P - AAH/DwAB/w4AAQMB/w4AAQcB/wwAAYABAAEfAf8MAAH8AgABfwH8AgABfwH/AQABAwH/AfwBAAEDAf8B - +AIAAR8B+AIAAR8B/AIAAR8B/AIAAQMB4AIAAQMB4AIAAQMB/AIAAQMB/AIAAQMB4AIAAQMB4AIAAQMB - /AIAAQMB/AIAAQMBwAIAAQMBwAIAAQMB+AIAAQEB+AIAAQMBgAIAAQEBgAIAAQEB4AIAAQEB+AIAAQMB - gAMAAYADAAHAAgABAQH4AgABAwGAAwABgAMAAcACAAEBAfgCAAEDAYADAAGAAwABgAIAAQEB+AIAAQMI - AAGAAgABAQGAAgABAwgAAYACAAEBAYACAAEDCAABgAIAAQEBgAIAAQMIAAGAAgABAQMAAQEIAAGAAgAB - AQwAAYACAAEBDAABgAIAAQEMAAGADwABgA8AAYBCAAEBAYADAAGAAwABgAYAAQMBgAMAAYADAAGABgAB - AwGAAwABgAIAAQEBgAIAAQEBgAIAAR8BwAIAAQEBgAIAAQEBgAIAAQEBgAIAAX8BwAIAAQMBwAIAAQMB - wAIAAQMBwAIAAf8BgAIAAQ8BwAIAAQMBwAIAAQMBwAIAAf8BgAIAAQ8B4AIAAQ8B4AIAAQ8B4AEAAQcB - /wGAAgAB/wH4AgABHwH4AgABHwHgAQAC/wGAAgAC/wGAAQAC/wGAAQAB/wH8AQ8C/wHgAQABBwH/FgAL - - - - 146, 26 - - - Form1 - - \ No newline at end of file diff --git a/embedding/browser/activex/tests/csbrowse/back.bmp b/embedding/browser/activex/tests/csbrowse/back.bmp deleted file mode 100644 index 582badea13b..00000000000 Binary files a/embedding/browser/activex/tests/csbrowse/back.bmp and /dev/null differ diff --git a/embedding/browser/activex/tests/csbrowse/forward.bmp b/embedding/browser/activex/tests/csbrowse/forward.bmp deleted file mode 100644 index b33a8486a36..00000000000 Binary files a/embedding/browser/activex/tests/csbrowse/forward.bmp and /dev/null differ diff --git a/embedding/browser/activex/tests/csbrowse/home.bmp b/embedding/browser/activex/tests/csbrowse/home.bmp deleted file mode 100644 index c329cda77a4..00000000000 Binary files a/embedding/browser/activex/tests/csbrowse/home.bmp and /dev/null differ diff --git a/embedding/browser/activex/tests/csbrowse/reload.bmp b/embedding/browser/activex/tests/csbrowse/reload.bmp deleted file mode 100644 index 111aafe7e8d..00000000000 Binary files a/embedding/browser/activex/tests/csbrowse/reload.bmp and /dev/null differ diff --git a/embedding/browser/activex/tests/csbrowse/stop.bmp b/embedding/browser/activex/tests/csbrowse/stop.bmp deleted file mode 100644 index bce64ce0a6c..00000000000 Binary files a/embedding/browser/activex/tests/csbrowse/stop.bmp and /dev/null differ diff --git a/embedding/browser/activex/tests/dbrowse/form.dcu b/embedding/browser/activex/tests/dbrowse/form.dcu deleted file mode 100644 index a9ce0b4a5a3..00000000000 Binary files a/embedding/browser/activex/tests/dbrowse/form.dcu and /dev/null differ diff --git a/embedding/browser/activex/tests/dbrowse/form.dfm b/embedding/browser/activex/tests/dbrowse/form.dfm deleted file mode 100644 index fbf2e879959..00000000000 Binary files a/embedding/browser/activex/tests/dbrowse/form.dfm and /dev/null differ diff --git a/embedding/browser/activex/tests/dbrowse/form.pas b/embedding/browser/activex/tests/dbrowse/form.pas deleted file mode 100644 index 220201b1c78..00000000000 --- a/embedding/browser/activex/tests/dbrowse/form.pas +++ /dev/null @@ -1,91 +0,0 @@ -unit form; - -interface - -uses - Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - StdCtrls, OleCtrls, SHDocVw_TLB, MOZILLACONTROLLib_TLB, ExtCtrls, - ComCtrls; - -type - TMainForm = class(TForm) - Browser: TMozillaBrowser; - Panel: TPanel; - Status: TPanel; - Address: TComboBox; - Go: TButton; - WebProgress: TProgressBar; - Stop: TButton; - procedure GoClick(Sender: TObject); - procedure FormResize(Sender: TObject); - procedure OnStatusTextChange(Sender: TObject; const Text: WideString); - procedure OnProgressChange(Sender: TObject; Progress, - ProgressMax: Integer); - procedure StopClick(Sender: TObject); - private - { Private declarations } - public - { Public declarations } - end; - -var - MainForm: TMainForm; - -implementation - -{$R *.DFM} - -procedure TMainForm.GoClick(Sender: TObject); -var Flags, TargetFrameName, PostData, Headers: OleVariant; -begin - Flags := 0; - Browser.Navigate(Address.Text, Flags, TargetFrameName, PostData, Headers); -end; - -procedure TMainForm.FormResize(Sender: TObject); -var - oldPanelWidth : Integer; -begin - oldPanelWidth := Panel.Width; - Panel.Top := MainForm.ClientHeight - Panel.Height; - Panel.Width := MainForm.ClientWidth; - Go.Left := Go.Left + Panel.Width - oldPanelWidth; - WebProgress.Left := WebProgress.Left + Panel.Width - oldPanelWidth; - Address.Width := Address.Width + Panel.Width - oldPanelWidth; - Status.Width := Status.Width + Panel.Width - oldPanelWidth; - Browser.Width := MainForm.ClientWidth; - Browser.Height := MainForm.ClientHeight - Panel.Height; -end; - -procedure TMainForm.OnStatusTextChange(Sender: TObject; - const Text: WideString); -begin - Status.Caption := Text; -end; - -procedure TMainForm.OnProgressChange(Sender: TObject; Progress, - ProgressMax: Integer); -begin - if Progress < 0 then - begin - WebProgress.Position := 0; - WebProgress.Max := 100; - end - else if ProgressMax < Progress then - begin - WebProgress.Position := Progress; - WebProgress.Max := Progress * 10; - end - else - begin - WebProgress.Position := Progress; - WebProgress.Max := ProgressMax; - end -end; - -procedure TMainForm.StopClick(Sender: TObject); -begin - Browser.Stop(); -end; - -end. diff --git a/embedding/browser/activex/tests/dbrowse/webbrowser.dof b/embedding/browser/activex/tests/dbrowse/webbrowser.dof deleted file mode 100644 index d82e8794734..00000000000 --- a/embedding/browser/activex/tests/dbrowse/webbrowser.dof +++ /dev/null @@ -1,75 +0,0 @@ -[Compiler] -A=1 -B=0 -C=1 -D=1 -E=0 -F=0 -G=1 -H=1 -I=1 -J=1 -K=0 -L=1 -M=0 -N=1 -O=1 -P=1 -Q=0 -R=0 -S=0 -T=0 -U=0 -V=1 -W=0 -X=1 -Y=0 -Z=1 -ShowHints=1 -ShowWarnings=1 -UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; -[Linker] -MapFile=0 -OutputObjs=0 -ConsoleApp=1 -DebugInfo=0 -MinStackSize=16384 -MaxStackSize=1048576 -ImageBase=4194304 -ExeDescription= -[Directories] -OutputDir= -UnitOutputDir= -SearchPath= -Packages=vclx30;VCL30;vcldb30;vcldbx30;VclSmp30;Qrpt30 -Conditionals= -DebugSourceDirs= -UsePackages=0 -[Parameters] -RunParams= -HostApplication= -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=2057 -CodePage=1252 -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= diff --git a/embedding/browser/activex/tests/dbrowse/webbrowser.dpr b/embedding/browser/activex/tests/dbrowse/webbrowser.dpr deleted file mode 100644 index 0756d5c9ac6..00000000000 --- a/embedding/browser/activex/tests/dbrowse/webbrowser.dpr +++ /dev/null @@ -1,14 +0,0 @@ -program webbrowser; - -uses - Forms, - SHDocVw_TLB in '..\..\Imports\SHDocVw_TLB.pas', - form in 'form.pas' {MainForm}; - -{$R *.RES} - -begin - Application.Initialize; - Application.CreateForm(TMainForm, MainForm); - Application.Run; -end. diff --git a/embedding/browser/activex/tests/plugin/calendar.html b/embedding/browser/activex/tests/plugin/calendar.html deleted file mode 100644 index fd6fb853947..00000000000 --- a/embedding/browser/activex/tests/plugin/calendar.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - -

This page is designed for Communicator 4.x with the Mozilla -ActiveX plugin installed! You also need to have the MS calendar control installed to see anything

- -

- - diff --git a/embedding/browser/activex/tests/plugin/calendar_scripted.htm b/embedding/browser/activex/tests/plugin/calendar_scripted.htm deleted file mode 100644 index 541a69a61e5..00000000000 --- a/embedding/browser/activex/tests/plugin/calendar_scripted.htm +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - Mozilla Plugin Test Page - - - - - -

This page is designed for Communicator 4.x, Netscape 7.x or -Mozilla 1.x with the Mozilla ActiveX plugin installed! You also need -to have the MS calendar control installed to see anything

- -

- - -

-
- -
- -
- Change the current day: -
-
-
- These tests should cause exceptions by calling with duff property names etc.
- - - - -
-

- -

- - - - diff --git a/embedding/browser/activex/tests/vbrowse/VBrowse.vbp b/embedding/browser/activex/tests/vbrowse/VBrowse.vbp deleted file mode 100644 index ab1a1b48da6..00000000000 --- a/embedding/browser/activex/tests/vbrowse/VBrowse.vbp +++ /dev/null @@ -1,37 +0,0 @@ -Type=Exe -Form=browser.frm -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT40\System32\stdole2.tlb#OLE Automation -Object={1339B53E-3453-11D2-93B9-000000000000}#1.0#0; MozillaControl.dll -Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX -Object={FE0065C0-1B7B-11CF-9D53-00AA003C9CB6}#1.0#0; comct232.ocx -Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0; comctl32.ocx -Form=frmToolBar.frm -Object={EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0; SHDOCVW.DLL -Form=frmExplorer.frm -IconForm="frmMozilla" -Startup="frmToolBar" -HelpFile="" -ExeName32="VBrowse.exe" -Command32="" -Name="Project1" -HelpContextID="0" -CompatibleMode="0" -MajorVer=1 -MinorVer=0 -RevisionVer=0 -AutoIncrementVer=0 -ServerSupportFiles=0 -CompilationType=0 -OptimizationType=0 -FavorPentiumPro(tm)=0 -CodeViewDebugInfo=0 -NoAliasing=0 -BoundsCheck=0 -OverflowCheck=0 -FlPointCheck=0 -FDIVCheck=0 -UnroundedFP=0 -StartMode=0 -Unattended=0 -ThreadPerObject=0 -MaxNumberOfThreads=1 diff --git a/embedding/browser/activex/tests/vbrowse/browser.frm b/embedding/browser/activex/tests/vbrowse/browser.frm deleted file mode 100644 index 51f521bd885..00000000000 --- a/embedding/browser/activex/tests/vbrowse/browser.frm +++ /dev/null @@ -1,54 +0,0 @@ -VERSION 5.00 -Object = "{1339B53E-3453-11D2-93B9-000000000000}#1.0#0"; "MozillaControl.dll" -Begin VB.Form frmMozilla - Caption = "Mozilla Control" - ClientHeight = 5880 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 7710 - LinkTopic = "Form1" - ScaleHeight = 392 - ScaleMode = 3 'Pixel - ScaleWidth = 514 - Begin MOZILLACONTROLLibCtl.MozillaBrowser Browser1 - Height = 5535 - Left = 0 - OleObjectBlob = "browser.frx":0000 - TabIndex = 0 - Top = 0 - Width = 7695 - End -End -Attribute VB_Name = "frmMozilla" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Private Sub Browser1_BeforeNavigate(ByVal URL As String, ByVal Flags As Long, ByVal TargetFrameName As String, PostData As Variant, ByVal Headers As String, Cancel As Boolean) - frmToolBar.Browser_BeforeNavigate URL, Flags, TargetFrameName, PostData, Headers, Cancel -End Sub - -Private Sub Browser1_NavigateComplete(ByVal URL As String) - frmToolBar.Browser_NavigateComplete URL -End Sub - -Private Sub Browser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean) - frmToolBar.Browser_BeforeNavigate2 pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel -End Sub - -Private Sub Browser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant) - frmToolBar.Browser_NavigateComplete2 pDisp, URL -End Sub - -Private Sub Browser1_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long) - frmToolBar.Browser_ProgressChange Progress, ProgressMax -End Sub - -Private Sub Browser1_StatusTextChange(ByVal Text As String) - frmToolBar.Browser_StatusTextChange Text -End Sub - -Private Sub Form_Resize() - Browser1.Width = ScaleWidth - Browser1.Height = ScaleHeight -End Sub diff --git a/embedding/browser/activex/tests/vbrowse/browser.frx b/embedding/browser/activex/tests/vbrowse/browser.frx deleted file mode 100644 index 9ae0f67293c..00000000000 Binary files a/embedding/browser/activex/tests/vbrowse/browser.frx and /dev/null differ diff --git a/embedding/browser/activex/tests/vbrowse/frmExplorer.frm b/embedding/browser/activex/tests/vbrowse/frmExplorer.frm deleted file mode 100644 index 93389e51024..00000000000 --- a/embedding/browser/activex/tests/vbrowse/frmExplorer.frm +++ /dev/null @@ -1,63 +0,0 @@ -VERSION 5.00 -Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "SHDOCVW.DLL" -Begin VB.Form frmExplorer - Caption = "Internet Explorer Control" - ClientHeight = 5550 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 6675 - LinkTopic = "Form1" - ScaleHeight = 5550 - ScaleWidth = 6675 - StartUpPosition = 3 'Windows Default - Begin SHDocVwCtl.WebBrowser Browser1 - Height = 3015 - Left = 0 - TabIndex = 0 - Top = 0 - Width = 4575 - ExtentX = 8070 - ExtentY = 5318 - ViewMode = 1 - Offline = 0 - Silent = 0 - RegisterAsBrowser= 0 - RegisterAsDropTarget= 1 - AutoArrange = -1 'True - NoClientEdge = 0 'False - AlignLeft = 0 'False - ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}" - Location = "" - End -End -Attribute VB_Name = "frmExplorer" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Private Sub Browser1_NavigateComplete(ByVal URL As String) - frmToolBar.Browser_NavigateComplete URL -End Sub - -Private Sub Browser1_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long) - frmToolBar.Browser_ProgressChange Progress, ProgressMax -End Sub - -Private Sub Browser1_StatusTextChange(ByVal Text As String) - frmToolBar.Browser_StatusTextChange Text -End Sub - -Private Sub Form_Resize() - Browser1.Width = ScaleWidth - Browser1.Height = ScaleHeight -End Sub - -Private Sub Browser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean) - frmToolBar.Browser_BeforeNavigate2 pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel -End Sub - -Private Sub Browser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant) - frmToolBar.Browser_NavigateComplete2 pDisp, URL -End Sub - - diff --git a/embedding/browser/activex/tests/vbrowse/frmToolBar.frm b/embedding/browser/activex/tests/vbrowse/frmToolBar.frm deleted file mode 100644 index 92ee26e058c..00000000000 --- a/embedding/browser/activex/tests/vbrowse/frmToolBar.frm +++ /dev/null @@ -1,315 +0,0 @@ -VERSION 5.00 -Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "comctl32.ocx" -Begin VB.Form frmToolBar - Caption = "Control Bar" - ClientHeight = 1215 - ClientLeft = 165 - ClientTop = 735 - ClientWidth = 7965 - LinkTopic = "Form2" - ScaleHeight = 81 - ScaleMode = 3 'Pixel - ScaleWidth = 531 - StartUpPosition = 3 'Windows Default - Begin ComctlLib.Toolbar Toolbar1 - Align = 1 'Align Top - Height = 660 - Left = 0 - TabIndex = 0 - Top = 0 - Width = 7965 - _ExtentX = 14049 - _ExtentY = 1164 - ButtonWidth = 1032 - ButtonHeight = 1005 - AllowCustomize = 0 'False - Appearance = 1 - ImageList = "ImageList1" - _Version = 327682 - BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7} - NumButtons = 10 - BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7} - Key = "goback" - Object.ToolTipText = "Go Back" - Object.Tag = "" - ImageIndex = 1 - EndProperty - BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7} - Key = "goforward" - Object.ToolTipText = "Go Forward" - Object.Tag = "" - ImageIndex = 5 - EndProperty - BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7} - Key = "reload" - Object.ToolTipText = "Reload Page" - Object.Tag = "" - ImageIndex = 6 - EndProperty - BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7} - Object.Tag = "" - Style = 3 - MixedState = -1 'True - EndProperty - BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7} - Key = "gohome" - Object.ToolTipText = "Go Home" - Object.Tag = "" - ImageIndex = 3 - EndProperty - BeginProperty Button6 {0713F354-850A-101B-AFC0-4210102A8DA7} - Key = "gosearch" - Object.ToolTipText = "Search Web" - Object.Tag = "" - ImageIndex = 8 - EndProperty - BeginProperty Button7 {0713F354-850A-101B-AFC0-4210102A8DA7} - Key = "ph" - Object.Tag = "" - Style = 4 - Object.Width = 200 - MixedState = -1 'True - EndProperty - BeginProperty Button8 {0713F354-850A-101B-AFC0-4210102A8DA7} - Key = "loadpage" - Object.ToolTipText = "Load this URL" - Object.Tag = "" - ImageIndex = 4 - EndProperty - BeginProperty Button9 {0713F354-850A-101B-AFC0-4210102A8DA7} - Object.Tag = "" - Style = 3 - MixedState = -1 'True - EndProperty - BeginProperty Button10 {0713F354-850A-101B-AFC0-4210102A8DA7} - Key = "stop" - Object.ToolTipText = "Stop Loading" - Object.Tag = "" - ImageIndex = 2 - EndProperty - EndProperty - Begin VB.ComboBox cmbUrl - BeginProperty Font - Name = "MS Sans Serif" - Size = 12 - Charset = 0 - Weight = 400 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 420 - ItemData = "frmToolBar.frx":0000 - Left = 3120 - List = "frmToolBar.frx":0016 - TabIndex = 1 - Text = "http://www.mozilla.com" - Top = 120 - Width = 2895 - End - End - Begin VB.OptionButton rbExplorer - Caption = "InternetExplorer" - Height = 255 - Left = 2160 - TabIndex = 4 - Top = 720 - Width = 1575 - End - Begin VB.OptionButton rbMozilla - Caption = "Mozilla" - Height = 255 - Left = 960 - TabIndex = 3 - Top = 720 - Value = -1 'True - Width = 1215 - End - Begin ComctlLib.StatusBar StatusBar1 - Align = 2 'Align Bottom - Height = 255 - Left = 0 - TabIndex = 2 - Top = 960 - Width = 7965 - _ExtentX = 14049 - _ExtentY = 450 - SimpleText = "" - _Version = 327682 - BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} - NumPanels = 2 - BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} - AutoSize = 1 - Object.Width = 11404 - MinWidth = 2646 - TextSave = "" - Object.Tag = "" - EndProperty - BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} - Alignment = 2 - Object.Width = 2117 - MinWidth = 2117 - TextSave = "" - Object.Tag = "" - EndProperty - EndProperty - End - Begin VB.Label Label1 - Caption = "Control:" - Height = 255 - Left = 120 - TabIndex = 5 - Top = 720 - Width = 855 - End - Begin ComctlLib.ImageList ImageList1 - Left = 6240 - Top = 480 - _ExtentX = 1005 - _ExtentY = 1005 - BackColor = -2147483643 - ImageWidth = 32 - ImageHeight = 32 - MaskColor = 12632256 - _Version = 327682 - BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} - NumListImages = 8 - BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} - Picture = "frmToolBar.frx":00A4 - Key = "back" - EndProperty - BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} - Picture = "frmToolBar.frx":03BE - Key = "stop" - EndProperty - BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} - Picture = "frmToolBar.frx":06D8 - Key = "home" - EndProperty - BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} - Picture = "frmToolBar.frx":09F2 - Key = "gotopage" - EndProperty - BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} - Picture = "frmToolBar.frx":0D0C - Key = "forward" - EndProperty - BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7} - Picture = "frmToolBar.frx":1026 - Key = "reload" - EndProperty - BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7} - Picture = "frmToolBar.frx":1340 - Key = "go" - EndProperty - BeginProperty ListImage8 {0713E8C3-850A-101B-AFC0-4210102A8DA7} - Picture = "frmToolBar.frx":165A - Key = "gofind" - EndProperty - EndProperty - End - Begin VB.Menu debug - Caption = "Debug" - Begin VB.Menu verbs - Caption = "OLE Verbs" - End - End -End -Attribute VB_Name = "frmToolBar" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Dim browser As Object - -Private Sub Form_Load() - frmMozilla.Show - frmExplorer.Show - Set browser = frmMozilla.Browser1 -End Sub - -Sub Browser_BeforeNavigate(ByVal URL As String, ByVal Flags As Long, ByVal TargetFrameName As String, PostData As Variant, ByVal Headers As String, Cancel As Boolean) - Debug.Print "Browser_BeforeNavigate " & URL - StatusBar1.Panels(1).Text = "Loading " & URL -End Sub - -Sub Browser_NavigateComplete(ByVal URL As String) - Debug.Print "Browser_NavigateComplete " & URL - StatusBar1.Panels(1).Text = "Loaded " & URL - StatusBar1.Panels(2).Text = "" -End Sub - -Sub Browser_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean) - Debug.Print "Browser_BeforeNavigate2 " & URL - StatusBar1.Panels(1).Text = "Loaded " & URL - StatusBar1.Panels(2).Text = "" -End Sub - -Sub Browser_NavigateComplete2(ByVal pDisp As Object, URL As Variant) - Debug.Print "Browser_NavigateComplete2 " & URL - StatusBar1.Panels(1).Text = "Loaded " & URL - StatusBar1.Panels(2).Text = "" -End Sub - -Sub Browser_StatusTextChange(ByVal Text As String) - Debug.Print "Browser_StatusTextChange " & Text - StatusBar1.Panels(1).Text = Text -End Sub - -Sub Browser_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long) - Dim fProgress As Double - If Progress = 0 Then -' fProgress = 0 - ElseIf ProgressMax > 0 Then -' fProgress = (Progress * 100) / ProgressMax - Else - ' fProgress = 0# - Debug.Print "Progress error - Progress = " & Progress & ", ProgressMax = " & ProgressMax - End If -' StatusBar1.Panels(2).Text = Int(fProgress) & "%" -End Sub - -Private Sub rbExplorer_Click() - Set browser = frmExplorer.Browser1 -End Sub - -Private Sub rbMozilla_Click() - Set browser = frmMozilla.Browser1 -End Sub - -Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button) - Select Case Button.Key - Case "goback" - browser.GoBack - Case "goforward" - browser.GoForward - Case "reload" - browser.Refresh - Case "gohome" - browser.GoHome - Case "gosearch" - browser.GoSearch - Case "loadpage" - browser.Navigate cmbUrl.Text - Case "stop" - browser.Stop - Case Else - End Select -End Sub - -Private Sub verbs_Click() - ' Query the browser to see what IOleCommandTarget commands it supports - Dim nCmd As Integer - Dim nStatus As Integer - For nCmd = 1 To 40 - nStatus = browser.QueryStatusWB(nCmd) - If nStatus And 1 Then - Debug.Print "Command " & nCmd & " is supported" - Else - Debug.Print "Command " & nCmd & " is not supported" - End If - If nStatus And 2 Then - Debug.Print "Command " & nCmd & " is disabled" - End If - Next -End Sub diff --git a/embedding/browser/activex/tests/vbrowse/frmToolBar.frx b/embedding/browser/activex/tests/vbrowse/frmToolBar.frx deleted file mode 100644 index 119c739205a..00000000000 Binary files a/embedding/browser/activex/tests/vbrowse/frmToolBar.frx and /dev/null differ diff --git a/embedding/browser/activex/tests/vbxml/test.xml b/embedding/browser/activex/tests/vbxml/test.xml deleted file mode 100644 index fd40dfb207d..00000000000 --- a/embedding/browser/activex/tests/vbxml/test.xml +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - function StartUp() - { - dump("Doing Startup...\n"); - appCore = XPAppCoresManager.Find("BrowserAppCore"); - dump("Looking up BrowserAppCore...\n"); - if (appCore == null) { - dump("Creating BrowserAppCore...\n"); - appCore = new BrowserAppCore(); - if (appCore != null) { - dump("BrowserAppCore has been created.\n"); - appCore.Init("BrowserAppCore"); - appCore.setToolbarWindow(window); - appCore.setContentWindow(window.parent.frames[1]); - appCore.setWebShellWindow(window.parent); - appCore.setDisableCallback("DoDisableButtons();"); - appCore.setEnableCallback("DoEnableButtons();"); - dump("Adding BrowserAppCore to AppCoreManager...\n"); - XPAppCoresManager.Add(appCore); - } - } else { - dump("BrowserAppCore has already been created! Why?\n"); - } - } - - function DoDisableButtons() - { - // Find buttons in the UI and disable them - dump("Browser disabling buttons\n"); - } - - function DoEnableButtons() - { - // Find buttons in the UI and enable them - dump("Browser enabling buttons\n"); - } - - function BrowserBack() - { - appCore = XPAppCoresManager.Find("BrowserAppCore"); - if (appCore != null) { - dump("Going Back\n"); - appCore.back(); - } else { - dump("BrowserAppCore has not been created!\n"); - } - } - - function BrowserForward() - { - appCore = XPAppCoresManager.Find("BrowserAppCore"); - if (appCore != null) { - dump("Going Forward\n"); - appCore.forward(); - } else { - dump("BrowserAppCore has not been created!\n"); - } - } - - function BrowserNewWindow() - { - appCore = XPAppCoresManager.Find("BrowserAppCore"); - if (appCore != null) { - dump("Opening New Window\n"); - appCore.newWindow(); - } else { - dump("BrowserAppCore has not been created!\n"); - } - } - - function BrowserPrintPreview() - { - dump("BrowserPrintPreview\n"); - } - - function BrowserClose() - { - dump("BrowserClose\n"); - } - - function BrowserExit() - { - appCore = XPAppCoresManager.Find("BrowserAppCore"); - if (appCore != null) { - dump("Exiting\n"); - appCore.exit(); - } else { - dump("BrowserAppCore has not been created!\n"); - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Back - - - Forward - - - Reload - - - Stop - - - Home - - - Print - - - - - - - - Bookmarks - - - - What's Related - - - - - - Mozilla.org - - - Mozilla.org - - - Mozilla.org - - - - - - - diff --git a/embedding/browser/activex/tests/vbxml/xml.frm b/embedding/browser/activex/tests/vbxml/xml.frm deleted file mode 100644 index 19e30abd128..00000000000 --- a/embedding/browser/activex/tests/vbxml/xml.frm +++ /dev/null @@ -1,76 +0,0 @@ -VERSION 5.00 -Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" -Begin VB.Form Form1 - Caption = "Form1" - ClientHeight = 4932 - ClientLeft = 48 - ClientTop = 276 - ClientWidth = 5052 - LinkTopic = "Form1" - ScaleHeight = 4932 - ScaleWidth = 5052 - StartUpPosition = 3 'Windows Default - Begin MSComctlLib.TreeView treeXML - Height = 4692 - Left = 120 - TabIndex = 3 - Top = 120 - Width = 3132 - _ExtentX = 5525 - _ExtentY = 8276 - _Version = 393217 - Indentation = 176 - LineStyle = 1 - Style = 7 - Appearance = 1 - End - Begin VB.TextBox txtURL - Height = 288 - Left = 3480 - TabIndex = 1 - Text = "M:\moz\mozilla\webshell\embed\ActiveX\xml\tests\vbxml\test.xml" - Top = 480 - Width = 1332 - End - Begin VB.CommandButton Command1 - Caption = "Parse XML" - Height = 492 - Left = 3480 - TabIndex = 0 - Top = 960 - Width = 1332 - End - Begin VB.Label Label1 - Caption = "XML File:" - Height = 252 - Left = 3480 - TabIndex = 2 - Top = 120 - Width = 852 - End -End -Attribute VB_Name = "Form1" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Private Sub Command1_Click() - Dim o As New MozXMLDocument - o.URL = txtURL.Text - Debug.Print o.root.tagName - treeXML.Nodes.Add , , "R", "XML" - buildBranch "R", o.root -End Sub - -Sub buildBranch(ByRef sParentKey As String, o As Object) - Dim n As Integer - Dim c As Object - Dim sKey As String - - Set c = o.children - For i = 0 To c.length - 1 - sKey = sParentKey + "." + CStr(i) - treeXML.Nodes.Add sParentKey, tvwChild, sKey, c.Item(i).tagName - buildBranch sKey, c.Item(i) - Next -End Sub diff --git a/embedding/browser/activex/tests/vbxml/xml.vbp b/embedding/browser/activex/tests/vbxml/xml.vbp deleted file mode 100644 index 30133eea281..00000000000 --- a/embedding/browser/activex/tests/vbxml/xml.vbp +++ /dev/null @@ -1,33 +0,0 @@ -Type=Exe -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\StdOle2.Tlb#OLE Automation -Reference=*\G{45E5B410-2805-11D3-9425-000000000000}#1.0#0#..\..\Debug\activexml.dll#Mozilla XML 1.0 Type Library -Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX -Object={86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCT2.OCX -Object={38911DA0-E448-11D0-84A3-00DD01104159}#1.1#0; COMCT332.OCX -Form=xml.frm -Startup="Form1" -ExeName32="xml.exe" -Command32="" -Name="Project1" -HelpContextID="0" -CompatibleMode="0" -MajorVer=1 -MinorVer=0 -RevisionVer=0 -AutoIncrementVer=0 -ServerSupportFiles=0 -CompilationType=0 -OptimizationType=0 -FavorPentiumPro(tm)=0 -CodeViewDebugInfo=0 -NoAliasing=0 -BoundsCheck=0 -OverflowCheck=0 -FlPointCheck=0 -FDIVCheck=0 -UnroundedFP=0 -StartMode=0 -Unattended=0 -Retained=0 -ThreadPerObject=0 -MaxNumberOfThreads=1 diff --git a/embedding/browser/activex/tests/vbxml/xml.vbw b/embedding/browser/activex/tests/vbxml/xml.vbw deleted file mode 100644 index f03dd00b88e..00000000000 --- a/embedding/browser/activex/tests/vbxml/xml.vbw +++ /dev/null @@ -1 +0,0 @@ -Form1 = 99, 16, 850, 493, , 22, 22, 653, 533, C diff --git a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp index c61f947ca15..b1ec4fa2dfc 100644 --- a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp +++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp @@ -74,7 +74,6 @@ #include "nsIDOMEvent.h" #include "nsIDOMMouseEvent.h" #include "nsIDOMNSUIEvent.h" -#include "nsIDOMEventTarget.h" #include "nsIDOMNamedNodeMap.h" #include "nsIFormControl.h" #include "nsIDOMHTMLInputElement.h" @@ -102,9 +101,7 @@ #include "nsPresContext.h" #include "nsIViewManager.h" #include "nsIView.h" -#include "nsPIDOMEventTarget.h" -#include "nsIEventListenerManager.h" -#include "nsIDOMEventGroup.h" +#include "nsEventListenerManager.h" #include "nsIDOMDragEvent.h" #include "nsIConstraintValidation.h" @@ -112,10 +109,10 @@ // GetEventReceiver // // A helper routine that navigates the tricky path from a |nsWebBrowser| to -// a |nsPIDOMEventTarget| via the window root and chrome event handler. +// a |nsIDOMEventTarget| via the window root and chrome event handler. // static nsresult -GetPIDOMEventTarget( nsWebBrowser* inBrowser, nsPIDOMEventTarget** aTarget) +GetDOMEventTarget( nsWebBrowser* inBrowser, nsIDOMEventTarget** aTarget) { NS_ENSURE_ARG_POINTER(inBrowser); @@ -127,11 +124,10 @@ GetPIDOMEventTarget( nsWebBrowser* inBrowser, nsPIDOMEventTarget** aTarget) NS_ENSURE_TRUE(domWindowPrivate, NS_ERROR_FAILURE); nsPIDOMWindow *rootWindow = domWindowPrivate->GetPrivateRoot(); NS_ENSURE_TRUE(rootWindow, NS_ERROR_FAILURE); - nsCOMPtr piTarget = - do_QueryInterface(rootWindow->GetChromeEventHandler()); - NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE); - *aTarget = piTarget; - NS_IF_ADDREF(*aTarget); + nsCOMPtr target = + rootWindow->GetChromeEventHandler(); + NS_ENSURE_TRUE(target, NS_ERROR_FAILURE); + target.forget(aTarget); return NS_OK; } @@ -888,21 +884,19 @@ nsDocShellTreeOwner::AddChromeListeners() } // register dragover and drop event listeners with the listener manager - nsCOMPtr piTarget; - GetPIDOMEventTarget(mWebBrowser, getter_AddRefs(piTarget)); + nsCOMPtr target; + GetDOMEventTarget(mWebBrowser, getter_AddRefs(target)); - nsCOMPtr sysGroup; - piTarget->GetSystemEventGroup(getter_AddRefs(sysGroup)); - nsIEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE); - if (sysGroup && elmP) + nsEventListenerManager* elmP = target->GetListenerManager(PR_TRUE); + if (elmP) { rv = elmP->AddEventListenerByType(this, NS_LITERAL_STRING("dragover"), - NS_EVENT_FLAG_BUBBLE, - sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); NS_ENSURE_SUCCESS(rv, rv); rv = elmP->AddEventListenerByType(this, NS_LITERAL_STRING("drop"), - NS_EVENT_FLAG_BUBBLE, - sysGroup); + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); } return rv; @@ -922,24 +916,20 @@ nsDocShellTreeOwner::RemoveChromeListeners() NS_RELEASE(mChromeContextMenuListener); } - nsCOMPtr piTarget; - GetPIDOMEventTarget(mWebBrowser, getter_AddRefs(piTarget)); + nsCOMPtr piTarget; + GetDOMEventTarget(mWebBrowser, getter_AddRefs(piTarget)); if (!piTarget) return NS_OK; - nsCOMPtr sysGroup; - piTarget->GetSystemEventGroup(getter_AddRefs(sysGroup)); - nsIEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE); - if (sysGroup && elmP) + nsEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE); + if (elmP) { - nsresult rv = - elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("dragover"), - NS_EVENT_FLAG_BUBBLE, - sysGroup); - NS_ENSURE_SUCCESS(rv, rv); - rv = elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("drop"), - NS_EVENT_FLAG_BUBBLE, - sysGroup); + elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("dragover"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); + elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("drop"), + NS_EVENT_FLAG_BUBBLE | + NS_EVENT_FLAG_SYSTEM_EVENT); } return NS_OK; @@ -1246,7 +1236,7 @@ NS_IMETHODIMP ChromeTooltipListener::AddChromeListeners() { if (!mEventTarget) - GetPIDOMEventTarget(mWebBrowser, getter_AddRefs(mEventTarget)); + GetDOMEventTarget(mWebBrowser, getter_AddRefs(mEventTarget)); // Register the appropriate events for tooltips, but only if // the embedding chrome cares. @@ -1729,7 +1719,7 @@ NS_IMETHODIMP ChromeContextMenuListener::AddChromeListeners() { if (!mEventTarget) - GetPIDOMEventTarget(mWebBrowser, getter_AddRefs(mEventTarget)); + GetDOMEventTarget(mWebBrowser, getter_AddRefs(mEventTarget)); // Register the appropriate events for context menus, but only if // the embedding chrome cares. diff --git a/embedding/browser/webBrowser/nsDocShellTreeOwner.h b/embedding/browser/webBrowser/nsDocShellTreeOwner.h index a4280c05dc6..a9ee4c07eeb 100644 --- a/embedding/browser/webBrowser/nsDocShellTreeOwner.h +++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.h @@ -52,7 +52,6 @@ #include "nsIWebBrowserChrome.h" #include "nsIDOMMouseListener.h" #include "nsIDOMDocument.h" -#include "nsIDOMEventTarget.h" #include "nsIEmbeddingSiteWindow.h" #include "nsIWebProgressListener.h" #include "nsWeakReference.h" @@ -66,7 +65,7 @@ #include "nsITooltipTextProvider.h" #include "nsCTooltipTextProvider.h" #include "nsIDroppedLinkHandler.h" -#include "nsPIDOMEventTarget.h" +#include "nsIDOMEventTarget.h" #include "nsCommandHandler.h" class nsWebBrowser; @@ -225,7 +224,7 @@ private: NS_IMETHOD HideTooltip ( ) ; nsWebBrowser* mWebBrowser; - nsCOMPtr mEventTarget; + nsCOMPtr mEventTarget; nsCOMPtr mTooltipTextProvider; // This must be a strong ref in order to make sure we can hide the tooltip @@ -292,7 +291,7 @@ private: PRPackedBool mContextMenuListenerInstalled; nsWebBrowser* mWebBrowser; - nsCOMPtr mEventTarget; + nsCOMPtr mEventTarget; nsCOMPtr mWebBrowserChrome; }; // class ChromeContextMenuListener diff --git a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index 4fd8076a0b3..1e68b58844e 100644 --- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -1460,10 +1460,12 @@ PRUint32 nsWindowWatcher::CalculateChromeFlags(const char *aFeatures, NS_ENSURE_TRUE(securityManager, NS_ERROR_FAILURE); PRBool isChrome = PR_FALSE; - securityManager->SubjectPrincipalIsSystem(&isChrome); + nsresult rv = securityManager->SubjectPrincipalIsSystem(&isChrome); + if (NS_FAILED(rv)) { + isChrome = PR_FALSE; + } nsCOMPtr prefBranch; - nsresult rv; nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, PR_TRUE); @@ -1984,7 +1986,10 @@ nsWindowWatcher::SizeOpenedDocShellItem(nsIDocShellTreeItem *aDocShellItem, nsCOMPtr chromeWin(do_QueryInterface(aParent)); PRBool isChrome = PR_FALSE; - securityManager->SubjectPrincipalIsSystem(&isChrome); + nsresult rv = securityManager->SubjectPrincipalIsSystem(&isChrome); + if (NS_FAILED(rv)) { + isChrome = PR_FALSE; + } // Only enable special priveleges for chrome when chrome calls // open() on a chrome window diff --git a/extensions/gio/nsGIOProtocolHandler.cpp b/extensions/gio/nsGIOProtocolHandler.cpp index 9faa639298d..893c2fb00ce 100644 --- a/extensions/gio/nsGIOProtocolHandler.cpp +++ b/extensions/gio/nsGIOProtocolHandler.cpp @@ -481,7 +481,7 @@ nsGIOInputStream::DoRead(char *aBuf, PRUint32 aCount, PRUint32 *aCountRead) PRUint32 bufLen = mDirBuf.Length() - mDirBufCursor; if (bufLen) { - PRUint32 n = PR_MIN(bufLen, aCount); + PRUint32 n = NS_MIN(bufLen, aCount); memcpy(aBuf, mDirBuf.get() + mDirBufCursor, n); *aCountRead += n; aBuf += n; diff --git a/extensions/spellcheck/src/mozInlineSpellChecker.cpp b/extensions/spellcheck/src/mozInlineSpellChecker.cpp index 58b9f84a47a..d89ee31a210 100644 --- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp +++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp @@ -73,7 +73,6 @@ #include "nsIDOMDocument.h" #include "nsIDOMElement.h" #include "nsIDOMEventTarget.h" -#include "nsPIDOMEventTarget.h" #include "nsIDOMMouseEvent.h" #include "nsIDOMKeyEvent.h" #include "nsIDOMNode.h" @@ -94,7 +93,7 @@ #include "nsThreadUtils.h" #include "nsUnicharUtils.h" #include "nsIContent.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsGUIEvent.h" // Set to spew messages to the console about what is happening. @@ -645,10 +644,10 @@ mozInlineSpellChecker::RegisterEventListeners() nsresult rv = editor->GetDocument(getter_AddRefs(doc)); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr piTarget = do_QueryInterface(doc, &rv); + nsCOMPtr piTarget = do_QueryInterface(doc, &rv); NS_ENSURE_SUCCESS(rv, rv); - nsIEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE); + nsEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE); if (elmP) { // Focus event doesn't bubble so adding the listener to capturing phase elmP->AddEventListenerByIID(static_cast(this), @@ -678,10 +677,10 @@ mozInlineSpellChecker::UnregisterEventListeners() editor->GetDocument(getter_AddRefs(doc)); NS_ENSURE_TRUE(doc, NS_ERROR_NULL_POINTER); - nsCOMPtr piTarget = do_QueryInterface(doc); + nsCOMPtr piTarget = do_QueryInterface(doc); NS_ENSURE_TRUE(piTarget, NS_ERROR_NULL_POINTER); - nsCOMPtr elmP = + nsEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE); if (elmP) { elmP->RemoveEventListenerByIID(static_cast(this), diff --git a/extensions/widgetutils/src/nsWidgetUtils.cpp b/extensions/widgetutils/src/nsWidgetUtils.cpp index 6b252d34b1a..b9eca33d1a9 100644 --- a/extensions/widgetutils/src/nsWidgetUtils.cpp +++ b/extensions/widgetutils/src/nsWidgetUtils.cpp @@ -66,7 +66,6 @@ #include "nsIDOMEventTarget.h" #include "nsPIDOMWindow.h" #include "nsIDOMWindow.h" -#include "nsIDOM3EventTarget.h" #include "nsIDOMKeyListener.h" #include "nsIDOMCompositionListener.h" #include "nsIDOMTextListener.h" @@ -445,15 +444,12 @@ nsWidgetUtils::GetChromeEventHandler(nsIDOMWindow *aDOMWin, nsIDOMEventTarget **aChromeTarget) { nsCOMPtr privateDOMWindow(do_QueryInterface(aDOMWin)); - nsPIDOMEventTarget* chromeEventHandler = nsnull; + nsIDOMEventTarget* chromeEventHandler = nsnull; if (privateDOMWindow) { chromeEventHandler = privateDOMWindow->GetChromeEventHandler(); } - nsCOMPtr target(do_QueryInterface(chromeEventHandler)); - - *aChromeTarget = target; - NS_IF_ADDREF(*aChromeTarget); + NS_IF_ADDREF(*aChromeTarget = chromeEventHandler); } void @@ -467,17 +463,18 @@ nsWidgetUtils::RemoveWindowListeners(nsIDOMWindow *aDOMWin) } // Use capturing, otherwise the normal find next will get activated when ours should - nsCOMPtr piTarget(do_QueryInterface(chromeEventHandler)); // Remove DOM Text listener for IME text events - rv = piTarget->RemoveEventListenerByIID(static_cast(this), - NS_GET_IID(nsIDOMMouseListener)); + rv = chromeEventHandler-> + RemoveEventListenerByIID(static_cast(this), + NS_GET_IID(nsIDOMMouseListener)); if (NS_FAILED(rv)) { NS_WARNING("Failed to add Mouse Motion listener\n"); return; } - rv = piTarget->RemoveEventListenerByIID(static_cast(this), - NS_GET_IID(nsIDOMMouseMotionListener)); + rv = chromeEventHandler-> + RemoveEventListenerByIID(static_cast(this), + NS_GET_IID(nsIDOMMouseMotionListener)); if (NS_FAILED(rv)) { NS_WARNING("Failed to add Mouse Motion listener\n"); return; @@ -495,17 +492,18 @@ nsWidgetUtils::AttachWindowListeners(nsIDOMWindow *aDOMWin) } // Use capturing, otherwise the normal find next will get activated when ours should - nsCOMPtr piTarget(do_QueryInterface(chromeEventHandler)); // Attach menu listeners, this will help us ignore keystrokes meant for menus - rv = piTarget->AddEventListenerByIID(static_cast(this), - NS_GET_IID(nsIDOMMouseListener)); + rv = chromeEventHandler-> + AddEventListenerByIID(static_cast(this), + NS_GET_IID(nsIDOMMouseListener)); if (NS_FAILED(rv)) { NS_WARNING("Failed to add Mouse Motion listener\n"); return; } - rv = piTarget->AddEventListenerByIID(static_cast(this), - NS_GET_IID(nsIDOMMouseMotionListener)); + rv = chromeEventHandler-> + AddEventListenerByIID(static_cast(this), + NS_GET_IID(nsIDOMMouseMotionListener)); if (NS_FAILED(rv)) { NS_WARNING("Failed to add Mouse Motion listener\n"); return; diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h new file mode 100644 index 00000000000..da001346e82 --- /dev/null +++ b/gfx/2d/2D.h @@ -0,0 +1,668 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 ***** */ + +#ifndef _MOZILLA_GFX_2D_H +#define _MOZILLA_GFX_2D_H + +#include "Point.h" +#include "Rect.h" +#include "Matrix.h" + +// This RefPtr class isn't ideal for usage in Azure, as it doesn't allow T** +// outparams using the &-operator. But it will have to do as there's no easy +// solution. +#include "mozilla/RefPtr.h" + +struct _cairo_surface; +typedef _cairo_surface cairo_surface_t; + +struct ID3D10Device1; +struct ID3D10Texture2D; + +namespace mozilla { +namespace gfx { + +class SourceSurface; +class DataSourceSurface; +class DrawTarget; + +struct NativeSurface { + NativeSurfaceType mType; + SurfaceFormat mFormat; + void *mSurface; +}; + +struct NativeFont { + NativeFontType mType; + void *mFont; +}; + +/* + * This structure is used to send draw options that are universal to all drawing + * operations. It consists of the following: + * + * mAlpha - Alpha value by which the mask generated by this operation is + * multiplied. + * mCompositionOp - The operator that indicates how the source and destination + * patterns are blended. + * mAntiAliasMode - The AntiAlias mode used for this drawing operation. + * mSnapping - Whether this operation is snapped to pixel boundaries. + */ +struct DrawOptions { + DrawOptions(Float aAlpha = 1.0f, + CompositionOp aCompositionOp = OP_OVER, + AntialiasMode aAntialiasMode = AA_GRAY, + Snapping aSnapping = SNAP_NONE) + : mAlpha(aAlpha) + , mCompositionOp(aCompositionOp) + , mAntialiasMode(aAntialiasMode) + , mSnapping(aSnapping) + {} + + Float mAlpha; + CompositionOp mCompositionOp : 8; + AntialiasMode mAntialiasMode : 2; + Snapping mSnapping : 1; +}; + +/* + * This structure is used to send stroke options that are used in stroking + * operations. It consists of the following: + * + * mLineWidth - Width of the stroke in userspace. + * mLineJoin - Join style used for joining lines. + * mLineCap - Cap style used for capping lines. + * mMiterLimit - Miter limit in units of linewidth + */ +struct StrokeOptions { + StrokeOptions(Float aLineWidth = 1.0f, + JoinStyle aLineJoin = JOIN_MITER_OR_BEVEL, + CapStyle aLineCap = CAP_BUTT, + Float aMiterLimit = 10.0f) + : mLineWidth(aLineWidth) + , mMiterLimit(aMiterLimit) + , mLineJoin(aLineJoin) + , mLineCap(aLineCap) + {} + + Float mLineWidth; + Float mMiterLimit; + JoinStyle mLineJoin : 4; + CapStyle mLineCap : 3; +}; + +/* + * This structure supplies additional options for calls to DrawSurface. + * + * mFilter - Filter used when resampling source surface region to the + * destination region. + */ +struct DrawSurfaceOptions { + DrawSurfaceOptions(Filter aFilter = FILTER_LINEAR) + : mFilter(aFilter) + { } + + Filter mFilter : 3; +}; + +/* + * This class is used to store gradient stops, it can only be used with a + * matching DrawTarget. Not adhering to this condition will make a draw call + * fail. + */ +class GradientStops : public RefCounted +{ +public: + virtual ~GradientStops() {} + + virtual BackendType GetBackendType() const = 0; + +protected: + GradientStops() {} +}; + +/* + * This is the base class for 'patterns'. Patterns describe the pixels used as + * the source for a masked composition operation that is done by the different + * drawing commands. These objects are not backend specific, however for + * example the gradient stops on a gradient pattern can be backend specific. + */ +class Pattern +{ +public: + virtual ~Pattern() {} + + virtual PatternType GetType() const = 0; + +protected: + Pattern() {} +}; + +class ColorPattern : public Pattern +{ +public: + ColorPattern(const Color &aColor) + : mColor(aColor) + {} + + virtual PatternType GetType() const { return PATTERN_COLOR; } + + Color mColor; +}; + +/* + * This class is used for Linear Gradient Patterns, the gradient stops are + * stored in a separate object and are backend dependent. This class itself + * may be used on the stack. + */ +class LinearGradientPattern : public Pattern +{ +public: + /* + * aBegin Start of the linear gradient + * aEnd End of the linear gradient + * aStops GradientStops object for this gradient, this should match the + * backend type of the draw target this pattern will be used with. + */ + LinearGradientPattern(const Point &aBegin, + const Point &aEnd, + GradientStops *aStops) + : mBegin(aBegin) + , mEnd(aEnd) + , mStops(aStops) + { + } + + virtual PatternType GetType() const { return PATTERN_LINEAR_GRADIENT; } + + Point mBegin; + Point mEnd; + RefPtr mStops; +}; + +/* + * This class is used for Radial Gradient Patterns, the gradient stops are + * stored in a separate object and are backend dependent. This class itself + * may be used on the stack. + */ +class RadialGradientPattern : public Pattern +{ +public: + /* + * aBegin Start of the linear gradient + * aEnd End of the linear gradient + * aStops GradientStops object for this gradient, this should match the + * backend type of the draw target this pattern will be used with. + */ + RadialGradientPattern(const Point &aCenter, + const Point &aOrigin, + Float aRadius, + GradientStops *aStops) + : mCenter(aCenter) + , mOrigin(aOrigin) + , mRadius(aRadius) + , mStops(aStops) + { + } + + virtual PatternType GetType() const { return PATTERN_RADIAL_GRADIENT; } + + Point mCenter; + Point mOrigin; + Float mRadius; + RefPtr mStops; +}; + +/* + * This class is used for Surface Patterns, they wrap a surface and a + * repetition mode for the surface. This may be used on the stack. + */ +class SurfacePattern : public Pattern +{ +public: + SurfacePattern(SourceSurface *aSourceSurface, ExtendMode aExtendMode) + : mSurface(aSourceSurface) + , mExtendMode(aExtendMode) + {} + + virtual PatternType GetType() const { return PATTERN_SURFACE; } + + RefPtr mSurface; + ExtendMode mExtendMode; + Filter mFilter; +}; + +/* + * This is the base class for source surfaces. These objects are surfaces + * which may be used as a source in a SurfacePattern of a DrawSurface call. + * They cannot be drawn to directly. + */ +class SourceSurface : public RefCounted +{ +public: + virtual ~SourceSurface() {} + + virtual SurfaceType GetType() const = 0; + virtual IntSize GetSize() const = 0; + virtual SurfaceFormat GetFormat() const = 0; + + /* + * This function will get a DataSourceSurface for this surface, a + * DataSourceSurface's data can be accessed directly. + */ + virtual TemporaryRef GetDataSurface() = 0; +}; + +class DataSourceSurface : public SourceSurface +{ +public: + /* Get the raw bitmap data of the surface */ + virtual unsigned char *GetData() = 0; + /* + * Stride of the surface, distance in bytes between the start of the image + * data belonging to row y and row y+1. This may be negative. + */ + virtual int32_t Stride() = 0; + + virtual TemporaryRef GetDataSurface() { RefPtr temp = this; return temp.forget(); } +}; + +/* This is an abstract object that accepts path segments. */ +class PathSink : public RefCounted +{ +public: + virtual ~PathSink() {} + + /* Move the current point in the path, any figure currently being drawn will + * be considered closed during fill operations, however when stroking the + * closing line segment will not be drawn. + */ + virtual void MoveTo(const Point &aPoint) = 0; + /* Add a linesegment to the current figure */ + virtual void LineTo(const Point &aPoint) = 0; + /* Add a cubic bezier curve to the current figure */ + virtual void BezierTo(const Point &aCP1, + const Point &aCP2, + const Point &aCP3) = 0; + /* Add a quadratic bezier curve to the current figure */ + virtual void QuadraticBezierTo(const Point &aCP1, + const Point &aCP2) = 0; + /* Close the current figure, this will essentially generate a line segment + * from the current point to the starting point for the current figure + */ + virtual void Close() = 0; + /* Add an arc to the current figure */ + virtual void Arc(const Point &aOrigin, float aRadius, float aStartAngle, + float aEndAngle, bool aAntiClockwise = false) = 0; + /* Point the current subpath is at - or where the next subpath will start + * if there is no active subpath. + */ + virtual Point CurrentPoint() const = 0; +}; + +class PathBuilder; + +/* The path class is used to create (sets of) figures of any shape that can be + * filled or stroked to a DrawTarget + */ +class Path : public RefCounted +{ +public: + virtual ~Path() {} + + virtual BackendType GetBackendType() const = 0; + + /* This returns a PathBuilder object that contains a copy of the contents of + * this path and is still writable. + */ + virtual TemporaryRef CopyToBuilder(FillRule aFillRule = FILL_WINDING) const = 0; + virtual TemporaryRef TransformedCopyToBuilder(const Matrix &aTransform, + FillRule aFillRule = FILL_WINDING) const = 0; + + /* This function checks if a point lies within a path. It allows passing a + * transform that will transform the path to the coordinate space in which + * aPoint is given. + */ + virtual bool ContainsPoint(const Point &aPoint, const Matrix &aTransform) const = 0; + + /* This gets the fillrule this path's builder was created with. This is not + * mutable. + */ + virtual FillRule GetFillRule() const = 0; +}; + +/* The PathBuilder class allows path creation. Once finish is called on the + * pathbuilder it may no longer be written to. + */ +class PathBuilder : public PathSink +{ +public: + /* Finish writing to the path and return a Path object that can be used for + * drawing. Future use of the builder results in a crash! + */ + virtual TemporaryRef Finish() = 0; +}; + +struct Glyph +{ + uint32_t mIndex; + Point mPosition; +}; + +/* This class functions as a glyph buffer that can be drawn to a DrawTarget. + * XXX - This should probably contain the guts of gfxTextRun in the future as + * roc suggested. But for now it's a simple container for a glyph vector. + */ +struct GlyphBuffer +{ + // A pointer to a buffer of glyphs. Managed by the caller. + const Glyph *mGlyphs; + // Number of glyphs mGlyphs points to. + uint32_t mNumGlyphs; +}; + +/* This class is an abstraction of a backend/platform specific font object + * at a particular size. It is passed into text drawing calls to describe + * the font used for the drawing call. + */ +class ScaledFont : public RefCounted +{ +public: + virtual ~ScaledFont() {} + + virtual FontType GetType() const = 0; + + /* This allows getting a path that describes the outline of a set of glyphs. + * A target is passed in so that the guarantee is made the returned path + * can be used with any DrawTarget that has the same backend as the one + * passed in. + */ + virtual TemporaryRef GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget) = 0; + +protected: + ScaledFont() {} +}; + +/* This is the main class used for all the drawing. It is created through the + * factory and accepts drawing commands. The results of drawing to a target + * may be used either through a Snapshot or by flushing the target and directly + * accessing the backing store a DrawTarget was created with. + */ +class DrawTarget : public RefCounted +{ +public: + DrawTarget() : mTransformDirty(false) {} + virtual ~DrawTarget() {} + + virtual BackendType GetType() const = 0; + virtual TemporaryRef Snapshot() = 0; + virtual IntSize GetSize() = 0; + + /* Ensure that the DrawTarget backend has flushed all drawing operations to + * this draw target. This must be called before using the backing surface of + * this draw target outside of GFX 2D code. + */ + virtual void Flush() = 0; + + /* + * Draw a surface to the draw target. Possibly doing partial drawing or + * applying scaling. No sampling happens outside the source. + * + * aSurface Source surface to draw + * aDest Destination rectangle that this drawing operation should draw to + * aSource Source rectangle in aSurface coordinates, this area of aSurface + * will be stretched to the size of aDest. + * aOptions General draw options that are applied to the operation + * aSurfOptions DrawSurface options that are applied + */ + virtual void DrawSurface(SourceSurface *aSurface, + const Rect &aDest, + const Rect &aSource, + const DrawSurfaceOptions &aSurfOptions = DrawSurfaceOptions(), + const DrawOptions &aOptions = DrawOptions()) = 0; + + /* + * Blend a surface to the draw target with a shadow. The shadow is drawn as a + * gaussian blur using a specified sigma. + * NOTE: This function works in device space! + * + * aSurface Source surface to draw. + * aDest Destination point that this drawing operation should draw to. + * aColor Color of the drawn shadow + * aOffset Offset of the shadow + * aSigma Sigma used for the guassian filter kernel + */ + virtual void DrawSurfaceWithShadow(SourceSurface *aSurface, + const Point &aDest, + const Color &aColor, + const Point &aOffset, + Float aSigma) = 0; + + /* + * Clear a rectangle on the draw target to transparent black. This will + * respect the clipping region and transform. + * + * aRect Rectangle to clear + */ + virtual void ClearRect(const Rect &aRect) = 0; + + /* + * This is essentially a 'memcpy' between two surfaces. It moves a pixel + * aligned area from the source surface unscaled directly onto the + * drawtarget. This ignores both transform and clip. + * + * aSurface Surface to copy from + * aSourceRect Source rectangle to be copied + * aDest Destination point to copy the surface to + */ + virtual void CopySurface(SourceSurface *aSurface, + const IntRect &aSourceRect, + const IntPoint &aDestination) = 0; + + /* + * Fill a rectangle on the DrawTarget with a certain source pattern. + * + * aRect Rectangle that forms the mask of this filling operation + * aPattern Pattern that forms the source of this filling operation + * aOptions Options that are applied to this operation + */ + virtual void FillRect(const Rect &aRect, + const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()) = 0; + + /* + * Stroke a rectangle on the DrawTarget with a certain source pattern. + * + * aRect Rectangle that forms the mask of this stroking operation + * aPattern Pattern that forms the source of this stroking operation + * aOptions Options that are applied to this operation + */ + virtual void StrokeRect(const Rect &aRect, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()) = 0; + + /* + * Stroke a line on the DrawTarget with a certain source pattern. + * + * aStart Starting point of the line + * aEnd End point of the line + * aPattern Pattern that forms the source of this stroking operation + * aOptions Options that are applied to this operation + */ + virtual void StrokeLine(const Point &aStart, + const Point &aEnd, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()) = 0; + + /* + * Stroke a path on the draw target with a certain source pattern. + * + * aPath Path that is to be stroked + * aPattern Pattern that should be used for the stroke + * aStrokeOptions Stroke options used for this operation + * aOptions Draw options used for this operation + */ + virtual void Stroke(const Path *aPath, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()) = 0; + + /* + * Fill a path on the draw target with a certain source pattern. + * + * aPath Path that is to be filled + * aPattern Pattern that should be used for the fill + * aOptions Draw options used for this operation + */ + virtual void Fill(const Path *aPath, + const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()) = 0; + + /* + * Fill a series of clyphs on the draw target with a certain source pattern. + */ + virtual void FillGlyphs(ScaledFont *aFont, + const GlyphBuffer &aBuffer, + const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()) = 0; + + /* + * Push a clip to the DrawTarget. + * + * aPath The path to clip to + */ + virtual void PushClip(const Path *aPath) = 0; + + /* Pop a clip from the DrawTarget. A pop without a corresponding push will + * be ignored. + */ + virtual void PopClip() = 0; + + /* + * Create a SourceSurface optimized for use with this DrawTarget for + * existing bitmap data in memory. + */ + virtual TemporaryRef CreateSourceSurfaceFromData(unsigned char *aData, + const IntSize &aSize, + int32_t aStride, + SurfaceFormat aFormat) const = 0; + + /* + * Create a SourceSurface optimized for use with this DrawTarget from + * an arbitrary other SourceSurface. This may return aSourceSurface or some + * other existing surface. + */ + virtual TemporaryRef OptimizeSourceSurface(SourceSurface *aSurface) const = 0; + + /* + * Create a SourceSurface for a type of NativeSurface. This may fail if the + * draw target does not know how to deal with the type of NativeSurface passed + * in. + */ + virtual TemporaryRef + CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const = 0; + + /* + * Create a DrawTarget whose snapshot is optimized for use with this DrawTarget. + */ + virtual TemporaryRef + CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const = 0; + + /* + * Create a path builder with the specified fillmode. + */ + virtual TemporaryRef CreatePathBuilder(FillRule aFillRule = FILL_WINDING) const = 0; + + /* + * Create a GradientStops object that holds information about a set of + * gradient stops, this object is required for linear or radial gradient + * patterns to represent the color stops in the gradient. + * + * aStops An array of gradient stops + * aNumStops Number of stops in the array aStops + */ + virtual TemporaryRef CreateGradientStops(GradientStop *aStops, uint32_t aNumStops) const = 0; + + const Matrix &GetTransform() const { return mTransform; } + + /* + * Set a transform on the surface, this transform is applied at drawing time + * to both the mask and source of the operation. + */ + virtual void SetTransform(const Matrix &aTransform) + { mTransform = aTransform; mTransformDirty = true; } + + SurfaceFormat GetFormat() { return mFormat; } + + /* Tries to get a native surface for a DrawTarget, this may fail if the + * draw target cannot convert to this surface type. + */ + virtual void *GetNativeSurface(NativeSurfaceType aType) = 0; + +protected: + Matrix mTransform; + bool mTransformDirty : 1; + + SurfaceFormat mFormat; +}; + +class Factory +{ +public: +#ifdef USE_CAIRO + static TemporaryRef CreateDrawTargetForCairoSurface(cairo_surface_t* aSurface); +#endif + + static TemporaryRef CreateDrawTarget(BackendType aBackend, const IntSize &aSize, SurfaceFormat aFormat); + static TemporaryRef CreateScaledFontForNativeFont(const NativeFont &aNativeFont, Float aSize); + +#ifdef WIN32 + static TemporaryRef CreateDrawTargetForD3D10Texture(ID3D10Texture2D *aTexture, SurfaceFormat aFormat); + static void SetDirect3D10Device(ID3D10Device1 *aDevice); + static ID3D10Device1 *GetDirect3D10Device(); + +private: + static ID3D10Device1 *mD3D10Device; +#endif +}; + +} +} + +#endif // _MOZILLA_GFX_2D_H diff --git a/gfx/src/BaseMargin.h b/gfx/2d/BaseMargin.h similarity index 93% rename from gfx/src/BaseMargin.h rename to gfx/2d/BaseMargin.h index a25089473e0..1b99482cce7 100644 --- a/gfx/src/BaseMargin.h +++ b/gfx/2d/BaseMargin.h @@ -35,12 +35,13 @@ * * ***** END LICENSE BLOCK ***** */ -#ifndef MOZILLA_BASEMARGIN_H_ -#define MOZILLA_BASEMARGIN_H_ +#ifndef MOZILLA_GFX_BASEMARGIN_H_ +#define MOZILLA_GFX_BASEMARGIN_H_ -#include "gfxCore.h" +#include "Types.h" namespace mozilla { +namespace gfx { /** * Do not use this class directly. Subclass it, pass that subclass as the @@ -68,12 +69,10 @@ struct BaseMargin { T TopBottom() const { return top + bottom; } T& Side(SideT aSide) { - NS_PRECONDITION(aSide <= NS_SIDE_LEFT, "Out of range side"); // This is ugly! return *(&top + aSide); } T Side(SideT aSide) const { - NS_PRECONDITION(aSide <= NS_SIDE_LEFT, "Out of range side"); // This is ugly! return *(&top + aSide); } @@ -104,6 +103,7 @@ struct BaseMargin { } }; +} } -#endif /* MOZILLA_BASEMARGIN_H_ */ +#endif /* MOZILLA_GFX_BASEMARGIN_H_ */ diff --git a/gfx/src/BasePoint.h b/gfx/2d/BasePoint.h similarity index 96% rename from gfx/src/BasePoint.h rename to gfx/2d/BasePoint.h index 21cb0b64251..08f695fd262 100644 --- a/gfx/src/BasePoint.h +++ b/gfx/2d/BasePoint.h @@ -35,10 +35,11 @@ * * ***** END LICENSE BLOCK ***** */ -#ifndef MOZILLA_BASEPOINT_H_ -#define MOZILLA_BASEPOINT_H_ +#ifndef MOZILLA_GFX_BASEPOINT_H_ +#define MOZILLA_GFX_BASEPOINT_H_ namespace mozilla { +namespace gfx { /** * Do not use this class directly. Subclass it, pass that subclass as the @@ -95,6 +96,7 @@ struct BasePoint { } }; +} } -#endif /* MOZILLA_BASEPOINT_H_ */ +#endif /* MOZILLA_GFX_BASEPOINT_H_ */ diff --git a/gfx/src/BaseRect.h b/gfx/2d/BaseRect.h similarity index 76% rename from gfx/src/BaseRect.h rename to gfx/2d/BaseRect.h index 49b84f697b7..9359f5a7f2f 100644 --- a/gfx/src/BaseRect.h +++ b/gfx/2d/BaseRect.h @@ -35,12 +35,27 @@ * * ***** END LICENSE BLOCK ***** */ -#ifndef MOZILLA_BASERECT_H_ -#define MOZILLA_BASERECT_H_ +#ifndef MOZILLA_GFX_BASERECT_H_ +#define MOZILLA_GFX_BASERECT_H_ -#include "nsAlgorithm.h" +#include namespace mozilla { +namespace gfx { + +// XXX - conflicts with exceptions on 10.6. Define our own gfx_min/gfx_max +// functions here. Avoid min/max to avoid conflicts with existing #defines on windows. +template +T gfx_min(T aVal1, T aVal2) +{ + return (aVal1 < aVal2) ? aVal1 : aVal2; +} + +template +T gfx_max(T aVal1, T aVal2) +{ + return (aVal1 > aVal2) ? aVal1 : aVal2; +} /** * Rectangles have two interpretations: a set of (zero-size) points, @@ -113,15 +128,15 @@ struct BaseRect { } // Returns the rectangle containing the intersection of the points // (including edges) of *this and aRect. If there are no points in that - // intersection, returns an empty rectangle with x/y set to the max of the x/y + // intersection, returns an empty rectangle with x/y set to the gfx_max of the x/y // of *this and aRect. Sub Intersect(const Sub& aRect) const { Sub result; - result.x = NS_MAX(x, aRect.x); - result.y = NS_MAX(y, aRect.y); - result.width = NS_MIN(XMost(), aRect.XMost()) - result.x; - result.height = NS_MIN(YMost(), aRect.YMost()) - result.y; + result.x = gfx_max(x, aRect.x); + result.y = gfx_max(y, aRect.y); + result.width = gfx_min(XMost(), aRect.XMost()) - result.x; + result.height = gfx_min(YMost(), aRect.YMost()) - result.y; if (result.width < 0 || result.height < 0) { result.SizeTo(0, 0); } @@ -129,7 +144,7 @@ struct BaseRect { } // Sets *this to be the rectangle containing the intersection of the points // (including edges) of *this and aRect. If there are no points in that - // intersection, sets *this to be an empty rectangle with x/y set to the max + // intersection, sets *this to be an empty rectangle with x/y set to the gfx_max // of the x/y of *this and aRect. // // 'this' can be the same object as either aRect1 or aRect2 @@ -159,10 +174,10 @@ struct BaseRect { Sub UnionEdges(const Sub& aRect) const { Sub result; - result.x = NS_MIN(x, aRect.x); - result.y = NS_MIN(y, aRect.y); - result.width = NS_MAX(XMost(), aRect.XMost()) - result.x; - result.height = NS_MAX(YMost(), aRect.YMost()) - result.y; + result.x = gfx_min(x, aRect.x); + result.y = gfx_min(y, aRect.y); + result.width = gfx_max(XMost(), aRect.XMost()) - result.x; + result.height = gfx_max(YMost(), aRect.YMost()) - result.y; return result; } // Computes the smallest rectangle that contains both the area of both @@ -223,15 +238,15 @@ struct BaseRect { { x += aDx; y += aDy; - width = NS_MAX(T(0), width - 2 * aDx); - height = NS_MAX(T(0), height - 2 * aDy); + width = gfx_max(T(0), width - 2 * aDx); + height = gfx_max(T(0), height - 2 * aDy); } void Deflate(const Margin& aMargin) { x += aMargin.left; y += aMargin.top; - width = NS_MAX(T(0), width - aMargin.LeftRight()); - height = NS_MAX(T(0), height - aMargin.TopBottom()); + width = gfx_max(T(0), width - aMargin.LeftRight()); + height = gfx_max(T(0), height - aMargin.TopBottom()); } void Deflate(const SizeT& aSize) { Deflate(aSize.width, aSize.height); } @@ -295,13 +310,50 @@ struct BaseRect { // Scale 'this' by aScale, converting coordinates to integers so that the result is // the smallest integer-coordinate rectangle containing the unrounded result. + // Note: this can turn an empty rectangle into a non-empty rectangle void ScaleRoundOut(double aScale) { ScaleRoundOut(aScale, aScale); } + // Scale 'this' by aXScale and aYScale, converting coordinates to integers so + // that the result is the smallest integer-coordinate rectangle containing the + // unrounded result. + // Note: this can turn an empty rectangle into a non-empty rectangle void ScaleRoundOut(double aXScale, double aYScale) { - T right = static_cast(NS_ceil(double(XMost()) * aXScale)); - T bottom = static_cast(NS_ceil(double(YMost()) * aYScale)); - x = static_cast(NS_floor(double(x) * aXScale)); - y = static_cast(NS_floor(double(y) * aYScale)); + T right = static_cast(ceil(double(XMost()) * aXScale)); + T bottom = static_cast(ceil(double(YMost()) * aYScale)); + x = static_cast(floor(double(x) * aXScale)); + y = static_cast(floor(double(y) * aYScale)); + width = right - x; + height = bottom - y; + } + // Scale 'this' by aScale, converting coordinates to integers so that the result is + // the largest integer-coordinate rectangle contained by the unrounded result. + void ScaleRoundIn(double aScale) { ScaleRoundIn(aScale, aScale); } + // Scale 'this' by aXScale and aYScale, converting coordinates to integers so + // that the result is the largest integer-coordinate rectangle contained by the + // unrounded result. + void ScaleRoundIn(double aXScale, double aYScale) + { + T right = static_cast(floor(double(XMost()) * aXScale)); + T bottom = static_cast(floor(double(YMost()) * aYScale)); + x = static_cast(ceil(double(x) * aXScale)); + y = static_cast(ceil(double(y) * aYScale)); + width = gfx_max(0, right - x); + height = gfx_max(0, bottom - y); + } + // Scale 'this' by 1/aScale, converting coordinates to integers so that the result is + // the smallest integer-coordinate rectangle containing the unrounded result. + // Note: this can turn an empty rectangle into a non-empty rectangle + void ScaleInverseRoundOut(double aScale) { ScaleInverseRoundOut(aScale, aScale); } + // Scale 'this' by 1/aXScale and 1/aYScale, converting coordinates to integers so + // that the result is the smallest integer-coordinate rectangle containing the + // unrounded result. + // Note: this can turn an empty rectangle into a non-empty rectangle + void ScaleInverseRoundOut(double aXScale, double aYScale) + { + T right = static_cast(ceil(double(XMost()) / aXScale)); + T bottom = static_cast(ceil(double(YMost()) / aYScale)); + x = static_cast(floor(double(x) / aXScale)); + y = static_cast(floor(double(y) / aYScale)); width = right - x; height = bottom - y; } @@ -313,6 +365,7 @@ private: bool operator!=(const Sub& aRect) const { return false; } }; +} } -#endif /* MOZILLA_BASERECT_H_ */ +#endif /* MOZILLA_GFX_BASERECT_H_ */ diff --git a/gfx/src/BaseSize.h b/gfx/2d/BaseSize.h similarity index 96% rename from gfx/src/BaseSize.h rename to gfx/2d/BaseSize.h index f995b337261..0751887af53 100644 --- a/gfx/src/BaseSize.h +++ b/gfx/2d/BaseSize.h @@ -35,10 +35,11 @@ * * ***** END LICENSE BLOCK ***** */ -#ifndef MOZILLA_BASESIZE_H_ -#define MOZILLA_BASESIZE_H_ +#ifndef MOZILLA_GFX_BASESIZE_H_ +#define MOZILLA_GFX_BASESIZE_H_ namespace mozilla { +namespace gfx { /** * Do not use this class directly. Subclass it, pass that subclass as the @@ -96,6 +97,7 @@ struct BaseSize { } }; +} } -#endif /* MOZILLA_BASESIZE_H_ */ +#endif /* MOZILLA_GFX_BASESIZE_H_ */ diff --git a/gfx/2d/DrawTargetCG.cpp b/gfx/2d/DrawTargetCG.cpp new file mode 100644 index 00000000000..6e7d91e36b3 --- /dev/null +++ b/gfx/2d/DrawTargetCG.cpp @@ -0,0 +1,184 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 "DrawTargetCG.h" +#include "SourceSurfaceCG.h" +#include "Rect.h" + +//CG_EXTERN void CGContextSetCompositeOperation (CGContextRef, PrivateCGCompositeMode); + +namespace mozilla { +namespace gfx { + +static CGRect RectToCGRect(Rect r) +{ + return CGRectMake(r.x, r.y, r.width, r.height); +} + +CGBlendMode ToBlendMode(CompositionOp op) +{ + CGBlendMode mode; + switch (op) { + case OP_OVER: + mode = kCGBlendModeNormal; + break; + case OP_SOURCE: + mode = kCGBlendModeCopy; + break; + case OP_CLEAR: + mode = kCGBlendModeClear; + break; + case OP_ADD: + mode = kCGBlendModePlusLighter; + break; + case OP_ATOP: + mode = kCGBlendModeSourceAtop; + break; + default: + mode = kCGBlendModeNormal; + } + return mode; +} + + + +DrawTargetCG::DrawTargetCG() +{ +} + +DrawTargetCG::~DrawTargetCG() +{ +} + +TemporaryRef +DrawTargetCG::Snapshot() +{ + return NULL; +} + +TemporaryRef +DrawTargetCG::CreateSourceSurfaceFromData(unsigned char *aData, + const IntSize &aSize, + int32_t aStride, + SurfaceFormat aFormat) const +{ + RefPtr newSurf = new SourceSurfaceCG(); + + if (!newSurf->InitFromData(aData, aSize, aStride, aFormat)) { + return NULL; + } + + return newSurf; +} + +TemporaryRef +DrawTargetCG::OptimizeSourceSurface(SourceSurface *aSurface) const +{ + return NULL; +} + +void +DrawTargetCG::DrawSurface(SourceSurface *aSurface, + const Rect &aDest, + const Rect &aSource, + const DrawOptions &aOptions, + const DrawSurfaceOptions &aSurfOptions) +{ + CGImageRef image; + CGImageRef subimage = NULL; + if (aSurface->GetType() == COREGRAPHICS_IMAGE) { + image = static_cast(aSurface)->GetImage(); + /* we have two options here: + * - create a subimage -- this is slower + * - fancy things with clip and different dest rects */ + { + subimage = CGImageCreateWithImageInRect(image, RectToCGRect(aSource)); + image = subimage; + } + + CGContextDrawImage(mCg, RectToCGRect(aDest), image); + + CGImageRelease(subimage); + } +} + +void +DrawTargetCG::FillRect(const Rect &aRect, + const Pattern &aPattern, + const DrawOptions &aOptions) +{ + //XXX: it would be nice to hang a CGColor off of the pattern here + if (aPattern.GetType() == COLOR) { + Color color = static_cast(&aPattern)->mColor; + //XXX: the m prefixes are painful here + CGContextSetRGBFillColor(mCg, color.mR, color.mG, color.mB, color.mA); + } + + CGContextSetBlendMode(mCg, ToBlendMode(aOptions.mCompositionOp)); + CGContextFillRect(mCg, RectToCGRect(aRect)); +} + + +bool +DrawTargetCG::Init(const IntSize &aSize) +{ + CGColorSpaceRef cgColorspace; + cgColorspace = CGColorSpaceCreateDeviceRGB(); + + mSize = aSize; + + int bitsPerComponent = 8; + int stride = mSize.width; + + CGBitmapInfo bitinfo; + + bitinfo = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst; + + // XXX: mWidth is ugly + mCg = CGBitmapContextCreate (NULL, + mSize.width, + mSize.height, + bitsPerComponent, + stride, + cgColorspace, + bitinfo); + + CGColorSpaceRelease (cgColorspace); + + return true; +} +} +} diff --git a/gfx/2d/DrawTargetCG.h b/gfx/2d/DrawTargetCG.h new file mode 100644 index 00000000000..d6908f91751 --- /dev/null +++ b/gfx/2d/DrawTargetCG.h @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Jeff Muizelaar + * + * 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 ***** */ + +#pragma once + +#include + +#include "2D.h" +#include "Rect.h" +namespace mozilla { +namespace gfx { + +class DrawTargetCG : public DrawTarget +{ +public: + DrawTargetCG(); + virtual ~DrawTargetCG(); + + virtual BackendType GetType() const { return COREGRAPHICS; } + virtual TemporaryRef Snapshot(); + + virtual void DrawSurface(SourceSurface *aSurface, + const Rect &aDest, + const Rect &aSource, + const DrawOptions &aOptions = DrawOptions(), + const DrawSurfaceOptions &aSurfOptions = DrawSurfaceOptions()); + + virtual void FillRect(const Rect &aRect, + const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()); + + + bool Init(const IntSize &aSize); + bool Init(CGContextRef cgContext, const IntSize &aSize); + + /* This is for creating good compatible surfaces */ + virtual TemporaryRef CreateSourceSurfaceFromData(unsigned char *aData, + const IntSize &aSize, + int32_t aStride, + SurfaceFormat aFormat) const; + virtual TemporaryRef OptimizeSourceSurface(SourceSurface *aSurface) const; +private: + bool InitCGRenderTarget(); + + IntSize mSize; + CGContextRef mCg; + +}; + +} +} diff --git a/gfx/2d/DrawTargetCairo.cpp b/gfx/2d/DrawTargetCairo.cpp new file mode 100644 index 00000000000..ae6d4671895 --- /dev/null +++ b/gfx/2d/DrawTargetCairo.cpp @@ -0,0 +1,219 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * 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 "DrawTargetCairo.h" +#include "SourceSurfaceCairo.h" + +namespace mozilla { +namespace gfx { + +cairo_operator_t +GfxOpToCairoOp(CompositionOp op) +{ + switch (op) + { + case OP_OVER: + return CAIRO_OPERATOR_OVER; + case OP_SOURCE: + return CAIRO_OPERATOR_SOURCE; + case OP_ADD: + return CAIRO_OPERATOR_ADD; + case OP_ATOP: + return CAIRO_OPERATOR_ATOP; + case OP_COUNT: + break; + } + + return CAIRO_OPERATOR_OVER; +} + +cairo_filter_t +GfxFilterToCairoFilter(Filter filter) +{ + switch (filter) + { + case FILTER_LINEAR: + return CAIRO_FILTER_BILINEAR; + case FILTER_POINT: + return CAIRO_FILTER_NEAREST; + } + + return CAIRO_FILTER_BILINEAR; +} + +cairo_format_t +GfxFormatToCairoFormat(SurfaceFormat format) +{ + switch (format) + { + case FORMAT_B8G8R8A8: + return CAIRO_FORMAT_ARGB32; + case FORMAT_B8G8R8X8: + return CAIRO_FORMAT_RGB24; + case FORMAT_A8: + return CAIRO_FORMAT_A8; + } + + return CAIRO_FORMAT_ARGB32; +} + +void +GfxMatrixToCairoMatrix(const Matrix& mat, cairo_matrix_t& retval) +{ + cairo_matrix_init(&retval, mat._11, mat._12, mat._21, mat._22, mat._31, mat._32); +} + +DrawTargetCairo::DrawTargetCairo() + : mContext(NULL) +{ +} + +DrawTargetCairo::~DrawTargetCairo() +{ + cairo_destroy(mContext); +} + +TemporaryRef +DrawTargetCairo::Snapshot() +{ + return NULL; +} + +void +DrawTargetCairo::Flush() +{ + cairo_surface_t* surf = cairo_get_target(mContext); + cairo_surface_flush(surf); +} + +void +DrawTargetCairo::DrawSurface(SourceSurface *aSurface, + const Rect &aDest, + const Rect &aSource, + const DrawSurfaceOptions &aSurfOptions, + const DrawOptions &aOptions) +{ + float sx = aSource.Width() / aDest.Width(); + float sy = aSource.Height() / aDest.Height(); + + cairo_matrix_t src_mat; + cairo_matrix_init_scale(&src_mat, sx, sy); + cairo_matrix_translate(&src_mat, -aSource.X(), -aSource.Y()); + + cairo_surface_t* surf = NULL; + if (aSurface->GetType() == SURFACE_CAIRO) { + surf = static_cast(aSurface)->GetSurface(); + } + + cairo_pattern_t* pat = cairo_pattern_create_for_surface(surf); + cairo_pattern_set_matrix(pat, &src_mat); + cairo_pattern_set_filter(pat, GfxFilterToCairoFilter(aSurfOptions.mFilter)); + + cairo_set_operator(mContext, GfxOpToCairoOp(aOptions.mCompositionOp)); + cairo_rectangle(mContext, aDest.X(), aDest.Y(), + aDest.Width(), aDest.Height()); + cairo_fill(mContext); + + cairo_pattern_destroy(pat); +} + +void +DrawTargetCairo::FillRect(const Rect &aRect, + const Pattern &aPattern, + const DrawOptions &aOptions) +{ + cairo_new_path(mContext); + cairo_rectangle(mContext, aRect.x, aRect.y, aRect.Width(), aRect.Height()); + + cairo_set_operator(mContext, GfxOpToCairoOp(aOptions.mCompositionOp)); + + if (aPattern.GetType() == PATTERN_COLOR) { + Color color = static_cast(aPattern).mColor; + cairo_set_source_rgba(mContext, color.r, color.g, + color.b, color.a); + } + + cairo_fill(mContext); +} + +TemporaryRef +DrawTargetCairo::CreateSourceSurfaceFromData(unsigned char *aData, + const IntSize &aSize, + int32_t aStride, + SurfaceFormat aFormat) const +{ + cairo_surface_t* surf = cairo_image_surface_create_for_data(aData, + GfxFormatToCairoFormat(aFormat), + aSize.width, + aSize.height, + aStride); + RefPtr source_surf = new SourceSurfaceCairo(); + source_surf->InitFromSurface(surf, aSize, aFormat); + cairo_surface_destroy(surf); + return source_surf; +} + +TemporaryRef +DrawTargetCairo::OptimizeSourceSurface(SourceSurface *aSurface) const +{ + return NULL; +} + +TemporaryRef +DrawTargetCairo::CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const +{ + return NULL; +} + +bool +DrawTargetCairo::Init(cairo_surface_t* aSurface) +{ + mContext = cairo_create(aSurface); + + return true; +} + +void +DrawTargetCairo::SetTransform(const Matrix& aTransform) +{ + cairo_matrix_t mat; + GfxMatrixToCairoMatrix(aTransform, mat); + cairo_set_matrix(mContext, &mat); + mTransform = aTransform; +} + +} +} diff --git a/gfx/2d/DrawTargetCairo.h b/gfx/2d/DrawTargetCairo.h new file mode 100644 index 00000000000..fbc11c9cb47 --- /dev/null +++ b/gfx/2d/DrawTargetCairo.h @@ -0,0 +1,143 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * 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 ***** */ + +#ifndef _MOZILLA_GFX_DRAWTARGET_CAIRO_H_ +#define _MOZILLA_GFX_DRAWTARGET_CAIRO_H_ + +#include "2D.h" +#include "cairo.h" + +namespace mozilla { +namespace gfx { + +class DrawTargetCairo : public DrawTarget +{ +public: + DrawTargetCairo(); + virtual ~DrawTargetCairo(); + + virtual BackendType GetType() const { return BACKEND_CAIRO; } + virtual TemporaryRef Snapshot(); + virtual IntSize GetSize() { return IntSize(); } + + virtual void Flush(); + virtual void DrawSurface(SourceSurface *aSurface, + const Rect &aDest, + const Rect &aSource, + const DrawSurfaceOptions &aSurfOptions = DrawSurfaceOptions(), + const DrawOptions &aOptions = DrawOptions()); + virtual void DrawSurfaceWithShadow(SourceSurface *aSurface, + const Point &aDest, + const Color &aColor, + const Point &aOffset, + Float aSigma) + { } + + virtual void ClearRect(const Rect &aRect) + { } + + virtual void CopySurface(SourceSurface *aSurface, + const IntRect &aSourceRect, + const IntPoint &aDestination) + { } + + virtual void FillRect(const Rect &aRect, + const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()); + virtual void StrokeRect(const Rect &aRect, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()) + { return; } + virtual void StrokeLine(const Point &aStart, + const Point &aEnd, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()) + { return; } + + virtual void Stroke(const Path *aPath, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()) + { return; } + + virtual void Fill(const Path *aPath, + const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()) + { return; } + + virtual void FillGlyphs(ScaledFont *aFont, + const GlyphBuffer &aBuffer, + const Pattern &aPattern, + const DrawOptions &aOptions) + { return; } + + virtual void PushClip(const Path *aPath) { } + virtual void PopClip() { } + + virtual TemporaryRef CreatePathBuilder(FillRule aFillRule = FILL_WINDING) const { return NULL; } + + virtual TemporaryRef CreateSourceSurfaceFromData(unsigned char *aData, + const IntSize &aSize, + int32_t aStride, + SurfaceFormat aFormat) const; + virtual TemporaryRef OptimizeSourceSurface(SourceSurface *aSurface) const; + virtual TemporaryRef + CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const; + virtual TemporaryRef + CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const + { return NULL; } + + virtual TemporaryRef CreateGradientStops(GradientStop *aStops, uint32_t aNumStops) const + { return NULL; } + + virtual void *GetNativeSurface(NativeSurfaceType aType) + { return NULL; } + + virtual void SetTransform(const Matrix& aTransform); + + bool Init(cairo_surface_t* aSurface); + +private: + + cairo_t* mContext; +}; + +} +} + +#endif // _MOZILLA_GFX_DRAWTARGET_CAIRO_H_ diff --git a/gfx/2d/DrawTargetD2D.cpp b/gfx/2d/DrawTargetD2D.cpp new file mode 100644 index 00000000000..5d80061f4b4 --- /dev/null +++ b/gfx/2d/DrawTargetD2D.cpp @@ -0,0 +1,1679 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 "DrawTargetD2D.h" +#include "SourceSurfaceD2D.h" +#include "SourceSurfaceD2DTarget.h" +#include "ShadersD2D.h" +#include "PathD2D.h" +#include "GradientStopsD2D.h" +#include "ScaledFontDWrite.h" +#include "Logging.h" +#include "Tools.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +typedef HRESULT (WINAPI*D2D1CreateFactoryFunc)( + __in D2D1_FACTORY_TYPE factoryType, + __in REFIID iid, + __in_opt CONST D2D1_FACTORY_OPTIONS *pFactoryOptions, + __out void **factory +); + +typedef HRESULT (WINAPI*D3D10CreateEffectFromMemoryFunc)( + __in void *pData, + __in SIZE_T DataLength, + __in UINT FXFlags, + __in ID3D10Device *pDevice, + __in ID3D10EffectPool *pEffectPool, + __out ID3D10Effect **ppEffect +); + +namespace mozilla { +namespace gfx { + +struct Vertex { + float x; + float y; +}; + +ID2D1Factory *DrawTargetD2D::mFactory; + +// Helper class to restore surface contents that was clipped out but may have +// been altered by a drawing call. +class AutoSaveRestoreClippedOut +{ +public: + AutoSaveRestoreClippedOut(DrawTargetD2D *aDT) + : mDT(aDT) + {} + + void Save() { + if (!mDT->mPushedClips.size()) { + return; + } + + mDT->Flush(); + + RefPtr tmpTexture; + IntSize size = mDT->mSize; + SurfaceFormat format = mDT->mFormat; + + CD3D10_TEXTURE2D_DESC desc(DXGIFormat(format), size.width, size.height, + 1, 1); + desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; + + HRESULT hr = mDT->mDevice->CreateTexture2D(&desc, NULL, byRef(tmpTexture)); + if (FAILED(hr)) { + gfxWarning() << "Failed to create temporary texture to hold surface data."; + } + mDT->mDevice->CopyResource(tmpTexture, mDT->mTexture); + + D2D1_BITMAP_PROPERTIES props = + D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(format), + AlphaMode(format))); + + RefPtr surf; + + tmpTexture->QueryInterface((IDXGISurface**)byRef(surf)); + + hr = mDT->mRT->CreateSharedBitmap(IID_IDXGISurface, surf, + &props, byRef(mOldSurfBitmap)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to create shared bitmap for old surface."; + } + + factory()->CreatePathGeometry(byRef(mClippedArea)); + RefPtr currentSink; + mClippedArea->Open(byRef(currentSink)); + + std::vector::iterator iter = mDT->mPushedClips.begin(); + iter->mPath->GetGeometry()->Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES, + iter->mTransform, currentSink); + + currentSink->Close(); + + iter++; + for (;iter != mDT->mPushedClips.end(); iter++) { + RefPtr newGeom; + factory()->CreatePathGeometry(byRef(newGeom)); + + newGeom->Open(byRef(currentSink)); + mClippedArea->CombineWithGeometry(iter->mPath->GetGeometry(), D2D1_COMBINE_MODE_INTERSECT, + iter->mTransform, currentSink); + + currentSink->Close(); + + mClippedArea = newGeom; + } + } + + ID2D1Factory *factory() { return mDT->factory(); } + + ~AutoSaveRestoreClippedOut() + { + if (!mOldSurfBitmap) { + return; + } + + ID2D1RenderTarget *rt = mDT->mRT; + + // Write the area that was clipped out back to the surface. This all + // happens in device space. + rt->SetTransform(D2D1::IdentityMatrix()); + mDT->mTransformDirty = true; + + RefPtr rectGeom; + factory()->CreateRectangleGeometry(D2D1::InfiniteRect(), byRef(rectGeom)); + + RefPtr invClippedArea; + factory()->CreatePathGeometry(byRef(invClippedArea)); + RefPtr sink; + invClippedArea->Open(byRef(sink)); + + HRESULT hr = rectGeom->CombineWithGeometry(mClippedArea, D2D1_COMBINE_MODE_EXCLUDE, + NULL, sink); + sink->Close(); + + RefPtr brush; + rt->CreateBitmapBrush(mOldSurfBitmap, D2D1::BitmapBrushProperties(), D2D1::BrushProperties(), byRef(brush)); + + rt->FillGeometry(invClippedArea, brush); + } + +private: + + DrawTargetD2D *mDT; + + // If we have an operator unbound by the source, this will contain a bitmap + // with the old dest surface data. + RefPtr mOldSurfBitmap; + // This contains the area drawing is clipped to. + RefPtr mClippedArea; +}; + +DrawTargetD2D::DrawTargetD2D() + : mClipsArePushed(false) + , mPrivateData(NULL) +{ +} + +DrawTargetD2D::~DrawTargetD2D() +{ + if (mRT) { + PopAllClips(); + + mRT->EndDraw(); + } + if (mTempRT) { + mTempRT->EndDraw(); + } +} + +/* + * DrawTarget Implementation + */ +TemporaryRef +DrawTargetD2D::Snapshot() +{ + RefPtr newSurf = new SourceSurfaceD2DTarget(); + + newSurf->mFormat = mFormat; + newSurf->mTexture = mTexture; + newSurf->mDrawTarget = this; + + mSnapshots.push_back(newSurf); + + Flush(); + + return newSurf; +} + +void +DrawTargetD2D::Flush() +{ + PopAllClips(); + + HRESULT hr = mRT->Flush(); + + if (FAILED(hr)) { + gfxWarning() << "Error reported when trying to flush D2D rendertarget. Code: " << hr; + } +} + +void +DrawTargetD2D::DrawSurface(SourceSurface *aSurface, + const Rect &aDest, + const Rect &aSource, + const DrawSurfaceOptions &aSurfOptions, + const DrawOptions &aOptions) +{ + RefPtr bitmap; + + ID2D1RenderTarget *rt = GetRTForOperator(aOptions.mCompositionOp); + + PrepareForDrawing(rt); + + Rect srcRect = aSource; + + switch (aSurface->GetType()) { + + case SURFACE_D2D1_BITMAP: + { + SourceSurfaceD2D *srcSurf = static_cast(aSurface); + bitmap = srcSurf->GetBitmap(); + + if (!bitmap) { + if (aSource.width > rt->GetMaximumBitmapSize() || + aSource.height > rt->GetMaximumBitmapSize()) { + gfxDebug() << "Bitmap source larger than texture size specified. DrawBitmap will silently fail."; + // Don't know how to deal with this yet. + return; + } + + int stride = srcSurf->GetSize().width * BytesPerPixel(srcSurf->GetFormat()); + + unsigned char *data = &srcSurf->mRawData.front() + + (uint32_t)aSource.y * stride + + (uint32_t)aSource.x * BytesPerPixel(srcSurf->GetFormat()); + + D2D1_BITMAP_PROPERTIES props = + D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(srcSurf->GetFormat()), AlphaMode(srcSurf->GetFormat()))); + mRT->CreateBitmap(D2D1::SizeU(UINT32(aSource.width), UINT32(aSource.height)), data, stride, props, byRef(bitmap)); + + srcRect.x -= (uint32_t)aSource.x; + srcRect.y -= (uint32_t)aSource.y; + } + } + break; + case SURFACE_D2D1_DRAWTARGET: + { + SourceSurfaceD2DTarget *srcSurf = static_cast(aSurface); + bitmap = srcSurf->GetBitmap(mRT); + + if (!srcSurf->IsCopy()) { + srcSurf->mDrawTarget->mDependentTargets.push_back(this); + } + } + break; + } + + rt->DrawBitmap(bitmap, D2DRect(aDest), aOptions.mAlpha, D2DFilter(aSurfOptions.mFilter), D2DRect(srcRect)); + + FinalizeRTForOperator(aOptions.mCompositionOp, aDest); +} + +void +DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface, + const Point &aDest, + const Color &aColor, + const Point &aOffset, + Float aSigma) +{ + RefPtr srView = NULL; + if (aSurface->GetType() != SURFACE_D2D1_DRAWTARGET) { + return; + } + + Flush(); + + srView = static_cast(aSurface)->GetSRView(); + + EnsureViews(); + + if (!mTempRTView) { + // This view is only needed in this path. + HRESULT hr = mDevice->CreateRenderTargetView(mTempTexture, NULL, byRef(mTempRTView)); + + if (FAILED(hr)) { + gfxWarning() << "Failure to create RenderTargetView. Code: " << hr; + return; + } + } + + RefPtr destRTView = mRTView; + RefPtr destTexture; + HRESULT hr; + + if (mPushedClips.size()) { + // We need to take clips into account, draw into a temporary surface, which + // we then blend back with the proper clips set, using D2D. + CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, + mSize.width, mSize.height, + 1, 1); + desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; + + hr = mDevice->CreateTexture2D(&desc, NULL, byRef(destTexture)); + if (FAILED(hr)) { + gfxWarning() << "Failure to create temporary texture. Size: " << mSize << " Code: " << hr; + return; + } + + hr = mDevice->CreateRenderTargetView(destTexture, NULL, byRef(destRTView)); + if (FAILED(hr)) { + gfxWarning() << "Failure to create RenderTargetView. Code: " << hr; + return; + } + + float color[4] = { 0, 0, 0, 0 }; + mDevice->ClearRenderTargetView(destRTView, color); + } + + + IntSize srcSurfSize; + ID3D10RenderTargetView *rtViews; + D3D10_VIEWPORT viewport; + + UINT stride = sizeof(Vertex); + UINT offset = 0; + ID3D10Buffer *buff = mPrivateData->mVB; + + mDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + mDevice->IASetVertexBuffers(0, 1, &buff, &stride, &offset); + mDevice->IASetInputLayout(mPrivateData->mInputLayout); + + mPrivateData->mEffect->GetVariableByName("QuadDesc")->AsVector()-> + SetFloatVector(ShaderConstantRectD3D10(-1.0f, 1.0f, 2.0f, -2.0f)); + mPrivateData->mEffect->GetVariableByName("TexCoords")->AsVector()-> + SetFloatVector(ShaderConstantRectD3D10(0, 0, 1.0f, 1.0f)); + + // If we create a downsampled source surface we need to correct aOffset for that. + Point correctedOffset = aOffset + aDest; + + // The 'practical' scaling factors. + Float dsFactorX = 1.0f; + Float dsFactorY = 1.0f; + + if (aSigma > 1.7f) { + // In this case 9 samples of our original will not cover it. Generate the + // mip levels for the original and create a downsampled version from + // them. We generate a version downsampled so that a kernel for a sigma + // of 1.7 will produce the right results. + float blurWeights[9] = { 0.234671f, 0.197389f, 0.197389f, 0.117465f, 0.117465f, 0.049456f, 0.049456f, 0.014732f, 0.014732f }; + mPrivateData->mEffect->GetVariableByName("BlurWeights")->SetRawValue(blurWeights, 0, sizeof(blurWeights)); + + CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, + aSurface->GetSize().width, + aSurface->GetSize().height); + desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; + desc.MiscFlags = D3D10_RESOURCE_MISC_GENERATE_MIPS; + + RefPtr mipTexture; + hr = mDevice->CreateTexture2D(&desc, NULL, byRef(mipTexture)); + + if (FAILED(hr)) { + gfxWarning() << "Failure to create temporary texture. Size: " << + aSurface->GetSize() << " Code: " << hr; + return; + } + + IntSize dsSize = IntSize(int32_t(aSurface->GetSize().width * (1.7f / aSigma)), + int32_t(aSurface->GetSize().height * (1.7f / aSigma))); + + if (dsSize.width < 1) { + dsSize.width = 1; + } + if (dsSize.height < 1) { + dsSize.height = 1; + } + + dsFactorX = dsSize.width / Float(aSurface->GetSize().width); + dsFactorY = dsSize.height / Float(aSurface->GetSize().height); + correctedOffset.x *= dsFactorX; + correctedOffset.y *= dsFactorY; + + desc = CD3D10_TEXTURE2D_DESC(DXGI_FORMAT_B8G8R8A8_UNORM, + dsSize.width, + dsSize.height, 1, 1); + desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; + RefPtr tmpDSTexture; + hr = mDevice->CreateTexture2D(&desc, NULL, byRef(tmpDSTexture)); + + if (FAILED(hr)) { + gfxWarning() << "Failure to create temporary texture. Size: " << dsSize << " Code: " << hr; + return; + } + + D3D10_BOX box; + box.left = box.top = box.front = 0; + box.back = 1; + box.right = aSurface->GetSize().width; + box.bottom = aSurface->GetSize().height; + mDevice->CopySubresourceRegion(mipTexture, 0, 0, 0, 0, static_cast(aSurface)->mTexture, 0, &box); + + mDevice->CreateShaderResourceView(mipTexture, NULL, byRef(srView)); + mDevice->GenerateMips(srView); + + RefPtr dsRTView; + RefPtr dsSRView; + mDevice->CreateRenderTargetView(tmpDSTexture, NULL, byRef(dsRTView)); + mDevice->CreateShaderResourceView(tmpDSTexture, NULL, byRef(dsSRView)); + + rtViews = dsRTView; + mDevice->OMSetRenderTargets(1, &rtViews, NULL); + + viewport.MaxDepth = 1; + viewport.MinDepth = 0; + viewport.Height = dsSize.height; + viewport.Width = dsSize.width; + viewport.TopLeftX = 0; + viewport.TopLeftY = 0; + + mDevice->RSSetViewports(1, &viewport); + mPrivateData->mEffect->GetVariableByName("tex")->AsShaderResource()->SetResource(srView); + mPrivateData->mEffect->GetTechniqueByName("SampleTexture")-> + GetPassByIndex(0)->Apply(0); + + mDevice->OMSetBlendState(GetBlendStateForOperator(OP_OVER), NULL, 0xffffffff); + + mDevice->Draw(4, 0); + + srcSurfSize = dsSize; + + srView = dsSRView; + } else { + // In this case generate a kernel to draw the blur directly to the temp + // surf in one direction and to final in the other. + float blurWeights[9]; + + float normalizeFactor = 1.0f; + if (aSigma != 0) { + normalizeFactor = 1.0f / Float(sqrt(2 * M_PI * pow(aSigma, 2))); + } + + blurWeights[0] = normalizeFactor; + + // XXX - We should actually optimize for Sigma = 0 here. We could use a + // much simpler shader and save a lot of texture lookups. + for (int i = 1; i < 9; i += 2) { + if (aSigma != 0) { + blurWeights[i] = blurWeights[i + 1] = normalizeFactor * + exp(-pow(float((i + 1) / 2), 2) / (2 * pow(aSigma, 2))); + } else { + blurWeights[i] = blurWeights[i + 1] = 0; + } + } + + mPrivateData->mEffect->GetVariableByName("BlurWeights")->SetRawValue(blurWeights, 0, sizeof(blurWeights)); + + viewport.MaxDepth = 1; + viewport.MinDepth = 0; + viewport.Height = aSurface->GetSize().height; + viewport.Width = aSurface->GetSize().width; + viewport.TopLeftX = 0; + viewport.TopLeftY = 0; + + mDevice->RSSetViewports(1, &viewport); + + srcSurfSize = aSurface->GetSize(); + } + + // We may need to draw to a different intermediate surface if our temp + // texture isn't big enough. + bool needBiggerTemp = srcSurfSize.width > mSize.width || + srcSurfSize.height > mSize.height; + + RefPtr tmpRTView; + RefPtr tmpSRView; + RefPtr tmpTexture; + + IntSize tmpSurfSize = mSize; + + if (!needBiggerTemp) { + tmpRTView = mTempRTView; + tmpSRView = mSRView; + } else { + CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, + srcSurfSize.width, + srcSurfSize.height, + 1, 1); + desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; + + mDevice->CreateTexture2D(&desc, NULL, byRef(tmpTexture)); + mDevice->CreateRenderTargetView(tmpTexture, NULL, byRef(tmpRTView)); + mDevice->CreateShaderResourceView(tmpTexture, NULL, byRef(tmpSRView)); + + tmpSurfSize = srcSurfSize; + } + + rtViews = tmpRTView; + mDevice->OMSetRenderTargets(1, &rtViews, NULL); + + mPrivateData->mEffect->GetVariableByName("tex")->AsShaderResource()->SetResource(srView); + + // Premultiplied! + float shadowColor[4] = { aColor.r * aColor.a, aColor.g * aColor.a, + aColor.b * aColor.a, aColor.a }; + mPrivateData->mEffect->GetVariableByName("ShadowColor")->AsVector()-> + SetFloatVector(shadowColor); + + float pixelOffset = 1.0f / float(srcSurfSize.width); + float blurOffsetsH[9] = { 0, pixelOffset, -pixelOffset, + 2.0f * pixelOffset, -2.0f * pixelOffset, + 3.0f * pixelOffset, -3.0f * pixelOffset, + 4.0f * pixelOffset, - 4.0f * pixelOffset }; + + pixelOffset = 1.0f / float(tmpSurfSize.height); + float blurOffsetsV[9] = { 0, pixelOffset, -pixelOffset, + 2.0f * pixelOffset, -2.0f * pixelOffset, + 3.0f * pixelOffset, -3.0f * pixelOffset, + 4.0f * pixelOffset, - 4.0f * pixelOffset }; + + mPrivateData->mEffect->GetVariableByName("BlurOffsetsH")-> + SetRawValue(blurOffsetsH, 0, sizeof(blurOffsetsH)); + mPrivateData->mEffect->GetVariableByName("BlurOffsetsV")-> + SetRawValue(blurOffsetsV, 0, sizeof(blurOffsetsV)); + + mPrivateData->mEffect->GetTechniqueByName("SampleTextureWithShadow")-> + GetPassByIndex(0)->Apply(0); + + mDevice->Draw(4, 0); + + viewport.MaxDepth = 1; + viewport.MinDepth = 0; + viewport.Height = mSize.height; + viewport.Width = mSize.width; + viewport.TopLeftX = 0; + viewport.TopLeftY = 0; + + mDevice->RSSetViewports(1, &viewport); + + mPrivateData->mEffect->GetVariableByName("tex")->AsShaderResource()->SetResource(tmpSRView); + + rtViews = destRTView; + mDevice->OMSetRenderTargets(1, &rtViews, NULL); + + mPrivateData->mEffect->GetVariableByName("TexCoords")->AsVector()-> + SetFloatVector(ShaderConstantRectD3D10(-correctedOffset.x / Float(tmpSurfSize.width), -correctedOffset.y / Float(tmpSurfSize.height), + mSize.width / Float(tmpSurfSize.width) * dsFactorX, + mSize.height / Float(tmpSurfSize.height) * dsFactorY)); + mPrivateData->mEffect->GetTechniqueByName("SampleTextureWithShadow")-> + GetPassByIndex(1)->Apply(0); + + mDevice->Draw(4, 0); + + mPrivateData->mEffect->GetVariableByName("tex")->AsShaderResource()->SetResource(static_cast(aSurface)->GetSRView()); + mPrivateData->mEffect->GetVariableByName("TexCoords")->AsVector()-> + SetFloatVector(ShaderConstantRectD3D10(-aDest.x / aSurface->GetSize().width, -aDest.y / aSurface->GetSize().height, + Float(mSize.width) / aSurface->GetSize().width, + Float(mSize.height) / aSurface->GetSize().height)); + mPrivateData->mEffect->GetTechniqueByName("SampleTexture")-> + GetPassByIndex(0)->Apply(0); + mDevice->OMSetBlendState(GetBlendStateForOperator(OP_OVER), NULL, 0xffffffff); + + mDevice->Draw(4, 0); + + if (mPushedClips.size()) { + // Assert destTexture + + // Blend back using the proper clips. + PrepareForDrawing(mRT); + + RefPtr surf; + hr = destTexture->QueryInterface((IDXGISurface**) byRef(surf)); + + if (FAILED(hr)) { + gfxWarning() << "Failure to QI texture to surface. Code: " << hr; + return; + } + + D2D1_BITMAP_PROPERTIES props = + D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(mFormat), AlphaMode(mFormat))); + RefPtr bitmap; + hr = mRT->CreateSharedBitmap(IID_IDXGISurface, surf, + &props, byRef(bitmap)); + + if (FAILED(hr)) { + gfxWarning() << "Failure to create shared bitmap for surface. Code: " << hr; + return; + } + + mRT->DrawBitmap(bitmap); + } +} + +void +DrawTargetD2D::ClearRect(const Rect &aRect) +{ + mRT->SetTransform(D2DMatrix(mTransform)); + PopAllClips(); + + AutoSaveRestoreClippedOut restoreClippedOut(this); + + restoreClippedOut.Save(); + + bool needsClip = false; + + needsClip = aRect.x > 0 || aRect.y > 0 || + aRect.XMost() < mSize.width || + aRect.YMost() < mSize.height; + + if (needsClip) { + mRT->PushAxisAlignedClip(D2DRect(aRect), D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); + } + mRT->Clear(D2D1::ColorF(0, 0.0f)); + if (needsClip) { + mRT->PopAxisAlignedClip(); + } + return; +} + +void +DrawTargetD2D::CopySurface(SourceSurface *aSurface, + const IntRect &aSourceRect, + const IntPoint &aDestination) +{ + Rect srcRect(aSourceRect.x, aSourceRect.y, aSourceRect.width, aSourceRect.height); + Rect dstRect(aDestination.x, aDestination.y, aSourceRect.width, aSourceRect.height); + + mRT->SetTransform(D2D1::IdentityMatrix()); + mRT->PushAxisAlignedClip(D2DRect(dstRect), D2D1_ANTIALIAS_MODE_ALIASED); + mRT->Clear(D2D1::ColorF(0, 0.0f)); + mRT->PopAxisAlignedClip(); + + RefPtr bitmap; + + switch (aSurface->GetType()) { + case SURFACE_D2D1_BITMAP: + { + SourceSurfaceD2D *srcSurf = static_cast(aSurface); + bitmap = srcSurf->GetBitmap(); + } + break; + case SURFACE_D2D1_DRAWTARGET: + { + SourceSurfaceD2DTarget *srcSurf = static_cast(aSurface); + bitmap = srcSurf->GetBitmap(mRT); + + if (!srcSurf->IsCopy()) { + srcSurf->mDrawTarget->mDependentTargets.push_back(this); + } + } + break; + } + + if (!bitmap) { + return; + } + + mRT->DrawBitmap(bitmap, D2DRect(dstRect), 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, + D2DRect(srcRect)); +} + +void +DrawTargetD2D::FillRect(const Rect &aRect, + const Pattern &aPattern, + const DrawOptions &aOptions) +{ + ID2D1RenderTarget *rt = GetRTForOperator(aOptions.mCompositionOp); + + PrepareForDrawing(rt); + + RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + + if (brush) { + rt->FillRectangle(D2DRect(aRect), brush); + } + + FinalizeRTForOperator(aOptions.mCompositionOp, aRect); +} + +void +DrawTargetD2D::StrokeRect(const Rect &aRect, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions, + const DrawOptions &aOptions) +{ + ID2D1RenderTarget *rt = GetRTForOperator(aOptions.mCompositionOp); + + PrepareForDrawing(rt); + + RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + + RefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); + + if (brush && strokeStyle) { + rt->DrawRectangle(D2DRect(aRect), brush, aStrokeOptions.mLineWidth, strokeStyle); + } + + FinalizeRTForOperator(aOptions.mCompositionOp, aRect); +} + +void +DrawTargetD2D::StrokeLine(const Point &aStart, + const Point &aEnd, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions, + const DrawOptions &aOptions) +{ + ID2D1RenderTarget *rt = GetRTForOperator(aOptions.mCompositionOp); + + PrepareForDrawing(rt); + + RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + + RefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); + + if (brush && strokeStyle) { + rt->DrawLine(D2DPoint(aStart), D2DPoint(aEnd), brush, aStrokeOptions.mLineWidth, strokeStyle); + } + + FinalizeRTForOperator(aOptions.mCompositionOp, Rect(0, 0, Float(mSize.width), Float(mSize.height))); +} + +void +DrawTargetD2D::Stroke(const Path *aPath, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions, + const DrawOptions &aOptions) +{ + if (aPath->GetBackendType() != BACKEND_DIRECT2D) { + gfxDebug() << *this << ": Ignoring drawing call for incompatible path."; + return; + } + + const PathD2D *d2dPath = static_cast(aPath); + + ID2D1RenderTarget *rt = GetRTForOperator(aOptions.mCompositionOp); + + PrepareForDrawing(rt); + + RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + + RefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); + + if (brush && strokeStyle) { + rt->DrawGeometry(d2dPath->mGeometry, brush, aStrokeOptions.mLineWidth, strokeStyle); + } + + FinalizeRTForOperator(aOptions.mCompositionOp, Rect(0, 0, Float(mSize.width), Float(mSize.height))); +} + +void +DrawTargetD2D::Fill(const Path *aPath, + const Pattern &aPattern, + const DrawOptions &aOptions) +{ + if (aPath->GetBackendType() != BACKEND_DIRECT2D) { + gfxDebug() << *this << ": Ignoring drawing call for incompatible path."; + return; + } + + const PathD2D *d2dPath = static_cast(aPath); + + ID2D1RenderTarget *rt = GetRTForOperator(aOptions.mCompositionOp); + + PrepareForDrawing(rt); + + RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + + if (brush) { + rt->FillGeometry(d2dPath->mGeometry, brush); + } + + Rect bounds; + if (aOptions.mCompositionOp != OP_OVER) { + D2D1_RECT_F d2dbounds; + d2dPath->mGeometry->GetBounds(D2D1::IdentityMatrix(), &d2dbounds); + bounds = ToRect(d2dbounds); + } + FinalizeRTForOperator(aOptions.mCompositionOp, bounds); +} + +void +DrawTargetD2D::FillGlyphs(ScaledFont *aFont, + const GlyphBuffer &aBuffer, + const Pattern &aPattern, + const DrawOptions &aOptions) +{ + if (aFont->GetType() != FONT_DWRITE) { + gfxDebug() << *this << ": Ignoring drawing call for incompatible font."; + return; + } + + ScaledFontDWrite *font = static_cast(aFont); + + ID2D1RenderTarget *rt = GetRTForOperator(aOptions.mCompositionOp); + + PrepareForDrawing(rt); + + RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + + DWRITE_GLYPH_RUN glyphRun; + + glyphRun.bidiLevel = 0; + glyphRun.fontEmSize = font->mSize; + glyphRun.isSideways = FALSE; + glyphRun.fontFace = font->mFontFace; + glyphRun.glyphCount = aBuffer.mNumGlyphs; + + std::vector indices; + std::vector advances; + std::vector offsets; + indices.resize(aBuffer.mNumGlyphs); + advances.resize(aBuffer.mNumGlyphs); + offsets.resize(aBuffer.mNumGlyphs); + + memset(&advances.front(), 0, sizeof(FLOAT) * aBuffer.mNumGlyphs); + for (unsigned int i = 0; i < aBuffer.mNumGlyphs; i++) { + indices[i] = aBuffer.mGlyphs[i].mIndex; + offsets[i].advanceOffset = aBuffer.mGlyphs[i].mPosition.x; + offsets[i].ascenderOffset = -aBuffer.mGlyphs[i].mPosition.y; + } + + glyphRun.glyphAdvances = &advances.front(); + glyphRun.glyphIndices = &indices.front(); + glyphRun.glyphOffsets = &offsets.front(); + + if (brush) { + rt->DrawGlyphRun(D2D1::Point2F(), &glyphRun, brush); + } + + FinalizeRTForOperator(aOptions.mCompositionOp, Rect(0, 0, (Float)mSize.width, (Float)mSize.height)); +} + +void +DrawTargetD2D::PushClip(const Path *aPath) +{ + if (aPath->GetBackendType() != BACKEND_DIRECT2D) { + gfxDebug() << *this << ": Ignoring clipping call for incompatible path."; + return; + } + + RefPtr pathD2D = static_cast(const_cast(aPath)); + + PushedClip clip; + clip.mTransform = D2DMatrix(mTransform); + clip.mPath = pathD2D; + + RefPtr layer; + pathD2D->mGeometry->GetBounds(clip.mTransform, &clip.mBounds); + + mRT->CreateLayer( byRef(layer)); + + clip.mLayer = layer; + mPushedClips.push_back(clip); + + // The transform of clips is relative to the world matrix, since we use the total + // transform for the clips, make the world matrix identity. + mRT->SetTransform(D2D1::IdentityMatrix()); + mTransformDirty = true; + + if (mClipsArePushed) { + mRT->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), pathD2D->mGeometry, + D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, + clip.mTransform), layer); + } +} + +void +DrawTargetD2D::PopClip() +{ + if (mClipsArePushed) { + mRT->PopLayer(); + } + mPushedClips.pop_back(); +} + +TemporaryRef +DrawTargetD2D::CreateSourceSurfaceFromData(unsigned char *aData, + const IntSize &aSize, + int32_t aStride, + SurfaceFormat aFormat) const +{ + RefPtr newSurf = new SourceSurfaceD2D(); + + if (!newSurf->InitFromData(aData, aSize, aStride, aFormat, mRT)) { + gfxDebug() << *this << ": Failure to create source surface from data. Size: " << aSize; + return NULL; + } + + return newSurf; +} + +TemporaryRef +DrawTargetD2D::OptimizeSourceSurface(SourceSurface *aSurface) const +{ + // Unsupported! + return NULL; +} + +TemporaryRef +DrawTargetD2D::CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const +{ + if (aSurface.mType != NATIVE_SURFACE_D3D10_TEXTURE) { + gfxDebug() << *this << ": Failure to create source surface from non-D3D10 texture native surface."; + return NULL; + } + RefPtr newSurf = new SourceSurfaceD2D(); + + if (!newSurf->InitFromTexture(static_cast(aSurface.mSurface), + aSurface.mFormat, + mRT)) + { + gfxWarning() << *this << ": Failed to create SourceSurface from texture."; + return NULL; + } + + return newSurf; +} + +TemporaryRef +DrawTargetD2D::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const +{ + RefPtr newTarget = + new DrawTargetD2D(); + + if (!newTarget->Init(aSize, aFormat)) { + gfxDebug() << *this << ": Failed to create optimal draw target. Size: " << aSize; + return NULL; + } + + return newTarget; +} + +TemporaryRef +DrawTargetD2D::CreatePathBuilder(FillRule aFillRule) const +{ + RefPtr path; + HRESULT hr = factory()->CreatePathGeometry(byRef(path)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to create Direct2D Path Geometry. Code: " << hr; + return NULL; + } + + RefPtr sink; + hr = path->Open(byRef(sink)); + if (FAILED(hr)) { + gfxWarning() << "Failed to access Direct2D Path Geometry. Code: " << hr; + return NULL; + } + + if (aFillRule == FILL_WINDING) { + sink->SetFillMode(D2D1_FILL_MODE_WINDING); + } + + return new PathBuilderD2D(sink, path, aFillRule); +} + +TemporaryRef +DrawTargetD2D::CreateGradientStops(GradientStop *aStops, uint32_t aNumStops) const +{ + D2D1_GRADIENT_STOP *stops = new D2D1_GRADIENT_STOP[aNumStops]; + + for (uint32_t i = 0; i < aNumStops; i++) { + stops[i].position = aStops[i].offset; + stops[i].color = D2DColor(aStops[i].color); + } + + RefPtr stopCollection; + + HRESULT hr = mRT->CreateGradientStopCollection(stops, aNumStops, byRef(stopCollection)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to create GradientStopCollection. Code: " << hr; + return NULL; + } + + return new GradientStopsD2D(stopCollection); +} + +void* +DrawTargetD2D::GetNativeSurface(NativeSurfaceType aType) +{ + if (aType != NATIVE_SURFACE_D3D10_TEXTURE) { + return NULL; + } + + return mTexture; +} + +/* + * Public functions + */ +bool +DrawTargetD2D::Init(const IntSize &aSize, SurfaceFormat aFormat) +{ + HRESULT hr; + + mSize = aSize; + mFormat = aFormat; + + if (!Factory::GetDirect3D10Device()) { + gfxDebug() << "Failed to Init Direct2D DrawTarget (No D3D10 Device set.)"; + return false; + } + mDevice = Factory::GetDirect3D10Device(); + + CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, + mSize.width, + mSize.height, + 1, 1); + desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; + + hr = mDevice->CreateTexture2D(&desc, NULL, byRef(mTexture)); + + if (FAILED(hr)) { + gfxDebug() << "Failed to init Direct2D DrawTarget. Size: " << mSize << " Code: " << hr; + return false; + } + + return InitD2DRenderTarget(); +} + +bool +DrawTargetD2D::Init(ID3D10Texture2D *aTexture, SurfaceFormat aFormat) +{ + HRESULT hr; + + mTexture = aTexture; + mFormat = aFormat; + + if (!mTexture) { + gfxDebug() << "No valid texture for Direct2D draw target initialization."; + return false; + } + + RefPtr device; + mTexture->GetDevice(byRef(device)); + + hr = device->QueryInterface((ID3D10Device1**)byRef(mDevice)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to get D3D10 device from texture."; + return false; + } + + D3D10_TEXTURE2D_DESC desc; + mTexture->GetDesc(&desc); + mSize.width = desc.Width; + mSize.height = desc.Height; + + return InitD2DRenderTarget(); +} + +// {0D398B49-AE7B-416F-B26D-EA3C137D1CF7} +static const GUID sPrivateDataD2D = +{ 0xd398b49, 0xae7b, 0x416f, { 0xb2, 0x6d, 0xea, 0x3c, 0x13, 0x7d, 0x1c, 0xf7 } }; + +bool +DrawTargetD2D::InitD3D10Data() +{ + HRESULT hr; + + UINT privateDataSize; + privateDataSize = sizeof(mPrivateData); + hr = mDevice->GetPrivateData(sPrivateDataD2D, &privateDataSize, &mPrivateData); + + if (SUCCEEDED(hr)) { + return true; + } + + mPrivateData = new PrivateD3D10DataD2D; + + D3D10CreateEffectFromMemoryFunc createD3DEffect; + HMODULE d3dModule = LoadLibraryW(L"d3d10_1.dll"); + createD3DEffect = (D3D10CreateEffectFromMemoryFunc) + GetProcAddress(d3dModule, "D3D10CreateEffectFromMemory"); + + hr = createD3DEffect((void*)d2deffect, sizeof(d2deffect), 0, mDevice, NULL, byRef(mPrivateData->mEffect)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to initialize Direct2D required effects. Code: " << hr; + return false; + } + + privateDataSize = sizeof(mPrivateData); + mDevice->SetPrivateData(sPrivateDataD2D, privateDataSize, &mPrivateData); + + D3D10_INPUT_ELEMENT_DESC layout[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }, + }; + D3D10_PASS_DESC passDesc; + + mPrivateData->mEffect->GetTechniqueByName("SampleTexture")->GetPassByIndex(0)->GetDesc(&passDesc); + + hr = mDevice->CreateInputLayout(layout, + sizeof(layout) / sizeof(D3D10_INPUT_ELEMENT_DESC), + passDesc.pIAInputSignature, + passDesc.IAInputSignatureSize, + byRef(mPrivateData->mInputLayout)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to initialize Direct2D required InputLayout. Code: " << hr; + return false; + } + + D3D10_SUBRESOURCE_DATA data; + Vertex vertices[] = { {0.0, 0.0}, {1.0, 0.0}, {0.0, 1.0}, {1.0, 1.0} }; + data.pSysMem = vertices; + CD3D10_BUFFER_DESC bufferDesc(sizeof(vertices), D3D10_BIND_VERTEX_BUFFER); + + hr = mDevice->CreateBuffer(&bufferDesc, &data, byRef(mPrivateData->mVB)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to initialize Direct2D required VertexBuffer. Code: " << hr; + return false; + } + + return true; +} + +/* + * Private helpers + */ +bool +DrawTargetD2D::InitD2DRenderTarget() +{ + if (!factory()) { + return false; + } + + mRT = CreateRTForTexture(mTexture); + + if (!mRT) { + return false; + } + + mRT->BeginDraw(); + + mRT->Clear(D2D1::ColorF(0, 0)); + + return InitD3D10Data(); +} + +void +DrawTargetD2D::PrepareForDrawing(ID2D1RenderTarget *aRT) +{ + if (!mClipsArePushed || aRT == mTempRT) { + if (mPushedClips.size()) { + // The transform of clips is relative to the world matrix, since we use the total + // transform for the clips, make the world matrix identity. + mRT->SetTransform(D2D1::IdentityMatrix()); + for (std::vector::iterator iter = mPushedClips.begin(); + iter != mPushedClips.end(); iter++) { + aRT->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), iter->mPath->mGeometry, + D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, + iter->mTransform), iter->mLayer); + } + if (aRT == mRT) { + mClipsArePushed = true; + } + } + } + mRT->SetTransform(D2DMatrix(mTransform)); + MarkChanged(); + + if (aRT == mTempRT) { + mTempRT->SetTransform(D2DMatrix(mTransform)); + } +} + +void +DrawTargetD2D::MarkChanged() +{ + if (mSnapshots.size()) { + for (std::vector::iterator iter = mSnapshots.begin(); + iter != mSnapshots.end(); iter++) { + (*iter)->DrawTargetWillChange(); + } + // All snapshots will now have copied data. + mSnapshots.clear(); + } + if (mDependentTargets.size()) { + for (std::vector>::iterator iter = mDependentTargets.begin(); + iter != mDependentTargets.end(); iter++) { + (*iter)->Flush(); + } + mDependentTargets.clear(); + } +} + +ID3D10BlendState* +DrawTargetD2D::GetBlendStateForOperator(CompositionOp aOperator) +{ + if (mPrivateData->mBlendStates[aOperator]) { + return mPrivateData->mBlendStates[aOperator]; + } + + D3D10_BLEND_DESC desc; + + memset(&desc, 0, sizeof(D3D10_BLEND_DESC)); + + desc.AlphaToCoverageEnable = FALSE; + desc.BlendEnable[0] = TRUE; + desc.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL; + desc.BlendOp = desc.BlendOpAlpha = D3D10_BLEND_OP_ADD; + + switch (aOperator) { + case OP_ADD: + desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_ONE; + desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_ONE; + break; + case OP_IN: + desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_DEST_ALPHA; + desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_ZERO; + break; + case OP_OUT: + desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_INV_DEST_ALPHA; + desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_ZERO; + break; + case OP_ATOP: + desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_DEST_ALPHA; + desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA; + break; + case OP_DEST_IN: + desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_ZERO; + desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_SRC_ALPHA; + break; + case OP_DEST_OUT: + desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_ZERO; + desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA; + break; + case OP_DEST_ATOP: + desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_INV_DEST_ALPHA; + desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_SRC_ALPHA; + break; + case OP_DEST_OVER: + desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_INV_DEST_ALPHA; + desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_ONE; + break; + case OP_XOR: + desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_INV_DEST_ALPHA; + desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA; + break; + case OP_SOURCE: + desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_ONE; + desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_ZERO; + break; + default: + desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_ONE; + desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA; + } + + mDevice->CreateBlendState(&desc, byRef(mPrivateData->mBlendStates[aOperator])); + + return mPrivateData->mBlendStates[aOperator]; +} + +/* This function prepares the temporary RT for drawing and returns it when a + * drawing operation other than OVER is required. + */ +ID2D1RenderTarget* +DrawTargetD2D::GetRTForOperator(CompositionOp aOperator) +{ + if (aOperator == OP_OVER) { + return mRT; + } + + PopAllClips(); + + if (mTempRT) { + mTempRT->Clear(D2D1::ColorF(0, 0)); + return mTempRT; + } + + EnsureViews(); + + if (!mRTView || !mSRView) { + gfxDebug() << *this << ": Failed to get required views. Defaulting to OP_OVER."; + return mRT; + } + + mTempRT = CreateRTForTexture(mTempTexture); + + if (!mTempRT) { + return mRT; + } + + mTempRT->BeginDraw(); + + mTempRT->Clear(D2D1::ColorF(0, 0)); + + return mTempRT; +} + +/* This function blends back the content of a drawing operation (drawn to an + * empty surface with OVER, so the surface now contains the source operation + * contents) to the rendertarget using the requested composition operation. + * In order to respect clip for operations which are unbound by their mask, + * the old content of the surface outside the clipped area may be blended back + * to the surface. + */ +void +DrawTargetD2D::FinalizeRTForOperator(CompositionOp aOperator, const Rect &aBounds) +{ + if (aOperator == OP_OVER) { + return; + } + + if (!mTempRT) { + return; + } + + for (unsigned int i = 0; i < mPushedClips.size(); i++) { + mTempRT->PopLayer(); + } + + mRT->Flush(); + mTempRT->Flush(); + + AutoSaveRestoreClippedOut restoreClippedOut(this); + + bool needsWriteBack = + !IsOperatorBoundByMask(aOperator) && mPushedClips.size(); + + if (needsWriteBack) { + restoreClippedOut.Save(); + } + + ID3D10RenderTargetView *rtViews = mRTView; + mDevice->OMSetRenderTargets(1, &rtViews, NULL); + + UINT stride = sizeof(Vertex); + UINT offset = 0; + ID3D10Buffer *buff = mPrivateData->mVB; + + mDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + mDevice->IASetVertexBuffers(0, 1, &buff, &stride, &offset); + mDevice->IASetInputLayout(mPrivateData->mInputLayout); + + D3D10_VIEWPORT viewport; + viewport.MaxDepth = 1; + viewport.MinDepth = 0; + viewport.Height = mSize.height; + viewport.Width = mSize.width; + viewport.TopLeftX = 0; + viewport.TopLeftY = 0; + + mDevice->RSSetViewports(1, &viewport); + mPrivateData->mEffect->GetVariableByName("tex")->AsShaderResource()->SetResource(mSRView); + mPrivateData->mEffect->GetVariableByName("QuadDesc")->AsVector()-> + SetFloatVector(ShaderConstantRectD3D10(-1.0f, 1.0f, 2.0f, -2.0f)); + mPrivateData->mEffect->GetVariableByName("TexCoords")->AsVector()-> + SetFloatVector(ShaderConstantRectD3D10(0, 0, 1.0f, 1.0f)); + + mPrivateData->mEffect->GetTechniqueByName("SampleTexture")->GetPassByIndex(0)->Apply(0); + + mDevice->OMSetBlendState(GetBlendStateForOperator(aOperator), NULL, 0xffffffff); + + mDevice->Draw(4, 0); +} + +TemporaryRef +DrawTargetD2D::CreateRTForTexture(ID3D10Texture2D *aTexture) +{ + HRESULT hr; + + RefPtr surface; + RefPtr rt; + + hr = aTexture->QueryInterface((IDXGISurface**)byRef(surface)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to QI texture to surface."; + return NULL; + } + + D3D10_TEXTURE2D_DESC desc; + aTexture->GetDesc(&desc); + + D2D1_RENDER_TARGET_PROPERTIES props = + D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT, D2D1::PixelFormat(desc.Format, D2D1_ALPHA_MODE_PREMULTIPLIED)); + hr = factory()->CreateDxgiSurfaceRenderTarget(surface, props, byRef(rt)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to create D2D render target for texture."; + return NULL; + } + + return rt; +} + +void +DrawTargetD2D::EnsureViews() +{ + if (mTempTexture && mSRView && mRTView) { + return; + } + + HRESULT hr; + + CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, + mSize.width, + mSize.height, + 1, 1); + desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; + + hr = mDevice->CreateTexture2D(&desc, NULL, byRef(mTempTexture)); + + if (FAILED(hr)) { + gfxWarning() << *this << "Failed to create temporary texture for rendertarget. Size: " + << mSize << " Code: " << hr; + return; + } + + hr = mDevice->CreateShaderResourceView(mTempTexture, NULL, byRef(mSRView)); + + if (FAILED(hr)) { + gfxWarning() << *this << "Failed to create shader resource view for temp texture. Code: " << hr; + return; + } + + hr = mDevice->CreateRenderTargetView(mTexture, NULL, byRef(mRTView)); + + if (FAILED(hr)) { + gfxWarning() << *this << "Failed to create rendertarget view for temp texture. Code: " << hr; + } +} + +void +DrawTargetD2D::PopAllClips() +{ + if (mClipsArePushed) { + for (unsigned int i = 0; i < mPushedClips.size(); i++) { + mRT->PopLayer(); + } + + mClipsArePushed = false; + } +} + +TemporaryRef +DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) +{ + if (aPattern.GetType() == PATTERN_COLOR) { + RefPtr colBrush; + Color color = static_cast(&aPattern)->mColor; + mRT->CreateSolidColorBrush(D2D1::ColorF(color.r, color.g, + color.b, color.a), + D2D1::BrushProperties(aAlpha), + byRef(colBrush)); + return colBrush; + } else if (aPattern.GetType() == PATTERN_LINEAR_GRADIENT) { + RefPtr gradBrush; + const LinearGradientPattern *pat = + static_cast(&aPattern); + + GradientStopsD2D *stops = static_cast(pat->mStops.get()); + + if (!stops) { + gfxDebug() << "No stops specified for gradient pattern."; + return NULL; + } + + mRT->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties(D2DPoint(pat->mBegin), + D2DPoint(pat->mEnd)), + D2D1::BrushProperties(aAlpha), + stops->mStopCollection, + byRef(gradBrush)); + return gradBrush; + } else if (aPattern.GetType() == PATTERN_RADIAL_GRADIENT) { + RefPtr gradBrush; + const RadialGradientPattern *pat = + static_cast(&aPattern); + + GradientStopsD2D *stops = static_cast(pat->mStops.get()); + + if (!stops) { + gfxDebug() << "No stops specified for gradient pattern."; + return NULL; + } + + mRT->CreateRadialGradientBrush(D2D1::RadialGradientBrushProperties(D2DPoint(pat->mCenter), + D2DPoint(pat->mOrigin - pat->mCenter), + pat->mRadius, + pat->mRadius), + D2D1::BrushProperties(aAlpha), + stops->mStopCollection, + byRef(gradBrush)); + return gradBrush; + } else if (aPattern.GetType() == PATTERN_SURFACE) { + RefPtr bmBrush; + const SurfacePattern *pat = + static_cast(&aPattern); + + if (!pat->mSurface) { + gfxDebug() << "No source surface specified for surface pattern"; + return NULL; + } + + RefPtr bitmap; + + switch (pat->mSurface->GetType()) { + case SURFACE_D2D1_BITMAP: + { + SourceSurfaceD2D *surf = static_cast(pat->mSurface.get()); + + bitmap = surf->mBitmap; + + if (!bitmap) { + gfxDebug() << "Source surface used for pattern too large!"; + return NULL; + } + } + break; + case SURFACE_D2D1_DRAWTARGET: + { + SourceSurfaceD2DTarget *surf = + static_cast(pat->mSurface.get()); + + bitmap = surf->GetBitmap(mRT); + + if (!surf->IsCopy()) { + surf->mDrawTarget->mDependentTargets.push_back(this); + } + } + break; + } + + D2D1_EXTEND_MODE extend = D2D1_EXTEND_MODE_CLAMP; + switch (pat->mExtendMode) { + case EXTEND_WRAP: + extend = D2D1_EXTEND_MODE_WRAP; + break; + case EXTEND_MIRROR: + extend = D2D1_EXTEND_MODE_MIRROR; + break; + } + + mRT->CreateBitmapBrush(bitmap, + D2D1::BitmapBrushProperties(extend, + extend, + D2DFilter(pat->mFilter)), + D2D1::BrushProperties(aAlpha), + byRef(bmBrush)); + + return bmBrush; + } + + gfxWarning() << "Invalid pattern type detected."; + return NULL; +} + +TemporaryRef +DrawTargetD2D::CreateStrokeStyleForOptions(const StrokeOptions &aStrokeOptions) +{ + RefPtr style; + + D2D1_CAP_STYLE capStyle; + D2D1_LINE_JOIN joinStyle; + + switch (aStrokeOptions.mLineCap) { + case CAP_BUTT: + capStyle = D2D1_CAP_STYLE_FLAT; + break; + case CAP_ROUND: + capStyle = D2D1_CAP_STYLE_ROUND; + break; + case CAP_SQUARE: + capStyle = D2D1_CAP_STYLE_SQUARE; + break; + } + + switch (aStrokeOptions.mLineJoin) { + case JOIN_MITER: + joinStyle = D2D1_LINE_JOIN_MITER; + break; + case JOIN_MITER_OR_BEVEL: + joinStyle = D2D1_LINE_JOIN_MITER_OR_BEVEL; + break; + case JOIN_ROUND: + joinStyle = D2D1_LINE_JOIN_ROUND; + break; + case JOIN_BEVEL: + joinStyle = D2D1_LINE_JOIN_BEVEL; + break; + } + + + HRESULT hr = factory()->CreateStrokeStyle(D2D1::StrokeStyleProperties(capStyle, capStyle, + capStyle, joinStyle, + aStrokeOptions.mMiterLimit), + NULL, 0, byRef(style)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to create Direct2D stroke style."; + } + + return style; +} + +ID2D1Factory* +DrawTargetD2D::factory() +{ + if (mFactory) { + return mFactory; + } + + D2D1CreateFactoryFunc createD2DFactory; + HMODULE d2dModule = LoadLibraryW(L"d2d1.dll"); + createD2DFactory = (D2D1CreateFactoryFunc) + GetProcAddress(d2dModule, "D2D1CreateFactory"); + + if (!createD2DFactory) { + gfxWarning() << "Failed to locate D2D1CreateFactory function."; + return NULL; + } + + D2D1_FACTORY_OPTIONS options; +#ifdef _DEBUG + options.debugLevel = D2D1_DEBUG_LEVEL_NONE; +#else + options.debugLevel = D2D1_DEBUG_LEVEL_NONE; +#endif + + HRESULT hr = createD2DFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, + __uuidof(ID2D1Factory), + &options, + (void**)&mFactory); + + if (FAILED(hr)) { + gfxWarning() << "Failed to create Direct2D factory."; + } + + return mFactory; +} + +} +} diff --git a/gfx/2d/DrawTargetD2D.h b/gfx/2d/DrawTargetD2D.h new file mode 100644 index 00000000000..7c163298bbb --- /dev/null +++ b/gfx/2d/DrawTargetD2D.h @@ -0,0 +1,204 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 ***** */ + +#ifndef MOZILLA_GFX_DRAWTARGETD2D_H_ +#define MOZILLA_GFX_DRAWTARGETD2D_H_ + +#include "2D.h" +#include "PathD2D.h" +#include +#include "HelpersD2D.h" + +#include +#include + +namespace mozilla { +namespace gfx { + +class SourceSurfaceD2DTarget; + +struct PrivateD3D10DataD2D +{ + RefPtr mEffect; + RefPtr mInputLayout; + RefPtr mVB; + RefPtr mBlendStates[OP_COUNT]; +}; + +class DrawTargetD2D : public DrawTarget +{ +public: + DrawTargetD2D(); + virtual ~DrawTargetD2D(); + + virtual BackendType GetType() const { return BACKEND_DIRECT2D; } + virtual TemporaryRef Snapshot(); + virtual IntSize GetSize() { return mSize; } + + virtual void Flush(); + virtual void DrawSurface(SourceSurface *aSurface, + const Rect &aDest, + const Rect &aSource, + const DrawSurfaceOptions &aSurfOptions = DrawSurfaceOptions(), + const DrawOptions &aOptions = DrawOptions()); + virtual void DrawSurfaceWithShadow(SourceSurface *aSurface, + const Point &aDest, + const Color &aColor, + const Point &aOffset, + Float aSigma); + virtual void ClearRect(const Rect &aRect); + + virtual void CopySurface(SourceSurface *aSurface, + const IntRect &aSourceRect, + const IntPoint &aDestination); + + virtual void FillRect(const Rect &aRect, + const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()); + virtual void StrokeRect(const Rect &aRect, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()); + virtual void StrokeLine(const Point &aStart, + const Point &aEnd, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()); + virtual void Stroke(const Path *aPath, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()); + virtual void Fill(const Path *aPath, + const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()); + virtual void FillGlyphs(ScaledFont *aFont, + const GlyphBuffer &aBuffer, + const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()); + virtual void PushClip(const Path *aPath); + virtual void PopClip(); + + virtual TemporaryRef CreateSourceSurfaceFromData(unsigned char *aData, + const IntSize &aSize, + int32_t aStride, + SurfaceFormat aFormat) const; + virtual TemporaryRef OptimizeSourceSurface(SourceSurface *aSurface) const; + + virtual TemporaryRef + CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const; + + virtual TemporaryRef + CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const; + + virtual TemporaryRef CreatePathBuilder(FillRule aFillRule = FILL_WINDING) const; + + virtual TemporaryRef CreateGradientStops(GradientStop *aStops, uint32_t aNumStops) const; + + virtual void *GetNativeSurface(NativeSurfaceType aType); + + bool Init(const IntSize &aSize, SurfaceFormat aFormat); + bool Init(ID3D10Texture2D *aTexture, SurfaceFormat aFormat); + bool InitD3D10Data(); + + static ID2D1Factory *factory(); + + operator std::string() const { + std::stringstream stream; + stream << "DrawTargetD2D(" << this << ")"; + return stream.str(); + } +private: + friend class AutoSaveRestoreClippedOut; + friend class SourceSurfaceD2DTarget; + + bool InitD2DRenderTarget(); + void PrepareForDrawing(ID2D1RenderTarget *aRT); + + // This function will mark the surface as changing, and make sure any + // copy-on-write snapshots are notified. + void MarkChanged(); + + ID3D10BlendState *GetBlendStateForOperator(CompositionOp aOperator); + ID2D1RenderTarget *GetRTForOperator(CompositionOp aOperator); + void FinalizeRTForOperator(CompositionOp aOperator, const Rect &aBounds); + void EnsureViews(); + void PopAllClips(); + + TemporaryRef CreateRTForTexture(ID3D10Texture2D *aTexture); + + TemporaryRef CreateBrushForPattern(const Pattern &aPattern, Float aAlpha = 1.0f); + TemporaryRef CreateStrokeStyleForOptions(const StrokeOptions &aStrokeOptions); + + IntSize mSize; + + RefPtr mDevice; + RefPtr mTexture; + mutable RefPtr mRT; + + // Temporary texture and render target used for supporting alternative operators. + RefPtr mTempTexture; + RefPtr mRTView; + RefPtr mSRView; + RefPtr mTempRT; + RefPtr mTempRTView; + + // List of pushed clips. + struct PushedClip + { + RefPtr mLayer; + D2D1_RECT_F mBounds; + D2D1_MATRIX_3X2_F mTransform; + RefPtr mPath; + }; + std::vector mPushedClips; + + // List of Snapshots of this surface, these need to be told when this + // surface is modified. Possibly vector is not the best choice here. + std::vector mSnapshots; + // A list of targets we need to flush when we're modified. + std::vector> mDependentTargets; + + // True of the current clip stack is pushed to the main RT. + bool mClipsArePushed; + PrivateD3D10DataD2D *mPrivateData; + static ID2D1Factory *mFactory; +}; + +} +} + +#endif /* MOZILLA_GFX_DRAWTARGETD2D_H_ */ diff --git a/gfx/2d/Factory.cpp b/gfx/2d/Factory.cpp new file mode 100644 index 00000000000..527694e4976 --- /dev/null +++ b/gfx/2d/Factory.cpp @@ -0,0 +1,152 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 "2D.h" + +#ifdef USE_CAIRO +#include "DrawTargetCairo.h" +#endif + +#ifdef WIN32 +#include "DrawTargetD2D.h" +#include "ScaledFontDWrite.h" +#include +#endif + +#include "Logging.h" + +#ifdef PR_LOGGING +PRLogModuleInfo *sGFX2DLog = PR_NewLogModule("gfx2d"); +#endif + +namespace mozilla { +namespace gfx { + +// XXX - Need to define an API to set this. +int sGfxLogLevel = LOG_DEBUG; + +#ifdef WIN32 +ID3D10Device1 *Factory::mD3D10Device; +#endif + +TemporaryRef +Factory::CreateDrawTarget(BackendType aBackend, const IntSize &aSize, SurfaceFormat aFormat) +{ + switch (aBackend) { +#ifdef WIN32 + case BACKEND_DIRECT2D: + { + RefPtr newTarget; + newTarget = new DrawTargetD2D(); + if (newTarget->Init(aSize, aFormat)) { + return newTarget; + } + break; + } +#endif + default: + gfxDebug() << "Invalid draw target type specified."; + return NULL; + } + + gfxDebug() << "Failed to create DrawTarget, Type: " << aBackend << " Size: " << aSize; + // Failed + return NULL; +} + +TemporaryRef +Factory::CreateScaledFontForNativeFont(const NativeFont &aNativeFont, Float aSize) +{ + switch (aNativeFont.mType) { +#ifdef WIN32 + case NATIVE_FONT_DWRITE_FONT_FACE: + { + return new ScaledFontDWrite(static_cast(aNativeFont.mFont), aSize); + } +#endif + default: + gfxWarning() << "Invalid native font type specified."; + return NULL; + } +} + +#ifdef WIN32 +TemporaryRef +Factory::CreateDrawTargetForD3D10Texture(ID3D10Texture2D *aTexture, SurfaceFormat aFormat) +{ + RefPtr newTarget; + + newTarget = new DrawTargetD2D(); + if (newTarget->Init(aTexture, aFormat)) { + return newTarget; + } + + gfxWarning() << "Failed to create draw target for D3D10 texture."; + + // Failed + return NULL; +} + +void +Factory::SetDirect3D10Device(ID3D10Device1 *aDevice) +{ + mD3D10Device = aDevice; +} + +ID3D10Device1* +Factory::GetDirect3D10Device() +{ + return mD3D10Device; +} + +#endif // XP_WIN + +#ifdef USE_CAIRO +TemporaryRef +Factory::CreateDrawTargetForCairoSurface(cairo_surface_t* aSurface) +{ + RefPtr newTarget = new DrawTargetCairo(); + if (newTarget->Init(aSurface)) { + return newTarget; + } + + return NULL; +} +#endif + +} +} diff --git a/js/src/xpconnect/idl/XPCIDispatch.idl b/gfx/2d/GradientStopsD2D.h similarity index 66% rename from js/src/xpconnect/idl/XPCIDispatch.idl rename to gfx/2d/GradientStopsD2D.h index 9f2207d04b4..bdb228c9114 100644 --- a/js/src/xpconnect/idl/XPCIDispatch.idl +++ b/gfx/2d/GradientStopsD2D.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -12,14 +12,14 @@ * for the specific language governing rights and limitations under the * License. * - * The Original Code is the IDispatch implementation for XPConnect. + * The Original Code is Mozilla Corporation code. * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Bas Schouten * * 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 @@ -35,17 +35,32 @@ * * ***** END LICENSE BLOCK ***** */ -%{C++ -#error "You should not be including this file" -%} +#ifndef MOZILLA_GFX_GRADIENTSTOPSD2D_H_ +#define MOZILLA_GFX_GRADIENTSTOPSD2D_H_ -#include "nsISupports.idl" +#include "2D.h" -/** - * This interface is not to be used directly, it is to be used internally - * for XPConnect's IDispatch support - */ -[scriptable, uuid(00020400-0000-0000-C000-000000000046)] -interface IDispatch : nsISupports +#include + +namespace mozilla { +namespace gfx { + +class GradientStopsD2D : public GradientStops { +public: + GradientStopsD2D(ID2D1GradientStopCollection *aStopCollection) + : mStopCollection(aStopCollection) + {} + + virtual BackendType GetBackendType() const { return BACKEND_DIRECT2D; } + +private: + friend class DrawTargetD2D; + + mutable RefPtr mStopCollection; }; + +} +} + +#endif /* MOZILLA_GFX_GRADIENTSTOPSD2D_H_ */ diff --git a/gfx/2d/HelpersD2D.h b/gfx/2d/HelpersD2D.h new file mode 100644 index 00000000000..a1c1a0a5d97 --- /dev/null +++ b/gfx/2d/HelpersD2D.h @@ -0,0 +1,175 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 ***** */ + +#ifndef MOZILLA_GFX_HELPERSD2D_H_ +#define MOZILLA_GFX_HELPERSD2D_H_ + +#include +#include "2D.h" + +namespace mozilla { +namespace gfx { + +static inline D2D1_POINT_2F D2DPoint(const Point &aPoint) +{ + return D2D1::Point2F(aPoint.x, aPoint.y); +} + +static inline D2D1_SIZE_U D2DIntSize(const IntSize &aSize) +{ + return D2D1::SizeU(aSize.width, aSize.height); +} + +static inline D2D1_RECT_F D2DRect(const Rect &aRect) +{ + return D2D1::RectF(aRect.x, aRect.y, aRect.XMost(), aRect.YMost()); +} + +static inline D2D1_BITMAP_INTERPOLATION_MODE D2DFilter(const Filter &aFilter) +{ + switch (aFilter) { + case FILTER_POINT: + return D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR; + } + + return D2D1_BITMAP_INTERPOLATION_MODE_LINEAR; +} + +static inline D2D1_ANTIALIAS_MODE D2DAAMode(const AntialiasMode &aMode) +{ + switch (aMode) { + case AA_NONE: + D2D1_ANTIALIAS_MODE_ALIASED; + } + + return D2D1_ANTIALIAS_MODE_PER_PRIMITIVE; +} + +static inline D2D1_MATRIX_3X2_F D2DMatrix(const Matrix &aTransform) +{ + return D2D1::Matrix3x2F(aTransform._11, aTransform._12, + aTransform._21, aTransform._22, + aTransform._31, aTransform._32); +} + +static inline D2D1_COLOR_F D2DColor(const Color &aColor) +{ + return D2D1::ColorF(aColor.r, aColor.g, aColor.b, aColor.a); +} + +static inline IntSize ToIntSize(const D2D1_SIZE_U &aSize) +{ + return IntSize(aSize.width, aSize.height); +} + +static inline SurfaceFormat ToPixelFormat(const D2D1_PIXEL_FORMAT &aFormat) +{ + switch(aFormat.format) { + case DXGI_FORMAT_A8_UNORM: + return FORMAT_A8; + case DXGI_FORMAT_B8G8R8A8_UNORM: + if (aFormat.alphaMode == D2D1_ALPHA_MODE_IGNORE) { + return FORMAT_B8G8R8X8; + } else { + return FORMAT_B8G8R8A8; + } + } + + return FORMAT_B8G8R8A8; +} + +static inline Rect ToRect(const D2D1_RECT_F &aRect) +{ + return Rect(aRect.left, aRect.top, aRect.right - aRect.left, aRect.bottom - aRect.top); +} + +static inline DXGI_FORMAT DXGIFormat(SurfaceFormat aFormat) +{ + switch (aFormat) { + case FORMAT_B8G8R8A8: + return DXGI_FORMAT_B8G8R8A8_UNORM; + case FORMAT_B8G8R8X8: + return DXGI_FORMAT_B8G8R8A8_UNORM; + case FORMAT_A8: + return DXGI_FORMAT_A8_UNORM; + } + + return DXGI_FORMAT_UNKNOWN; +} + +static inline D2D1_ALPHA_MODE AlphaMode(SurfaceFormat aFormat) +{ + switch (aFormat) { + case FORMAT_B8G8R8X8: + return D2D1_ALPHA_MODE_IGNORE; + } + + return D2D1_ALPHA_MODE_PREMULTIPLIED; +} + +static inline int BytesPerPixel(SurfaceFormat aFormat) +{ + switch (aFormat) { + case FORMAT_A8: + return 1; + default: + return 4; + } +} + +/** + * This structure is used to pass rectangles to our shader constant. We can use + * this for passing rectangular areas to SetVertexShaderConstant. In the format + * of a 4 component float(x,y,width,height). Our vertex shader can then use + * this to construct rectangular positions from the 0,0-1,1 quad that we source + * it with. + */ +struct ShaderConstantRectD3D10 +{ + float mX, mY, mWidth, mHeight; + ShaderConstantRectD3D10(float aX, float aY, float aWidth, float aHeight) + : mX(aX), mY(aY), mWidth(aWidth), mHeight(aHeight) + { } + + // For easy passing to SetVertexShaderConstantF. + operator float* () { return &mX; } +}; + +} +} + +#endif /* MOZILLA_GFX_HELPERSD2D_H_ */ diff --git a/gfx/2d/Logging.h b/gfx/2d/Logging.h new file mode 100644 index 00000000000..dcc365082ab --- /dev/null +++ b/gfx/2d/Logging.h @@ -0,0 +1,144 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 ***** */ + +#ifndef MOZILLA_GFX_LOGGING_H_ +#define MOZILLA_GFX_LOGGING_H_ + +#include +#include + +#include "Point.h" + +#ifdef WIN32 +#include +#endif + +#ifdef PR_LOGGING +#include + +extern PRLogModuleInfo *sGFX2DLog; +#endif + +namespace mozilla { +namespace gfx { + +const int LOG_DEBUG = 1; +const int LOG_WARNING = 2; + +#ifdef PR_LOGGING + +inline PRLogModuleLevel PRLogLevelForLevel(int aLevel) { + switch (aLevel) { + case LOG_DEBUG: + return PR_LOG_DEBUG; + case LOG_WARNING: + return PR_LOG_WARNING; + } + return PR_LOG_DEBUG; +} + +#endif + +extern int sGfxLogLevel; + +static void OutputMessage(const std::string &aString, int aLevel) { +#if defined(WIN32) && !defined(PR_LOGGING) + if (aLevel >= sGfxLogLevel) { + ::OutputDebugStringA(aString.c_str()); + } +#elif defined(PR_LOGGING) + if (PR_LOG_TEST(sGFX2DLog, PRLogLevelForLevel(aLevel))) { + PR_LogPrint(aString.c_str()); + } +#else + if (aLevel >= sGfxLogLevel) { + printf(aString.c_str()); + } +#endif +} + +class NoLog +{ +public: + NoLog() {} + ~NoLog() {} + + template + NoLog &operator <<(const T &aLogText) { return *this; } +}; + +template +class Log +{ +public: + Log() {} + ~Log() { mMessage << '\n'; WriteLog(mMessage.str()); } + + Log &operator <<(const std::string &aLogText) { mMessage << aLogText; return *this; } + Log &operator <<(unsigned int aInt) { mMessage << aInt; return *this; } + Log &operator <<(const Size &aSize) + { mMessage << "(" << aSize.width << "x" << aSize.height << ")"; return *this; } + Log &operator <<(const IntSize &aSize) + { mMessage << "(" << aSize.width << "x" << aSize.height << ")"; return *this; } + +private: + + void WriteLog(const std::string &aString) { + OutputMessage(aString, L); + } + + std::stringstream mMessage; +}; + +typedef Log DebugLog; +typedef Log WarningLog; + +#ifdef GFX_LOG_DEBUG +#define gfxDebug DebugLog +#else +#define gfxDebug if (1) ; else NoLog +#endif +#ifdef GFX_LOG_WARNING +#define gfxWarning WarningLog +#else +#define gfxWarning if (1) ; else NoLog +#endif + +} +} + +#endif /* MOZILLA_GFX_LOGGING_H_ */ diff --git a/embedding/browser/activex/src/control_kicker/Makefile.in b/gfx/2d/Makefile.in similarity index 52% rename from embedding/browser/activex/src/control_kicker/Makefile.in rename to gfx/2d/Makefile.in index b6d0f4dfc66..91728dc71c2 100644 --- a/embedding/browser/activex/src/control_kicker/Makefile.in +++ b/gfx/2d/Makefile.in @@ -1,4 +1,4 @@ -# +# # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # @@ -12,19 +12,18 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is the Mozilla browser. +# The Original Code is Mozilla Corporation code. # -# The Initial Developer of the Original Code is -# Netscape Communications, Inc. -# Portions created by the Initial Developer are Copyright (C) 2001 +# The Initial Developer of the Original Code is Mozilla Foundation. +# Portions created by the Initial Developer are Copyright (C) 2011 # the Initial Developer. All Rights Reserved. # # Contributor(s): -# Adam Lock +# Bas Schouten # # 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"), +# 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 @@ -36,48 +35,66 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../../../.. +DEPTH = ../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -LIBRARY_NAME = mozctlx -DEFFILE = $(win_srcdir)/mozctlx.def -FORCE_SHARED_LIB= 1 -GRE_MODULE = 1 -MOZILLA_INTERNAL_API = 1 +MODULE = gfx2d +LIBRARY_NAME = gfx2d +LIBXUL_LIBRARY = 1 +EXPORT_LIBRARY = 1 -CPPSRCS = \ - StdAfx.cpp \ - control_kicker.cpp \ +EXPORTS_NAMESPACES = mozilla/gfx +EXPORTS_mozilla/gfx = \ + 2D.h \ + BasePoint.h \ + BaseMargin.h \ + BaseRect.h \ + BaseSize.h \ + Point.h \ + Matrix.h \ + Rect.h \ + Types.h \ $(NULL) -OS_LIBS += \ - comdlg32.lib \ - ole32.lib \ - oleaut32.lib \ - uuid.lib \ - shell32.lib \ +CPPSRCS = \ + Factory.cpp \ + Matrix.cpp \ + DrawTargetCairo.cpp \ + SourceSurfaceCairo.cpp \ + $(NULL) + +DEFINES += -DMOZ_GFX -DUSE_CAIRO + +ifdef MOZ_DEBUG +DEFINES += -DGFX_LOG_DEBUG -DGFX_LOG_WARNING +endif + +ifeq ($(MOZ_WIDGET_TOOLKIT),windows) +CPPSRCS += \ + DrawTargetD2D.cpp \ + SourceSurfaceD2D.cpp \ + SourceSurfaceD2DTarget.cpp \ + PathD2D.cpp \ + ScaledFontDWrite.cpp \ $(NULL) -ENABLE_CXX_EXCEPTIONS = 1 +DEFINES += -DWIN32 +endif -EMBED_MANIFEST_AT = 2 +#ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) +#CPPSRCS += \ +# DrawTargetCG.cpp \ +# SourceSurfaceCG.cpp \ +# $(NULL) +# +## Always link with OpenGL/AGL +#EXTRA_DSO_LDOPTS += -framework OpenGL -framework AGL -framework QuickTime -framework AppKit -framework QuartzCore +#endif include $(topsrcdir)/config/rules.mk -CXXFLAGS += -D "WIN32" -GF -MT -O1 - -libs:: -ifdef MOZ_ACTIVEX_REGISTRATION -ifneq ($(OS_TARGET),WIN98) - -regsvr32 -s -c $(DIST)/bin/$(SHARED_LIBRARY) -endif -endif - -clean clobber clobber_all realclean distclean:: - -regsvr32 -s -c -u $(DIST)/bin/$(SHARED_LIBRARY) - -control_kicker.cpp StdAfx.cpp: StdAfx.h +CXXFLAGS += $(MOZ_CAIRO_CFLAGS) diff --git a/gfx/2d/Matrix.cpp b/gfx/2d/Matrix.cpp new file mode 100644 index 00000000000..641a97c9d5d --- /dev/null +++ b/gfx/2d/Matrix.cpp @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 "Matrix.h" +#include + +namespace mozilla { +namespace gfx { + +Matrix +Matrix::Rotation(Float aAngle) +{ + Matrix newMatrix; + + Float s = sin(aAngle); + Float c = cos(aAngle); + + newMatrix._11 = c; + newMatrix._12 = s; + newMatrix._21 = -s; + newMatrix._22 = c; + + return newMatrix; +} + +Rect +Matrix::TransformBounds(const Rect &aRect) const +{ + int i; + Point quad[4]; + Float min_x, max_x; + Float min_y, max_y; + + quad[0] = *this * aRect.TopLeft(); + quad[1] = *this * aRect.TopRight(); + quad[2] = *this * aRect.BottomLeft(); + quad[3] = *this * aRect.BottomRight(); + + min_x = max_x = quad[0].x; + min_y = max_y = quad[0].y; + + for (i = 1; i < 4; i++) { + if (quad[i].x < min_x) + min_x = quad[i].x; + if (quad[i].x > max_x) + max_x = quad[i].x; + + if (quad[i].y < min_y) + min_y = quad[i].y; + if (quad[i].y > max_y) + max_y = quad[i].y; + } + + return Rect(min_x, min_y, max_x - min_x, max_y - min_y); +} + +} +} diff --git a/gfx/2d/Matrix.h b/gfx/2d/Matrix.h new file mode 100644 index 00000000000..195b8e2e712 --- /dev/null +++ b/gfx/2d/Matrix.h @@ -0,0 +1,151 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 ***** */ + +#ifndef MOZILLA_GFX_MATRIX_H_ +#define MOZILLA_GFX_MATRIX_H_ + +#include "Types.h" +#include "Rect.h" +#include "Point.h" +#include + +namespace mozilla { +namespace gfx { + +class Matrix +{ +public: + Matrix() + : _11(1.0f), _12(0) + , _21(0), _22(1.0f) + , _31(0), _32(0) + {} + Matrix(Float a11, Float a12, Float a21, Float a22, Float a31, Float a32) + : _11(a11), _12(a12) + , _21(a21), _22(a22) + , _31(a31), _32(a32) + {} + Float _11, _12; + Float _21, _22; + Float _31, _32; + + Point operator *(const Point &aPoint) const + { + Point retPoint; + + retPoint.x = aPoint.x * _11 + aPoint.y * _21 + _31; + retPoint.y = aPoint.x * _12 + aPoint.y * _22 + _32; + + return retPoint; + } + + Rect TransformBounds(const Rect& rect) const; + + // Apply a scale to this matrix. This scale will be applied -before- the + // existing transformation of the matrix. + Matrix &Scale(Float aX, Float aY) + { + _11 *= aX; + _12 *= aX; + _21 *= aY; + _22 *= aY; + + return *this; + } + + Matrix &Translate(Float aX, Float aY) + { + _31 += _11 * aX + _21 * aY; + _32 += _12 * aX + _22 * aY; + + return *this; + } + + bool Invert() + { + // Compute co-factors. + Float A = _22; + Float B = -_21; + Float C = _21 * _32 - _22 * _31; + Float D = -_12; + Float E = _11; + Float F = _31 * _12 - _11 * _32; + + Float det = Determinant(); + + if (!det) { + return false; + } + + Float inv_det = 1 / det; + + _11 = inv_det * A; + _12 = inv_det * D; + _21 = inv_det * B; + _22 = inv_det * E; + _31 = inv_det * C; + _32 = inv_det * F; + + return true; + } + + Float Determinant() const + { + return _11 * _22 - _12 * _21; + } + + static Matrix Rotation(Float aAngle); + + Matrix operator*(const Matrix &aMatrix) const + { + Matrix resultMatrix; + + resultMatrix._11 = this->_11 * aMatrix._11 + this->_12 * aMatrix._21; + resultMatrix._12 = this->_11 * aMatrix._12 + this->_12 * aMatrix._22; + resultMatrix._21 = this->_21 * aMatrix._11 + this->_22 * aMatrix._21; + resultMatrix._22 = this->_21 * aMatrix._12 + this->_22 * aMatrix._22; + resultMatrix._31 = this->_31 * aMatrix._11 + this->_32 * aMatrix._21 + aMatrix._31; + resultMatrix._32 = this->_31 * aMatrix._12 + this->_32 * aMatrix._22 + aMatrix._32; + + return resultMatrix; + } +}; + +} +} + +#endif /* MOZILLA_GFX_MATRIX_H_ */ diff --git a/gfx/2d/PathD2D.cpp b/gfx/2d/PathD2D.cpp new file mode 100644 index 00000000000..34c9f3e825d --- /dev/null +++ b/gfx/2d/PathD2D.cpp @@ -0,0 +1,348 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 ***** */ + +#pragma once + +#include "PathD2D.h" +#include "HelpersD2D.h" +#include +#include "DrawTargetD2D.h" +#include "Logging.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +namespace mozilla { +namespace gfx { + +// This class exists as a wrapper for ID2D1SimplifiedGeometry sink, it allows +// a geometry to be duplicated into a geometry sink, while removing the final +// figure end and thus allowing a figure that was implicitly closed to be +// continued. +class OpeningGeometrySink : public ID2D1SimplifiedGeometrySink +{ +public: + OpeningGeometrySink(ID2D1SimplifiedGeometrySink *aSink) + : mSink(aSink) + , mNeedsFigureEnded(false) + { + } + + HRESULT STDMETHODCALLTYPE QueryInterface(const IID &aIID, void **aPtr) + { + if (!aPtr) { + return E_POINTER; + } + + if (aIID == IID_IUnknown) { + *aPtr = static_cast(this); + return S_OK; + } else if (aIID == IID_ID2D1SimplifiedGeometrySink) { + *aPtr = static_cast(this); + return S_OK; + } + + return E_NOINTERFACE; + } + + ULONG STDMETHODCALLTYPE AddRef() + { + return 1; + } + + ULONG STDMETHODCALLTYPE Release() + { + return 1; + } + + // We ignore SetFillMode, the copier will decide. + STDMETHOD_(void, SetFillMode)(D2D1_FILL_MODE aMode) + { EnsureFigureEnded(); return; } + STDMETHOD_(void, BeginFigure)(D2D1_POINT_2F aPoint, D2D1_FIGURE_BEGIN aBegin) + { EnsureFigureEnded(); return mSink->BeginFigure(aPoint, aBegin); } + STDMETHOD_(void, AddLines)(const D2D1_POINT_2F *aLines, UINT aCount) + { EnsureFigureEnded(); return mSink->AddLines(aLines, aCount); } + STDMETHOD_(void, AddBeziers)(const D2D1_BEZIER_SEGMENT *aSegments, UINT aCount) + { EnsureFigureEnded(); return mSink->AddBeziers(aSegments, aCount); } + STDMETHOD(Close)() + { /* Should never be called! */ return S_OK; } + STDMETHOD_(void, SetSegmentFlags)(D2D1_PATH_SEGMENT aFlags) + { return mSink->SetSegmentFlags(aFlags); } + + // This function is special - it's the reason this class exists. + // It needs to intercept the very last endfigure. So that a user can + // continue writing to this sink as if they never stopped. + STDMETHOD_(void, EndFigure)(D2D1_FIGURE_END aEnd) + { + if (aEnd == D2D1_FIGURE_END_CLOSED) { + return mSink->EndFigure(aEnd); + } else { + mNeedsFigureEnded = true; + } + } +private: + void EnsureFigureEnded() + { + if (mNeedsFigureEnded) { + mSink->EndFigure(D2D1_FIGURE_END_OPEN); + mNeedsFigureEnded = false; + } + } + + ID2D1SimplifiedGeometrySink *mSink; + bool mNeedsFigureEnded; +}; + +PathBuilderD2D::~PathBuilderD2D() +{ +} + +void +PathBuilderD2D::MoveTo(const Point &aPoint) +{ + if (mFigureActive) { + mSink->EndFigure(D2D1_FIGURE_END_OPEN); + mFigureActive = false; + } + EnsureActive(aPoint); + mCurrentPoint = aPoint; +} + +void +PathBuilderD2D::LineTo(const Point &aPoint) +{ + EnsureActive(aPoint); + mSink->AddLine(D2DPoint(aPoint)); + + mCurrentPoint = aPoint; +} + +void +PathBuilderD2D::BezierTo(const Point &aCP1, + const Point &aCP2, + const Point &aCP3) + { + EnsureActive(aCP1); + mSink->AddBezier(D2D1::BezierSegment(D2DPoint(aCP1), + D2DPoint(aCP2), + D2DPoint(aCP3))); + + mCurrentPoint = aCP3; +} + +void +PathBuilderD2D::QuadraticBezierTo(const Point &aCP1, + const Point &aCP2) +{ + EnsureActive(aCP1); + mSink->AddQuadraticBezier(D2D1::QuadraticBezierSegment(D2DPoint(aCP1), + D2DPoint(aCP2))); + + mCurrentPoint = aCP2; +} + +void +PathBuilderD2D::Close() +{ + if (mFigureActive) { + mSink->EndFigure(D2D1_FIGURE_END_CLOSED); + + mFigureActive = false; + + EnsureActive(mBeginPoint); + } +} + +void +PathBuilderD2D::Arc(const Point &aOrigin, Float aRadius, Float aStartAngle, + Float aEndAngle, bool aAntiClockwise) +{ + if (aAntiClockwise && aStartAngle < aEndAngle) { + // D2D does things a little differently, and draws the arc by specifying an + // beginning and an end point. This means the circle will be the wrong way + // around if the start angle is smaller than the end angle. It might seem + // tempting to invert aAntiClockwise but that would change the sweeping + // direction of the arc to instead we exchange start/begin. + Float oldStart = aStartAngle; + aStartAngle = aEndAngle; + aEndAngle = oldStart; + } + + // XXX - Workaround for now, D2D does not appear to do the desired thing when + // the angle sweeps a complete circle. + if (aEndAngle - aStartAngle >= 2 * M_PI) { + aEndAngle = Float(aStartAngle + M_PI * 1.9999); + } else if (aStartAngle - aEndAngle >= 2 * M_PI) { + aStartAngle = Float(aEndAngle + M_PI * 1.9999); + } + + Point startPoint; + startPoint.x = aOrigin.x + aRadius * cos(aStartAngle); + startPoint.y = aOrigin.y + aRadius * sin(aStartAngle); + + if (!mFigureActive) { + EnsureActive(startPoint); + } else { + mSink->AddLine(D2DPoint(startPoint)); + } + + Point endPoint; + endPoint.x = aOrigin.x + aRadius * cos(aEndAngle); + endPoint.y = aOrigin.y + aRadius * sin(aEndAngle); + + D2D1_ARC_SIZE arcSize = D2D1_ARC_SIZE_SMALL; + + if (aAntiClockwise) { + if (aStartAngle - aEndAngle > M_PI) { + arcSize = D2D1_ARC_SIZE_LARGE; + } + } else { + if (aEndAngle - aStartAngle > M_PI) { + arcSize = D2D1_ARC_SIZE_LARGE; + } + } + + mSink->AddArc(D2D1::ArcSegment(D2DPoint(endPoint), + D2D1::SizeF(aRadius, aRadius), + 0.0f, + aAntiClockwise ? D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE : + D2D1_SWEEP_DIRECTION_CLOCKWISE, + arcSize)); + + mCurrentPoint = endPoint; +} + +Point +PathBuilderD2D::CurrentPoint() const +{ + return mCurrentPoint; +} + +void +PathBuilderD2D::EnsureActive(const Point &aPoint) +{ + if (!mFigureActive) { + mSink->BeginFigure(D2DPoint(aPoint), D2D1_FIGURE_BEGIN_FILLED); + mBeginPoint = aPoint; + mFigureActive = true; + } +} + +TemporaryRef +PathBuilderD2D::Finish() +{ + if (mFigureActive) { + mSink->EndFigure(D2D1_FIGURE_END_OPEN); + } + + HRESULT hr = mSink->Close(); + if (FAILED(hr)) { + gfxDebug() << "Failed to close PathSink. Code: " << hr; + return NULL; + } + + return new PathD2D(mGeometry, mFigureActive, mCurrentPoint, mFillRule); +} + +TemporaryRef +PathD2D::CopyToBuilder(FillRule aFillRule) const +{ + return TransformedCopyToBuilder(Matrix(), aFillRule); +} + +TemporaryRef +PathD2D::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFillRule) const +{ + RefPtr path; + HRESULT hr = DrawTargetD2D::factory()->CreatePathGeometry(byRef(path)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to create PathGeometry. Code: " << hr; + return NULL; + } + + RefPtr sink; + hr = path->Open(byRef(sink)); + if (FAILED(hr)) { + gfxWarning() << "Failed to open Geometry for writing. Code: " << hr; + return NULL; + } + + if (aFillRule == FILL_WINDING) { + sink->SetFillMode(D2D1_FILL_MODE_WINDING); + } + + if (mEndedActive) { + OpeningGeometrySink wrapSink(sink); + mGeometry->Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES, + D2DMatrix(aTransform), + &wrapSink); + } else { + mGeometry->Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES, + D2DMatrix(aTransform), + sink); + } + + RefPtr pathBuilder = new PathBuilderD2D(sink, path, mFillRule); + + pathBuilder->mCurrentPoint = aTransform * mEndPoint; + + if (mEndedActive) { + pathBuilder->mFigureActive = true; + } + + return pathBuilder; +} + +bool +PathD2D::ContainsPoint(const Point &aPoint, const Matrix &aTransform) const +{ + BOOL result; + + HRESULT hr = mGeometry->FillContainsPoint(D2DPoint(aPoint), D2DMatrix(aTransform), 0.001f, &result); + + if (FAILED(hr)) { + // Log + return false; + } + + return !!result; +} + +} +} \ No newline at end of file diff --git a/gfx/2d/PathD2D.h b/gfx/2d/PathD2D.h new file mode 100644 index 00000000000..cb3d90d8227 --- /dev/null +++ b/gfx/2d/PathD2D.h @@ -0,0 +1,126 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 ***** */ + +#ifndef MOZILLA_GFX_PATHD2D_H_ +#define MOZILLA_GFX_PATHD2D_H_ + +#include "2D.h" +#include + +namespace mozilla { +namespace gfx { + +class PathD2D; + +class PathBuilderD2D : public PathBuilder +{ +public: + PathBuilderD2D(ID2D1GeometrySink *aSink, ID2D1PathGeometry *aGeom, FillRule aFillRule) + : mSink(aSink) + , mGeometry(aGeom) + , mFigureActive(false) + , mFillRule(aFillRule) + { + } + virtual ~PathBuilderD2D(); + + virtual void MoveTo(const Point &aPoint); + virtual void LineTo(const Point &aPoint); + virtual void BezierTo(const Point &aCP1, + const Point &aCP2, + const Point &aCP3); + virtual void QuadraticBezierTo(const Point &aCP1, + const Point &aCP2); + virtual void Close(); + virtual void Arc(const Point &aOrigin, Float aRadius, Float aStartAngle, + Float aEndAngle, bool aAntiClockwise = false); + virtual Point CurrentPoint() const; + + virtual TemporaryRef Finish(); + + ID2D1GeometrySink *GetSink() { return mSink; } + +private: + friend class PathD2D; + + void EnsureActive(const Point &aPoint); + + RefPtr mSink; + RefPtr mGeometry; + + bool mFigureActive; + Point mCurrentPoint; + Point mBeginPoint; + FillRule mFillRule; +}; + +class PathD2D : public Path +{ +public: + PathD2D(ID2D1PathGeometry *aGeometry, bool aEndedActive, + const Point &aEndPoint, FillRule aFillRule) + : mGeometry(aGeometry) + , mEndedActive(aEndedActive) + , mEndPoint(aEndPoint) + , mFillRule(aFillRule) + {} + + virtual BackendType GetBackendType() const { return BACKEND_DIRECT2D; } + + virtual TemporaryRef CopyToBuilder(FillRule aFillRule = FILL_WINDING) const; + virtual TemporaryRef TransformedCopyToBuilder(const Matrix &aTransform, + FillRule aFillRule = FILL_WINDING) const; + + virtual bool ContainsPoint(const Point &aPoint, const Matrix &aTransform) const; + + virtual FillRule GetFillRule() const { return mFillRule; } + + ID2D1Geometry *GetGeometry() { return mGeometry; } + +private: + friend class DrawTargetD2D; + + mutable RefPtr mGeometry; + bool mEndedActive; + Point mEndPoint; + FillRule mFillRule; +}; + +} +} + +#endif /* MOZILLA_GFX_PATHD2D_H_ */ diff --git a/gfx/2d/Point.h b/gfx/2d/Point.h new file mode 100644 index 00000000000..2d8913635c0 --- /dev/null +++ b/gfx/2d/Point.h @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 ***** */ + +#ifndef MOZILLA_GFX_POINT_H_ +#define MOZILLA_GFX_POINT_H_ + +#include "Types.h" +#include "BasePoint.h" +#include "BaseSize.h" + +namespace mozilla { +namespace gfx { + +struct Point : + public BasePoint { + typedef BasePoint Super; + Point() : Super() {} + Point(Float aX, Float aY) : Super(aX, aY) {} +}; + +struct IntPoint : + public BasePoint { + typedef BasePoint Super; + IntPoint() : Super() {} + IntPoint(int32_t aX, int32_t aY) : Super(aX, aY) {} +}; + +struct Size : + public BaseSize { + typedef BaseSize Super; + + Size() : Super() {} + Size(Float aWidth, Float aHeight) : Super(aWidth, aHeight) {} +}; + +struct IntSize : + public BaseSize { + typedef BaseSize Super; + + IntSize() : Super() {} + IntSize(int32_t aWidth, int32_t aHeight) : Super(aWidth, aHeight) {} +}; + +} +} + +#endif /* MOZILLA_GFX_POINT_H_ */ diff --git a/gfx/2d/Rect.h b/gfx/2d/Rect.h new file mode 100644 index 00000000000..3028c08995d --- /dev/null +++ b/gfx/2d/Rect.h @@ -0,0 +1,83 @@ +/* -*- 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (Sub) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Robert O'Callahan + * + * 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 ***** */ + +#ifndef MOZILLA_GFX_RECT_H_ +#define MOZILLA_GFX_RECT_H_ + +#include "BaseRect.h" +#include "BaseMargin.h" +#include "Point.h" + +namespace mozilla { +namespace gfx { + +struct Margin : + public BaseMargin { + typedef BaseMargin Super; + + // Constructors + Margin(const Margin& aMargin) : Super(aMargin) {} + Margin(Float aLeft, Float aTop, Float aRight, Float aBottom) + : Super(aLeft, aTop, aRight, aBottom) {} +}; + +struct Rect : + public BaseRect { + typedef BaseRect Super; + + Rect() : Super() {} + Rect(Point aPos, mozilla::gfx::Size aSize) : + Super(aPos, aSize) {} + Rect(Float _x, Float _y, Float _width, Float _height) : + Super(_x, _y, _width, _height) {} +}; + +struct IntRect : + public BaseRect { + typedef BaseRect Super; + + IntRect() : Super() {} + IntRect(IntPoint aPos, mozilla::gfx::IntSize aSize) : + Super(aPos, aSize) {} + IntRect(int32_t _x, int32_t _y, int32_t _width, int32_t _height) : + Super(_x, _y, _width, _height) {} +}; + +} +} + +#endif /* MOZILLA_GFX_RECT_H_ */ diff --git a/js/src/xpconnect/idl/nsIActiveXSecurityPolicy.idl b/gfx/2d/ScaledFontDWrite.cpp similarity index 51% rename from js/src/xpconnect/idl/nsIActiveXSecurityPolicy.idl rename to gfx/2d/ScaledFontDWrite.cpp index 6d4d00e8147..27fa38cd464 100644 --- a/js/src/xpconnect/idl/nsIActiveXSecurityPolicy.idl +++ b/gfx/2d/ScaledFontDWrite.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -12,14 +12,14 @@ * for the specific language governing rights and limitations under the * License. * - * The Original Code is the IDispatch implementation for XPConnect. + * The Original Code is Mozilla Corporation code. * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Bas Schouten * * 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 @@ -35,33 +35,47 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsISupports.idl" +#include "ScaledFontDWrite.h" +#include "PathD2D.h" -%{ C++ -#define NS_IACTIVEXSECURITYPOLICY_CONTRACTID "@mozilla.org/nsactivexsecuritypolicy;1" -%} +#include -[scriptable, uuid(0a3928d2-76c8-4c25-86a9-9c005ad832f4)] -interface nsIActiveXSecurityPolicy : nsISupports +namespace mozilla { +namespace gfx { + +TemporaryRef +ScaledFontDWrite::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget) { - /** Host nothing at all. */ - const unsigned long HOSTING_FLAGS_HOST_NOTHING = 0x00000000; - /** Allow hosting of safe for scripting objects. */ - const unsigned long HOSTING_FLAGS_HOST_SAFE_OBJECTS = 1; - /** Allow any object to be hosted. */ - const unsigned long HOSTING_FLAGS_HOST_ALL_OBJECTS = 2; - /** Allow objects to be downloaded and installed. */ - const unsigned long HOSTING_FLAGS_DOWNLOAD_CONTROLS = 4; - /** Allow objects marked safe for scripting to be scripted. */ - const unsigned long HOSTING_FLAGS_SCRIPT_SAFE_OBJECTS = 8; - /** Allow any object to be scripted. */ - const unsigned long HOSTING_FLAGS_SCRIPT_ALL_OBJECTS = 16; + if (aTarget->GetType() != BACKEND_DIRECT2D) { + // For now we only support Direct2D. + return NULL; + } - /** - * Return the ActiveX security and hosting flags. - * @param context The context for which flags are requested. At present the - * only valid value is nsnull. - */ - unsigned long getHostingFlags(in string aContext); -}; + RefPtr pathBuilder = aTarget->CreatePathBuilder(); + PathBuilderD2D *pathBuilderD2D = + static_cast(pathBuilder.get()); + + std::vector indices; + std::vector advances; + std::vector offsets; + indices.resize(aBuffer.mNumGlyphs); + advances.resize(aBuffer.mNumGlyphs); + offsets.resize(aBuffer.mNumGlyphs); + + memset(&advances.front(), 0, sizeof(FLOAT) * aBuffer.mNumGlyphs); + for (unsigned int i = 0; i < aBuffer.mNumGlyphs; i++) { + indices[i] = aBuffer.mGlyphs[i].mIndex; + offsets[i].advanceOffset = aBuffer.mGlyphs[i].mPosition.x; + offsets[i].ascenderOffset = -aBuffer.mGlyphs[i].mPosition.y; + } + + mFontFace->GetGlyphRunOutline(mSize, &indices.front(), &advances.front(), + &offsets.front(), aBuffer.mNumGlyphs, + FALSE, FALSE, pathBuilderD2D->GetSink()); + + return pathBuilder->Finish(); +} + +} +} diff --git a/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/General/XPCStress.js b/gfx/2d/ScaledFontDWrite.h similarity index 64% rename from js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/General/XPCStress.js rename to gfx/2d/ScaledFontDWrite.h index 2edc7e972a6..5e48d5b83ea 100644 --- a/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/General/XPCStress.js +++ b/gfx/2d/ScaledFontDWrite.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -12,14 +12,14 @@ * for the specific language governing rights and limitations under the * License. * - * The Original Code is the IDispatch implementation for XPConnect. + * The Original Code is Mozilla Corporation code. * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Bas Schouten * * 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 @@ -35,24 +35,35 @@ * * ***** END LICENSE BLOCK ***** */ -/** - * Make repeated calls so GC kicks in and we can check for memory leaks. - */ +#ifndef MOZILLA_GFX_SCALEDFONTDWRITE_H_ +#define MOZILLA_GFX_SCALEDFONTDWRITE_H_ -test(); +#include "2D.h" +#include -function test() +namespace mozilla { +namespace gfx { + +class ScaledFontDWrite : public ScaledFont { - printStatus("Stress testing"); - for (index = 0; index < 10000; ++index) - { - for (x = 0; x < objectsDesc.length; ++x) - { - var obj = COMObject(objectsDesc[x].cid); - for (prop in obj) - { - print(index + ":" +objectsDesc[x].name + ":" + prop); - } - } - } +public: + ScaledFontDWrite(IDWriteFontFace *aFont, Float aSize) + : mFontFace(aFont) + , mSize(aSize) + {} + + virtual FontType GetType() const { return FONT_DWRITE; } + + virtual TemporaryRef GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget); + +private: + friend class DrawTargetD2D; + + RefPtr mFontFace; + Float mSize; +}; + } +} + +#endif /* MOZILLA_GFX_SCALEDFONTDWRITE_H_ */ diff --git a/gfx/2d/ShadersD2D.fx b/gfx/2d/ShadersD2D.fx new file mode 100644 index 00000000000..736d33fac07 --- /dev/null +++ b/gfx/2d/ShadersD2D.fx @@ -0,0 +1,156 @@ +// We store vertex coordinates and the quad shape in a constant buffer, this is +// easy to update and allows us to use a single call to set the x, y, w, h of +// the quad. +// The QuadDesc and TexCoords both work as follows: +// The x component is the quad left point, the y component is the top point +// the z component is the width, and the w component is the height. The quad +// are specified in viewport coordinates, i.e. { -1.0f, 1.0f, 2.0f, -2.0f } +// would cover the entire viewport (which runs from <-1.0f, 1.0f> left to right +// and <-1.0f, 1.0f> -bottom- to top. The TexCoords desc is specified in texture +// space <0, 1.0f> left to right and top to bottom. The input vertices of the +// shader stage always form a rectangle from {0, 0} - {1, 1} +cbuffer cb0 +{ + float4 QuadDesc; + float4 TexCoords; +} + +cbuffer cb1 +{ + float4 BlurOffsetsH[3]; + float4 BlurOffsetsV[3]; + float4 BlurWeights[3]; + float4 ShadowColor; +} + +struct VS_OUTPUT +{ + float4 Position : SV_Position; + float2 TexCoord : TEXCOORD0; +}; + +Texture2D tex; + +sampler sSampler = sampler_state { + Filter = MIN_MAG_MIP_LINEAR; + Texture = tex; + AddressU = Clamp; + AddressV = Clamp; +}; + +sampler sShadowSampler = sampler_state { + Filter = MIN_MAG_MIP_LINEAR; + Texture = tex; + AddressU = Border; + AddressV = Border; + BorderColor = float4(0, 0, 0, 0); +}; + +RasterizerState TextureRast +{ + ScissorEnable = False; + CullMode = None; +}; + +BlendState ShadowBlendH +{ + BlendEnable[0] = False; + RenderTargetWriteMask[0] = 0xF; +}; + +BlendState ShadowBlendV +{ + BlendEnable[0] = True; + SrcBlend = One; + DestBlend = Inv_Src_Alpha; + BlendOp = Add; + SrcBlendAlpha = One; + DestBlendAlpha = Inv_Src_Alpha; + BlendOpAlpha = Add; + RenderTargetWriteMask[0] = 0xF; +}; + +VS_OUTPUT SampleTextureVS(float3 pos : POSITION) +{ + VS_OUTPUT Output; + Output.Position.w = 1.0f; + Output.Position.x = pos.x * QuadDesc.z + QuadDesc.x; + Output.Position.y = pos.y * QuadDesc.w + QuadDesc.y; + Output.Position.z = 0; + Output.TexCoord.x = pos.x * TexCoords.z + TexCoords.x; + Output.TexCoord.y = pos.y * TexCoords.w + TexCoords.y; + return Output; +} + +float4 SampleTexturePS( VS_OUTPUT In) : SV_Target +{ + return tex.Sample(sSampler, In.TexCoord); +}; + +float4 SampleShadowHPS( VS_OUTPUT In) : SV_Target +{ + float outputStrength = 0; + + outputStrength += BlurWeights[0].x * tex.Sample(sShadowSampler, float2(In.TexCoord.x + BlurOffsetsH[0].x, In.TexCoord.y)).a; + outputStrength += BlurWeights[0].y * tex.Sample(sShadowSampler, float2(In.TexCoord.x + BlurOffsetsH[0].y, In.TexCoord.y)).a; + outputStrength += BlurWeights[0].z * tex.Sample(sShadowSampler, float2(In.TexCoord.x + BlurOffsetsH[0].z, In.TexCoord.y)).a; + outputStrength += BlurWeights[0].w * tex.Sample(sShadowSampler, float2(In.TexCoord.x + BlurOffsetsH[0].w, In.TexCoord.y)).a; + outputStrength += BlurWeights[1].x * tex.Sample(sShadowSampler, float2(In.TexCoord.x + BlurOffsetsH[1].x, In.TexCoord.y)).a; + outputStrength += BlurWeights[1].y * tex.Sample(sShadowSampler, float2(In.TexCoord.x + BlurOffsetsH[1].y, In.TexCoord.y)).a; + outputStrength += BlurWeights[1].z * tex.Sample(sShadowSampler, float2(In.TexCoord.x + BlurOffsetsH[1].z, In.TexCoord.y)).a; + outputStrength += BlurWeights[1].w * tex.Sample(sShadowSampler, float2(In.TexCoord.x + BlurOffsetsH[1].w, In.TexCoord.y)).a; + outputStrength += BlurWeights[2].x * tex.Sample(sShadowSampler, float2(In.TexCoord.x + BlurOffsetsH[2].x, In.TexCoord.y)).a; + + return ShadowColor * outputStrength; +}; + +float4 SampleShadowVPS( VS_OUTPUT In) : SV_Target +{ + float4 outputColor = float4(0, 0, 0, 0); + + outputColor += BlurWeights[0].x * tex.Sample(sShadowSampler, float2(In.TexCoord.x, In.TexCoord.y + BlurOffsetsV[0].x)); + outputColor += BlurWeights[0].y * tex.Sample(sShadowSampler, float2(In.TexCoord.x, In.TexCoord.y + BlurOffsetsV[0].y)); + outputColor += BlurWeights[0].z * tex.Sample(sShadowSampler, float2(In.TexCoord.x, In.TexCoord.y + BlurOffsetsV[0].z)); + outputColor += BlurWeights[0].w * tex.Sample(sShadowSampler, float2(In.TexCoord.x, In.TexCoord.y + BlurOffsetsV[0].w)); + outputColor += BlurWeights[1].x * tex.Sample(sShadowSampler, float2(In.TexCoord.x, In.TexCoord.y + BlurOffsetsV[1].x)); + outputColor += BlurWeights[1].y * tex.Sample(sShadowSampler, float2(In.TexCoord.x, In.TexCoord.y + BlurOffsetsV[1].y)); + outputColor += BlurWeights[1].z * tex.Sample(sShadowSampler, float2(In.TexCoord.x, In.TexCoord.y + BlurOffsetsV[1].z)); + outputColor += BlurWeights[1].w * tex.Sample(sShadowSampler, float2(In.TexCoord.x, In.TexCoord.y + BlurOffsetsV[1].w)); + outputColor += BlurWeights[2].x * tex.Sample(sShadowSampler, float2(In.TexCoord.x, In.TexCoord.y + BlurOffsetsV[2].x)); + + return outputColor; +}; + +technique10 SampleTexture +{ + pass P0 + { + SetRasterizerState(TextureRast); + SetVertexShader(CompileShader(vs_4_0_level_9_3, SampleTextureVS())); + SetGeometryShader(NULL); + SetPixelShader(CompileShader(ps_4_0_level_9_3, SampleTexturePS())); + } +} + + +technique10 SampleTextureWithShadow +{ + // Horizontal pass + pass P0 + { + SetRasterizerState(TextureRast); + SetBlendState(ShadowBlendH, float4(1.0f, 1.0f, 1.0f, 1.0f), 0xffffffff); + SetVertexShader(CompileShader(vs_4_0_level_9_3, SampleTextureVS())); + SetGeometryShader(NULL); + SetPixelShader(CompileShader(ps_4_0_level_9_3, SampleShadowHPS())); + } + // Vertical pass + pass P1 + { + SetRasterizerState(TextureRast); + SetBlendState(ShadowBlendV, float4(1.0f, 1.0f, 1.0f, 1.0f), 0xffffffff); + SetVertexShader(CompileShader(vs_4_0_level_9_3, SampleTextureVS())); + SetGeometryShader(NULL); + SetPixelShader(CompileShader(ps_4_0_level_9_3, SampleShadowVPS())); + } +} \ No newline at end of file diff --git a/gfx/2d/ShadersD2D.h b/gfx/2d/ShadersD2D.h new file mode 100644 index 00000000000..47fb5787d22 --- /dev/null +++ b/gfx/2d/ShadersD2D.h @@ -0,0 +1,2411 @@ +#if 0 +// +// FX Version: fx_4_0 +// Child effect (requires effect pool): false +// +// 2 local buffer(s) +// +cbuffer cb0 +{ + float4 QuadDesc; // Offset: 0, size: 16 + float4 TexCoords; // Offset: 16, size: 16 +} + +cbuffer cb1 +{ + float4 BlurOffsetsH[3]; // Offset: 0, size: 48 + float4 BlurOffsetsV[3]; // Offset: 48, size: 48 + float4 BlurWeights[3]; // Offset: 96, size: 48 + float4 ShadowColor; // Offset: 144, size: 16 +} + +// +// 6 local object(s) +// +Texture2D tex; +SamplerState sSampler +{ + Filter = uint(MIN_MAG_MIP_LINEAR /* 21 */); + Texture = tex; + AddressU = uint(CLAMP /* 3 */); + AddressV = uint(CLAMP /* 3 */); +}; +SamplerState sShadowSampler +{ + Filter = uint(MIN_MAG_MIP_LINEAR /* 21 */); + Texture = tex; + AddressU = uint(BORDER /* 4 */); + AddressV = uint(BORDER /* 4 */); + BorderColor = float4(0, 0, 0, 0); +}; +RasterizerState TextureRast +{ + ScissorEnable = bool(FALSE /* 0 */); + CullMode = uint(NONE /* 1 */); +}; +BlendState ShadowBlendH +{ + BlendEnable[0] = bool(FALSE /* 0 */); + RenderTargetWriteMask[0] = byte(0x0f); +}; +BlendState ShadowBlendV +{ + BlendEnable[0] = bool(TRUE /* 1 */); + SrcBlend[0] = uint(ONE /* 2 */); + DestBlend[0] = uint(INV_SRC_ALPHA /* 6 */); + BlendOp[0] = uint(ADD /* 1 */); + SrcBlendAlpha[0] = uint(ONE /* 2 */); + DestBlendAlpha[0] = uint(INV_SRC_ALPHA /* 6 */); + BlendOpAlpha[0] = uint(ADD /* 1 */); + RenderTargetWriteMask[0] = byte(0x0f); +}; + +// +// 2 technique(s) +// +technique10 SampleTexture +{ + pass P0 + { + RasterizerState = TextureRast; + VertexShader = asm { + // + // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // + // + // Buffer Definitions: + // + // cbuffer cb0 + // { + // + // float4 QuadDesc; // Offset: 0 Size: 16 + // float4 TexCoords; // Offset: 16 Size: 16 + // + // } + // + // + // Resource Bindings: + // + // Name Type Format Dim Slot Elements + // ------------------------------ ---------- ------- ----------- ---- -------- + // cb0 cbuffer NA NA 0 1 + // + // + // + // Input signature: + // + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------ ------ + // POSITION 0 xyz 0 NONE float xy + // + // + // Output signature: + // + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------ ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // + // + // Constant buffer to DX9 shader constant mappings: + // + // Target Reg Buffer Start Reg # of Regs Data Conversion + // ---------- ------- --------- --------- ---------------------- + // c1 cb0 0 2 ( FLT, FLT, FLT, FLT) + // + // + // Runtime generated constant mappings: + // + // Target Reg Constant Description + // ---------- -------------------------------------------------- + // c0 Vertex Shader position offset + // + // + // Level9 shader bytecode: + // + vs_2_x + def c3, 0, 1, 0, 0 + dcl_texcoord v0 + mad oT0.xy, v0, c2.zwzw, c2 + mad r0.xy, v0, c1.zwzw, c1 + add oPos.xy, r0, c0 + mov oPos.zw, c3.xyxy + + // approximately 4 instruction slots used + vs_4_0 + dcl_constantbuffer cb0[2], immediateIndexed + dcl_input v0.xy + dcl_output_siv o0.xyzw, position + dcl_output o1.xy + mad o0.xy, v0.xyxx, cb0[0].zwzz, cb0[0].xyxx + mov o0.zw, l(0,0,0,1.000000) + mad o1.xy, v0.xyxx, cb0[1].zwzz, cb0[1].xyxx + ret + // Approximately 4 instruction slots used + + }; + GeometryShader = NULL; + PixelShader = asm { + // + // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // + // + // Resource Bindings: + // + // Name Type Format Dim Slot Elements + // ------------------------------ ---------- ------- ----------- ---- -------- + // sSampler sampler NA NA 0 1 + // tex texture float4 2d 0 1 + // + // + // + // Input signature: + // + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------ ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy + // + // + // Output signature: + // + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------ ------ + // SV_Target 0 xyzw 0 TARGET float xyzw + // + // + // Sampler/Resource to DX9 shader sampler mappings: + // + // Target Sampler Source Sampler Source Resource + // -------------- --------------- ---------------- + // s0 s0 t0 + // + // + // Level9 shader bytecode: + // + ps_2_x + dcl t0.xy + dcl_2d s0 + texld r0, t0, s0 + mov oC0, r0 + + // approximately 2 instruction slots used (1 texture, 1 arithmetic) + ps_4_0 + dcl_sampler s0, mode_default + dcl_resource_texture2d (float,float,float,float) t0 + dcl_input_ps linear v1.xy + dcl_output o0.xyzw + sample o0.xyzw, v1.xyxx, t0.xyzw, s0 + ret + // Approximately 2 instruction slots used + + }; + } + +} + +technique10 SampleTextureWithShadow +{ + pass P0 + { + RasterizerState = TextureRast; + AB_BlendFactor = float4(1, 1, 1, 1); + AB_SampleMask = uint(0xffffffff); + BlendState = ShadowBlendH; + VertexShader = asm { + // + // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // + // + // Buffer Definitions: + // + // cbuffer cb0 + // { + // + // float4 QuadDesc; // Offset: 0 Size: 16 + // float4 TexCoords; // Offset: 16 Size: 16 + // + // } + // + // + // Resource Bindings: + // + // Name Type Format Dim Slot Elements + // ------------------------------ ---------- ------- ----------- ---- -------- + // cb0 cbuffer NA NA 0 1 + // + // + // + // Input signature: + // + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------ ------ + // POSITION 0 xyz 0 NONE float xy + // + // + // Output signature: + // + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------ ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // + // + // Constant buffer to DX9 shader constant mappings: + // + // Target Reg Buffer Start Reg # of Regs Data Conversion + // ---------- ------- --------- --------- ---------------------- + // c1 cb0 0 2 ( FLT, FLT, FLT, FLT) + // + // + // Runtime generated constant mappings: + // + // Target Reg Constant Description + // ---------- -------------------------------------------------- + // c0 Vertex Shader position offset + // + // + // Level9 shader bytecode: + // + vs_2_x + def c3, 0, 1, 0, 0 + dcl_texcoord v0 + mad oT0.xy, v0, c2.zwzw, c2 + mad r0.xy, v0, c1.zwzw, c1 + add oPos.xy, r0, c0 + mov oPos.zw, c3.xyxy + + // approximately 4 instruction slots used + vs_4_0 + dcl_constantbuffer cb0[2], immediateIndexed + dcl_input v0.xy + dcl_output_siv o0.xyzw, position + dcl_output o1.xy + mad o0.xy, v0.xyxx, cb0[0].zwzz, cb0[0].xyxx + mov o0.zw, l(0,0,0,1.000000) + mad o1.xy, v0.xyxx, cb0[1].zwzz, cb0[1].xyxx + ret + // Approximately 4 instruction slots used + + }; + GeometryShader = NULL; + PixelShader = asm { + // + // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // + // + // Buffer Definitions: + // + // cbuffer cb1 + // { + // + // float4 BlurOffsetsH[3]; // Offset: 0 Size: 48 + // float4 BlurOffsetsV[3]; // Offset: 48 Size: 48 [unused] + // float4 BlurWeights[3]; // Offset: 96 Size: 48 + // float4 ShadowColor; // Offset: 144 Size: 16 + // + // } + // + // + // Resource Bindings: + // + // Name Type Format Dim Slot Elements + // ------------------------------ ---------- ------- ----------- ---- -------- + // sShadowSampler sampler NA NA 0 1 + // tex texture float4 2d 0 1 + // cb1 cbuffer NA NA 0 1 + // + // + // + // Input signature: + // + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------ ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy + // + // + // Output signature: + // + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------ ------ + // SV_Target 0 xyzw 0 TARGET float xyzw + // + // + // Constant buffer to DX9 shader constant mappings: + // + // Target Reg Buffer Start Reg # of Regs Data Conversion + // ---------- ------- --------- --------- ---------------------- + // c0 cb0 0 3 ( FLT, FLT, FLT, FLT) + // c3 cb0 6 4 ( FLT, FLT, FLT, FLT) + // + // + // Sampler/Resource to DX9 shader sampler mappings: + // + // Target Sampler Source Sampler Source Resource + // -------------- --------------- ---------------- + // s0 s0 t0 + // + // + // Level9 shader bytecode: + // + ps_2_x + dcl t0.xy + dcl_2d s0 + add r0.x, t0.x, c0.y + mov r0.y, t0.y + add r1.x, t0.x, c0.x + mov r1.y, t0.y + texld r0, r0, s0 + texld r1, r1, s0 + mul r0.x, r0.w, c3.y + mad r0.x, c3.x, r1.w, r0.x + add r1.x, t0.x, c0.z + mov r1.y, t0.y + add r2.x, t0.x, c0.w + mov r2.y, t0.y + texld r1, r1, s0 + texld r2, r2, s0 + mad r0.x, c3.z, r1.w, r0.x + mad r0.x, c3.w, r2.w, r0.x + add r1.x, t0.x, c1.x + mov r1.y, t0.y + add r2.x, t0.x, c1.y + mov r2.y, t0.y + texld r1, r1, s0 + texld r2, r2, s0 + mad r0.x, c4.x, r1.w, r0.x + mad r0.x, c4.y, r2.w, r0.x + add r1.x, t0.x, c1.z + mov r1.y, t0.y + add r2.x, t0.x, c1.w + mov r2.y, t0.y + texld r1, r1, s0 + texld r2, r2, s0 + mad r0.x, c4.z, r1.w, r0.x + mad r0.x, c4.w, r2.w, r0.x + add r1.x, t0.x, c2.x + mov r1.y, t0.y + texld r1, r1, s0 + mad r0.x, c5.x, r1.w, r0.x + mul r0, r0.x, c6 + mov oC0, r0 + + // approximately 38 instruction slots used (9 texture, 29 arithmetic) + ps_4_0 + dcl_constantbuffer cb0[10], immediateIndexed + dcl_sampler s0, mode_default + dcl_resource_texture2d (float,float,float,float) t0 + dcl_input_ps linear v1.xy + dcl_output o0.xyzw + dcl_temps 4 + add r0.xyzw, v1.xxxx, cb0[0].zxwy + mov r1.xz, r0.yywy + mov r1.yw, v1.yyyy + sample r2.xyzw, r1.zwzz, t0.xyzw, s0 + sample r1.xyzw, r1.xyxx, t0.xyzw, s0 + mul r1.x, r2.w, cb0[6].y + mad r1.x, cb0[6].x, r1.w, r1.x + mov r0.yw, v1.yyyy + sample r2.xyzw, r0.xyxx, t0.xyzw, s0 + sample r0.xyzw, r0.zwzz, t0.xyzw, s0 + mad r0.x, cb0[6].z, r2.w, r1.x + mad r0.x, cb0[6].w, r0.w, r0.x + add r1.xyzw, v1.xxxx, cb0[1].zxwy + mov r2.xz, r1.yywy + mov r2.yw, v1.yyyy + sample r3.xyzw, r2.xyxx, t0.xyzw, s0 + sample r2.xyzw, r2.zwzz, t0.xyzw, s0 + mad r0.x, cb0[7].x, r3.w, r0.x + mad r0.x, cb0[7].y, r2.w, r0.x + mov r1.yw, v1.yyyy + sample r2.xyzw, r1.xyxx, t0.xyzw, s0 + sample r1.xyzw, r1.zwzz, t0.xyzw, s0 + mad r0.x, cb0[7].z, r2.w, r0.x + mad r0.x, cb0[7].w, r1.w, r0.x + add r1.x, v1.x, cb0[2].x + mov r1.y, v1.y + sample r1.xyzw, r1.xyxx, t0.xyzw, s0 + mad r0.x, cb0[8].x, r1.w, r0.x + mul o0.xyzw, r0.xxxx, cb0[9].xyzw + ret + // Approximately 30 instruction slots used + + }; + } + + pass P1 + { + RasterizerState = TextureRast; + AB_BlendFactor = float4(1, 1, 1, 1); + AB_SampleMask = uint(0xffffffff); + BlendState = ShadowBlendV; + VertexShader = asm { + // + // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // + // + // Buffer Definitions: + // + // cbuffer cb0 + // { + // + // float4 QuadDesc; // Offset: 0 Size: 16 + // float4 TexCoords; // Offset: 16 Size: 16 + // + // } + // + // + // Resource Bindings: + // + // Name Type Format Dim Slot Elements + // ------------------------------ ---------- ------- ----------- ---- -------- + // cb0 cbuffer NA NA 0 1 + // + // + // + // Input signature: + // + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------ ------ + // POSITION 0 xyz 0 NONE float xy + // + // + // Output signature: + // + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------ ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // + // + // Constant buffer to DX9 shader constant mappings: + // + // Target Reg Buffer Start Reg # of Regs Data Conversion + // ---------- ------- --------- --------- ---------------------- + // c1 cb0 0 2 ( FLT, FLT, FLT, FLT) + // + // + // Runtime generated constant mappings: + // + // Target Reg Constant Description + // ---------- -------------------------------------------------- + // c0 Vertex Shader position offset + // + // + // Level9 shader bytecode: + // + vs_2_x + def c3, 0, 1, 0, 0 + dcl_texcoord v0 + mad oT0.xy, v0, c2.zwzw, c2 + mad r0.xy, v0, c1.zwzw, c1 + add oPos.xy, r0, c0 + mov oPos.zw, c3.xyxy + + // approximately 4 instruction slots used + vs_4_0 + dcl_constantbuffer cb0[2], immediateIndexed + dcl_input v0.xy + dcl_output_siv o0.xyzw, position + dcl_output o1.xy + mad o0.xy, v0.xyxx, cb0[0].zwzz, cb0[0].xyxx + mov o0.zw, l(0,0,0,1.000000) + mad o1.xy, v0.xyxx, cb0[1].zwzz, cb0[1].xyxx + ret + // Approximately 4 instruction slots used + + }; + GeometryShader = NULL; + PixelShader = asm { + // + // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // + // + // Buffer Definitions: + // + // cbuffer cb1 + // { + // + // float4 BlurOffsetsH[3]; // Offset: 0 Size: 48 [unused] + // float4 BlurOffsetsV[3]; // Offset: 48 Size: 48 + // float4 BlurWeights[3]; // Offset: 96 Size: 48 + // float4 ShadowColor; // Offset: 144 Size: 16 [unused] + // + // } + // + // + // Resource Bindings: + // + // Name Type Format Dim Slot Elements + // ------------------------------ ---------- ------- ----------- ---- -------- + // sShadowSampler sampler NA NA 0 1 + // tex texture float4 2d 0 1 + // cb1 cbuffer NA NA 0 1 + // + // + // + // Input signature: + // + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------ ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy + // + // + // Output signature: + // + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------ ------ + // SV_Target 0 xyzw 0 TARGET float xyzw + // + // + // Constant buffer to DX9 shader constant mappings: + // + // Target Reg Buffer Start Reg # of Regs Data Conversion + // ---------- ------- --------- --------- ---------------------- + // c0 cb0 3 6 ( FLT, FLT, FLT, FLT) + // + // + // Sampler/Resource to DX9 shader sampler mappings: + // + // Target Sampler Source Sampler Source Resource + // -------------- --------------- ---------------- + // s0 s0 t0 + // + // + // Level9 shader bytecode: + // + ps_2_x + dcl t0.xy + dcl_2d s0 + add r0.y, t0.y, c0.y + mov r0.x, t0.x + add r1.y, t0.y, c0.x + mov r1.x, t0.x + texld r0, r0, s0 + texld r1, r1, s0 + mul r0, r0, c3.y + mad r0, c3.x, r1, r0 + add r1.y, t0.y, c0.z + mov r1.x, t0.x + add r2.y, t0.y, c0.w + mov r2.x, t0.x + texld r1, r1, s0 + texld r2, r2, s0 + mad r0, c3.z, r1, r0 + mad r0, c3.w, r2, r0 + add r1.y, t0.y, c1.x + mov r1.x, t0.x + add r2.y, t0.y, c1.y + mov r2.x, t0.x + texld r1, r1, s0 + texld r2, r2, s0 + mad r0, c4.x, r1, r0 + mad r0, c4.y, r2, r0 + add r1.y, t0.y, c1.z + mov r1.x, t0.x + add r2.y, t0.y, c1.w + mov r2.x, t0.x + texld r1, r1, s0 + texld r2, r2, s0 + mad r0, c4.z, r1, r0 + mad r0, c4.w, r2, r0 + add r1.y, t0.y, c2.x + mov r1.x, t0.x + texld r1, r1, s0 + mad r0, c5.x, r1, r0 + mov oC0, r0 + + // approximately 37 instruction slots used (9 texture, 28 arithmetic) + ps_4_0 + dcl_constantbuffer cb0[9], immediateIndexed + dcl_sampler s0, mode_default + dcl_resource_texture2d (float,float,float,float) t0 + dcl_input_ps linear v1.xy + dcl_output o0.xyzw + dcl_temps 4 + mov r0.xz, v1.xxxx + add r1.xyzw, v1.yyyy, cb0[3].xzyw + mov r0.yw, r1.xxxz + sample r2.xyzw, r0.zwzz, t0.xyzw, s0 + sample r0.xyzw, r0.xyxx, t0.xyzw, s0 + mul r2.xyzw, r2.xyzw, cb0[6].yyyy + mad r0.xyzw, cb0[6].xxxx, r0.xyzw, r2.xyzw + mov r1.xz, v1.xxxx + sample r2.xyzw, r1.xyxx, t0.xyzw, s0 + sample r1.xyzw, r1.zwzz, t0.xyzw, s0 + mad r0.xyzw, cb0[6].zzzz, r2.xyzw, r0.xyzw + mad r0.xyzw, cb0[6].wwww, r1.xyzw, r0.xyzw + mov r1.xz, v1.xxxx + add r2.xyzw, v1.yyyy, cb0[4].xzyw + mov r1.yw, r2.xxxz + sample r3.xyzw, r1.xyxx, t0.xyzw, s0 + sample r1.xyzw, r1.zwzz, t0.xyzw, s0 + mad r0.xyzw, cb0[7].xxxx, r3.xyzw, r0.xyzw + mad r0.xyzw, cb0[7].yyyy, r1.xyzw, r0.xyzw + mov r2.xz, v1.xxxx + sample r1.xyzw, r2.xyxx, t0.xyzw, s0 + sample r2.xyzw, r2.zwzz, t0.xyzw, s0 + mad r0.xyzw, cb0[7].zzzz, r1.xyzw, r0.xyzw + mad r0.xyzw, cb0[7].wwww, r2.xyzw, r0.xyzw + add r1.y, v1.y, cb0[5].x + mov r1.x, v1.x + sample r1.xyzw, r1.xyxx, t0.xyzw, s0 + mad o0.xyzw, cb0[8].xxxx, r1.xyzw, r0.xyzw + ret + // Approximately 29 instruction slots used + + }; + } + +} + +#endif + +const BYTE d2deffect[] = +{ + 68, 88, 66, 67, 245, 80, + 253, 174, 31, 0, 29, 195, + 254, 34, 10, 37, 101, 204, + 99, 74, 1, 0, 0, 0, + 216, 40, 0, 0, 1, 0, + 0, 0, 36, 0, 0, 0, + 70, 88, 49, 48, 172, 40, + 0, 0, 1, 16, 255, 254, + 2, 0, 0, 0, 6, 0, + 0, 0, 6, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 80, 36, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 0, + 0, 0, 6, 0, 0, 0, + 0, 0, 0, 0, 99, 98, + 48, 0, 102, 108, 111, 97, + 116, 52, 0, 8, 0, 0, + 0, 1, 0, 0, 0, 0, + 0, 0, 0, 16, 0, 0, + 0, 16, 0, 0, 0, 16, + 0, 0, 0, 10, 33, 0, + 0, 81, 117, 97, 100, 68, + 101, 115, 99, 0, 84, 101, + 120, 67, 111, 111, 114, 100, + 115, 0, 99, 98, 49, 0, + 8, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 48, 0, 0, 0, 16, 0, + 0, 0, 48, 0, 0, 0, + 10, 33, 0, 0, 66, 108, + 117, 114, 79, 102, 102, 115, + 101, 116, 115, 72, 0, 66, + 108, 117, 114, 79, 102, 102, + 115, 101, 116, 115, 86, 0, + 66, 108, 117, 114, 87, 101, + 105, 103, 104, 116, 115, 0, + 83, 104, 97, 100, 111, 119, + 67, 111, 108, 111, 114, 0, + 84, 101, 120, 116, 117, 114, + 101, 50, 68, 0, 144, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 12, 0, + 0, 0, 116, 101, 120, 0, + 83, 97, 109, 112, 108, 101, + 114, 83, 116, 97, 116, 101, + 0, 186, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 21, 0, 0, 0, 115, + 83, 97, 109, 112, 108, 101, + 114, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 21, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 3, 0, + 0, 0, 115, 83, 104, 97, + 100, 111, 119, 83, 97, 109, + 112, 108, 101, 114, 0, 1, + 0, 0, 0, 2, 0, 0, + 0, 21, 0, 0, 0, 1, + 0, 0, 0, 2, 0, 0, + 0, 4, 0, 0, 0, 1, + 0, 0, 0, 2, 0, 0, + 0, 4, 0, 0, 0, 4, + 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 82, + 97, 115, 116, 101, 114, 105, + 122, 101, 114, 83, 116, 97, + 116, 101, 0, 103, 1, 0, + 0, 2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 4, 0, 0, + 0, 84, 101, 120, 116, 117, + 114, 101, 82, 97, 115, 116, + 0, 1, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 2, + 0, 0, 0, 1, 0, 0, + 0, 66, 108, 101, 110, 100, + 83, 116, 97, 116, 101, 0, + 183, 1, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 83, 104, + 97, 100, 111, 119, 66, 108, + 101, 110, 100, 72, 0, 1, + 0, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 3, 0, 0, + 0, 15, 0, 0, 0, 83, + 104, 97, 100, 111, 119, 66, + 108, 101, 110, 100, 86, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 6, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 6, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 15, 0, 0, 0, + 83, 97, 109, 112, 108, 101, + 84, 101, 120, 116, 117, 114, + 101, 0, 80, 48, 0, 152, + 3, 0, 0, 68, 88, 66, + 67, 219, 222, 190, 170, 104, + 118, 127, 154, 100, 214, 1, + 86, 70, 204, 61, 202, 1, + 0, 0, 0, 152, 3, 0, + 0, 6, 0, 0, 0, 56, + 0, 0, 0, 228, 0, 0, + 0, 168, 1, 0, 0, 36, + 2, 0, 0, 12, 3, 0, + 0, 64, 3, 0, 0, 65, + 111, 110, 57, 164, 0, 0, + 0, 164, 0, 0, 0, 0, + 2, 254, 255, 112, 0, 0, + 0, 52, 0, 0, 0, 1, + 0, 36, 0, 0, 0, 48, + 0, 0, 0, 48, 0, 0, + 0, 36, 0, 1, 0, 48, + 0, 0, 0, 0, 0, 2, + 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, + 2, 254, 255, 81, 0, 0, + 5, 3, 0, 15, 160, 0, + 0, 0, 0, 0, 0, 128, + 63, 0, 0, 0, 0, 0, + 0, 0, 0, 31, 0, 0, + 2, 5, 0, 0, 128, 0, + 0, 15, 144, 4, 0, 0, + 4, 0, 0, 3, 224, 0, + 0, 228, 144, 2, 0, 238, + 160, 2, 0, 228, 160, 4, + 0, 0, 4, 0, 0, 3, + 128, 0, 0, 228, 144, 1, + 0, 238, 160, 1, 0, 228, + 160, 2, 0, 0, 3, 0, + 0, 3, 192, 0, 0, 228, + 128, 0, 0, 228, 160, 1, + 0, 0, 2, 0, 0, 12, + 192, 3, 0, 68, 160, 255, + 255, 0, 0, 83, 72, 68, + 82, 188, 0, 0, 0, 64, + 0, 1, 0, 47, 0, 0, + 0, 89, 0, 0, 4, 70, + 142, 32, 0, 0, 0, 0, + 0, 2, 0, 0, 0, 95, + 0, 0, 3, 50, 16, 16, + 0, 0, 0, 0, 0, 103, + 0, 0, 4, 242, 32, 16, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 101, 0, 0, + 3, 50, 32, 16, 0, 1, + 0, 0, 0, 50, 0, 0, + 11, 50, 32, 16, 0, 0, + 0, 0, 0, 70, 16, 16, + 0, 0, 0, 0, 0, 230, + 138, 32, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 70, + 128, 32, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 54, + 0, 0, 8, 194, 32, 16, + 0, 0, 0, 0, 0, 2, + 64, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 128, + 63, 50, 0, 0, 11, 50, + 32, 16, 0, 1, 0, 0, + 0, 70, 16, 16, 0, 0, + 0, 0, 0, 230, 138, 32, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 70, 128, 32, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 62, 0, 0, + 1, 83, 84, 65, 84, 116, + 0, 0, 0, 4, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 82, + 68, 69, 70, 224, 0, 0, + 0, 1, 0, 0, 0, 64, + 0, 0, 0, 1, 0, 0, + 0, 28, 0, 0, 0, 0, + 4, 254, 255, 0, 1, 0, + 0, 174, 0, 0, 0, 60, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, + 0, 99, 98, 48, 0, 60, + 0, 0, 0, 2, 0, 0, + 0, 88, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 136, + 0, 0, 0, 0, 0, 0, + 0, 16, 0, 0, 0, 2, + 0, 0, 0, 148, 0, 0, + 0, 0, 0, 0, 0, 164, + 0, 0, 0, 16, 0, 0, + 0, 16, 0, 0, 0, 2, + 0, 0, 0, 148, 0, 0, + 0, 0, 0, 0, 0, 81, + 117, 97, 100, 68, 101, 115, + 99, 0, 171, 171, 171, 1, + 0, 3, 0, 1, 0, 4, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 84, 101, 120, + 67, 111, 111, 114, 100, 115, + 0, 77, 105, 99, 114, 111, + 115, 111, 102, 116, 32, 40, + 82, 41, 32, 72, 76, 83, + 76, 32, 83, 104, 97, 100, + 101, 114, 32, 67, 111, 109, + 112, 105, 108, 101, 114, 32, + 57, 46, 50, 57, 46, 57, + 53, 50, 46, 51, 49, 49, + 49, 0, 171, 73, 83, 71, + 78, 44, 0, 0, 0, 1, + 0, 0, 0, 8, 0, 0, + 0, 32, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 0, + 0, 0, 0, 7, 3, 0, + 0, 80, 79, 83, 73, 84, + 73, 79, 78, 0, 171, 171, + 171, 79, 83, 71, 78, 80, + 0, 0, 0, 2, 0, 0, + 0, 8, 0, 0, 0, 56, + 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, + 0, 15, 0, 0, 0, 68, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3, + 0, 0, 0, 1, 0, 0, + 0, 3, 12, 0, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 171, 171, 171, 129, + 2, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, + 0, 188, 2, 0, 0, 68, + 88, 66, 67, 57, 173, 135, + 37, 0, 15, 237, 50, 142, + 80, 59, 160, 81, 240, 60, + 171, 1, 0, 0, 0, 188, + 2, 0, 0, 6, 0, 0, + 0, 56, 0, 0, 0, 164, + 0, 0, 0, 16, 1, 0, + 0, 140, 1, 0, 0, 48, + 2, 0, 0, 136, 2, 0, + 0, 65, 111, 110, 57, 100, + 0, 0, 0, 100, 0, 0, + 0, 0, 2, 255, 255, 60, + 0, 0, 0, 40, 0, 0, + 0, 0, 0, 40, 0, 0, + 0, 40, 0, 0, 0, 40, + 0, 1, 0, 36, 0, 0, + 0, 40, 0, 0, 0, 0, + 0, 1, 2, 255, 255, 31, + 0, 0, 2, 0, 0, 0, + 128, 0, 0, 3, 176, 31, + 0, 0, 2, 0, 0, 0, + 144, 0, 8, 15, 160, 66, + 0, 0, 3, 0, 0, 15, + 128, 0, 0, 228, 176, 0, + 8, 228, 160, 1, 0, 0, + 2, 0, 8, 15, 128, 0, + 0, 228, 128, 255, 255, 0, + 0, 83, 72, 68, 82, 100, + 0, 0, 0, 64, 0, 0, + 0, 25, 0, 0, 0, 90, + 0, 0, 3, 0, 96, 16, + 0, 0, 0, 0, 0, 88, + 24, 0, 4, 0, 112, 16, + 0, 0, 0, 0, 0, 85, + 85, 0, 0, 98, 16, 0, + 3, 50, 16, 16, 0, 1, + 0, 0, 0, 101, 0, 0, + 3, 242, 32, 16, 0, 0, + 0, 0, 0, 69, 0, 0, + 9, 242, 32, 16, 0, 0, + 0, 0, 0, 70, 16, 16, + 0, 1, 0, 0, 0, 70, + 126, 16, 0, 0, 0, 0, + 0, 0, 96, 16, 0, 0, + 0, 0, 0, 62, 0, 0, + 1, 83, 84, 65, 84, 116, + 0, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 82, + 68, 69, 70, 156, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2, 0, 0, + 0, 28, 0, 0, 0, 0, + 4, 255, 255, 0, 1, 0, + 0, 105, 0, 0, 0, 92, + 0, 0, 0, 3, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, + 0, 101, 0, 0, 0, 2, + 0, 0, 0, 5, 0, 0, + 0, 4, 0, 0, 0, 255, + 255, 255, 255, 0, 0, 0, + 0, 1, 0, 0, 0, 12, + 0, 0, 0, 115, 83, 97, + 109, 112, 108, 101, 114, 0, + 116, 101, 120, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 73, 83, 71, 78, 80, + 0, 0, 0, 2, 0, 0, + 0, 8, 0, 0, 0, 56, + 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, + 0, 15, 0, 0, 0, 68, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3, + 0, 0, 0, 1, 0, 0, + 0, 3, 3, 0, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 171, 171, 171, 79, + 83, 71, 78, 44, 0, 0, + 0, 1, 0, 0, 0, 8, + 0, 0, 0, 32, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3, 0, 0, + 0, 0, 0, 0, 0, 15, + 0, 0, 0, 83, 86, 95, + 84, 97, 114, 103, 101, 116, + 0, 171, 171, 49, 6, 0, + 0, 0, 0, 0, 0, 83, + 97, 109, 112, 108, 101, 84, + 101, 120, 116, 117, 114, 101, + 87, 105, 116, 104, 83, 104, + 97, 100, 111, 119, 0, 4, + 0, 0, 0, 1, 0, 0, + 0, 0, 0, 128, 63, 1, + 0, 0, 0, 0, 0, 128, + 63, 1, 0, 0, 0, 0, + 0, 128, 63, 1, 0, 0, + 0, 0, 0, 128, 63, 1, + 0, 0, 0, 3, 0, 0, + 0, 255, 255, 255, 255, 152, + 3, 0, 0, 68, 88, 66, + 67, 219, 222, 190, 170, 104, + 118, 127, 154, 100, 214, 1, + 86, 70, 204, 61, 202, 1, + 0, 0, 0, 152, 3, 0, + 0, 6, 0, 0, 0, 56, + 0, 0, 0, 228, 0, 0, + 0, 168, 1, 0, 0, 36, + 2, 0, 0, 12, 3, 0, + 0, 64, 3, 0, 0, 65, + 111, 110, 57, 164, 0, 0, + 0, 164, 0, 0, 0, 0, + 2, 254, 255, 112, 0, 0, + 0, 52, 0, 0, 0, 1, + 0, 36, 0, 0, 0, 48, + 0, 0, 0, 48, 0, 0, + 0, 36, 0, 1, 0, 48, + 0, 0, 0, 0, 0, 2, + 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, + 2, 254, 255, 81, 0, 0, + 5, 3, 0, 15, 160, 0, + 0, 0, 0, 0, 0, 128, + 63, 0, 0, 0, 0, 0, + 0, 0, 0, 31, 0, 0, + 2, 5, 0, 0, 128, 0, + 0, 15, 144, 4, 0, 0, + 4, 0, 0, 3, 224, 0, + 0, 228, 144, 2, 0, 238, + 160, 2, 0, 228, 160, 4, + 0, 0, 4, 0, 0, 3, + 128, 0, 0, 228, 144, 1, + 0, 238, 160, 1, 0, 228, + 160, 2, 0, 0, 3, 0, + 0, 3, 192, 0, 0, 228, + 128, 0, 0, 228, 160, 1, + 0, 0, 2, 0, 0, 12, + 192, 3, 0, 68, 160, 255, + 255, 0, 0, 83, 72, 68, + 82, 188, 0, 0, 0, 64, + 0, 1, 0, 47, 0, 0, + 0, 89, 0, 0, 4, 70, + 142, 32, 0, 0, 0, 0, + 0, 2, 0, 0, 0, 95, + 0, 0, 3, 50, 16, 16, + 0, 0, 0, 0, 0, 103, + 0, 0, 4, 242, 32, 16, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 101, 0, 0, + 3, 50, 32, 16, 0, 1, + 0, 0, 0, 50, 0, 0, + 11, 50, 32, 16, 0, 0, + 0, 0, 0, 70, 16, 16, + 0, 0, 0, 0, 0, 230, + 138, 32, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 70, + 128, 32, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 54, + 0, 0, 8, 194, 32, 16, + 0, 0, 0, 0, 0, 2, + 64, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 128, + 63, 50, 0, 0, 11, 50, + 32, 16, 0, 1, 0, 0, + 0, 70, 16, 16, 0, 0, + 0, 0, 0, 230, 138, 32, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 70, 128, 32, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 62, 0, 0, + 1, 83, 84, 65, 84, 116, + 0, 0, 0, 4, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 82, + 68, 69, 70, 224, 0, 0, + 0, 1, 0, 0, 0, 64, + 0, 0, 0, 1, 0, 0, + 0, 28, 0, 0, 0, 0, + 4, 254, 255, 0, 1, 0, + 0, 174, 0, 0, 0, 60, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, + 0, 99, 98, 48, 0, 60, + 0, 0, 0, 2, 0, 0, + 0, 88, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 136, + 0, 0, 0, 0, 0, 0, + 0, 16, 0, 0, 0, 2, + 0, 0, 0, 148, 0, 0, + 0, 0, 0, 0, 0, 164, + 0, 0, 0, 16, 0, 0, + 0, 16, 0, 0, 0, 2, + 0, 0, 0, 148, 0, 0, + 0, 0, 0, 0, 0, 81, + 117, 97, 100, 68, 101, 115, + 99, 0, 171, 171, 171, 1, + 0, 3, 0, 1, 0, 4, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 84, 101, 120, + 67, 111, 111, 114, 100, 115, + 0, 77, 105, 99, 114, 111, + 115, 111, 102, 116, 32, 40, + 82, 41, 32, 72, 76, 83, + 76, 32, 83, 104, 97, 100, + 101, 114, 32, 67, 111, 109, + 112, 105, 108, 101, 114, 32, + 57, 46, 50, 57, 46, 57, + 53, 50, 46, 51, 49, 49, + 49, 0, 171, 73, 83, 71, + 78, 44, 0, 0, 0, 1, + 0, 0, 0, 8, 0, 0, + 0, 32, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 0, + 0, 0, 0, 7, 3, 0, + 0, 80, 79, 83, 73, 84, + 73, 79, 78, 0, 171, 171, + 171, 79, 83, 71, 78, 80, + 0, 0, 0, 2, 0, 0, + 0, 8, 0, 0, 0, 56, + 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, + 0, 15, 0, 0, 0, 68, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3, + 0, 0, 0, 1, 0, 0, + 0, 3, 12, 0, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 171, 171, 171, 65, + 9, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, + 0, 208, 9, 0, 0, 68, + 88, 66, 67, 88, 125, 98, + 31, 252, 245, 86, 128, 184, + 245, 122, 45, 178, 60, 220, + 51, 1, 0, 0, 0, 208, + 9, 0, 0, 6, 0, 0, + 0, 56, 0, 0, 0, 248, + 2, 0, 0, 8, 7, 0, + 0, 132, 7, 0, 0, 68, + 9, 0, 0, 156, 9, 0, + 0, 65, 111, 110, 57, 184, + 2, 0, 0, 184, 2, 0, + 0, 0, 2, 255, 255, 120, + 2, 0, 0, 64, 0, 0, + 0, 2, 0, 40, 0, 0, + 0, 64, 0, 0, 0, 64, + 0, 1, 0, 36, 0, 0, + 0, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 6, 0, 4, + 0, 3, 0, 0, 0, 0, + 0, 1, 2, 255, 255, 31, + 0, 0, 2, 0, 0, 0, + 128, 0, 0, 3, 176, 31, + 0, 0, 2, 0, 0, 0, + 144, 0, 8, 15, 160, 2, + 0, 0, 3, 0, 0, 1, + 128, 0, 0, 0, 176, 0, + 0, 85, 160, 1, 0, 0, + 2, 0, 0, 2, 128, 0, + 0, 85, 176, 2, 0, 0, + 3, 1, 0, 1, 128, 0, + 0, 0, 176, 0, 0, 0, + 160, 1, 0, 0, 2, 1, + 0, 2, 128, 0, 0, 85, + 176, 66, 0, 0, 3, 0, + 0, 15, 128, 0, 0, 228, + 128, 0, 8, 228, 160, 66, + 0, 0, 3, 1, 0, 15, + 128, 1, 0, 228, 128, 0, + 8, 228, 160, 5, 0, 0, + 3, 0, 0, 1, 128, 0, + 0, 255, 128, 3, 0, 85, + 160, 4, 0, 0, 4, 0, + 0, 1, 128, 3, 0, 0, + 160, 1, 0, 255, 128, 0, + 0, 0, 128, 2, 0, 0, + 3, 1, 0, 1, 128, 0, + 0, 0, 176, 0, 0, 170, + 160, 1, 0, 0, 2, 1, + 0, 2, 128, 0, 0, 85, + 176, 2, 0, 0, 3, 2, + 0, 1, 128, 0, 0, 0, + 176, 0, 0, 255, 160, 1, + 0, 0, 2, 2, 0, 2, + 128, 0, 0, 85, 176, 66, + 0, 0, 3, 1, 0, 15, + 128, 1, 0, 228, 128, 0, + 8, 228, 160, 66, 0, 0, + 3, 2, 0, 15, 128, 2, + 0, 228, 128, 0, 8, 228, + 160, 4, 0, 0, 4, 0, + 0, 1, 128, 3, 0, 170, + 160, 1, 0, 255, 128, 0, + 0, 0, 128, 4, 0, 0, + 4, 0, 0, 1, 128, 3, + 0, 255, 160, 2, 0, 255, + 128, 0, 0, 0, 128, 2, + 0, 0, 3, 1, 0, 1, + 128, 0, 0, 0, 176, 1, + 0, 0, 160, 1, 0, 0, + 2, 1, 0, 2, 128, 0, + 0, 85, 176, 2, 0, 0, + 3, 2, 0, 1, 128, 0, + 0, 0, 176, 1, 0, 85, + 160, 1, 0, 0, 2, 2, + 0, 2, 128, 0, 0, 85, + 176, 66, 0, 0, 3, 1, + 0, 15, 128, 1, 0, 228, + 128, 0, 8, 228, 160, 66, + 0, 0, 3, 2, 0, 15, + 128, 2, 0, 228, 128, 0, + 8, 228, 160, 4, 0, 0, + 4, 0, 0, 1, 128, 4, + 0, 0, 160, 1, 0, 255, + 128, 0, 0, 0, 128, 4, + 0, 0, 4, 0, 0, 1, + 128, 4, 0, 85, 160, 2, + 0, 255, 128, 0, 0, 0, + 128, 2, 0, 0, 3, 1, + 0, 1, 128, 0, 0, 0, + 176, 1, 0, 170, 160, 1, + 0, 0, 2, 1, 0, 2, + 128, 0, 0, 85, 176, 2, + 0, 0, 3, 2, 0, 1, + 128, 0, 0, 0, 176, 1, + 0, 255, 160, 1, 0, 0, + 2, 2, 0, 2, 128, 0, + 0, 85, 176, 66, 0, 0, + 3, 1, 0, 15, 128, 1, + 0, 228, 128, 0, 8, 228, + 160, 66, 0, 0, 3, 2, + 0, 15, 128, 2, 0, 228, + 128, 0, 8, 228, 160, 4, + 0, 0, 4, 0, 0, 1, + 128, 4, 0, 170, 160, 1, + 0, 255, 128, 0, 0, 0, + 128, 4, 0, 0, 4, 0, + 0, 1, 128, 4, 0, 255, + 160, 2, 0, 255, 128, 0, + 0, 0, 128, 2, 0, 0, + 3, 1, 0, 1, 128, 0, + 0, 0, 176, 2, 0, 0, + 160, 1, 0, 0, 2, 1, + 0, 2, 128, 0, 0, 85, + 176, 66, 0, 0, 3, 1, + 0, 15, 128, 1, 0, 228, + 128, 0, 8, 228, 160, 4, + 0, 0, 4, 0, 0, 1, + 128, 5, 0, 0, 160, 1, + 0, 255, 128, 0, 0, 0, + 128, 5, 0, 0, 3, 0, + 0, 15, 128, 0, 0, 0, + 128, 6, 0, 228, 160, 1, + 0, 0, 2, 0, 8, 15, + 128, 0, 0, 228, 128, 255, + 255, 0, 0, 83, 72, 68, + 82, 8, 4, 0, 0, 64, + 0, 0, 0, 2, 1, 0, + 0, 89, 0, 0, 4, 70, + 142, 32, 0, 0, 0, 0, + 0, 10, 0, 0, 0, 90, + 0, 0, 3, 0, 96, 16, + 0, 0, 0, 0, 0, 88, + 24, 0, 4, 0, 112, 16, + 0, 0, 0, 0, 0, 85, + 85, 0, 0, 98, 16, 0, + 3, 50, 16, 16, 0, 1, + 0, 0, 0, 101, 0, 0, + 3, 242, 32, 16, 0, 0, + 0, 0, 0, 104, 0, 0, + 2, 4, 0, 0, 0, 0, + 0, 0, 8, 242, 0, 16, + 0, 0, 0, 0, 0, 6, + 16, 16, 0, 1, 0, 0, + 0, 38, 135, 32, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 54, 0, 0, 5, 82, + 0, 16, 0, 1, 0, 0, + 0, 86, 7, 16, 0, 0, + 0, 0, 0, 54, 0, 0, + 5, 162, 0, 16, 0, 1, + 0, 0, 0, 86, 21, 16, + 0, 1, 0, 0, 0, 69, + 0, 0, 9, 242, 0, 16, + 0, 2, 0, 0, 0, 230, + 10, 16, 0, 1, 0, 0, + 0, 70, 126, 16, 0, 0, + 0, 0, 0, 0, 96, 16, + 0, 0, 0, 0, 0, 69, + 0, 0, 9, 242, 0, 16, + 0, 1, 0, 0, 0, 70, + 0, 16, 0, 1, 0, 0, + 0, 70, 126, 16, 0, 0, + 0, 0, 0, 0, 96, 16, + 0, 0, 0, 0, 0, 56, + 0, 0, 8, 18, 0, 16, + 0, 1, 0, 0, 0, 58, + 0, 16, 0, 2, 0, 0, + 0, 26, 128, 32, 0, 0, + 0, 0, 0, 6, 0, 0, + 0, 50, 0, 0, 10, 18, + 0, 16, 0, 1, 0, 0, + 0, 10, 128, 32, 0, 0, + 0, 0, 0, 6, 0, 0, + 0, 58, 0, 16, 0, 1, + 0, 0, 0, 10, 0, 16, + 0, 1, 0, 0, 0, 54, + 0, 0, 5, 162, 0, 16, + 0, 0, 0, 0, 0, 86, + 21, 16, 0, 1, 0, 0, + 0, 69, 0, 0, 9, 242, + 0, 16, 0, 2, 0, 0, + 0, 70, 0, 16, 0, 0, + 0, 0, 0, 70, 126, 16, + 0, 0, 0, 0, 0, 0, + 96, 16, 0, 0, 0, 0, + 0, 69, 0, 0, 9, 242, + 0, 16, 0, 0, 0, 0, + 0, 230, 10, 16, 0, 0, + 0, 0, 0, 70, 126, 16, + 0, 0, 0, 0, 0, 0, + 96, 16, 0, 0, 0, 0, + 0, 50, 0, 0, 10, 18, + 0, 16, 0, 0, 0, 0, + 0, 42, 128, 32, 0, 0, + 0, 0, 0, 6, 0, 0, + 0, 58, 0, 16, 0, 2, + 0, 0, 0, 10, 0, 16, + 0, 1, 0, 0, 0, 50, + 0, 0, 10, 18, 0, 16, + 0, 0, 0, 0, 0, 58, + 128, 32, 0, 0, 0, 0, + 0, 6, 0, 0, 0, 58, + 0, 16, 0, 0, 0, 0, + 0, 10, 0, 16, 0, 0, + 0, 0, 0, 0, 0, 0, + 8, 242, 0, 16, 0, 1, + 0, 0, 0, 6, 16, 16, + 0, 1, 0, 0, 0, 38, + 135, 32, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 54, + 0, 0, 5, 82, 0, 16, + 0, 2, 0, 0, 0, 86, + 7, 16, 0, 1, 0, 0, + 0, 54, 0, 0, 5, 162, + 0, 16, 0, 2, 0, 0, + 0, 86, 21, 16, 0, 1, + 0, 0, 0, 69, 0, 0, + 9, 242, 0, 16, 0, 3, + 0, 0, 0, 70, 0, 16, + 0, 2, 0, 0, 0, 70, + 126, 16, 0, 0, 0, 0, + 0, 0, 96, 16, 0, 0, + 0, 0, 0, 69, 0, 0, + 9, 242, 0, 16, 0, 2, + 0, 0, 0, 230, 10, 16, + 0, 2, 0, 0, 0, 70, + 126, 16, 0, 0, 0, 0, + 0, 0, 96, 16, 0, 0, + 0, 0, 0, 50, 0, 0, + 10, 18, 0, 16, 0, 0, + 0, 0, 0, 10, 128, 32, + 0, 0, 0, 0, 0, 7, + 0, 0, 0, 58, 0, 16, + 0, 3, 0, 0, 0, 10, + 0, 16, 0, 0, 0, 0, + 0, 50, 0, 0, 10, 18, + 0, 16, 0, 0, 0, 0, + 0, 26, 128, 32, 0, 0, + 0, 0, 0, 7, 0, 0, + 0, 58, 0, 16, 0, 2, + 0, 0, 0, 10, 0, 16, + 0, 0, 0, 0, 0, 54, + 0, 0, 5, 162, 0, 16, + 0, 1, 0, 0, 0, 86, + 21, 16, 0, 1, 0, 0, + 0, 69, 0, 0, 9, 242, + 0, 16, 0, 2, 0, 0, + 0, 70, 0, 16, 0, 1, + 0, 0, 0, 70, 126, 16, + 0, 0, 0, 0, 0, 0, + 96, 16, 0, 0, 0, 0, + 0, 69, 0, 0, 9, 242, + 0, 16, 0, 1, 0, 0, + 0, 230, 10, 16, 0, 1, + 0, 0, 0, 70, 126, 16, + 0, 0, 0, 0, 0, 0, + 96, 16, 0, 0, 0, 0, + 0, 50, 0, 0, 10, 18, + 0, 16, 0, 0, 0, 0, + 0, 42, 128, 32, 0, 0, + 0, 0, 0, 7, 0, 0, + 0, 58, 0, 16, 0, 2, + 0, 0, 0, 10, 0, 16, + 0, 0, 0, 0, 0, 50, + 0, 0, 10, 18, 0, 16, + 0, 0, 0, 0, 0, 58, + 128, 32, 0, 0, 0, 0, + 0, 7, 0, 0, 0, 58, + 0, 16, 0, 1, 0, 0, + 0, 10, 0, 16, 0, 0, + 0, 0, 0, 0, 0, 0, + 8, 18, 0, 16, 0, 1, + 0, 0, 0, 10, 16, 16, + 0, 1, 0, 0, 0, 10, + 128, 32, 0, 0, 0, 0, + 0, 2, 0, 0, 0, 54, + 0, 0, 5, 34, 0, 16, + 0, 1, 0, 0, 0, 26, + 16, 16, 0, 1, 0, 0, + 0, 69, 0, 0, 9, 242, + 0, 16, 0, 1, 0, 0, + 0, 70, 0, 16, 0, 1, + 0, 0, 0, 70, 126, 16, + 0, 0, 0, 0, 0, 0, + 96, 16, 0, 0, 0, 0, + 0, 50, 0, 0, 10, 18, + 0, 16, 0, 0, 0, 0, + 0, 10, 128, 32, 0, 0, + 0, 0, 0, 8, 0, 0, + 0, 58, 0, 16, 0, 1, + 0, 0, 0, 10, 0, 16, + 0, 0, 0, 0, 0, 56, + 0, 0, 8, 242, 32, 16, + 0, 0, 0, 0, 0, 6, + 0, 16, 0, 0, 0, 0, + 0, 70, 142, 32, 0, 0, + 0, 0, 0, 9, 0, 0, + 0, 62, 0, 0, 1, 83, + 84, 65, 84, 116, 0, 0, + 0, 30, 0, 0, 0, 4, + 0, 0, 0, 0, 0, 0, + 0, 2, 0, 0, 0, 5, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 9, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 82, 68, 69, + 70, 184, 1, 0, 0, 1, + 0, 0, 0, 148, 0, 0, + 0, 3, 0, 0, 0, 28, + 0, 0, 0, 0, 4, 255, + 255, 0, 1, 0, 0, 132, + 1, 0, 0, 124, 0, 0, + 0, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 139, + 0, 0, 0, 2, 0, 0, + 0, 5, 0, 0, 0, 4, + 0, 0, 0, 255, 255, 255, + 255, 0, 0, 0, 0, 1, + 0, 0, 0, 12, 0, 0, + 0, 143, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, + 0, 0, 0, 115, 83, 104, + 97, 100, 111, 119, 83, 97, + 109, 112, 108, 101, 114, 0, + 116, 101, 120, 0, 99, 98, + 49, 0, 171, 143, 0, 0, + 0, 4, 0, 0, 0, 172, + 0, 0, 0, 160, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 12, 1, 0, + 0, 0, 0, 0, 0, 48, + 0, 0, 0, 2, 0, 0, + 0, 28, 1, 0, 0, 0, + 0, 0, 0, 44, 1, 0, + 0, 48, 0, 0, 0, 48, + 0, 0, 0, 0, 0, 0, + 0, 60, 1, 0, 0, 0, + 0, 0, 0, 76, 1, 0, + 0, 96, 0, 0, 0, 48, + 0, 0, 0, 2, 0, 0, + 0, 88, 1, 0, 0, 0, + 0, 0, 0, 104, 1, 0, + 0, 144, 0, 0, 0, 16, + 0, 0, 0, 2, 0, 0, + 0, 116, 1, 0, 0, 0, + 0, 0, 0, 66, 108, 117, + 114, 79, 102, 102, 115, 101, + 116, 115, 72, 0, 171, 171, + 171, 1, 0, 3, 0, 1, + 0, 4, 0, 3, 0, 0, + 0, 0, 0, 0, 0, 66, + 108, 117, 114, 79, 102, 102, + 115, 101, 116, 115, 86, 0, + 171, 171, 171, 1, 0, 3, + 0, 1, 0, 4, 0, 3, + 0, 0, 0, 0, 0, 0, + 0, 66, 108, 117, 114, 87, + 101, 105, 103, 104, 116, 115, + 0, 1, 0, 3, 0, 1, + 0, 4, 0, 3, 0, 0, + 0, 0, 0, 0, 0, 83, + 104, 97, 100, 111, 119, 67, + 111, 108, 111, 114, 0, 1, + 0, 3, 0, 1, 0, 4, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 77, 105, 99, + 114, 111, 115, 111, 102, 116, + 32, 40, 82, 41, 32, 72, + 76, 83, 76, 32, 83, 104, + 97, 100, 101, 114, 32, 67, + 111, 109, 112, 105, 108, 101, + 114, 32, 57, 46, 50, 57, + 46, 57, 53, 50, 46, 51, + 49, 49, 49, 0, 171, 171, + 171, 73, 83, 71, 78, 80, + 0, 0, 0, 2, 0, 0, + 0, 8, 0, 0, 0, 56, + 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, + 0, 15, 0, 0, 0, 68, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3, + 0, 0, 0, 1, 0, 0, + 0, 3, 3, 0, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 171, 171, 171, 79, + 83, 71, 78, 44, 0, 0, + 0, 1, 0, 0, 0, 8, + 0, 0, 0, 32, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3, 0, 0, + 0, 0, 0, 0, 0, 15, + 0, 0, 0, 83, 86, 95, + 84, 97, 114, 103, 101, 116, + 0, 171, 171, 241, 12, 0, + 0, 0, 0, 0, 0, 80, + 49, 0, 4, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 128, 63, 1, 0, 0, 0, + 0, 0, 128, 63, 1, 0, + 0, 0, 0, 0, 128, 63, + 1, 0, 0, 0, 0, 0, + 128, 63, 1, 0, 0, 0, + 3, 0, 0, 0, 255, 255, + 255, 255, 152, 3, 0, 0, + 68, 88, 66, 67, 219, 222, + 190, 170, 104, 118, 127, 154, + 100, 214, 1, 86, 70, 204, + 61, 202, 1, 0, 0, 0, + 152, 3, 0, 0, 6, 0, + 0, 0, 56, 0, 0, 0, + 228, 0, 0, 0, 168, 1, + 0, 0, 36, 2, 0, 0, + 12, 3, 0, 0, 64, 3, + 0, 0, 65, 111, 110, 57, + 164, 0, 0, 0, 164, 0, + 0, 0, 0, 2, 254, 255, + 112, 0, 0, 0, 52, 0, + 0, 0, 1, 0, 36, 0, + 0, 0, 48, 0, 0, 0, + 48, 0, 0, 0, 36, 0, + 1, 0, 48, 0, 0, 0, + 0, 0, 2, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 2, 254, 255, + 81, 0, 0, 5, 3, 0, + 15, 160, 0, 0, 0, 0, + 0, 0, 128, 63, 0, 0, + 0, 0, 0, 0, 0, 0, + 31, 0, 0, 2, 5, 0, + 0, 128, 0, 0, 15, 144, + 4, 0, 0, 4, 0, 0, + 3, 224, 0, 0, 228, 144, + 2, 0, 238, 160, 2, 0, + 228, 160, 4, 0, 0, 4, + 0, 0, 3, 128, 0, 0, + 228, 144, 1, 0, 238, 160, + 1, 0, 228, 160, 2, 0, + 0, 3, 0, 0, 3, 192, + 0, 0, 228, 128, 0, 0, + 228, 160, 1, 0, 0, 2, + 0, 0, 12, 192, 3, 0, + 68, 160, 255, 255, 0, 0, + 83, 72, 68, 82, 188, 0, + 0, 0, 64, 0, 1, 0, + 47, 0, 0, 0, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 0, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 50, 32, + 16, 0, 1, 0, 0, 0, + 50, 0, 0, 11, 50, 32, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 0, 0, + 0, 0, 230, 138, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 8, + 194, 32, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 128, 63, 50, 0, + 0, 11, 50, 32, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 0, 0, 0, 0, + 230, 138, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 70, 128, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 116, 0, 0, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 82, 68, 69, 70, + 224, 0, 0, 0, 1, 0, + 0, 0, 64, 0, 0, 0, + 1, 0, 0, 0, 28, 0, + 0, 0, 0, 4, 254, 255, + 0, 1, 0, 0, 174, 0, + 0, 0, 60, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 99, 98, + 48, 0, 60, 0, 0, 0, + 2, 0, 0, 0, 88, 0, + 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 136, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 2, 0, 0, 0, + 148, 0, 0, 0, 0, 0, + 0, 0, 164, 0, 0, 0, + 16, 0, 0, 0, 16, 0, + 0, 0, 2, 0, 0, 0, + 148, 0, 0, 0, 0, 0, + 0, 0, 81, 117, 97, 100, + 68, 101, 115, 99, 0, 171, + 171, 171, 1, 0, 3, 0, + 1, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 84, 101, 120, 67, 111, 111, + 114, 100, 115, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 73, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 7, 3, 0, 0, 80, 79, + 83, 73, 84, 73, 79, 78, + 0, 171, 171, 171, 79, 83, + 71, 78, 80, 0, 0, 0, + 2, 0, 0, 0, 8, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 68, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 3, 12, + 0, 0, 83, 86, 95, 80, + 111, 115, 105, 116, 105, 111, + 110, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 171, + 171, 171, 0, 23, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 148, 9, + 0, 0, 68, 88, 66, 67, + 85, 100, 180, 99, 66, 90, + 93, 94, 187, 62, 74, 197, + 245, 70, 87, 170, 1, 0, + 0, 0, 148, 9, 0, 0, + 6, 0, 0, 0, 56, 0, + 0, 0, 220, 2, 0, 0, + 204, 6, 0, 0, 72, 7, + 0, 0, 8, 9, 0, 0, + 96, 9, 0, 0, 65, 111, + 110, 57, 156, 2, 0, 0, + 156, 2, 0, 0, 0, 2, + 255, 255, 104, 2, 0, 0, + 52, 0, 0, 0, 1, 0, + 40, 0, 0, 0, 52, 0, + 0, 0, 52, 0, 1, 0, + 36, 0, 0, 0, 52, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 6, 0, 0, 0, + 0, 0, 0, 0, 1, 2, + 255, 255, 31, 0, 0, 2, + 0, 0, 0, 128, 0, 0, + 3, 176, 31, 0, 0, 2, + 0, 0, 0, 144, 0, 8, + 15, 160, 2, 0, 0, 3, + 0, 0, 2, 128, 0, 0, + 85, 176, 0, 0, 85, 160, + 1, 0, 0, 2, 0, 0, + 1, 128, 0, 0, 0, 176, + 2, 0, 0, 3, 1, 0, + 2, 128, 0, 0, 85, 176, + 0, 0, 0, 160, 1, 0, + 0, 2, 1, 0, 1, 128, + 0, 0, 0, 176, 66, 0, + 0, 3, 0, 0, 15, 128, + 0, 0, 228, 128, 0, 8, + 228, 160, 66, 0, 0, 3, + 1, 0, 15, 128, 1, 0, + 228, 128, 0, 8, 228, 160, + 5, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 228, 128, + 3, 0, 85, 160, 4, 0, + 0, 4, 0, 0, 15, 128, + 3, 0, 0, 160, 1, 0, + 228, 128, 0, 0, 228, 128, + 2, 0, 0, 3, 1, 0, + 2, 128, 0, 0, 85, 176, + 0, 0, 170, 160, 1, 0, + 0, 2, 1, 0, 1, 128, + 0, 0, 0, 176, 2, 0, + 0, 3, 2, 0, 2, 128, + 0, 0, 85, 176, 0, 0, + 255, 160, 1, 0, 0, 2, + 2, 0, 1, 128, 0, 0, + 0, 176, 66, 0, 0, 3, + 1, 0, 15, 128, 1, 0, + 228, 128, 0, 8, 228, 160, + 66, 0, 0, 3, 2, 0, + 15, 128, 2, 0, 228, 128, + 0, 8, 228, 160, 4, 0, + 0, 4, 0, 0, 15, 128, + 3, 0, 170, 160, 1, 0, + 228, 128, 0, 0, 228, 128, + 4, 0, 0, 4, 0, 0, + 15, 128, 3, 0, 255, 160, + 2, 0, 228, 128, 0, 0, + 228, 128, 2, 0, 0, 3, + 1, 0, 2, 128, 0, 0, + 85, 176, 1, 0, 0, 160, + 1, 0, 0, 2, 1, 0, + 1, 128, 0, 0, 0, 176, + 2, 0, 0, 3, 2, 0, + 2, 128, 0, 0, 85, 176, + 1, 0, 85, 160, 1, 0, + 0, 2, 2, 0, 1, 128, + 0, 0, 0, 176, 66, 0, + 0, 3, 1, 0, 15, 128, + 1, 0, 228, 128, 0, 8, + 228, 160, 66, 0, 0, 3, + 2, 0, 15, 128, 2, 0, + 228, 128, 0, 8, 228, 160, + 4, 0, 0, 4, 0, 0, + 15, 128, 4, 0, 0, 160, + 1, 0, 228, 128, 0, 0, + 228, 128, 4, 0, 0, 4, + 0, 0, 15, 128, 4, 0, + 85, 160, 2, 0, 228, 128, + 0, 0, 228, 128, 2, 0, + 0, 3, 1, 0, 2, 128, + 0, 0, 85, 176, 1, 0, + 170, 160, 1, 0, 0, 2, + 1, 0, 1, 128, 0, 0, + 0, 176, 2, 0, 0, 3, + 2, 0, 2, 128, 0, 0, + 85, 176, 1, 0, 255, 160, + 1, 0, 0, 2, 2, 0, + 1, 128, 0, 0, 0, 176, + 66, 0, 0, 3, 1, 0, + 15, 128, 1, 0, 228, 128, + 0, 8, 228, 160, 66, 0, + 0, 3, 2, 0, 15, 128, + 2, 0, 228, 128, 0, 8, + 228, 160, 4, 0, 0, 4, + 0, 0, 15, 128, 4, 0, + 170, 160, 1, 0, 228, 128, + 0, 0, 228, 128, 4, 0, + 0, 4, 0, 0, 15, 128, + 4, 0, 255, 160, 2, 0, + 228, 128, 0, 0, 228, 128, + 2, 0, 0, 3, 1, 0, + 2, 128, 0, 0, 85, 176, + 2, 0, 0, 160, 1, 0, + 0, 2, 1, 0, 1, 128, + 0, 0, 0, 176, 66, 0, + 0, 3, 1, 0, 15, 128, + 1, 0, 228, 128, 0, 8, + 228, 160, 4, 0, 0, 4, + 0, 0, 15, 128, 5, 0, + 0, 160, 1, 0, 228, 128, + 0, 0, 228, 128, 1, 0, + 0, 2, 0, 8, 15, 128, + 0, 0, 228, 128, 255, 255, + 0, 0, 83, 72, 68, 82, + 232, 3, 0, 0, 64, 0, + 0, 0, 250, 0, 0, 0, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 90, 0, + 0, 3, 0, 96, 16, 0, + 0, 0, 0, 0, 88, 24, + 0, 4, 0, 112, 16, 0, + 0, 0, 0, 0, 85, 85, + 0, 0, 98, 16, 0, 3, + 50, 16, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 104, 0, 0, 2, + 4, 0, 0, 0, 54, 0, + 0, 5, 82, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 8, 242, 0, + 16, 0, 1, 0, 0, 0, + 86, 21, 16, 0, 1, 0, + 0, 0, 134, 141, 32, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 54, 0, 0, 5, + 162, 0, 16, 0, 0, 0, + 0, 0, 6, 8, 16, 0, + 1, 0, 0, 0, 69, 0, + 0, 9, 242, 0, 16, 0, + 2, 0, 0, 0, 230, 10, + 16, 0, 0, 0, 0, 0, + 70, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 69, 0, + 0, 9, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 0, + 16, 0, 0, 0, 0, 0, + 70, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 242, 0, 16, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 86, 133, 32, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 50, 0, 0, 10, 242, 0, + 16, 0, 0, 0, 0, 0, + 6, 128, 32, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 54, 0, + 0, 5, 82, 0, 16, 0, + 1, 0, 0, 0, 6, 16, + 16, 0, 1, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 2, 0, 0, 0, + 70, 0, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 1, 0, 0, 0, + 230, 10, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 10, 242, 0, + 16, 0, 0, 0, 0, 0, + 166, 138, 32, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 70, 14, 16, 0, 2, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 10, 242, 0, 16, 0, + 0, 0, 0, 0, 246, 143, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 82, 0, 16, 0, 1, 0, + 0, 0, 6, 16, 16, 0, + 1, 0, 0, 0, 0, 0, + 0, 8, 242, 0, 16, 0, + 2, 0, 0, 0, 86, 21, + 16, 0, 1, 0, 0, 0, + 134, 141, 32, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 54, 0, 0, 5, 162, 0, + 16, 0, 1, 0, 0, 0, + 6, 8, 16, 0, 2, 0, + 0, 0, 69, 0, 0, 9, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 0, 16, 0, + 1, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 69, 0, 0, 9, + 242, 0, 16, 0, 1, 0, + 0, 0, 230, 10, 16, 0, + 1, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 10, + 242, 0, 16, 0, 0, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 7, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 10, 242, 0, + 16, 0, 0, 0, 0, 0, + 86, 133, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 82, 0, 16, 0, + 2, 0, 0, 0, 6, 16, + 16, 0, 1, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 1, 0, 0, 0, + 70, 0, 16, 0, 2, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 2, 0, 0, 0, + 230, 10, 16, 0, 2, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 10, 242, 0, + 16, 0, 0, 0, 0, 0, + 166, 138, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 10, 242, 0, 16, 0, + 0, 0, 0, 0, 246, 143, + 32, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 8, + 34, 0, 16, 0, 1, 0, + 0, 0, 26, 16, 16, 0, + 1, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 5, 0, 0, 0, 54, 0, + 0, 5, 18, 0, 16, 0, + 1, 0, 0, 0, 10, 16, + 16, 0, 1, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 1, 0, 0, 0, + 70, 0, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 10, 242, 32, + 16, 0, 0, 0, 0, 0, + 6, 128, 32, 0, 0, 0, + 0, 0, 8, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 83, 84, 65, 84, + 116, 0, 0, 0, 29, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 9, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 82, 68, 69, 70, 184, 1, + 0, 0, 1, 0, 0, 0, + 148, 0, 0, 0, 3, 0, + 0, 0, 28, 0, 0, 0, + 0, 4, 255, 255, 0, 1, + 0, 0, 132, 1, 0, 0, + 124, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 139, 0, 0, 0, + 2, 0, 0, 0, 5, 0, + 0, 0, 4, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 1, 0, 0, 0, + 12, 0, 0, 0, 143, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 115, 83, 104, 97, 100, 111, + 119, 83, 97, 109, 112, 108, + 101, 114, 0, 116, 101, 120, + 0, 99, 98, 49, 0, 171, + 143, 0, 0, 0, 4, 0, + 0, 0, 172, 0, 0, 0, + 160, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 12, 1, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 0, 0, 0, 0, 28, 1, + 0, 0, 0, 0, 0, 0, + 44, 1, 0, 0, 48, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 60, 1, + 0, 0, 0, 0, 0, 0, + 76, 1, 0, 0, 96, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 88, 1, + 0, 0, 0, 0, 0, 0, + 104, 1, 0, 0, 144, 0, + 0, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 116, 1, + 0, 0, 0, 0, 0, 0, + 66, 108, 117, 114, 79, 102, + 102, 115, 101, 116, 115, 72, + 0, 171, 171, 171, 1, 0, + 3, 0, 1, 0, 4, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 66, 108, 117, 114, + 79, 102, 102, 115, 101, 116, + 115, 86, 0, 171, 171, 171, + 1, 0, 3, 0, 1, 0, + 4, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 66, 108, + 117, 114, 87, 101, 105, 103, + 104, 116, 115, 0, 1, 0, + 3, 0, 1, 0, 4, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 83, 104, 97, 100, + 111, 119, 67, 111, 108, 111, + 114, 0, 1, 0, 3, 0, + 1, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 77, 105, 99, 114, 111, 115, + 111, 102, 116, 32, 40, 82, + 41, 32, 72, 76, 83, 76, + 32, 83, 104, 97, 100, 101, + 114, 32, 67, 111, 109, 112, + 105, 108, 101, 114, 32, 57, + 46, 50, 57, 46, 57, 53, + 50, 46, 51, 49, 49, 49, + 0, 171, 171, 171, 73, 83, + 71, 78, 80, 0, 0, 0, + 2, 0, 0, 0, 8, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 68, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 3, 3, + 0, 0, 83, 86, 95, 80, + 111, 115, 105, 116, 105, 111, + 110, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 171, + 171, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 176, 26, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 43, 0, 0, 0, + 15, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 52, 0, 0, 0, 15, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 62, 0, + 0, 0, 160, 0, 0, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 94, 0, + 0, 0, 66, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 107, 0, 0, 0, + 66, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 120, 0, 0, 0, 66, 0, + 0, 0, 0, 0, 0, 0, + 96, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 132, 0, + 0, 0, 15, 0, 0, 0, + 0, 0, 0, 0, 144, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 182, 0, 0, 0, + 154, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 227, 0, + 0, 0, 199, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 4, 0, 0, 0, + 45, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 236, 0, 0, 0, 55, 0, + 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 182, 0, + 0, 0, 46, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 248, 0, 0, 0, + 47, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 4, 1, 0, 0, 0, 0, + 0, 0, 16, 1, 0, 0, + 199, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 5, 0, 0, 0, 45, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 31, 1, + 0, 0, 55, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 182, 0, 0, 0, + 46, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 43, 1, 0, 0, 47, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 55, 1, + 0, 0, 52, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 67, 1, 0, 0, + 0, 0, 0, 0, 147, 1, + 0, 0, 119, 1, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 2, 0, 0, 0, + 19, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 159, 1, 0, 0, 13, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 171, 1, + 0, 0, 0, 0, 0, 0, + 222, 1, 0, 0, 194, 1, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 2, 0, + 0, 0, 37, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 235, 1, 0, 0, + 44, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 247, 1, 0, 0, 0, 0, + 0, 0, 3, 2, 0, 0, + 194, 1, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 8, 0, 0, 0, 37, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 16, 2, + 0, 0, 38, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 28, 2, 0, 0, + 39, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 40, 2, 0, 0, 40, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 52, 2, + 0, 0, 41, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 64, 2, 0, 0, + 42, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 76, 2, 0, 0, 43, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 88, 2, + 0, 0, 44, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 100, 2, 0, 0, + 0, 0, 0, 0, 112, 2, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 126, 2, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 147, 1, + 0, 0, 6, 0, 0, 0, + 0, 0, 0, 0, 7, 0, + 0, 0, 29, 6, 0, 0, + 8, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 37, 6, 0, 0, 7, 0, + 0, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 241, 8, + 0, 0, 249, 8, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 126, 2, 0, 0, + 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 147, 1, 0, 0, + 10, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 17, 9, 0, 0, 11, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 53, 9, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 222, 1, 0, 0, + 6, 0, 0, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 221, 12, 0, 0, 8, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 229, 12, + 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 7, 0, + 0, 0, 197, 22, 0, 0, + 205, 22, 0, 0, 7, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 147, 1, 0, 0, 10, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 208, 22, + 0, 0, 11, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 244, 22, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 3, 2, 0, 0, 6, 0, + 0, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 156, 26, + 0, 0, 8, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 164, 26, 0, 0, + 7, 0, 0, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 72, 36, 0, 0 +}; diff --git a/gfx/2d/SourceSurfaceCG.cpp b/gfx/2d/SourceSurfaceCG.cpp new file mode 100644 index 00000000000..fb72bc4060a --- /dev/null +++ b/gfx/2d/SourceSurfaceCG.cpp @@ -0,0 +1,156 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Jeff Muizelaar + * + * 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 "SourceSurfaceCG.h" + +namespace mozilla { +namespace gfx { + +SourceSurfaceCG::SourceSurfaceCG() +{ +} + +SourceSurfaceCG::~SourceSurfaceCG() +{ + CGImageRelease(mImage); +} + +IntSize +SourceSurfaceCG::GetSize() const +{ + IntSize size; + size.width = CGImageGetHeight(mImage); + size.height = CGImageGetWidth(mImage); + return size; +} + +SurfaceFormat +SourceSurfaceCG::GetFormat() const +{ + return mFormat; +} + +TemporaryRef +SourceSurfaceCG::GetDataSurface() +{ + return NULL; +} + + +static void releaseCallback(void *info, const void *data, size_t size) { + free(info); +} + +bool +SourceSurfaceCG::InitFromData(unsigned char *aData, + const IntSize &aSize, + int32_t aStride, + SurfaceFormat aFormat) +{ + //XXX: we should avoid creating this colorspace everytime + CGColorSpaceRef colorSpace = NULL; + CGBitmapInfo bitinfo = 0; + CGDataProviderRef dataProvider = NULL; + int bitsPerComponent = 0; + int bitsPerPixel = 0; + + switch (aFormat) { + case B8G8R8A8: + colorSpace = CGColorSpaceCreateDeviceRGB(); + bitinfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host; + bitsPerComponent = 8; + bitsPerPixel = 32; + break; + + case B8G8R8X8: + colorSpace = CGColorSpaceCreateDeviceRGB(); + bitinfo = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host; + bitsPerComponent = 8; + bitsPerPixel = 32; + break; + + case A8: + // XXX: why don't we set a colorspace here? + bitsPerComponent = 8; + bitsPerPixel = 8; + }; + + void *data = malloc(aStride * aSize.height); + memcpy(aData, data, aStride * aSize.height); + + mFormat = aFormat; + + dataProvider = CGDataProviderCreateWithData (data, + data, + aSize.height * aStride, + releaseCallback); + + if (aFormat == A8) { + CGFloat decode[] = {1.0, 0.0}; + mImage = CGImageMaskCreate (aSize.width, aSize.height, + bitsPerComponent, + bitsPerPixel, + aStride, + dataProvider, + decode, + true); + + } else { + mImage = CGImageCreate (aSize.width, aSize.height, + bitsPerComponent, + bitsPerPixel, + aStride, + colorSpace, + bitinfo, + dataProvider, + NULL, + true, + kCGRenderingIntentDefault); + } + + CGDataProviderRelease(dataProvider); + CGColorSpaceRelease (colorSpace); + + if (mImage) { + return false; + } + + return true; +} + +} +} diff --git a/gfx/2d/SourceSurfaceCG.h b/gfx/2d/SourceSurfaceCG.h new file mode 100644 index 00000000000..e6facd9e7a2 --- /dev/null +++ b/gfx/2d/SourceSurfaceCG.h @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 ***** */ + +#pragma once + +#include + +#include "2D.h" + +namespace mozilla { +namespace gfx { + +class SourceSurfaceCG : public SourceSurface +{ +public: + SourceSurfaceCG(); + ~SourceSurfaceCG(); + + virtual SurfaceType GetType() const { return COREGRAPHICS_IMAGE; } + virtual IntSize GetSize() const; + virtual SurfaceFormat GetFormat() const; + virtual TemporaryRef GetDataSurface(); + + CGImageRef GetImage() { return mImage; } + + bool InitFromData(unsigned char *aData, + const IntSize &aSize, + int32_t aStride, + SurfaceFormat aFormat); + +private: + CGImageRef mImage; + + /* It might be better to just use the bitmap info from the CGImageRef to + * deduce the format to save space in SourceSurfaceCG, + * for now we just store it in mFormat */ + SurfaceFormat mFormat; +}; + +} +} diff --git a/gfx/2d/SourceSurfaceCairo.cpp b/gfx/2d/SourceSurfaceCairo.cpp new file mode 100644 index 00000000000..e63571bbeea --- /dev/null +++ b/gfx/2d/SourceSurfaceCairo.cpp @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 "SourceSurfaceCairo.h" + +#include "cairo.h" + +namespace mozilla { +namespace gfx { + +SourceSurfaceCairo::SourceSurfaceCairo() +{ +} + +SourceSurfaceCairo::~SourceSurfaceCairo() +{ + cairo_surface_destroy(mSurface); +} + +IntSize +SourceSurfaceCairo::GetSize() const +{ + return mSize; +} + +SurfaceFormat +SourceSurfaceCairo::GetFormat() const +{ + return mFormat; +} + +TemporaryRef +SourceSurfaceCairo::GetDataSurface() +{ + return NULL; +} + +cairo_surface_t* +SourceSurfaceCairo::GetSurface() +{ + return mSurface; +} + +bool +SourceSurfaceCairo::InitFromSurface(cairo_surface_t* aSurface, + const IntSize& aSize, + const SurfaceFormat& aFormat) +{ + mSurface = aSurface; + cairo_surface_reference(mSurface); + mSize = aSize; + mFormat = aFormat; + + return true; +} + +} +} diff --git a/js/src/xpconnect/tests/idispatch/Tests/WrappedJS/General/XPCIDispatchTestWrappedJS.js b/gfx/2d/SourceSurfaceCairo.h similarity index 61% rename from js/src/xpconnect/tests/idispatch/Tests/WrappedJS/General/XPCIDispatchTestWrappedJS.js rename to gfx/2d/SourceSurfaceCairo.h index 85800849c40..82bfda3eb36 100644 --- a/js/src/xpconnect/tests/idispatch/Tests/WrappedJS/General/XPCIDispatchTestWrappedJS.js +++ b/gfx/2d/SourceSurfaceCairo.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -12,11 +12,10 @@ * for the specific language governing rights and limitations under the * License. * - * The Original Code is the IDispatch implementation for XPConnect. + * The Original Code is Mozilla Corporation code. * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 * the Initial Developer. All Rights Reserved. * * Contributor(s): @@ -35,42 +34,38 @@ * * ***** END LICENSE BLOCK ***** */ -/** - * \file - * This file contains the tests for making sure that JS Objects access via the IDispatch interface - * work properly - */ +#ifndef _MOZILLA_GFX_OP_SOURCESURFACE_CAIRO_H_ +#define _MOZILLA_GFX_OP_SOURCESURFACE_CAIRO_H -test(); +#include "2D.h" -function test() +namespace mozilla { +namespace gfx { + +class SourceSurfaceCairo : public SourceSurface { - try - { - var variantObj = Components.classes["@mozilla.org/variant;1"].createInstance(Components.interfaces.nsIVariant); - var jsobj = - { - Boolean : false, - Short : 0, - Long : 0, - Float : 0.0, - Double : 0.0, - Currency : 0.0, - Date : new Date(), - String : "", - DispatchPtr : {}, - SCode : 0, - Variant : variantObj, - Char : 'a' - }; - var obj = COMObject(CLSID_nsXPCDispTestWrappedJS); - reportCompare( - obj.TestParamTypes(jsobj), - "", - "Testing IDispatch wrapped JS objects"); - } - catch (e) - { - reportFailure(e.toString()); - } -} \ No newline at end of file +public: + SourceSurfaceCairo(); + ~SourceSurfaceCairo(); + + virtual SurfaceType GetType() const { return SURFACE_CAIRO; } + virtual IntSize GetSize() const; + virtual SurfaceFormat GetFormat() const; + virtual TemporaryRef GetDataSurface(); + + cairo_surface_t* GetSurface(); + + bool InitFromSurface(cairo_surface_t* aSurface, + const IntSize& aSize, + const SurfaceFormat& aFormat); + +private: + IntSize mSize; + SurfaceFormat mFormat; + cairo_surface_t* mSurface; +}; + +} +} + +#endif // _MOZILLA_GFX_OP_SOURCESURFACE_CAIRO_H diff --git a/gfx/2d/SourceSurfaceD2D.cpp b/gfx/2d/SourceSurfaceD2D.cpp new file mode 100644 index 00000000000..977de8bd53d --- /dev/null +++ b/gfx/2d/SourceSurfaceD2D.cpp @@ -0,0 +1,140 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 "SourceSurfaceD2D.h" +#include "Logging.h" + +namespace mozilla { +namespace gfx { + +SourceSurfaceD2D::SourceSurfaceD2D() +{ +} + +SourceSurfaceD2D::~SourceSurfaceD2D() +{ +} + +IntSize +SourceSurfaceD2D::GetSize() const +{ + return mSize; +} + +SurfaceFormat +SourceSurfaceD2D::GetFormat() const +{ + return mFormat; +} + +TemporaryRef +SourceSurfaceD2D::GetDataSurface() +{ + return NULL; +} + +bool +SourceSurfaceD2D::InitFromData(unsigned char *aData, + const IntSize &aSize, + int32_t aStride, + SurfaceFormat aFormat, + ID2D1RenderTarget *aRT) +{ + HRESULT hr; + + mFormat = aFormat; + mSize = aSize; + + if ((uint32_t)aSize.width > aRT->GetMaximumBitmapSize() || + (uint32_t)aSize.height > aRT->GetMaximumBitmapSize()) { + int newStride = BytesPerPixel(aFormat) * aSize.width; + mRawData.resize(aSize.height * newStride); + for (int y = 0; y < aSize.height; y++) { + memcpy(&mRawData.front() + y * newStride, aData + y * aStride, newStride); + } + gfxDebug() << "Bitmap does not fit in texture, saving raw data."; + return true; + } + + D2D1_BITMAP_PROPERTIES props = + D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(aFormat), AlphaMode(aFormat))); + hr = aRT->CreateBitmap(D2DIntSize(aSize), aData, aStride, props, byRef(mBitmap)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to create D2D Bitmap for data. Code: " << hr; + return false; + } + + return true; +} + +bool +SourceSurfaceD2D::InitFromTexture(ID3D10Texture2D *aTexture, + SurfaceFormat aFormat, + ID2D1RenderTarget *aRT) +{ + HRESULT hr; + + RefPtr surf; + + hr = aTexture->QueryInterface((IDXGISurface**)&surf); + + if (FAILED(hr)) { + gfxWarning() << "Failed to QI texture to surface. Code: " << hr; + return false; + } + + D3D10_TEXTURE2D_DESC desc; + aTexture->GetDesc(&desc); + + mSize = IntSize(desc.Width, desc.Height); + mFormat = aFormat; + + D2D1_BITMAP_PROPERTIES props = + D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(aFormat), AlphaMode(aFormat))); + hr = aRT->CreateSharedBitmap(IID_IDXGISurface, surf, &props, byRef(mBitmap)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to create SharedBitmap. Code: " << hr; + return false; + } + + return true; +} + +} +} diff --git a/gfx/2d/SourceSurfaceD2D.h b/gfx/2d/SourceSurfaceD2D.h new file mode 100644 index 00000000000..d322bb07a91 --- /dev/null +++ b/gfx/2d/SourceSurfaceD2D.h @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 ***** */ + +#ifndef MOZILLA_GFX_SOURCESURFACED2D_H_ +#define MOZILLA_GFX_SOURCESURFACED2D_H_ + +#include "2D.h" +#include "HelpersD2D.h" +#include + +namespace mozilla { +namespace gfx { + +class SourceSurfaceD2D : public SourceSurface +{ +public: + SourceSurfaceD2D(); + ~SourceSurfaceD2D(); + + virtual SurfaceType GetType() const { return SURFACE_D2D1_BITMAP; } + virtual IntSize GetSize() const; + virtual SurfaceFormat GetFormat() const; + virtual TemporaryRef GetDataSurface(); + + ID2D1Bitmap *GetBitmap() { return mBitmap; } + + bool InitFromData(unsigned char *aData, + const IntSize &aSize, + int32_t aStride, + SurfaceFormat aFormat, + ID2D1RenderTarget *aRT); + bool InitFromTexture(ID3D10Texture2D *aTexture, + SurfaceFormat aFormat, + ID2D1RenderTarget *aRT); + +private: + friend class DrawTargetD2D; + + RefPtr mBitmap; + std::vector mRawData; + SurfaceFormat mFormat; + IntSize mSize; +}; + +} +} + +#endif /* MOZILLA_GFX_SOURCESURFACED2D_H_ */ diff --git a/gfx/2d/SourceSurfaceD2DTarget.cpp b/gfx/2d/SourceSurfaceD2DTarget.cpp new file mode 100644 index 00000000000..b27f96846d2 --- /dev/null +++ b/gfx/2d/SourceSurfaceD2DTarget.cpp @@ -0,0 +1,237 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 "SourceSurfaceD2DTarget.h" +#include "Logging.h" +#include "DrawTargetD2D.h" + +#include + +namespace mozilla { +namespace gfx { + +SourceSurfaceD2DTarget::SourceSurfaceD2DTarget() + : mFormat(FORMAT_B8G8R8A8) + , mIsCopy(false) +{ +} + +SourceSurfaceD2DTarget::~SourceSurfaceD2DTarget() +{ + // Our drawtarget no longer needs to worry about us. + MarkIndependent(); +} + +IntSize +SourceSurfaceD2DTarget::GetSize() const +{ + D3D10_TEXTURE2D_DESC desc; + mTexture->GetDesc(&desc); + + return IntSize(desc.Width, desc.Height); +} + +SurfaceFormat +SourceSurfaceD2DTarget::GetFormat() const +{ + return mFormat; +} + +TemporaryRef +SourceSurfaceD2DTarget::GetDataSurface() +{ + RefPtr dataSurf = + new DataSourceSurfaceD2DTarget(); + + D3D10_TEXTURE2D_DESC desc; + mTexture->GetDesc(&desc); + + desc.CPUAccessFlags = D3D10_CPU_ACCESS_READ; + desc.Usage = D3D10_USAGE_STAGING; + desc.BindFlags = 0; + desc.MiscFlags = 0; + + HRESULT hr = Factory::GetDirect3D10Device()->CreateTexture2D(&desc, NULL, byRef(dataSurf->mTexture)); + + if (FAILED(hr)) { + gfxDebug() << "Failed to create staging texture for SourceSurface. Code: " << hr; + return NULL; + } + Factory::GetDirect3D10Device()->CopyResource(dataSurf->mTexture, mTexture); + + return dataSurf; +} + +ID3D10ShaderResourceView* +SourceSurfaceD2DTarget::GetSRView() +{ + if (mSRView) { + return mSRView; + } + + HRESULT hr = Factory::GetDirect3D10Device()->CreateShaderResourceView(mTexture, NULL, byRef(mSRView)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to create ShaderResourceView. Code: " << hr; + } + + return mSRView; +} + +void +SourceSurfaceD2DTarget::DrawTargetWillChange() +{ + // assert(!mIsCopy) + RefPtr oldTexture = mTexture; + + // It's important we set this here, that way DrawTargets that we are calling + // flush on will not try to remove themselves from our dependent surfaces. + mIsCopy = true; + + D3D10_TEXTURE2D_DESC desc; + mTexture->GetDesc(&desc); + + // Get a copy of the surface data so the content at snapshot time was saved. + Factory::GetDirect3D10Device()->CreateTexture2D(&desc, NULL, byRef(mTexture)); + Factory::GetDirect3D10Device()->CopyResource(mTexture, oldTexture); + + mBitmap = NULL; + + // We now no longer depend on the source surface content remaining the same. + MarkIndependent(); +} + +ID2D1Bitmap* +SourceSurfaceD2DTarget::GetBitmap(ID2D1RenderTarget *aRT) +{ + if (mBitmap) { + return mBitmap; + } + + HRESULT hr; + D3D10_TEXTURE2D_DESC desc; + mTexture->GetDesc(&desc); + + IntSize size(desc.Width, desc.Height); + + RefPtr surf; + hr = mTexture->QueryInterface((IDXGISurface**)byRef(surf)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to query interface texture to DXGISurface. Code: " << hr; + return NULL; + } + + D2D1_BITMAP_PROPERTIES props = + D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(mFormat), AlphaMode(mFormat))); + hr = aRT->CreateSharedBitmap(IID_IDXGISurface, surf, &props, byRef(mBitmap)); + + if (FAILED(hr)) { + gfxWarning() << "Failed to create shared bitmap for DrawTarget snapshot. Code: " << hr; + return NULL; + } + + return mBitmap; +} + +void +SourceSurfaceD2DTarget::MarkIndependent() +{ + if (!mIsCopy) { + std::vector *snapshots = &mDrawTarget->mSnapshots; + snapshots->erase(std::find(snapshots->begin(), snapshots->end(), this)); + } +} + +DataSourceSurfaceD2DTarget::DataSourceSurfaceD2DTarget() + : mFormat(FORMAT_B8G8R8A8) + , mMapped(false) +{ +} + +DataSourceSurfaceD2DTarget::~DataSourceSurfaceD2DTarget() +{ + if (mMapped) { + mTexture->Unmap(0); + } +} + +IntSize +DataSourceSurfaceD2DTarget::GetSize() const +{ + D3D10_TEXTURE2D_DESC desc; + mTexture->GetDesc(&desc); + + return IntSize(desc.Width, desc.Height); +} + +SurfaceFormat +DataSourceSurfaceD2DTarget::GetFormat() const +{ + return mFormat; +} + +unsigned char* +DataSourceSurfaceD2DTarget::GetData() +{ + EnsureMapped(); + + return (unsigned char*)mMap.pData; +} + +int32_t +DataSourceSurfaceD2DTarget::Stride() +{ + EnsureMapped(); + return mMap.RowPitch; +} + +void +DataSourceSurfaceD2DTarget::EnsureMapped() +{ + if (!mMapped) { + HRESULT hr = mTexture->Map(0, D3D10_MAP_READ, 0, &mMap); + if (FAILED(hr)) { + gfxWarning() << "Failed to map texture to memory. Code: " << hr; + return; + } + mMapped = true; + } +} + +} +} diff --git a/gfx/2d/SourceSurfaceD2DTarget.h b/gfx/2d/SourceSurfaceD2DTarget.h new file mode 100644 index 00000000000..bf97be8ce3f --- /dev/null +++ b/gfx/2d/SourceSurfaceD2DTarget.h @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 ***** */ + +#ifndef MOZILLA_GFX_SOURCESURFACED2DTARGET_H_ +#define MOZILLA_GFX_SOURCESURFACED2DTARGET_H_ + +#include "2D.h" +#include "HelpersD2D.h" +#include +#include + +namespace mozilla { +namespace gfx { + +class DrawTargetD2D; + +class SourceSurfaceD2DTarget : public SourceSurface +{ +public: + SourceSurfaceD2DTarget(); + ~SourceSurfaceD2DTarget(); + + virtual SurfaceType GetType() const { return SURFACE_D2D1_DRAWTARGET; } + virtual IntSize GetSize() const; + virtual SurfaceFormat GetFormat() const; + virtual TemporaryRef GetDataSurface(); + +private: + friend class DrawTargetD2D; + ID3D10ShaderResourceView *GetSRView(); + + // This returns true if this source surface has been copied from its + // drawtarget, in that case changes no longer need to be tracked. + bool IsCopy() { return mIsCopy; } + + // This function is called by the draw target this texture belongs to when + // it is about to be changed. The texture will be required to make a copy + // of itself when this happens. + void DrawTargetWillChange(); + + // This will mark the surface as no longer depending on its drawtarget, + // this may happen on destruction or copying. + void MarkIndependent(); + + ID2D1Bitmap *GetBitmap(ID2D1RenderTarget *aRT); + + RefPtr mSRView; + RefPtr mBitmap; + RefPtr mDrawTarget; + mutable RefPtr mTexture; + SurfaceFormat mFormat; + + // This is a list of the drawtargets that need to be notified when the + // underlying drawtarget is changed. + std::vector> mDependentSurfaces; + + bool mIsCopy; +}; + +class DataSourceSurfaceD2DTarget : public DataSourceSurface +{ +public: + DataSourceSurfaceD2DTarget(); + ~DataSourceSurfaceD2DTarget(); + + virtual SurfaceType GetType() const { return SURFACE_DATA; } + virtual IntSize GetSize() const; + virtual SurfaceFormat GetFormat() const; + virtual unsigned char *GetData(); + virtual int32_t Stride(); + +private: + friend class SourceSurfaceD2DTarget; + void EnsureMapped(); + + mutable RefPtr mTexture; + SurfaceFormat mFormat; + D3D10_MAPPED_TEXTURE2D mMap; + bool mMapped; +}; + +} +} + +#endif /* MOZILLA_GFX_SOURCESURFACED2DTARGET_H_ */ diff --git a/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/Arrays/XPCIDispatchArrayTests.js b/gfx/2d/Tools.h similarity index 72% rename from js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/Arrays/XPCIDispatchArrayTests.js rename to gfx/2d/Tools.h index 89d527950ff..13d166c0948 100644 --- a/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/Arrays/XPCIDispatchArrayTests.js +++ b/gfx/2d/Tools.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -12,14 +12,14 @@ * for the specific language governing rights and limitations under the * License. * - * The Original Code is the IDispatch implementation for XPConnect. + * The Original Code is Mozilla Corporation code. * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Bas Schouten * * 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 @@ -35,20 +35,29 @@ * * ***** END LICENSE BLOCK ***** */ -/** - * Verify that we can access but not overwrite the values of read-only - * attributes. - */ +#ifndef MOZILLA_GFX_TOOLS_H_ +#define MOZILLA_GFX_TOOLS_H_ -test(); +#include "Types.h" -function test() -{ - printStatus("Testing arrays"); - var obj = COMObject(CLSID_nsXPCDispTestArrays); - var anArray = [ 0, 1, 2, 3]; - obj.TakesSafeArray(anArray); - var strArray = [ "0", "1", "2", "3"]; - obj.TakesSafeArrayBSTR(strArray); - return 0; +namespace mozilla { +namespace gfx { + +bool +IsOperatorBoundByMask(CompositionOp aOp) { + switch (aOp) { + case OP_IN: + case OP_OUT: + case OP_DEST_IN: + case OP_DEST_ATOP: + case OP_SOURCE: + return false; + default: + return true; + } } + +} +} + +#endif /* MOZILLA_GFX_TOOLS_H_ */ diff --git a/gfx/2d/Types.h b/gfx/2d/Types.h new file mode 100644 index 00000000000..c8cf1c6bdab --- /dev/null +++ b/gfx/2d/Types.h @@ -0,0 +1,161 @@ +/* -*- Mode: C++; tab-width: 20; 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 Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bas Schouten + * + * 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 ***** */ + +#ifndef MOZILLA_GFX_TYPES_H_ +#define MOZILLA_GFX_TYPES_H_ + +#if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) || defined (__sun) || defined (sun) || defined (__digital__) +# include +#elif defined (_MSC_VER) +typedef unsigned __int8 uint8_t; +typedef __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; + +#elif defined (_AIX) +# include +#else +# include +#endif + +#include + +namespace mozilla { +namespace gfx { + +typedef float Float; + +enum SurfaceType +{ + SURFACE_DATA, /* Data surface - bitmap in memory */ + SURFACE_D2D1_BITMAP, /* Surface wrapping a ID2D1Bitmap */ + SURFACE_D2D1_DRAWTARGET, /* Surface made from a D2D draw target */ + SURFACE_CAIRO, /* Surface wrapping a cairo surface */ + SURFACE_COREGRAPHICS_IMAGE /* Surface wrapping a CoreGraphics Image */ +}; + +enum SurfaceFormat +{ + FORMAT_B8G8R8A8, + FORMAT_B8G8R8X8, + FORMAT_A8 +}; + +enum BackendType +{ + BACKEND_DIRECT2D, + BACKEND_COREGRAPHICS, + BACKEND_CAIRO +}; + +enum FontType +{ + FONT_DWRITE +}; + +enum NativeSurfaceType +{ + NATIVE_SURFACE_D3D10_TEXTURE +}; + +enum NativeFontType +{ + NATIVE_FONT_DWRITE_FONT_FACE +}; + +enum CompositionOp { OP_OVER, OP_ADD, OP_ATOP, OP_OUT, OP_IN, OP_SOURCE, OP_DEST_IN, OP_DEST_OUT, OP_DEST_OVER, OP_DEST_ATOP, OP_XOR, OP_COUNT }; +enum ExtendMode { EXTEND_CLAMP, EXTEND_WRAP, EXTEND_MIRROR }; +enum FillRule { FILL_WINDING, FILL_EVEN_ODD }; +enum AntialiasMode { AA_NONE, AA_GRAY, AA_SUBPIXEL }; +enum Snapping { SNAP_NONE, SNAP_ALIGNED }; +enum Filter { FILTER_LINEAR, FILTER_POINT }; +enum PatternType { PATTERN_COLOR, PATTERN_SURFACE, PATTERN_LINEAR_GRADIENT, PATTERN_RADIAL_GRADIENT }; +enum JoinStyle { JOIN_BEVEL, JOIN_ROUND, JOIN_MITER, JOIN_MITER_OR_BEVEL }; +enum CapStyle { CAP_BUTT, CAP_ROUND, CAP_SQUARE }; + +struct Color +{ +public: + Color() + : r(0.0f), g(0.0f), b(0.0f), a(0.0f) + {} + Color(Float aR, Float aG, Float aB, Float aA) + : r(aR), g(aG), b(aB), a(aA) + {} + Color(Float aR, Float aG, Float aB) + : r(aR), g(aG), b(aB), a(1.0f) + {} + + static Color FromABGR(uint32_t aColor) + { + Color newColor(((aColor >> 0) & 0xff) * (1.0f / 255.0f), + ((aColor >> 8) & 0xff) * (1.0f / 255.0f), + ((aColor >> 16) & 0xff) * (1.0f / 255.0f), + ((aColor >> 24) & 0xff) * (1.0f / 255.0f)); + + return newColor; + } + + Float r, g, b, a; +}; + +struct GradientStop +{ + Float offset; + Color color; +}; + +} +} + +// Side constants for use in various places +namespace mozilla { + namespace css { + enum Side {eSideTop, eSideRight, eSideBottom, eSideLeft}; + } +} + +// XXX - These don't really belong here. But for now this is where they go. +#define NS_SIDE_TOP mozilla::css::eSideTop +#define NS_SIDE_RIGHT mozilla::css::eSideRight +#define NS_SIDE_BOTTOM mozilla::css::eSideBottom +#define NS_SIDE_LEFT mozilla::css::eSideLeft + +#endif /* MOZILLA_GFX_TYPES_H_ */ diff --git a/gfx/2d/gfx2d.sln b/gfx/2d/gfx2d.sln new file mode 100644 index 00000000000..97b90100728 --- /dev/null +++ b/gfx/2d/gfx2d.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gfx2d", "gfx2d.vcxproj", "{5C80732F-8093-D263-7DD1-7D30B9A76091}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5C80732F-8093-D263-7DD1-7D30B9A76091}.Debug|Win32.ActiveCfg = Debug|Win32 + {5C80732F-8093-D263-7DD1-7D30B9A76091}.Debug|Win32.Build.0 = Debug|Win32 + {5C80732F-8093-D263-7DD1-7D30B9A76091}.Release|Win32.ActiveCfg = Release|Win32 + {5C80732F-8093-D263-7DD1-7D30B9A76091}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/gfx/2d/gfx2d.vcxproj b/gfx/2d/gfx2d.vcxproj new file mode 100644 index 00000000000..64e43115117 --- /dev/null +++ b/gfx/2d/gfx2d.vcxproj @@ -0,0 +1,114 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + Win32Proj + + + + StaticLibrary + true + + + Application + false + + + + + + + + + + + + + true + $(DXSDK_DIR)\Utilities\bin\x86;$(ExecutablePath) + + + true + + + + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);GFX_LOG_DEBUG;GFX_LOG_WARNING;MFBT_STAND_ALONE;XP_WIN + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + C:\Users\Bas\Dev\gfx-debug\dist\include;%(AdditionalIncludeDirectories) + + + MachineX86 + true + Windows + + + + + + + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Document + fxc /Tfx_4_0 /FhShadersD2D.h ShadersD2D.fx /Vn d2deffect + ShadersD2D.h + + + + + + \ No newline at end of file diff --git a/gfx/Makefile.in b/gfx/Makefile.in index c1148d15cd1..d90975e196a 100644 --- a/gfx/Makefile.in +++ b/gfx/Makefile.in @@ -48,7 +48,7 @@ ifdef MOZ_TREE_CAIRO DIRS = cairo endif -DIRS += ycbcr angle src qcms layers harfbuzz/src ots/src thebes ipc +DIRS += 2d ycbcr angle src qcms layers harfbuzz/src ots/src thebes ipc ifdef ENABLE_TESTS TOOL_DIRS += tests diff --git a/gfx/angle/README.mozilla b/gfx/angle/README.mozilla index 55111f46389..efdf541584b 100644 --- a/gfx/angle/README.mozilla +++ b/gfx/angle/README.mozilla @@ -8,6 +8,7 @@ In this order: angle-nspr-misc.patch - don't bother with ANGLE_OS detection with NSPR angle-renaming.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error + angle-amap-arev-fix.patch - plain bug fix, this is ANGLE r699 In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE. diff --git a/gfx/angle/angle-amap-arev-fix.patch b/gfx/angle/angle-amap-arev-fix.patch new file mode 100644 index 00000000000..6333b2b6d28 --- /dev/null +++ b/gfx/angle/angle-amap-arev-fix.patch @@ -0,0 +1,28 @@ +# HG changeset patch +# Parent c88f8e8921fb6399cf95b5899d2acc60951dddd1 +Bug 665934 - fix bug: arev was meant instead of amap - r=upstream + +This patch has been taken in ANGLE upstream as r699. + +diff --git a/gfx/angle/src/compiler/preprocessor/atom.c b/gfx/angle/src/compiler/preprocessor/atom.c +--- a/gfx/angle/src/compiler/preprocessor/atom.c ++++ b/gfx/angle/src/compiler/preprocessor/atom.c +@@ -330,17 +330,17 @@ static int GrowAtomTable(AtomTable *atab + newrev = malloc(sizeof(int)*size); + atable->size = 0; + } + if (!newmap || !newrev) { + /* failed to grow -- error */ + if (newmap) + atable->amap = newmap; + if (newrev) +- atable->amap = newrev; ++ atable->arev = newrev; + return -1; + } + memset(&newmap[atable->size], 0, (size - atable->size) * sizeof(int)); + memset(&newrev[atable->size], 0, (size - atable->size) * sizeof(int)); + atable->amap = newmap; + atable->arev = newrev; + atable->size = size; + } diff --git a/gfx/angle/src/compiler/preprocessor/atom.c b/gfx/angle/src/compiler/preprocessor/atom.c index 9b88181afcb..e59480bedd0 100644 --- a/gfx/angle/src/compiler/preprocessor/atom.c +++ b/gfx/angle/src/compiler/preprocessor/atom.c @@ -335,7 +335,7 @@ static int GrowAtomTable(AtomTable *atable, int size) if (newmap) atable->amap = newmap; if (newrev) - atable->amap = newrev; + atable->arev = newrev; return -1; } memset(&newmap[atable->size], 0, (size - atable->size) * sizeof(int)); diff --git a/gfx/cairo/cairo/src/cairo-cache-private.h b/gfx/cairo/cairo/src/cairo-cache-private.h index 76b556194d5..927ff0c0b96 100644 --- a/gfx/cairo/cairo/src/cairo-cache-private.h +++ b/gfx/cairo/cairo/src/cairo-cache-private.h @@ -84,7 +84,7 @@ * not be initialized if so desired. **/ typedef struct _cairo_cache_entry { - unsigned long hash; + uintptr_t hash; unsigned long size; } cairo_cache_entry_t; diff --git a/gfx/cairo/cairo/src/cairo-d2d-surface.cpp b/gfx/cairo/cairo/src/cairo-d2d-surface.cpp index 058186806f5..c75b3b7117c 100644 --- a/gfx/cairo/cairo/src/cairo-d2d-surface.cpp +++ b/gfx/cairo/cairo/src/cairo-d2d-surface.cpp @@ -4603,6 +4603,21 @@ FAIL_CREATE: return _cairo_surface_create_in_error(_cairo_error(CAIRO_STATUS_NO_MEMORY)); } +ID3D10Texture2D* +cairo_d2d_surface_get_texture(cairo_surface_t *surface) +{ + if (surface->type != CAIRO_SURFACE_TYPE_D2D) { + return NULL; + } + + cairo_d2d_surface_t *d2dsurf = reinterpret_cast(surface); + + RefPtr texture; + d2dsurf->surface->QueryInterface(&texture); + + return texture; +} + void cairo_d2d_scroll(cairo_surface_t *surface, int x, int y, cairo_rectangle_t *clip) { if (surface->type != CAIRO_SURFACE_TYPE_D2D) { diff --git a/gfx/cairo/cairo/src/cairo-scaled-font.c b/gfx/cairo/cairo/src/cairo-scaled-font.c index edac25294a0..0a2730f66a2 100644 --- a/gfx/cairo/cairo/src/cairo-scaled-font.c +++ b/gfx/cairo/cairo/src/cairo-scaled-font.c @@ -619,7 +619,7 @@ _cairo_scaled_font_init_key (cairo_scaled_font_t *scaled_font, hash = _hash_matrix_fnv (&scaled_font->ctm, hash); hash = _hash_mix_bits (hash); - hash ^= (unsigned long) scaled_font->font_face; + hash ^= (uintptr_t) scaled_font->font_face; hash ^= cairo_font_options_hash (&scaled_font->options); /* final mixing of bits */ @@ -2694,7 +2694,7 @@ _cairo_scaled_font_allocate_glyph (cairo_scaled_font_t *scaled_font, if (unlikely (page == NULL)) return _cairo_error (CAIRO_STATUS_NO_MEMORY); - page->cache_entry.hash = (unsigned long) scaled_font; + page->cache_entry.hash = (uintptr_t) scaled_font; page->cache_entry.size = 1; /* XXX occupancy weighting? */ page->num_glyphs = 0; diff --git a/gfx/cairo/cairo/src/cairo-wideint-type-private.h b/gfx/cairo/cairo/src/cairo-wideint-type-private.h index 4c910edf5fa..9e49ad947a6 100644 --- a/gfx/cairo/cairo/src/cairo-wideint-type-private.h +++ b/gfx/cairo/cairo/src/cairo-wideint-type-private.h @@ -58,6 +58,13 @@ typedef unsigned __int32 uint32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; +#ifndef _UINTPTR_T_DEFINED +#ifdef _WIN64 + typedef unsigned __int64 uintptr_t; +#else + typedef unsigned int uintptr_t; +#endif +#endif # ifndef HAVE_UINT64_T # define HAVE_UINT64_T 1 # endif diff --git a/gfx/cairo/cairo/src/cairo-win32.h b/gfx/cairo/cairo/src/cairo-win32.h index 75c03d40c4e..8313a3fd29c 100644 --- a/gfx/cairo/cairo/src/cairo-win32.h +++ b/gfx/cairo/cairo/src/cairo-win32.h @@ -250,6 +250,11 @@ cairo_d2d_surface_create_for_texture(cairo_device_t *device, struct ID3D10Texture2D *texture, cairo_content_t content); +/** + * Get the ID3D10Texture2D used for a surface. + */ +cairo_public struct ID3D10Texture2D *cairo_d2d_surface_get_texture(cairo_surface_t *surf); + /** * Present the backbuffer for a surface create for an HWND. This needs * to be called when the owner of the original window surface wants to diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 0b50809f750..5e3f49546f6 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -48,6 +48,7 @@ #include "mozilla/Util.h" using namespace mozilla::layers; +using namespace mozilla::gfx; typedef FrameMetrics::ViewID ViewID; const ViewID FrameMetrics::NULL_SCROLL_ID = 0; @@ -210,6 +211,14 @@ LayerManager::CreateOptimalSurface(const gfxIntSize &aSize, CreateOffscreenSurface(aSize, gfxASurface::ContentFromFormat(aFormat)); } +TemporaryRef +LayerManager::CreateDrawTarget(const IntSize &aSize, + SurfaceFormat aFormat) +{ + // Right now this doesn't work on the general layer manager. + return NULL; +} + #ifdef DEBUG void LayerManager::Mutated(Layer* aLayer) @@ -571,9 +580,6 @@ ThebesLayer::PrintInfo(nsACString& aTo, const char* aPrefix) if (!mValidRegion.IsEmpty()) { AppendToString(aTo, mValidRegion, " [valid=", "]"); } - if (mXResolution != 1.0 || mYResolution != 1.0) { - aTo.AppendPrintf(" [xres=%g yres=%g]", mXResolution, mYResolution); - } return aTo; } diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index e079e1cc145..9c461b751c6 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -49,6 +49,8 @@ #include "gfxColor.h" #include "gfxPattern.h" +#include "mozilla/gfx/2D.h" + #if defined(DEBUG) || defined(PR_LOGGING) # include // FILE # include "prlog.h" @@ -129,6 +131,7 @@ public: return mScrollId != NULL_SCROLL_ID; } + // These are all in layer coordinate space. nsIntRect mViewport; nsIntSize mContentSize; nsIntPoint mViewportScrollOffset; @@ -423,6 +426,15 @@ public: CreateOptimalSurface(const gfxIntSize &aSize, gfxASurface::gfxImageFormat imageFormat); + /** + * Creates a DrawTarget which is optimized for inter-operating with this + * layermanager. + */ + virtual TemporaryRef + CreateDrawTarget(const mozilla::gfx::IntSize &aSize, + mozilla::gfx::SurfaceFormat aFormat); + + /** * Return the name of the layer manager's backend. */ @@ -943,13 +955,24 @@ public: * region. */ virtual void InvalidateRegion(const nsIntRegion& aRegion) = 0; + /** + * CONSTRUCTION PHASE ONLY + * Set whether ComputeEffectiveTransforms should compute the + * "residual translation" --- the translation that should be applied *before* + * mEffectiveTransform to get the ideal transform for this ThebesLayer. + * When this is true, ComputeEffectiveTransforms will compute the residual + * and ensure that the layer is invalidated whenever the residual changes. + * When it's false, a change in the residual will not trigger invalidation + * and GetResidualTranslation will return 0,0. + * So when the residual is to be ignored, set this to false for better + * performance. + */ + void SetAllowResidualTranslation(bool aAllow) { mAllowResidualTranslation = aAllow; } /** * Can be used anytime */ const nsIntRegion& GetValidRegion() const { return mValidRegion; } - float GetXResolution() const { return mXResolution; } - float GetYResolution() const { return mYResolution; } virtual ThebesLayer* AsThebesLayer() { return this; } @@ -959,46 +982,63 @@ public: { // The default implementation just snaps 0,0 to pixels. gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface; - mEffectiveTransform = SnapTransform(idealTransform, gfxRect(0, 0, 0, 0), nsnull); + gfxMatrix residual; + mEffectiveTransform = SnapTransform(idealTransform, gfxRect(0, 0, 0, 0), + mAllowResidualTranslation ? &residual : nsnull); + // The residual can only be a translation because ThebesLayer snapping + // only aligns a single point with the pixel grid; scale factors are always + // preserved exactly + NS_ASSERTION(!residual.HasNonTranslation(), + "Residual transform can only be a translation"); + if (residual.GetTranslation() != mResidualTranslation) { + mResidualTranslation = residual.GetTranslation(); + NS_ASSERTION(-0.5 <= mResidualTranslation.x && mResidualTranslation.x < 0.5 && + -0.5 <= mResidualTranslation.y && mResidualTranslation.y < 0.5, + "Residual translation out of range"); + mValidRegion.SetEmpty(); + } } bool UsedForReadback() { return mUsedForReadback; } void SetUsedForReadback(bool aUsed) { mUsedForReadback = aUsed; } + /** + * Returns the residual translation. Apply this translation when drawing + * into the ThebesLayer so that when mEffectiveTransform is applied afterwards + * by layer compositing, the results exactly match the "ideal transform" + * (the product of the transform of this layer and its ancestors). + * Returns 0,0 unless SetAllowResidualTranslation(true) has been called. + * The residual translation components are always in the range [-0.5, 0.5). + */ + gfxPoint GetResidualTranslation() const { return mResidualTranslation; } protected: ThebesLayer(LayerManager* aManager, void* aImplData) : Layer(aManager, aImplData) , mValidRegion() - , mXResolution(1.0) - , mYResolution(1.0) , mUsedForReadback(false) + , mAllowResidualTranslation(false) { mContentFlags = 0; // Clear NO_TEXT, NO_TEXT_OVER_TRANSPARENT } virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix); + /** + * ComputeEffectiveTransforms snaps the ideal transform to get mEffectiveTransform. + * mResidualTranslation is the translation that should be applied *before* + * mEffectiveTransform to get the ideal transform. + */ + gfxPoint mResidualTranslation; nsIntRegion mValidRegion; - // Resolution values tell this to paint its content scaled by - // , into a backing buffer with - // dimensions scaled the same. A non-1.0 resolution also tells this - // to set scaling factors that compensate for the re-paint - // resolution when rendering itself to render targets - // - // Resolution doesn't affect the visible region, valid region, or - // re-painted regions at all. It only affects how scalable thebes - // content is rasterized to device pixels. - // - // Setting the resolution isn't part of the public ThebesLayer API - // because it's backend-specific, and it doesn't necessarily make - // sense for all backends to fully support it. - float mXResolution; - float mYResolution; /** * Set when this ThebesLayer is participating in readback, i.e. some * ReadbackLayer (may) be getting its background from this layer. */ bool mUsedForReadback; + /** + * True when + */ + bool mAllowResidualTranslation; }; /** @@ -1170,13 +1210,14 @@ class THEBES_API CanvasLayer : public Layer { public: struct Data { Data() - : mSurface(nsnull), mGLContext(nsnull), - mGLBufferIsPremultiplied(PR_FALSE) + : mSurface(nsnull), mGLContext(nsnull) + , mDrawTarget(nsnull), mGLBufferIsPremultiplied(PR_FALSE) { } /* One of these two must be specified, but never both */ gfxASurface* mSurface; // a gfx Surface for the canvas contents mozilla::gl::GLContext* mGLContext; // a GL PBuffer Context + mozilla::gfx::DrawTarget *mDrawTarget; // a DrawTarget for the canvas contents /* The size of the canvas content */ nsIntSize mSize; diff --git a/gfx/layers/ThebesLayerBuffer.cpp b/gfx/layers/ThebesLayerBuffer.cpp index fdded026eab..eaface98a9c 100644 --- a/gfx/layers/ThebesLayerBuffer.cpp +++ b/gfx/layers/ThebesLayerBuffer.cpp @@ -45,19 +45,6 @@ namespace mozilla { namespace layers { -static nsIntSize -ScaledSize(const nsIntSize& aSize, float aXScale, float aYScale) -{ - if (aXScale == 1.0 && aYScale == 1.0) { - return aSize; - } - - gfxRect rect(0, 0, aSize.width, aSize.height); - rect.Scale(aXScale, aYScale); - rect.RoundOut(); - return nsIntSize(rect.Width(), rect.Height()); -} - nsIntRect ThebesLayerBuffer::GetQuadrantRectangle(XSide aXSide, YSide aYSide) { @@ -82,8 +69,7 @@ ThebesLayerBuffer::GetQuadrantRectangle(XSide aXSide, YSide aYSide) void ThebesLayerBuffer::DrawBufferQuadrant(gfxContext* aTarget, XSide aXSide, YSide aYSide, - float aOpacity, - float aXRes, float aYRes) + float aOpacity) { // The rectangle that we're going to fill. Basically we're going to // render the buffer at mBufferRect + quadrantTranslation to get the @@ -111,19 +97,8 @@ ThebesLayerBuffer::DrawBufferQuadrant(gfxContext* aTarget, // Transform from user -> buffer space. gfxMatrix transform; - transform.Scale(aXRes, aYRes); transform.Translate(-quadrantTranslation); - // in common cases the matrix after scaling by 1/aRes is close to 1.0, - // so we want to make it 1.0 in both cases - transform.Scale(1.0 / aXRes, 1.0 / aYRes); - transform.NudgeToIntegers(); - - gfxMatrix ctxMatrix = aTarget->CurrentMatrix(); - ctxMatrix.Scale(1.0 / aXRes, 1.0 / aYRes); - ctxMatrix.NudgeToIntegers(); - aTarget->SetMatrix(ctxMatrix); - pattern->SetMatrix(transform); aTarget->SetPattern(pattern); @@ -138,21 +113,18 @@ ThebesLayerBuffer::DrawBufferQuadrant(gfxContext* aTarget, } void -ThebesLayerBuffer::DrawBufferWithRotation(gfxContext* aTarget, float aOpacity, - float aXRes, float aYRes) +ThebesLayerBuffer::DrawBufferWithRotation(gfxContext* aTarget, float aOpacity) { // Draw four quadrants. We could use REPEAT_, but it's probably better // not to, to be performance-safe. - DrawBufferQuadrant(aTarget, LEFT, TOP, aOpacity, aXRes, aYRes); - DrawBufferQuadrant(aTarget, RIGHT, TOP, aOpacity, aXRes, aYRes); - DrawBufferQuadrant(aTarget, LEFT, BOTTOM, aOpacity, aXRes, aYRes); - DrawBufferQuadrant(aTarget, RIGHT, BOTTOM, aOpacity, aXRes, aYRes); + DrawBufferQuadrant(aTarget, LEFT, TOP, aOpacity); + DrawBufferQuadrant(aTarget, RIGHT, TOP, aOpacity); + DrawBufferQuadrant(aTarget, LEFT, BOTTOM, aOpacity); + DrawBufferQuadrant(aTarget, RIGHT, BOTTOM, aOpacity); } already_AddRefed -ThebesLayerBuffer::GetContextForQuadrantUpdate(const nsIntRect& aBounds, - float aXResolution, - float aYResolution) +ThebesLayerBuffer::GetContextForQuadrantUpdate(const nsIntRect& aBounds) { nsRefPtr ctx = new gfxContext(mBuffer); @@ -163,49 +135,11 @@ ThebesLayerBuffer::GetContextForQuadrantUpdate(const nsIntRect& aBounds, YSide sideY = aBounds.YMost() <= yBoundary ? BOTTOM : TOP; nsIntRect quadrantRect = GetQuadrantRectangle(sideX, sideY); NS_ASSERTION(quadrantRect.Contains(aBounds), "Messed up quadrants"); - ctx->Scale(aXResolution, aYResolution); ctx->Translate(-gfxPoint(quadrantRect.x, quadrantRect.y)); return ctx.forget(); } -// Move the pixels in aBuffer specified by |aSourceRect| to |aDest|. -// |aSourceRect| and |aDest| are in the space of |aBuffer|, but -// unscaled by the resolution. This helper does the scaling. -static void -MovePixels(gfxASurface* aBuffer, - const nsIntRect& aSourceRect, const nsIntPoint& aDest, - float aXResolution, float aYResolution) -{ - gfxRect src(aSourceRect.x, aSourceRect.y, aSourceRect.width, aSourceRect.height); - gfxRect dest(aDest.x, aDest.y, aSourceRect.width, aSourceRect.height); - src.Scale(aXResolution, aYResolution); - dest.Scale(aXResolution, aYResolution); - -#ifdef DEBUG - // If we're doing a self-copy, enforce that the rects we're copying - // were computed in order to round to device pixels. If the rects - // we're moving *weren't* computed to round, then glitches like - // seaming are likely. Assume that the precision of these - // computations is 1 app unit, and toss in a fudge factor of 2.0. - static const gfxFloat kPrecision = - 1.0 / gfxFloat(nsDeviceContext::AppUnitsPerCSSPixel()); - // FIXME/bug 637852: we've decided to live with transient glitches - // during fast-panning for the time being. - NS_WARN_IF_FALSE( - src.WithinEpsilonOfIntegerPixels(2.0 * kPrecision * aXResolution) && - dest.WithinEpsilonOfIntegerPixels(2.0 * kPrecision * aXResolution), - "Rects don't round to device pixels within precision; glitches likely to follow"); -#endif - - src.Round(); - dest.Round(); - - aBuffer->MovePixels(nsIntRect(src.X(), src.Y(), - src.Width(), src.Height()), - nsIntPoint(dest.X(), dest.Y())); -} - static void WrapRotationAxis(PRInt32* aRotationPoint, PRInt32 aSize) { @@ -218,36 +152,24 @@ WrapRotationAxis(PRInt32* aRotationPoint, PRInt32 aSize) ThebesLayerBuffer::PaintState ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType, - float aXResolution, float aYResolution, PRUint32 aFlags) { PaintState result; - result.mDidSelfCopy = PR_FALSE; - float curXRes = aLayer->GetXResolution(); - float curYRes = aLayer->GetYResolution(); - // If we have non-identity resolution then mBufferRotation might not fall - // on a buffer pixel boundary, in which case that row of pixels will contain - // a mix of two completely different rows of the layer, which would be - // a catastrophe. So disable rotation in that case. - // We also need to disable rotation if we're going to be resampled when + // We need to disable rotation if we're going to be resampled when // drawing, because we might sample across the rotation boundary. - PRBool canHaveRotation = - !(aFlags & PAINT_WILL_RESAMPLE) && aXResolution == 1.0 && aYResolution == 1.0; + PRBool canHaveRotation = !(aFlags & PAINT_WILL_RESAMPLE); nsIntRegion validRegion = aLayer->GetValidRegion(); ContentType contentType; nsIntRegion neededRegion; - nsIntSize destBufferDims; PRBool canReuseBuffer; nsIntRect destBufferRect; while (PR_TRUE) { contentType = aContentType; neededRegion = aLayer->GetVisibleRegion(); - destBufferDims = ScaledSize(neededRegion.GetBounds().Size(), - aXResolution, aYResolution); - canReuseBuffer = mBuffer && BufferSizeOkFor(destBufferDims); + canReuseBuffer = mBuffer && BufferSizeOkFor(neededRegion.GetBounds().Size()); if (canReuseBuffer) { if (mBufferRect.Contains(neededRegion.GetBounds())) { @@ -273,22 +195,11 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType, // We need to validate the entire buffer, to make sure that only valid // pixels are sampled neededRegion = destBufferRect; - destBufferDims = ScaledSize(neededRegion.GetBounds().Size(), - aXResolution, aYResolution); } - if (mBuffer && - (contentType != mBuffer->GetContentType() || - aXResolution != curXRes || aYResolution != curYRes)) { + if (mBuffer && contentType != mBuffer->GetContentType()) { // We're effectively clearing the valid region, so we need to draw // the entire needed region now. - // - // XXX/cjones: a possibly worthwhile optimization to keep in mind - // is to re-use buffers when the resolution and visible region - // have changed in such a way that the buffer size stays the same. - // It might make even more sense to allocate buffers from a - // recyclable pool, so that we could keep this logic simple and - // still get back the same buffer. result.mRegionToInvalidate = aLayer->GetValidRegion(); validRegion.SetEmpty(); Clear(); @@ -309,12 +220,8 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType, nsIntRect drawBounds = result.mRegionToDraw.GetBounds(); nsRefPtr destBuffer; - PRBool bufferDimsChanged = PR_FALSE; PRUint32 bufferFlags = canHaveRotation ? ALLOW_REPEAT : 0; if (canReuseBuffer) { - NS_ASSERTION(curXRes == aXResolution && curYRes == aYResolution, - "resolution changes must Clear()!"); - nsIntRect keepArea; if (keepArea.IntersectRect(destBufferRect, mBufferRect)) { // Set mBufferRotation so that the pixels currently in mBuffer @@ -337,7 +244,7 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType, if (mBufferRotation == nsIntPoint(0,0)) { nsIntRect srcRect(nsIntPoint(0, 0), mBufferRect.Size()); nsIntPoint dest = mBufferRect.TopLeft() - destBufferRect.TopLeft(); - MovePixels(mBuffer, srcRect, dest, curXRes, curYRes); + mBuffer->MovePixels(srcRect, dest); result.mDidSelfCopy = PR_TRUE; // Don't set destBuffer; we special-case self-copies, and // just did the necessary work above. @@ -346,8 +253,7 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType, // We can't do a real self-copy because the buffer is rotated. // So allocate a new buffer for the destination. destBufferRect = neededRegion.GetBounds(); - bufferDimsChanged = PR_TRUE; - destBuffer = CreateBuffer(contentType, destBufferDims, bufferFlags); + destBuffer = CreateBuffer(contentType, destBufferRect.Size(), bufferFlags); if (!destBuffer) return result; } @@ -364,8 +270,7 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType, } } else { // The buffer's not big enough, so allocate a new one - bufferDimsChanged = PR_TRUE; - destBuffer = CreateBuffer(contentType, destBufferDims, bufferFlags); + destBuffer = CreateBuffer(contentType, destBufferRect.Size(), bufferFlags); if (!destBuffer) return result; } @@ -382,20 +287,14 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType, nsRefPtr tmpCtx = new gfxContext(destBuffer); nsIntPoint offset = -destBufferRect.TopLeft(); tmpCtx->SetOperator(gfxContext::OPERATOR_SOURCE); - tmpCtx->Scale(aXResolution, aYResolution); tmpCtx->Translate(gfxPoint(offset.x, offset.y)); - NS_ASSERTION(curXRes == aXResolution && curYRes == aYResolution, - "resolution changes must Clear()!"); - DrawBufferWithRotation(tmpCtx, 1.0, aXResolution, aYResolution); + DrawBufferWithRotation(tmpCtx, 1.0); } mBuffer = destBuffer.forget(); mBufferRect = destBufferRect; mBufferRotation = nsIntPoint(0,0); } - if (bufferDimsChanged) { - mBufferDims = destBufferDims; - } NS_ASSERTION(canHaveRotation || mBufferRotation == nsIntPoint(0,0), "Rotation disabled, but we have nonzero rotation?"); @@ -403,8 +302,7 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType, invalidate.Sub(aLayer->GetValidRegion(), destBufferRect); result.mRegionToInvalidate.Or(result.mRegionToInvalidate, invalidate); - result.mContext = GetContextForQuadrantUpdate(drawBounds, - aXResolution, aYResolution); + result.mContext = GetContextForQuadrantUpdate(drawBounds); gfxUtils::ClipToRegionSnapped(result.mContext, result.mRegionToDraw); if (contentType == gfxASurface::CONTENT_COLOR_ALPHA && !isClear) { diff --git a/gfx/layers/ThebesLayerBuffer.h b/gfx/layers/ThebesLayerBuffer.h index 9cea379c9c7..9550810f524 100644 --- a/gfx/layers/ThebesLayerBuffer.h +++ b/gfx/layers/ThebesLayerBuffer.h @@ -82,8 +82,7 @@ public: }; ThebesLayerBuffer(BufferSizePolicy aBufferSizePolicy) - : mBufferDims(0,0) - , mBufferRotation(0,0) + : mBufferRotation(0,0) , mBufferSizePolicy(aBufferSizePolicy) { MOZ_COUNT_CTOR(ThebesLayerBuffer); @@ -100,7 +99,6 @@ public: void Clear() { mBuffer = nsnull; - mBufferDims.SizeTo(0, 0); mBufferRect.SetEmpty(); } @@ -140,7 +138,6 @@ public: * fill the buffer bounds). */ PaintState BeginPaint(ThebesLayer* aLayer, ContentType aContentType, - float aXResolution, float aYResolution, PRUint32 aFlags); enum { @@ -170,32 +167,23 @@ protected: }; nsIntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide); void DrawBufferQuadrant(gfxContext* aTarget, XSide aXSide, YSide aYSide, - float aOpacity, float aXRes, float aYRes); - void DrawBufferWithRotation(gfxContext* aTarget, float aOpacity, - float aXRes, float aYRes); + float aOpacity); + void DrawBufferWithRotation(gfxContext* aTarget, float aOpacity); /** * |BufferRect()| is the rect of device pixels that this * ThebesLayerBuffer covers. That is what DrawBufferWithRotation() * will paint when it's called. - * - * |BufferDims()| is the actual dimensions of the underlying surface - * maintained by this, also in device pixels. It is *not* - * necessarily true that |BufferRect().Size() == BufferDims()|. - * They may differ if a ThebesLayer is drawn at a non-1.0 - * resolution. */ - const nsIntSize& BufferDims() const { return mBufferDims; } const nsIntRect& BufferRect() const { return mBufferRect; } const nsIntPoint& BufferRotation() const { return mBufferRotation; } already_AddRefed - SetBuffer(gfxASurface* aBuffer, const nsIntSize& aBufferDims, + SetBuffer(gfxASurface* aBuffer, const nsIntRect& aBufferRect, const nsIntPoint& aBufferRotation) { nsRefPtr tmp = mBuffer.forget(); mBuffer = aBuffer; - mBufferDims = aBufferDims; mBufferRect = aBufferRect; mBufferRotation = aBufferRotation; return tmp.forget(); @@ -206,24 +194,17 @@ protected: * which must be contained within a single quadrant. */ already_AddRefed - GetContextForQuadrantUpdate(const nsIntRect& aBounds, - float aXResolution, float aYResolution); + GetContextForQuadrantUpdate(const nsIntRect& aBounds); private: PRBool BufferSizeOkFor(const nsIntSize& aSize) { - return (aSize == mBufferDims || + return (aSize == mBufferRect.Size() || (SizedToVisibleBounds != mBufferSizePolicy && - aSize < mBufferDims)); + aSize < mBufferRect.Size())); } nsRefPtr mBuffer; - /** - * The actual dimensions of mBuffer. For the ContainsVisibleBounds - * policy or with resolution-scaled drawing, mBufferDims might be - * different than mBufferRect.Size(). - */ - nsIntSize mBufferDims; /** The area of the ThebesLayer that is covered by the buffer as a whole */ nsIntRect mBufferRect; /** diff --git a/gfx/layers/basic/BasicLayers.cpp b/gfx/layers/basic/BasicLayers.cpp index d8064a9b3fb..8876aee2ebc 100644 --- a/gfx/layers/basic/BasicLayers.cpp +++ b/gfx/layers/basic/BasicLayers.cpp @@ -41,6 +41,8 @@ #include "mozilla/layers/PLayerChild.h" #include "mozilla/layers/PLayersChild.h" #include "mozilla/layers/PLayersParent.h" +#include "mozilla/gfx/2D.h" + #include "ipc/ShadowLayerChild.h" #include "BasicLayers.h" @@ -416,19 +418,18 @@ public: void SetBackingBuffer(gfxASurface* aBuffer, const nsIntRect& aRect, const nsIntPoint& aRotation) { - gfxIntSize prevSize = gfxIntSize(BufferDims().width, BufferDims().height); + gfxIntSize prevSize = gfxIntSize(BufferRect().width, BufferRect().height); gfxIntSize newSize = aBuffer->GetSize(); NS_ABORT_IF_FALSE(newSize == prevSize, "Swapped-in buffer size doesn't match old buffer's!"); nsRefPtr oldBuffer; - oldBuffer = SetBuffer(aBuffer, nsIntSize(newSize.width, newSize.height), - aRect, aRotation); + oldBuffer = SetBuffer(aBuffer, aRect, aRotation); } void SetBackingBufferAndUpdateFrom( gfxASurface* aBuffer, gfxASurface* aSource, const nsIntRect& aRect, const nsIntPoint& aRotation, - const nsIntRegion& aUpdateRegion, float aXResolution, float aYResolution); + const nsIntRegion& aUpdateRegion); private: BasicThebesLayerBuffer(gfxASurface* aBuffer, @@ -437,8 +438,7 @@ private: // intended to be used for creating temporaries : ThebesLayerBuffer(ContainsVisibleBounds) { - gfxIntSize sz = aBuffer->GetSize(); - SetBuffer(aBuffer, nsIntSize(sz.width, sz.height), aRect, aRotation); + SetBuffer(aBuffer, aRect, aRotation); } BasicThebesLayer* mLayer; @@ -500,6 +500,21 @@ public: aType, gfxIntSize(aSize.width, aSize.height)); } + virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) + { + if (!BasicManager()->IsRetained()) { + // Don't do any snapping of our transform, since we're just going to + // draw straight through without intermediate buffers. + mEffectiveTransform = GetLocalTransform()*aTransformToSurface; + if (gfxPoint(0,0) != mResidualTranslation) { + mResidualTranslation = gfxPoint(0,0); + mValidRegion.SetEmpty(); + } + return; + } + ThebesLayer::ComputeEffectiveTransforms(aTransformToSurface); + } + protected: BasicLayerManager* BasicManager() { @@ -680,9 +695,6 @@ BasicThebesLayer::PaintThebes(gfxContext* aContext, } { - gfxSize scale = aContext->CurrentMatrix().ScaleFactors(PR_TRUE); - float paintXRes = BasicManager()->XResolution() * gfxUtils::ClampToScaleFactor(scale.width); - float paintYRes = BasicManager()->YResolution() * gfxUtils::ClampToScaleFactor(scale.height); PRUint32 flags = 0; gfxMatrix transform; if (!GetEffectiveTransform().Is2D(&transform) || @@ -691,7 +703,7 @@ BasicThebesLayer::PaintThebes(gfxContext* aContext, flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE; } Buffer::PaintState state = - mBuffer.BeginPaint(this, contentType, paintXRes, paintYRes, flags); + mBuffer.BeginPaint(this, contentType, flags); mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate); if (state.mContext) { @@ -702,9 +714,6 @@ BasicThebesLayer::PaintThebes(gfxContext* aContext, state.mRegionToInvalidate.And(state.mRegionToInvalidate, GetEffectiveVisibleRegion()); nsIntRegion extendedDrawRegion = state.mRegionToDraw; - extendedDrawRegion.ExtendForScaling(paintXRes, paintYRes); - mXResolution = paintXRes; - mYResolution = paintYRes; SetAntialiasingFlags(this, state.mContext); PaintBuffer(state.mContext, state.mRegionToDraw, extendedDrawRegion, state.mRegionToInvalidate, @@ -766,8 +775,7 @@ BasicThebesLayerBuffer::DrawTo(ThebesLayer* aLayer, // and may cause gray lines. gfxUtils::ClipToRegionSnapped(aTarget, aLayer->GetEffectiveVisibleRegion()); } - DrawBufferWithRotation(aTarget, aOpacity, - aLayer->GetXResolution(), aLayer->GetYResolution()); + DrawBufferWithRotation(aTarget, aOpacity); aTarget->Restore(); } @@ -782,19 +790,18 @@ void BasicThebesLayerBuffer::SetBackingBufferAndUpdateFrom( gfxASurface* aBuffer, gfxASurface* aSource, const nsIntRect& aRect, const nsIntPoint& aRotation, - const nsIntRegion& aUpdateRegion, float aXResolution, float aYResolution) + const nsIntRegion& aUpdateRegion) { SetBackingBuffer(aBuffer, aRect, aRotation); nsRefPtr destCtx = - GetContextForQuadrantUpdate(aUpdateRegion.GetBounds(), - aXResolution, aYResolution); + GetContextForQuadrantUpdate(aUpdateRegion.GetBounds()); destCtx->SetOperator(gfxContext::OPERATOR_SOURCE); if (IsClippingCheap(destCtx, aUpdateRegion)) { gfxUtils::ClipToRegion(destCtx, aUpdateRegion); } BasicThebesLayerBuffer srcBuffer(aSource, aRect, aRotation); - srcBuffer.DrawBufferWithRotation(destCtx, 1.0, aXResolution, aYResolution); + srcBuffer.DrawBufferWithRotation(destCtx, 1.0); } class BasicImageLayer : public ImageLayer, public BasicImplData { @@ -1015,6 +1022,8 @@ protected: nsRefPtr mSurface; nsRefPtr mGLContext; + mozilla::RefPtr mDrawTarget; + PRUint32 mCanvasFramebuffer; PRPackedBool mGLBufferIsPremultiplied; @@ -1037,8 +1046,12 @@ BasicCanvasLayer::Initialize(const Data& aData) mGLBufferIsPremultiplied = aData.mGLBufferIsPremultiplied; mCanvasFramebuffer = mGLContext->GetOffscreenFBO(); mNeedsYFlip = PR_TRUE; + } else if (aData.mDrawTarget) { + mDrawTarget = aData.mDrawTarget; + mSurface = gfxPlatform::GetPlatform()->GetThebesSurfaceForDrawTarget(mDrawTarget); + mNeedsYFlip = PR_FALSE; } else { - NS_ERROR("CanvasLayer created without mSurface or mGLContext?"); + NS_ERROR("CanvasLayer created without mSurface, mDrawTarget or mGLContext?"); } mBounds.SetRect(0, 0, aData.mSize.width, aData.mSize.height); @@ -1047,6 +1060,10 @@ BasicCanvasLayer::Initialize(const Data& aData) void BasicCanvasLayer::UpdateSurface(gfxASurface* aDestSurface) { + if (mDrawTarget) { + mDrawTarget->Flush(); + } + if (!mGLContext && aDestSurface) { nsRefPtr tmpCtx = new gfxContext(aDestSurface); tmpCtx->SetOperator(gfxContext::OPERATOR_SOURCE); @@ -1205,9 +1222,7 @@ BasicLayerManager::BasicLayerManager(nsIWidget* aWidget) : #ifdef DEBUG mPhase(PHASE_NONE), #endif - mXResolution(1.0) - , mYResolution(1.0) - , mWidget(aWidget) + mWidget(aWidget) , mDoubleBuffering(BUFFER_NONE), mUsingDefaultTarget(PR_FALSE) , mCachedSurfaceInUse(PR_FALSE) , mTransactionIncomplete(false) @@ -1921,8 +1936,7 @@ public: virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) { - aAttrs = ThebesLayerAttributes(GetValidRegion(), - mXResolution, mYResolution); + aAttrs = ThebesLayerAttributes(GetValidRegion()); } virtual Layer* AsLayer() { return this; } @@ -1931,7 +1945,6 @@ public: void SetBackBufferAndAttrs(const ThebesBuffer& aBuffer, const nsIntRegion& aValidRegion, - float aXResolution, float aYResolution, const OptionalThebesBuffer& aReadOnlyFrontBuffer, const nsIntRegion& aFrontUpdatedRegion); @@ -1972,8 +1985,6 @@ private: void BasicShadowableThebesLayer::SetBackBufferAndAttrs(const ThebesBuffer& aBuffer, const nsIntRegion& aValidRegion, - float aXResolution, - float aYResolution, const OptionalThebesBuffer& aReadOnlyFrontBuffer, const nsIntRegion& aFrontUpdatedRegion) { @@ -1986,8 +1997,6 @@ BasicShadowableThebesLayer::SetBackBufferAndAttrs(const ThebesBuffer& aBuffer, // to a texture it owns, then we probably got back the same buffer // we pushed in the update and all is well. If not, ... mValidRegion = aValidRegion; - mXResolution = aXResolution; - mYResolution = aYResolution; mBuffer.SetBackingBuffer(backBuffer, aBuffer.rect(), aBuffer.rotation()); return; } @@ -2004,7 +2013,7 @@ BasicShadowableThebesLayer::SetBackBufferAndAttrs(const ThebesBuffer& aBuffer, mBuffer.SetBackingBufferAndUpdateFrom( backBuffer, roFrontBuffer, roFront.rect(), roFront.rotation(), - aFrontUpdatedRegion, mXResolution, mYResolution); + aFrontUpdatedRegion); // Now the new back buffer has the same (interesting) pixels as the // new front buffer, and mValidRegion et al. are correct wrt the new // back buffer (i.e. as they were for the old back buffer) @@ -2094,7 +2103,6 @@ BasicShadowableThebesLayer::CreateBuffer(Buffer::ContentType aType, BasicManager()->CreatedThebesBuffer(BasicManager()->Hold(this), nsIntRegion(), - 1.0, 1.0, nsIntRect(), tmpFront); return BasicManager()->OpenDescriptor(mBackBuffer); @@ -2429,10 +2437,8 @@ public: *aOldRect = BufferRect(); *aOldRotation = BufferRotation(); - gfxIntSize newSize = aNewBuffer->GetSize(); nsRefPtr oldBuffer; oldBuffer = SetBuffer(aNewBuffer, - nsIntSize(newSize.width, newSize.height), aNewRect, aNewRotation); oldBuffer.forget(aOldBuffer); } @@ -2451,8 +2457,6 @@ class BasicShadowThebesLayer : public ShadowThebesLayer, public BasicImplData { public: BasicShadowThebesLayer(BasicShadowLayerManager* aLayerManager) : ShadowThebesLayer(aLayerManager, static_cast(this)) - , mOldXResolution(1.0) - , mOldYResolution(1.0) { MOZ_COUNT_CTOR(BasicShadowThebesLayer); } @@ -2465,8 +2469,7 @@ public: } virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront, - const nsIntRegion& aValidRegion, - float aXResolution, float aYResolution); + const nsIntRegion& aValidRegion); virtual void SetValidRegion(const nsIntRegion& aRegion) { @@ -2474,13 +2477,6 @@ public: ShadowThebesLayer::SetValidRegion(aRegion); } - virtual void SetResolution(float aXResolution, float aYResolution) - { - mOldXResolution = mXResolution; - mOldYResolution = mYResolution; - ShadowThebesLayer::SetResolution(aXResolution, aYResolution); - } - virtual void Disconnect() { DestroyFrontBuffer(); @@ -2490,7 +2486,6 @@ public: virtual void Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion, ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion, - float* aNewXResolution, float* aNewYResolution, OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion); virtual void DestroyFrontBuffer() @@ -2498,8 +2493,6 @@ public: mFrontBuffer.Clear(); mValidRegion.SetEmpty(); mOldValidRegion.SetEmpty(); - mOldXResolution = 1.0; - mOldYResolution = 1.0; if (IsSurfaceDescriptorValid(mFrontBufferDescriptor)) { BasicManager()->ShadowLayerManager::DestroySharedSurface(&mFrontBufferDescriptor, mAllocator); @@ -2525,18 +2518,13 @@ private: // Then when we Swap() back/front buffers, we can return these // parameters to our partner (adjusted as needed). nsIntRegion mOldValidRegion; - float mOldXResolution; - float mOldYResolution; }; void BasicShadowThebesLayer::SetFrontBuffer(const OptionalThebesBuffer& aNewFront, - const nsIntRegion& aValidRegion, - float aXResolution, float aYResolution) + const nsIntRegion& aValidRegion) { mValidRegion = mOldValidRegion = aValidRegion; - mXResolution = mOldXResolution = aXResolution; - mYResolution = mOldYResolution = aYResolution; NS_ABORT_IF_FALSE(OptionalThebesBuffer::Tnull_t != aNewFront.type(), "aNewFront must be valid here!"); @@ -2558,7 +2546,6 @@ BasicShadowThebesLayer::Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion, ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion, - float* aNewXResolution, float* aNewYResolution, OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion) { @@ -2566,25 +2553,7 @@ BasicShadowThebesLayer::Swap(const ThebesBuffer& aNewFront, aNewBack->buffer() = mFrontBufferDescriptor; // We have to invalidate the pixels painted into the new buffer. // They might overlap with our old pixels. - if (mOldXResolution == mXResolution && mOldYResolution == mYResolution) { - aNewBackValidRegion->Sub(mOldValidRegion, aUpdatedRegion); - } else { - // On resolution changes, pretend that our buffer has the new - // resolution, but just has no valid content. This can avoid - // unnecessary buffer reallocs. - // - // FIXME/bug 598866: when we start re-using buffers after - // resolution changes, we're going to need to implement - // front->back copies to avoid thrashing our valid region by - // always nullifying it. - aNewBackValidRegion->SetEmpty(); - mOldXResolution = mXResolution; - mOldYResolution = mYResolution; - } - NS_ASSERTION(mXResolution == mOldXResolution && mYResolution == mOldYResolution, - "Uh-oh, buffer allocation thrash forthcoming!"); - *aNewXResolution = mXResolution; - *aNewYResolution = mYResolution; + aNewBackValidRegion->Sub(mOldValidRegion, aUpdatedRegion); nsRefPtr newFrontBuffer = BasicManager()->OpenDescriptor(aNewFront.buffer()); @@ -3077,8 +3046,7 @@ BasicShadowLayerManager::ForwardTransaction() const OpThebesBufferSwap& obs = reply.get_OpThebesBufferSwap(); BasicShadowableThebesLayer* thebes = GetBasicShadowable(obs)->AsThebes(); thebes->SetBackBufferAndAttrs( - obs.newBackBuffer(), - obs.newValidRegion(), obs.newXResolution(), obs.newYResolution(), + obs.newBackBuffer(), obs.newValidRegion(), obs.readOnlyFrontBuffer(), obs.frontUpdatedRegion()); break; } diff --git a/gfx/layers/basic/BasicLayers.h b/gfx/layers/basic/BasicLayers.h index 2704b9c30bf..a883eea8492 100644 --- a/gfx/layers/basic/BasicLayers.h +++ b/gfx/layers/basic/BasicLayers.h @@ -115,21 +115,6 @@ public: void SetDefaultTarget(gfxContext* aContext, BufferMode aDoubleBuffering); gfxContext* GetDefaultTarget() { return mDefaultTarget; } - /** - * Set a target resolution for managed layers that are scalable. It - * might make sense to call this outside of a transaction, but - * currently it's only allowed during the construction phase of - * transactions. - */ - void SetResolution(float aXResolution, float aYResolution) - { - NS_ASSERTION(InConstruction(), "resolution must be set before drawing"); - mXResolution = aXResolution; - mYResolution = aYResolution; - } - float XResolution() const { return mXResolution; } - float YResolution() const { return mYResolution; } - nsIWidget* GetRetainerWidget() { return mWidget; } void ClearRetainerWidget() { mWidget = nsnull; } @@ -212,10 +197,6 @@ protected: bool EndTransactionInternal(DrawThebesLayerCallback aCallback, void* aCallbackData); - // Target resolution for scalable content. - float mXResolution; - float mYResolution; - // Widget whose surface should be used as the basis for ThebesLayer // buffers. nsIWidget* mWidget; diff --git a/gfx/layers/d3d10/CanvasLayerD3D10.cpp b/gfx/layers/d3d10/CanvasLayerD3D10.cpp index 8967a0e81bf..64485c5d433 100644 --- a/gfx/layers/d3d10/CanvasLayerD3D10.cpp +++ b/gfx/layers/d3d10/CanvasLayerD3D10.cpp @@ -42,6 +42,8 @@ #include "gfxWindowsSurface.h" #include "gfxWindowsPlatform.h" +using namespace mozilla::gfx; + namespace mozilla { namespace layers { @@ -56,8 +58,8 @@ CanvasLayerD3D10::Initialize(const Data& aData) if (aData.mSurface) { mSurface = aData.mSurface; - NS_ASSERTION(aData.mGLContext == nsnull, - "CanvasLayer can't have both surface and GLContext"); + NS_ASSERTION(aData.mGLContext == nsnull && !aData.mDrawTarget, + "CanvasLayer can't have both surface and GLContext/DrawTarget"); mNeedsYFlip = PR_FALSE; mDataIsPremultiplied = PR_TRUE; } else if (aData.mGLContext) { @@ -66,8 +68,29 @@ CanvasLayerD3D10::Initialize(const Data& aData) mCanvasFramebuffer = mGLContext->GetOffscreenFBO(); mDataIsPremultiplied = aData.mGLBufferIsPremultiplied; mNeedsYFlip = PR_TRUE; + } else if (aData.mDrawTarget) { + mDrawTarget = aData.mDrawTarget; + void *texture = mDrawTarget->GetNativeSurface(NATIVE_SURFACE_D3D10_TEXTURE); + + if (!texture) { + // XXX - Once we have non-D2D drawtargets we should do something more sensible here. + NS_WARNING("Failed to get D3D10 texture from DrawTarget."); + return; + } + + mTexture = static_cast(texture); + + NS_ASSERTION(aData.mGLContext == nsnull && aData.mSurface == nsnull, + "CanvasLayer can't have both surface and GLContext/Surface"); + + mNeedsYFlip = PR_FALSE; + mDataIsPremultiplied = PR_TRUE; + + mBounds.SetRect(0, 0, aData.mSize.width, aData.mSize.height); + device()->CreateShaderResourceView(mTexture, NULL, getter_AddRefs(mSRView)); + return; } else { - NS_ERROR("CanvasLayer created without mSurface or mGLContext?"); + NS_ERROR("CanvasLayer created without mSurface, mDrawTarget or mGLContext?"); } mBounds.SetRect(0, 0, aData.mSize.width, aData.mSize.height); @@ -116,6 +139,11 @@ CanvasLayerD3D10::UpdateSurface() return; mDirty = PR_FALSE; + if (mDrawTarget) { + mDrawTarget->Flush(); + return; + } + if (mIsD2DTexture) { mSurface->Flush(); return; diff --git a/gfx/layers/d3d10/CanvasLayerD3D10.h b/gfx/layers/d3d10/CanvasLayerD3D10.h index 758296e8f06..d76eb69ffcd 100644 --- a/gfx/layers/d3d10/CanvasLayerD3D10.h +++ b/gfx/layers/d3d10/CanvasLayerD3D10.h @@ -75,6 +75,7 @@ private: void UpdateSurface(); nsRefPtr mSurface; + mozilla::RefPtr mDrawTarget; nsRefPtr mGLContext; nsRefPtr mTexture; nsRefPtr mSRView; diff --git a/gfx/layers/d3d10/LayerManagerD3D10.cpp b/gfx/layers/d3d10/LayerManagerD3D10.cpp index c7a25a67acc..4315b930d5f 100644 --- a/gfx/layers/d3d10/LayerManagerD3D10.cpp +++ b/gfx/layers/d3d10/LayerManagerD3D10.cpp @@ -54,6 +54,8 @@ #include "gfxCrashReporterUtils.h" +using namespace mozilla::gfx; + namespace mozilla { namespace layers { @@ -427,6 +429,38 @@ LayerManagerD3D10::CreateOptimalSurface(const gfxIntSize &aSize, return surface.forget(); } +TemporaryRef +LayerManagerD3D10::CreateDrawTarget(const IntSize &aSize, + SurfaceFormat aFormat) +{ + if ((aFormat != FORMAT_B8G8R8A8 && + aFormat != FORMAT_B8G8R8X8)) { + return LayerManager::CreateDrawTarget(aSize, aFormat); + } + + nsRefPtr texture; + + CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aSize.width, aSize.height, 1, 1); + desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; + desc.MiscFlags = D3D10_RESOURCE_MISC_GDI_COMPATIBLE; + + HRESULT hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(texture)); + + if (FAILED(hr)) { + NS_WARNING("Failed to create new texture for CreateOptimalSurface!"); + return LayerManager::CreateDrawTarget(aSize, aFormat); + } + + RefPtr surface = + Factory::CreateDrawTargetForD3D10Texture(texture, aFormat); + + if (!surface) { + return LayerManager::CreateDrawTarget(aSize, aFormat); + } + + return surface; +} + ReadbackManagerD3D10* LayerManagerD3D10::readbackManager() { diff --git a/gfx/layers/d3d10/LayerManagerD3D10.h b/gfx/layers/d3d10/LayerManagerD3D10.h index 6c54e6624a9..26f421d351b 100644 --- a/gfx/layers/d3d10/LayerManagerD3D10.h +++ b/gfx/layers/d3d10/LayerManagerD3D10.h @@ -133,6 +133,10 @@ public: CreateOptimalSurface(const gfxIntSize &aSize, gfxASurface::gfxImageFormat imageFormat); + virtual TemporaryRef + CreateDrawTarget(const mozilla::gfx::IntSize &aSize, + mozilla::gfx::SurfaceFormat aFormat); + virtual LayersBackend GetBackendType() { return LAYERS_D3D10; } virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Direct3D 10"); } diff --git a/gfx/layers/d3d10/ThebesLayerD3D10.cpp b/gfx/layers/d3d10/ThebesLayerD3D10.cpp index 3cc0c77ae51..19abe6dabd4 100644 --- a/gfx/layers/d3d10/ThebesLayerD3D10.cpp +++ b/gfx/layers/d3d10/ThebesLayerD3D10.cpp @@ -79,8 +79,7 @@ ThebesLayerD3D10::InvalidateRegion(const nsIntRegion &aRegion) void ThebesLayerD3D10::CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcOffset, ID3D10Texture2D* aDest, const nsIntPoint &aDestOffset, - const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion, - float aXRes, float aYRes) + const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion) { nsIntRegion retainedRegion; nsIntRegionRectIterator iter(aCopyRegion); @@ -88,19 +87,18 @@ void ThebesLayerD3D10::CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcO while ((r = iter.Next())) { if (r->width * r->height > RETENTION_THRESHOLD) { // Calculate the retained rectangle's position on the old and the new - // surface. We need to scale these rectangles since the visible - // region is in unscaled units, and the texture size has been scaled. + // surface. D3D10_BOX box; - box.left = UINT(floor((r->x - aSrcOffset.x) * aXRes)); - box.top = UINT(floor((r->y - aSrcOffset.y) * aYRes)); - box.right = box.left + UINT(ceil(r->width * aXRes)); - box.bottom = box.top + UINT(ceil(r->height * aYRes)); + box.left = r->x - aSrcOffset.x; + box.top = r->y - aSrcOffset.y; + box.right = box.left + r->width; + box.bottom = box.top + r->height; box.back = 1; box.front = 0; device()->CopySubresourceRegion(aDest, 0, - UINT(floor((r->x - aDestOffset.x) * aXRes)), - UINT(floor((r->y - aDestOffset.y) * aYRes)), + r->x - aDestOffset.x, + r->y - aDestOffset.y, 0, aSrc, 0, &box); @@ -212,15 +210,6 @@ ThebesLayerD3D10::Validate(ReadbackProcessor *aReadback) VerifyContentType(mode); - float xres, yres; - GetDesiredResolutions(xres, yres); - - // If our resolution changed, we need new sized textures, delete the old ones. - if (ResolutionChanged(xres, yres)) { - mTexture = nsnull; - mTextureOnWhite = nsnull; - } - nsTArray readbackUpdates; nsIntRegion readbackRegion; if (aReadback && UsedForReadback()) { @@ -245,27 +234,23 @@ ThebesLayerD3D10::Validate(ReadbackProcessor *aReadback) nsIntRect largeRect = retainRegion.GetLargestRectangle(); - // If we had no hardware texture before, have no retained area larger than - // the retention threshold or the requested resolution has changed, - // we're not retaining and are done here. If our texture creation failed - // this can mean a device reset is pending and we should silently ignore the - // failure. In the future when device failures are properly handled we - // should test for the type of failure and gracefully handle different - // failures. See bug 569081. + // If we had no hardware texture before, or have no retained area larger than + // the retention threshold, we're not retaining and are done here. + // If our texture creation failed this can mean a device reset is pending + // and we should silently ignore the failure. In the future when device + // failures are properly handled we should test for the type of failure + // and gracefully handle different failures. See bug 569081. if (!oldTexture || !mTexture || - largeRect.width * largeRect.height < RETENTION_THRESHOLD || - ResolutionChanged(xres, yres)) { + largeRect.width * largeRect.height < RETENTION_THRESHOLD) { mValidRegion.SetEmpty(); } else { CopyRegion(oldTexture, mTextureRect.TopLeft(), mTexture, newTextureRect.TopLeft(), - retainRegion, &mValidRegion, - xres, yres); + retainRegion, &mValidRegion); if (oldTextureOnWhite) { CopyRegion(oldTextureOnWhite, mTextureRect.TopLeft(), mTextureOnWhite, newTextureRect.TopLeft(), - retainRegion, &mValidRegion, - xres, yres); + retainRegion, &mValidRegion); } } } @@ -353,11 +338,9 @@ ThebesLayerD3D10::VerifyContentType(SurfaceMode aMode) static void FillSurface(gfxASurface* aSurface, const nsIntRegion& aRegion, - const nsIntPoint& aOffset, const gfxRGBA& aColor, - float aXRes, float aYRes) + const nsIntPoint& aOffset, const gfxRGBA& aColor) { nsRefPtr ctx = new gfxContext(aSurface); - ctx->Scale(aXRes, aYRes); ctx->Translate(-gfxPoint(aOffset.x, aOffset.y)); gfxUtils::PathFromRegion(ctx, aRegion); ctx->SetColor(aColor); @@ -373,15 +356,11 @@ ThebesLayerD3D10::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode) return; } - float xres, yres; - GetDesiredResolutions(xres, yres); - aRegion.ExtendForScaling(xres, yres); - nsRefPtr destinationSurface; if (aMode == SURFACE_COMPONENT_ALPHA) { - FillSurface(mD2DSurface, aRegion, visibleRect.TopLeft(), gfxRGBA(0.0, 0.0, 0.0, 1.0), xres, yres); - FillSurface(mD2DSurfaceOnWhite, aRegion, visibleRect.TopLeft(), gfxRGBA(1.0, 1.0, 1.0, 1.0), xres, yres); + FillSurface(mD2DSurface, aRegion, visibleRect.TopLeft(), gfxRGBA(0.0, 0.0, 0.0, 1.0)); + FillSurface(mD2DSurfaceOnWhite, aRegion, visibleRect.TopLeft(), gfxRGBA(1.0, 1.0, 1.0, 1.0)); gfxASurface* surfaces[2] = { mD2DSurface.get(), mD2DSurfaceOnWhite.get() }; destinationSurface = new gfxTeeSurface(surfaces, NS_ARRAY_LENGTH(surfaces)); // Using this surface as a source will likely go horribly wrong, since @@ -393,8 +372,6 @@ ThebesLayerD3D10::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode) } nsRefPtr context = new gfxContext(destinationSurface); - // Draw content scaled at our current resolution. - context->Scale(xres, yres); nsIntRegionRectIterator iter(aRegion); context->Translate(gfxPoint(-visibleRect.x, -visibleRect.y)); @@ -425,15 +402,7 @@ ThebesLayerD3D10::CreateNewTextures(const gfxIntSize &aSize, SurfaceMode aMode) return; } - // Scale the requested size (in unscaled units) to the actual - // texture size we require. - gfxIntSize scaledSize; - float xres, yres; - GetDesiredResolutions(xres, yres); - scaledSize.width = PRInt32(ceil(aSize.width * xres)); - scaledSize.height = PRInt32(ceil(aSize.height * yres)); - - CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, scaledSize.width, scaledSize.height, 1, 1); + CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aSize.width, aSize.height, 1, 1); desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; desc.MiscFlags = D3D10_RESOURCE_MISC_GDI_COMPATIBLE; HRESULT hr; @@ -485,32 +454,6 @@ ThebesLayerD3D10::CreateNewTextures(const gfxIntSize &aSize, SurfaceMode aMode) return; } } - - mXResolution = xres; - mYResolution = yres; -} - -void -ThebesLayerD3D10::GetDesiredResolutions(float& aXRes, float& aYRes) -{ - const gfx3DMatrix& transform = GetLayer()->GetEffectiveTransform(); - gfxMatrix transform2d; - if (transform.Is2D(&transform2d)) { - gfxSize scale = transform2d.ScaleFactors(PR_TRUE); - //Scale factors are normalized to a power of 2 to reduce the number of resolution changes - aXRes = gfxUtils::ClampToScaleFactor(scale.width); - aYRes = gfxUtils::ClampToScaleFactor(scale.height); - } else { - aXRes = 1.0; - aYRes = 1.0; - } -} - -bool -ThebesLayerD3D10::ResolutionChanged(float aXRes, float aYRes) -{ - return aXRes != mXResolution || - aYRes != mYResolution; } } /* namespace layers */ diff --git a/gfx/layers/d3d10/ThebesLayerD3D10.h b/gfx/layers/d3d10/ThebesLayerD3D10.h index c101c04f4a0..9e5aa93ccb8 100644 --- a/gfx/layers/d3d10/ThebesLayerD3D10.h +++ b/gfx/layers/d3d10/ThebesLayerD3D10.h @@ -99,18 +99,7 @@ private: /* Copy a texture region */ void CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcOffset, ID3D10Texture2D* aDest, const nsIntPoint &aDestOffset, - const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion, - float aXRes, float aYRes); - - /** - * Calculate the desired texture resolution based on - * the layer managers resolution, and the current - * transforms scale factor. - */ - void GetDesiredResolutions(float& aXRes, float& aYRes); - - /* Check if the current texture resolution matches the stored resolution. */ - bool ResolutionChanged(float aXRes, float aYRes); + const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion); }; } /* layers */ diff --git a/gfx/layers/d3d9/ThebesLayerD3D9.cpp b/gfx/layers/d3d9/ThebesLayerD3D9.cpp index c679c48032d..3dc2e310129 100644 --- a/gfx/layers/d3d9/ThebesLayerD3D9.cpp +++ b/gfx/layers/d3d9/ThebesLayerD3D9.cpp @@ -77,8 +77,7 @@ ThebesLayerD3D9::InvalidateRegion(const nsIntRegion &aRegion) void ThebesLayerD3D9::CopyRegion(IDirect3DTexture9* aSrc, const nsIntPoint &aSrcOffset, IDirect3DTexture9* aDest, const nsIntPoint &aDestOffset, - const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion, - float aXRes, float aYRes) + const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion) { nsRefPtr srcSurface, dstSurface; aSrc->GetSurfaceLevel(0, getter_AddRefs(srcSurface)); @@ -92,17 +91,16 @@ ThebesLayerD3D9::CopyRegion(IDirect3DTexture9* aSrc, const nsIntPoint &aSrcOffse RECT oldRect, newRect; // Calculate the retained rectangle's position on the old and the new - // surface. We need to scale these rectangles since the visible - // region is in unscaled units, and the texture size has been scaled. - oldRect.left = UINT(floor((r->x - aSrcOffset.x) * aXRes)); - oldRect.top = UINT(floor((r->y - aSrcOffset.y) * aYRes)); - oldRect.right = oldRect.left + UINT(ceil(r->width * aXRes)); - oldRect.bottom = oldRect.top + UINT(ceil(r->height * aYRes)); + // surface. + oldRect.left = r->x - aSrcOffset.x; + oldRect.top = r->y - aSrcOffset.y; + oldRect.right = oldRect.left + r->width; + oldRect.bottom = oldRect.top + r->height; - newRect.left = UINT(floor((r->x - aDestOffset.x) * aXRes)); - newRect.top = UINT(floor((r->y - aDestOffset.y) * aYRes)); - newRect.right = newRect.left + UINT(ceil(r->width * aXRes)); - newRect.bottom = newRect.top + UINT(ceil(r->height * aYRes)); + newRect.left = r->x - aDestOffset.x; + newRect.top = r->y - aDestOffset.y; + newRect.right = newRect.left + r->width; + newRect.bottom = newRect.top + r->height; // Copy data from our old texture to the new one HRESULT hr = device()-> @@ -128,15 +126,6 @@ ThebesLayerD3D9::UpdateTextures(SurfaceMode aMode) { nsIntRect visibleRect = mVisibleRegion.GetBounds(); - float xres, yres; - GetDesiredResolutions(xres, yres); - - // If our resolution changed, we need new sized textures, delete the old ones. - if (ResolutionChanged(xres, yres)) { - mTexture = nsnull; - mTextureOnWhite = nsnull; - } - if (HaveTextures(aMode)) { if (!mTextureRect.IsEqualInterior(visibleRect)) { nsRefPtr oldTexture = mTexture; @@ -159,10 +148,10 @@ ThebesLayerD3D9::UpdateTextures(SurfaceMode aMode) mValidRegion.SetEmpty(); } else { CopyRegion(oldTexture, mTextureRect.TopLeft(), mTexture, visibleRect.TopLeft(), - retainRegion, &mValidRegion, xres, yres); + retainRegion, &mValidRegion); if (aMode == SURFACE_COMPONENT_ALPHA) { CopyRegion(oldTextureOnWhite, mTextureRect.TopLeft(), mTextureOnWhite, visibleRect.TopLeft(), - retainRegion, &mValidRegion, xres, yres); + retainRegion, &mValidRegion); } } @@ -369,7 +358,7 @@ public: OpaqueRenderer(const nsIntRegion& aUpdateRegion) : mUpdateRegion(aUpdateRegion), mDC(NULL) {} ~OpaqueRenderer() { End(); } - already_AddRefed Begin(LayerD3D9* aLayer, float aXRes, float aYRes); + already_AddRefed Begin(LayerD3D9* aLayer); void End(); IDirect3DTexture9* GetTexture() { return mTmpTexture; } @@ -381,15 +370,12 @@ private: }; already_AddRefed -OpaqueRenderer::Begin(LayerD3D9* aLayer, float aXRes, float aYRes) +OpaqueRenderer::Begin(LayerD3D9* aLayer) { nsIntRect bounds = mUpdateRegion.GetBounds(); - gfxIntSize scaledSize; - scaledSize.width = PRInt32(ceil(bounds.width * aXRes)); - scaledSize.height = PRInt32(ceil(bounds.height * aYRes)); HRESULT hr = aLayer->device()-> - CreateTexture(scaledSize.width, scaledSize.height, 1, 0, D3DFMT_X8R8G8B8, + CreateTexture(bounds.width, bounds.height, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, getter_AddRefs(mTmpTexture), NULL); if (FAILED(hr)) { @@ -427,11 +413,9 @@ OpaqueRenderer::End() static void FillSurface(gfxASurface* aSurface, const nsIntRegion& aRegion, - const nsIntPoint& aOffset, const gfxRGBA& aColor, - float aXRes, float aYRes) + const nsIntPoint& aOffset, const gfxRGBA& aColor) { nsRefPtr ctx = new gfxContext(aSurface); - ctx->Scale(aXRes, aYRes); ctx->Translate(-gfxPoint(aOffset.x, aOffset.y)); gfxUtils::ClipToRegion(ctx, aRegion); ctx->SetColor(aColor); @@ -444,14 +428,9 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, { HRESULT hr; nsIntRect visibleRect = mVisibleRegion.GetBounds(); - float xres, yres; - GetDesiredResolutions(xres, yres); nsRefPtr destinationSurface; nsIntRect bounds = aRegion.GetBounds(); - gfxIntSize scaledSize; - scaledSize.width = PRInt32(ceil(bounds.width * xres)); - scaledSize.height = PRInt32(ceil(bounds.height * yres)); nsRefPtr tmpTexture; OpaqueRenderer opaqueRenderer(aRegion); OpaqueRenderer opaqueRendererOnWhite(aRegion); @@ -459,11 +438,11 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, switch (aMode) { case SURFACE_OPAQUE: - destinationSurface = opaqueRenderer.Begin(this, xres, yres); + destinationSurface = opaqueRenderer.Begin(this); break; case SURFACE_SINGLE_CHANNEL_ALPHA: { - hr = device()->CreateTexture(scaledSize.width, scaledSize.height, 1, + hr = device()->CreateTexture(bounds.width, bounds.height, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, getter_AddRefs(tmpTexture), NULL); @@ -476,7 +455,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, // of our DEFAULT texture and then use UpdateTexture and add dirty rects // to update in a single call. nsRefPtr dest = new gfxWindowsSurface( - gfxIntSize(scaledSize.width, scaledSize.height), gfxASurface::ImageFormatARGB32); + gfxIntSize(bounds.width, bounds.height), gfxASurface::ImageFormatARGB32); // If the contents of this layer don't require component alpha in the // end of rendering, it's safe to enable Cleartype since all the Cleartype // glyphs must be over (or under) opaque pixels. @@ -486,11 +465,11 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, } case SURFACE_COMPONENT_ALPHA: { - nsRefPtr onBlack = opaqueRenderer.Begin(this, xres, yres); - nsRefPtr onWhite = opaqueRendererOnWhite.Begin(this, xres, yres); + nsRefPtr onBlack = opaqueRenderer.Begin(this); + nsRefPtr onWhite = opaqueRendererOnWhite.Begin(this); if (onBlack && onWhite) { - FillSurface(onBlack, aRegion, bounds.TopLeft(), gfxRGBA(0.0, 0.0, 0.0, 1.0), xres, yres); - FillSurface(onWhite, aRegion, bounds.TopLeft(), gfxRGBA(1.0, 1.0, 1.0, 1.0), xres, yres); + FillSurface(onBlack, aRegion, bounds.TopLeft(), gfxRGBA(0.0, 0.0, 0.0, 1.0)); + FillSurface(onWhite, aRegion, bounds.TopLeft(), gfxRGBA(1.0, 1.0, 1.0, 1.0)); gfxASurface* surfaces[2] = { onBlack.get(), onWhite.get() }; destinationSurface = new gfxTeeSurface(surfaces, NS_ARRAY_LENGTH(surfaces)); // Using this surface as a source will likely go horribly wrong, since @@ -506,10 +485,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, return; nsRefPtr context = new gfxContext(destinationSurface); - // Draw content scaled at our current resolution. - context->Scale(xres, yres); context->Translate(gfxPoint(-bounds.x, -bounds.y)); - aRegion.ExtendForScaling(xres, yres); LayerManagerD3D9::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo(); cbInfo.Callback(this, context, aRegion, nsIntRegion(), cbInfo.CallbackData); @@ -545,7 +521,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, nsRefPtr imgSurface = new gfxImageSurface((unsigned char *)r.pBits, - scaledSize, + bounds.Size(), r.Pitch, gfxASurface::ImageFormatARGB32); @@ -577,8 +553,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, } NS_ASSERTION(srcTextures.Length() == destTextures.Length(), "Mismatched lengths"); - // Copy to the texture. We need to scale these rectangles since the visible - // region is in unscaled units, and the texture sizes have been scaled. + // Copy to the texture. for (PRUint32 i = 0; i < srcTextures.Length(); ++i) { nsRefPtr srcSurface; nsRefPtr dstSurface; @@ -590,16 +565,14 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, const nsIntRect *iterRect; while ((iterRect = iter.Next())) { RECT rect; - rect.left = NS_MAX(0, LONG(floor((iterRect->x - bounds.x) * xres))); - rect.top = NS_MAX(0, LONG(floor((iterRect->y - bounds.y) * yres))); - rect.right = NS_MIN(scaledSize.width, - LONG(ceil((iterRect->XMost() - bounds.x) * xres))); - rect.bottom = NS_MIN(scaledSize.height, - LONG(ceil((iterRect->YMost() - bounds.y) * yres))); + rect.left = iterRect->x - bounds.x; + rect.top = iterRect->y - bounds.y; + rect.right = iterRect->XMost() - bounds.x; + rect.bottom = iterRect->YMost() - bounds.y; POINT point; - point.x = NS_MAX(0, LONG(floor((iterRect->x - visibleRect.x) * xres))); - point.y = NS_MAX(0, LONG(floor((iterRect->y - visibleRect.y) * yres))); + point.x = iterRect->x - visibleRect.x; + point.y = iterRect->y - visibleRect.y; device()->UpdateSurface(srcSurface, &rect, dstSurface, &point); } } @@ -614,52 +587,18 @@ ThebesLayerD3D9::CreateNewTextures(const gfxIntSize &aSize, return; } - // Scale the requested size (in unscaled units) to the actual - // texture size we require. - gfxIntSize scaledSize; - float xres, yres; - GetDesiredResolutions(xres, yres); - scaledSize.width = PRInt32(ceil(aSize.width * xres)); - scaledSize.height = PRInt32(ceil(aSize.height * yres)); - mTexture = nsnull; mTextureOnWhite = nsnull; - device()->CreateTexture(scaledSize.width, scaledSize.height, 1, + device()->CreateTexture(aSize.width, aSize.height, 1, D3DUSAGE_RENDERTARGET, aMode != SURFACE_SINGLE_CHANNEL_ALPHA ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, getter_AddRefs(mTexture), NULL); if (aMode == SURFACE_COMPONENT_ALPHA) { - device()->CreateTexture(scaledSize.width, scaledSize.height, 1, + device()->CreateTexture(aSize.width, aSize.height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, getter_AddRefs(mTextureOnWhite), NULL); } - - mXResolution = xres; - mYResolution = yres; -} - -void -ThebesLayerD3D9::GetDesiredResolutions(float& aXRes, float& aYRes) -{ - const gfx3DMatrix& transform = GetLayer()->GetEffectiveTransform(); - gfxMatrix transform2d; - if (transform.Is2D(&transform2d)) { - //Scale factors are normalized to a power of 2 to reduce the number of resolution changes - gfxSize scale = transform2d.ScaleFactors(PR_TRUE); - aXRes = gfxUtils::ClampToScaleFactor(scale.width); - aYRes = gfxUtils::ClampToScaleFactor(scale.height); - } else { - aXRes = 1.0; - aYRes = 1.0; - } -} - -bool -ThebesLayerD3D9::ResolutionChanged(float aXRes, float aYRes) -{ - return aXRes != mXResolution || - aYRes != mYResolution; } } /* namespace layers */ diff --git a/gfx/layers/d3d9/ThebesLayerD3D9.h b/gfx/layers/d3d9/ThebesLayerD3D9.h index baa470097c2..9bbf1257f2c 100644 --- a/gfx/layers/d3d9/ThebesLayerD3D9.h +++ b/gfx/layers/d3d9/ThebesLayerD3D9.h @@ -109,18 +109,7 @@ private: void CopyRegion(IDirect3DTexture9* aSrc, const nsIntPoint &aSrcOffset, IDirect3DTexture9* aDest, const nsIntPoint &aDestOffset, - const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion, - float aXRes, float aYRes); - - /** - * Calculate the desired texture resolution based on - * the layer managers resolution, and the current - * transforms scale factor. - */ - void GetDesiredResolutions(float& aXRes, float& aYRes); - - /* Check if the current texture resolution matches */ - bool ResolutionChanged(float aXRes, float aYRes); + const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion); }; } /* layers */ diff --git a/gfx/layers/ipc/PLayers.ipdl b/gfx/layers/ipc/PLayers.ipdl index 4fe4c5a9b58..fecaf456836 100644 --- a/gfx/layers/ipc/PLayers.ipdl +++ b/gfx/layers/ipc/PLayers.ipdl @@ -105,8 +105,6 @@ struct OpCreateThebesBuffer { PLayer layer; OptionalThebesBuffer initialFront; nsIntRegion frontValidRegion; - float xResolution; - float yResolution; }; struct OpDestroyThebesFrontBuffer { PLayer layer; }; @@ -141,8 +139,6 @@ struct CommonLayerAttributes { struct ThebesLayerAttributes { nsIntRegion validRegion; - float xResolution; - float yResolution; }; struct ContainerLayerAttributes{ FrameMetrics metrics; }; struct ColorLayerAttributes { gfxRGBA color; }; @@ -230,8 +226,6 @@ struct OpThebesBufferSwap { PLayer layer; ThebesBuffer newBackBuffer; nsIntRegion newValidRegion; - float newXResolution; - float newYResolution; // If the parent took the child's old back buffer and returned its // old front buffer, |readOnlyFrontBuffer| may (if non-null) contain // the child's old back buffer (parent's new front buffer). This diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index 6e0f3112290..63a172956be 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -186,8 +186,6 @@ ShadowLayerForwarder::CreatedCanvasLayer(ShadowableLayer* aCanvas) void ShadowLayerForwarder::CreatedThebesBuffer(ShadowableLayer* aThebes, const nsIntRegion& aFrontValidRegion, - float aXResolution, - float aYResolution, const nsIntRect& aBufferRect, const SurfaceDescriptor& aTempFrontBuffer) { @@ -199,9 +197,7 @@ ShadowLayerForwarder::CreatedThebesBuffer(ShadowableLayer* aThebes, } mTxn->AddEdit(OpCreateThebesBuffer(NULL, Shadow(aThebes), buffer, - aFrontValidRegion, - aXResolution, - aYResolution)); + aFrontValidRegion)); } void diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index 7cb80fd3493..f42b83bb011 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -157,7 +157,6 @@ public: */ void CreatedThebesBuffer(ShadowableLayer* aThebes, const nsIntRegion& aFrontValidRegion, - float aXResolution, float aYResolution, const nsIntRect& aBufferRect, const SurfaceDescriptor& aInitialFrontBuffer); /** @@ -494,8 +493,7 @@ public: * values. This is called when a new buffer has been created. */ virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront, - const nsIntRegion& aValidRegion, - float aXResolution, float aYResolution) = 0; + const nsIntRegion& aValidRegion) = 0; virtual void InvalidateRegion(const nsIntRegion& aRegion) { @@ -511,16 +509,6 @@ public: Mutated(); } - /** - * CONSTRUCTION PHASE ONLY - */ - virtual void SetResolution(float aXResolution, float aYResolution) - { - mXResolution = aXResolution; - mYResolution = aYResolution; - Mutated(); - } - /** * CONSTRUCTION PHASE ONLY * @@ -531,7 +519,6 @@ public: virtual void Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion, ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion, - float* aNewXResolution, float* aNewYResolution, OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion) = 0; /** diff --git a/gfx/layers/ipc/ShadowLayersParent.cpp b/gfx/layers/ipc/ShadowLayersParent.cpp index 4d67499e0b8..71609b80d01 100644 --- a/gfx/layers/ipc/ShadowLayersParent.cpp +++ b/gfx/layers/ipc/ShadowLayersParent.cpp @@ -211,8 +211,7 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray& cset, ShadowThebesLayer* thebes = static_cast( AsShadowLayer(otb)->AsLayer()); - thebes->SetFrontBuffer(otb.initialFront(), otb.frontValidRegion(), - otb.xResolution(), otb.yResolution()); + thebes->SetFrontBuffer(otb.initialFront(), otb.frontValidRegion()); break; } @@ -310,7 +309,6 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray& cset, specific.get_ThebesLayerAttributes(); thebesLayer->SetValidRegion(attrs.validRegion()); - thebesLayer->SetResolution(attrs.xResolution(), attrs.yResolution()); break; } @@ -391,16 +389,15 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray& cset, ThebesBuffer newBack; nsIntRegion newValidRegion; - float newXResolution, newYResolution; OptionalThebesBuffer readonlyFront; nsIntRegion frontUpdatedRegion; thebes->Swap(newFront, op.updatedRegion(), - &newBack, &newValidRegion, &newXResolution, &newYResolution, + &newBack, &newValidRegion, &readonlyFront, &frontUpdatedRegion); replyv.push_back( OpThebesBufferSwap( shadow, NULL, - newBack, newValidRegion, newXResolution, newYResolution, + newBack, newValidRegion, readonlyFront, frontUpdatedRegion)); break; } diff --git a/gfx/layers/opengl/LayerManagerOGL.cpp b/gfx/layers/opengl/LayerManagerOGL.cpp index b7a8a4c0b0e..cda64702b76 100644 --- a/gfx/layers/opengl/LayerManagerOGL.cpp +++ b/gfx/layers/opengl/LayerManagerOGL.cpp @@ -538,6 +538,8 @@ LayerManagerOGL::RootLayer() const return static_cast(mRoot->ImplData()); } +/* This function tries to stick to portable C89 as much as possible + * so that it can be easily copied into other applications */ void LayerManagerOGL::FPSState::DrawFPS(GLContext* context, CopyProgram* copyprog) { @@ -573,13 +575,18 @@ LayerManagerOGL::FPSState::DrawFPS(GLContext* context, CopyProgram* copyprog) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - unsigned long* buf = (unsigned long*)malloc(64 * 8 * 4); + // convert from 8 bit to 32 bit so that don't have to write the text above out in 32 bit format + // we rely on int being 32 bits + unsigned int* buf = (unsigned int*)malloc(64 * 8 * 4); for (int i = 0; i < 7; i++) { for (int j = 0; j < 41; j++) { - buf[i * 64 + j] = (text[i * 41 + j] == 0) ? 0xfff000ff : 0xffffffff; + unsigned int purple = 0xfff000ff; + unsigned int white = 0xffffffff; + buf[i * 64 + j] = (text[i * 41 + j] == 0) ? purple : white; } } context->fTexImage2D(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_RGBA, 64, 8, 0, LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, buf); + free(buf); initialized = true; } diff --git a/gfx/layers/opengl/ThebesLayerOGL.cpp b/gfx/layers/opengl/ThebesLayerOGL.cpp index 51c0f3937c7..a3b03677a09 100644 --- a/gfx/layers/opengl/ThebesLayerOGL.cpp +++ b/gfx/layers/opengl/ThebesLayerOGL.cpp @@ -171,8 +171,6 @@ public: enum { PAINT_WILL_RESAMPLE = ThebesLayerBuffer::PAINT_WILL_RESAMPLE }; virtual PaintState BeginPaint(ContentType aContentType, - float aXResolution, - float aYResolution, PRUint32 aFlags) = 0; void RenderTo(const nsIntPoint& aOffset, LayerManagerOGL* aManager, @@ -215,9 +213,6 @@ ThebesLayerBufferOGL::RenderTo(const nsIntPoint& aOffset, TextureImage::ScopedBindTexture texBind(mTexImage, LOCAL_GL_TEXTURE0); TextureImage::ScopedBindTexture texOnWhiteBind(mTexImageOnWhite, LOCAL_GL_TEXTURE1); - float xres = mLayer->GetXResolution(); - float yres = mLayer->GetYResolution(); - PRInt32 passes = mTexImageOnWhite ? 2 : 1; for (PRInt32 pass = 1; pass <= passes; ++pass) { LayerProgram *program; @@ -274,12 +269,6 @@ ThebesLayerBufferOGL::RenderTo(const nsIntPoint& aOffset, quadRect.MoveBy(-GetOriginOffset()); - // The buffer rect and rotation are resolution-neutral; with a - // non-1.0 resolution, only the texture size is scaled by the - // resolution. So map the quadrent rect into the space scaled to - // the texture size and let GL do the rest. - quadRect.ScaleRoundOut(xres, yres); - BindAndDrawQuadWithTextureRect(gl(), program, quadRect, mTexImage->GetSize(), mTexImage->GetWrapMode()); @@ -312,15 +301,11 @@ public: // ThebesLayerBufferOGL interface virtual PaintState BeginPaint(ContentType aContentType, - float aXResolution, - float aYResolution, PRUint32 aFlags) { // Let ThebesLayerBuffer do all the hard work for us! :D return ThebesLayerBuffer::BeginPaint(mLayer, aContentType, - aXResolution, - aYResolution, aFlags); } @@ -356,8 +341,6 @@ public: virtual ~BasicBufferOGL() {} virtual PaintState BeginPaint(ContentType aContentType, - float aXResolution, - float aYResolution, PRUint32 aFlags); protected: @@ -410,42 +393,20 @@ FillSurface(gfxASurface* aSurface, const nsIntRegion& aRegion, ctx->Paint(); } -static nsIntSize -ScaledSize(const nsIntSize& aSize, float aXScale, float aYScale) -{ - if (aXScale == 1.0 && aYScale == 1.0) { - return aSize; - } - - nsIntRect rect(0, 0, aSize.width, aSize.height); - rect.ScaleRoundOut(aXScale, aYScale); - return rect.Size(); -} - BasicBufferOGL::PaintState BasicBufferOGL::BeginPaint(ContentType aContentType, - float aXResolution, - float aYResolution, PRUint32 aFlags) { PaintState result; - float curXRes = mLayer->GetXResolution(); - float curYRes = mLayer->GetYResolution(); - // If we have non-identity resolution then mBufferRotation might not fall - // on a buffer pixel boundary, in which case that row of pixels will contain - // a mix of two completely different rows of the layer, which would be - // a catastrophe. So disable rotation in that case. - // We also need to disable rotation if we're going to be resampled when + // We need to disable rotation if we're going to be resampled when // drawing, because we might sample across the rotation boundary. - PRBool canHaveRotation = - !(aFlags & PAINT_WILL_RESAMPLE) && aXResolution == 1.0 && aYResolution == 1.0; + PRBool canHaveRotation = !(aFlags & PAINT_WILL_RESAMPLE); nsIntRegion validRegion = mLayer->GetValidRegion(); Layer::SurfaceMode mode; ContentType contentType; nsIntRegion neededRegion; - nsIntSize destBufferDims; PRBool canReuseBuffer; nsIntRect destBufferRect; @@ -453,8 +414,6 @@ BasicBufferOGL::BeginPaint(ContentType aContentType, mode = mLayer->GetSurfaceMode(); contentType = aContentType; neededRegion = mLayer->GetVisibleRegion(); - destBufferDims = ScaledSize(neededRegion.GetBounds().Size(), - aXResolution, aYResolution); // If we're going to resample, we need a buffer that's in clamp mode. canReuseBuffer = neededRegion.GetBounds().Size() <= mBufferRect.Size() && mTexImage && @@ -499,23 +458,13 @@ BasicBufferOGL::BeginPaint(ContentType aContentType, // We need to validate the entire buffer, to make sure that only valid // pixels are sampled neededRegion = destBufferRect; - destBufferDims = ScaledSize(neededRegion.GetBounds().Size(), - aXResolution, aYResolution); } if (mTexImage && (mTexImage->GetContentType() != contentType || - aXResolution != curXRes || aYResolution != curYRes || (mode == Layer::SURFACE_COMPONENT_ALPHA) != (mTexImageOnWhite != nsnull))) { // We're effectively clearing the valid region, so we need to draw // the entire needed region now. - // - // XXX/cjones: a possibly worthwhile optimization to keep in mind - // is to re-use buffers when the resolution and visible region - // have changed in such a way that the buffer size stays the same. - // It might make even more sense to allocate buffers from a - // recyclable pool, so that we could keep this logic simple and - // still get back the same buffer. result.mRegionToInvalidate = mLayer->GetValidRegion(); validRegion.SetEmpty(); mTexImage = nsnull; @@ -534,8 +483,8 @@ BasicBufferOGL::BeginPaint(ContentType aContentType, if (result.mRegionToDraw.IsEmpty()) return result; - if (destBufferDims.width > gl()->GetMaxTextureSize() || - destBufferDims.height > gl()->GetMaxTextureSize()) { + if (destBufferRect.width > gl()->GetMaxTextureSize() || + destBufferRect.height > gl()->GetMaxTextureSize()) { return result; } @@ -545,9 +494,6 @@ BasicBufferOGL::BeginPaint(ContentType aContentType, PRUint32 bufferFlags = canHaveRotation ? ALLOW_REPEAT : 0; if (canReuseBuffer) { - NS_ASSERTION(curXRes == aXResolution && curYRes == aYResolution, - "resolution changes must clear the buffer!"); - nsIntRect keepArea; if (keepArea.IntersectRect(destBufferRect, mBufferRect)) { // Set mBufferRotation so that the pixels currently in mBuffer @@ -571,12 +517,12 @@ BasicBufferOGL::BeginPaint(ContentType aContentType, // We can't do a real self-copy because the buffer is rotated. // So allocate a new buffer for the destination. destBufferRect = neededRegion.GetBounds(); - destBuffer = CreateClampOrRepeatTextureImage(gl(), destBufferDims, contentType, bufferFlags); + destBuffer = CreateClampOrRepeatTextureImage(gl(), destBufferRect.Size(), contentType, bufferFlags); if (!destBuffer) return result; if (mode == Layer::SURFACE_COMPONENT_ALPHA) { destBufferOnWhite = - CreateClampOrRepeatTextureImage(gl(), destBufferDims, contentType, bufferFlags); + CreateClampOrRepeatTextureImage(gl(), destBufferRect.Size(), contentType, bufferFlags); if (!destBufferOnWhite) return result; } @@ -593,13 +539,13 @@ BasicBufferOGL::BeginPaint(ContentType aContentType, } } else { // The buffer's not big enough, so allocate a new one - destBuffer = CreateClampOrRepeatTextureImage(gl(), destBufferDims, contentType, bufferFlags); + destBuffer = CreateClampOrRepeatTextureImage(gl(), destBufferRect.Size(), contentType, bufferFlags); if (!destBuffer) return result; if (mode == Layer::SURFACE_COMPONENT_ALPHA) { destBufferOnWhite = - CreateClampOrRepeatTextureImage(gl(), destBufferDims, contentType, bufferFlags); + CreateClampOrRepeatTextureImage(gl(), destBufferRect.Size(), contentType, bufferFlags); if (!destBufferOnWhite) return result; } @@ -623,24 +569,21 @@ BasicBufferOGL::BeginPaint(ContentType aContentType, srcRect.MoveBy(- mBufferRect.TopLeft() + mBufferRotation); dstRect.MoveBy(- destBufferRect.TopLeft()); - nsIntSize size = ScaledSize(destBufferRect.Size(), aXResolution, aYResolution); - destBuffer->Resize(size); - srcRect.ScaleRoundOut(aXResolution, aYResolution); - dstRect.ScaleRoundOut(aXResolution, aYResolution); + destBuffer->Resize(destBufferRect.Size()); gl()->BlitTextureImage(mTexImage, srcRect, destBuffer, dstRect); if (mode == Layer::SURFACE_COMPONENT_ALPHA) { - destBufferOnWhite->Resize(size); + destBufferOnWhite->Resize(destBufferRect.Size()); gl()->BlitTextureImage(mTexImageOnWhite, srcRect, destBufferOnWhite, dstRect); } } else { // can't blit, just draw everything - destBuffer = CreateClampOrRepeatTextureImage(gl(), destBufferDims, contentType, bufferFlags); + destBuffer = CreateClampOrRepeatTextureImage(gl(), destBufferRect.Size(), contentType, bufferFlags); if (mode == Layer::SURFACE_COMPONENT_ALPHA) { destBufferOnWhite = - CreateClampOrRepeatTextureImage(gl(), destBufferDims, contentType, bufferFlags); + CreateClampOrRepeatTextureImage(gl(), destBufferRect.Size(), contentType, bufferFlags); } } } @@ -672,7 +615,6 @@ BasicBufferOGL::BeginPaint(ContentType aContentType, // Make the region to draw relative to the buffer, before // passing to BeginUpdate. result.mRegionToDraw.MoveBy(offset); - result.mRegionToDraw.ScaleRoundOut(aXResolution, aYResolution); // BeginUpdate is allowed to modify the given region, // if it wants more to be repainted than we request. if (mode == Layer::SURFACE_COMPONENT_ALPHA) { @@ -711,15 +653,10 @@ BasicBufferOGL::BeginPaint(ContentType aContentType, NS_WARNING("unable to get context for update"); return result; } - result.mContext->Scale(aXResolution, aYResolution); result.mContext->Translate(-gfxPoint(quadrantRect.x, quadrantRect.y)); // Move rgnToPaint back into position so that the thebes callback // gets the right coordintes. - result.mRegionToDraw.ScaleRoundOut(1/aXResolution, 1/aYResolution); result.mRegionToDraw.MoveBy(-offset); - // Round our region out to values that will scale cleanly by the given - // resolution. - result.mRegionToDraw.ExtendForScaling(aXResolution, aYResolution); return result; } @@ -795,15 +732,8 @@ ThebesLayerOGL::RenderLayer(int aPreviousFrameBuffer, gfxASurface::CONTENT_COLOR_ALPHA; gfxMatrix transform2d; - gfxSize scale(1.0, 1.0); - float paintXRes = 1.0; - float paintYRes = 1.0; PRUint32 flags = 0; if (GetEffectiveTransform().Is2D(&transform2d)) { - scale = transform2d.ScaleFactors(PR_TRUE); - paintXRes = gfxUtils::ClampToScaleFactor(scale.width); - paintYRes = gfxUtils::ClampToScaleFactor(scale.height); - transform2d.Scale(1.0/paintXRes, 1.0/paintYRes); if (transform2d.HasNonIntegerTranslation()) { flags |= ThebesLayerBufferOGL::PAINT_WILL_RESAMPLE; } @@ -811,14 +741,11 @@ ThebesLayerOGL::RenderLayer(int aPreviousFrameBuffer, flags |= ThebesLayerBufferOGL::PAINT_WILL_RESAMPLE; } - Buffer::PaintState state = - mBuffer->BeginPaint(contentType, paintXRes, paintYRes, flags); + Buffer::PaintState state = mBuffer->BeginPaint(contentType, flags); mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate); if (state.mContext) { state.mRegionToInvalidate.And(state.mRegionToInvalidate, mVisibleRegion); - mXResolution = paintXRes; - mYResolution = paintYRes; LayerManager::DrawThebesLayerCallback callback = mOGLManager->GetThebesLayerCallback(); @@ -866,8 +793,7 @@ public: : ThebesLayerBufferOGL(aLayer, aLayer) {} - virtual PaintState BeginPaint(ContentType aContentType, - float, float, PRUint32) { + virtual PaintState BeginPaint(ContentType aContentType, PRUint32) { NS_RUNTIMEABORT("can't BeginPaint for a shadow layer"); return PaintState(); } @@ -903,26 +829,8 @@ ShadowBufferOGL::Upload(gfxASurface* aUpdate, const nsIntRegion& aUpdated, nsIntPoint visTopLeft = mLayer->GetVisibleRegion().GetBounds().TopLeft(); destRegion.MoveBy(-visTopLeft); - // |aUpdated|, |aRect|, and |aRotation| are in thebes-layer space, - // unadjusted for resolution. The texture is in device space, so - // first we need to map the update params to device space. - // - // XXX this prematurely commits us to updating rects instead of - // regions here. This will be a perf penalty on platforms that - // support region updates. This is OK for now because the - // TextureImage backends we care about need to update contiguous - // rects anyway, and would do this conversion internally. To fix - // this, we would need to scale the region instead of its bounds - // here. - nsIntRect destBounds = destRegion.GetBounds(); - gfxRect destRect(destBounds.x, destBounds.y, destBounds.width, destBounds.height); - destRect.Scale(mLayer->GetXResolution(), mLayer->GetYResolution()); - destRect.RoundOut(); - // NB: this gfxContext must not escape EndUpdate() below - nsIntRegion scaledDestRegion(nsIntRect(destRect.X(), destRect.Y(), - destRect.Width(), destRect.Height())); - mTexImage->DirectUpdate(aUpdate, scaledDestRegion); + mTexImage->DirectUpdate(aUpdate, destRegion); mBufferRect = aRect; mBufferRotation = aRotation; @@ -940,8 +848,7 @@ ShadowThebesLayerOGL::~ShadowThebesLayerOGL() void ShadowThebesLayerOGL::SetFrontBuffer(const OptionalThebesBuffer& aNewFront, - const nsIntRegion& aValidRegion, - float aXResolution, float aYResolution) + const nsIntRegion& aValidRegion) { if (mDestroyed) { return; @@ -960,7 +867,6 @@ ShadowThebesLayerOGL::Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion, ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion, - float* aNewXResolution, float* aNewYResolution, OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion) { @@ -971,8 +877,6 @@ ShadowThebesLayerOGL::Swap(const ThebesBuffer& aNewFront, *aNewBack = aNewFront; *aNewBackValidRegion = mValidRegion; - *aNewXResolution = mXResolution; - *aNewYResolution = mYResolution; *aReadOnlyFront = null_t(); aFrontUpdatedRegion->SetEmpty(); } diff --git a/gfx/layers/opengl/ThebesLayerOGL.h b/gfx/layers/opengl/ThebesLayerOGL.h index b2b459437a3..8f09a761735 100644 --- a/gfx/layers/opengl/ThebesLayerOGL.h +++ b/gfx/layers/opengl/ThebesLayerOGL.h @@ -93,12 +93,10 @@ public: // ShadowThebesLayer impl virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront, - const nsIntRegion& aValidRegion, - float aXResolution, float aYResolution); + const nsIntRegion& aValidRegion); virtual void Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion, ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion, - float* aNewXResolution, float* aNewYResolution, OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion); virtual void DestroyFrontBuffer(); diff --git a/gfx/src/Makefile.in b/gfx/src/Makefile.in index 744aedb9f54..7928b52ca34 100644 --- a/gfx/src/Makefile.in +++ b/gfx/src/Makefile.in @@ -58,16 +58,7 @@ XPIDLSRCS = \ gfxIFormats.idl \ gfxidltypes.idl \ $(NULL) - -EXPORTS_NAMESPACES = mozilla - -EXPORTS_mozilla = \ - BaseMargin.h \ - BasePoint.h \ - BaseRect.h \ - BaseSize.h \ - $(NULL) - + EXPORTS = \ gfxCore.h \ gfxCrashReporterUtils.h \ @@ -93,6 +84,8 @@ EXPORTS = \ $(NULL) ifdef MOZ_X11 +EXPORTS_NAMESPACES = mozilla + EXPORTS_mozilla += X11Util.h endif diff --git a/gfx/src/gfxCore.h b/gfx/src/gfxCore.h index 1ebb199acee..76fe68996b8 100644 --- a/gfx/src/gfxCore.h +++ b/gfx/src/gfxCore.h @@ -40,16 +40,6 @@ #include "nscore.h" -// Side constants for use in various places -namespace mozilla { - namespace css { - enum Side {eSideTop, eSideRight, eSideBottom, eSideLeft}; - } -} -#define NS_SIDE_TOP mozilla::css::eSideTop -#define NS_SIDE_RIGHT mozilla::css::eSideRight -#define NS_SIDE_BOTTOM mozilla::css::eSideBottom -#define NS_SIDE_LEFT mozilla::css::eSideLeft #define NS_GFX #define NS_GFX_(type) type #define NS_GFX_STATIC_MEMBER_(type) type diff --git a/gfx/src/nsBoundingMetrics.h b/gfx/src/nsBoundingMetrics.h index 6a9bf029e07..415ad90b320 100644 --- a/gfx/src/nsBoundingMetrics.h +++ b/gfx/src/nsBoundingMetrics.h @@ -108,8 +108,8 @@ struct nsBoundingMetrics { else { if (ascent < bm.ascent) ascent = bm.ascent; if (descent < bm.descent) descent = bm.descent; - leftBearing = PR_MIN(leftBearing, width + bm.leftBearing); - rightBearing = PR_MAX(rightBearing, width + bm.rightBearing); + leftBearing = NS_MIN(leftBearing, width + bm.leftBearing); + rightBearing = NS_MAX(rightBearing, width + bm.rightBearing); } width += bm.width; } diff --git a/gfx/src/nsCoord.h b/gfx/src/nsCoord.h index 65cdbe20130..89d5014cc56 100644 --- a/gfx/src/nsCoord.h +++ b/gfx/src/nsCoord.h @@ -38,6 +38,7 @@ #ifndef NSCOORD_H #define NSCOORD_H +#include "nsAlgorithm.h" #include "nscore.h" #include "nsMathUtils.h" #include @@ -142,8 +143,8 @@ inline nscoord _nscoordSaturatingMultiply(nscoord aCoord, float aScale, float product = aCoord * aScale; if (requireNotNegative ? aCoord > 0 : (aCoord > 0) == (aScale > 0)) - return NSToCoordRoundWithClamp(PR_MIN(nscoord_MAX, product)); - return NSToCoordRoundWithClamp(PR_MAX(nscoord_MIN, product)); + return NSToCoordRoundWithClamp(NS_MIN(nscoord_MAX, product)); + return NSToCoordRoundWithClamp(NS_MAX(nscoord_MIN, product)); #endif } @@ -218,13 +219,13 @@ NSCoordSaturatingAdd(nscoord a, nscoord b) "Doing nscoord addition with values > nscoord_MAX"); NS_ASSERTION((PRInt64)a + (PRInt64)b > (PRInt64)nscoord_MIN, "nscoord addition will reach or pass nscoord_MIN"); - // This one's only a warning because the PR_MIN below means that + // This one's only a warning because the NS_MIN below means that // we'll handle this case correctly. NS_WARN_IF_FALSE((PRInt64)a + (PRInt64)b < (PRInt64)nscoord_MAX, "nscoord addition capped to nscoord_MAX"); // Cap the result, just in case we're dealing with numbers near nscoord_MAX - return PR_MIN(nscoord_MAX, a + b); + return NS_MIN(nscoord_MAX, a + b); } #endif } @@ -277,13 +278,13 @@ NSCoordSaturatingSubtract(nscoord a, nscoord b, "Doing nscoord subtraction with values > nscoord_MAX"); NS_ASSERTION((PRInt64)a - (PRInt64)b > (PRInt64)nscoord_MIN, "nscoord subtraction will reach or pass nscoord_MIN"); - // This one's only a warning because the PR_MIN below means that + // This one's only a warning because the NS_MIN below means that // we'll handle this case correctly. NS_WARN_IF_FALSE((PRInt64)a - (PRInt64)b < (PRInt64)nscoord_MAX, "nscoord subtraction capped to nscoord_MAX"); // Cap the result, in case we're dealing with numbers near nscoord_MAX - return PR_MIN(nscoord_MAX, a - b); + return NS_MIN(nscoord_MAX, a - b); } } #endif diff --git a/gfx/src/nsDeviceContext.cpp b/gfx/src/nsDeviceContext.cpp index 35aa5ba873e..6ca8300c32f 100644 --- a/gfx/src/nsDeviceContext.cpp +++ b/gfx/src/nsDeviceContext.cpp @@ -381,7 +381,7 @@ nsDeviceContext::SetDPI() dpi = mWidget->GetDPI(); if (prefDPI < 0) { - dpi = PR_MAX(96.0f, dpi); + dpi = NS_MAX(96.0f, dpi); } } else { dpi = 96.0f; @@ -406,7 +406,7 @@ nsDeviceContext::SetDPI() } mAppUnitsPerDevNotScaledPixel = - PR_MAX(1, NS_lround(AppUnitsPerCSSPixel() / devPixelsPerCSSPixel)); + NS_MAX(1, NS_lround(AppUnitsPerCSSPixel() / devPixelsPerCSSPixel)); } NS_ASSERTION(dpi != -1.0, "no dpi set"); @@ -836,5 +836,5 @@ void nsDeviceContext::UpdateScaledAppUnits() { mAppUnitsPerDevPixel = - PR_MAX(1, NSToIntRound(float(mAppUnitsPerDevNotScaledPixel) / mPixelScale)); + NS_MAX(1, NSToIntRound(float(mAppUnitsPerDevNotScaledPixel) / mPixelScale)); } diff --git a/gfx/src/nsFontMetrics.cpp b/gfx/src/nsFontMetrics.cpp index d4c45405b89..7a07b9a182a 100644 --- a/gfx/src/nsFontMetrics.cpp +++ b/gfx/src/nsFontMetrics.cpp @@ -197,7 +197,7 @@ static gfxFloat ComputeMaxDescent(const gfxFont::Metrics& aMetrics, gfxFloat offset = NS_floor(-aFontGroup->GetUnderlineOffset() + 0.5); gfxFloat size = NS_round(aMetrics.underlineSize); gfxFloat minDescent = NS_floor(offset + size + 0.5); - return PR_MAX(minDescent, aMetrics.maxDescent); + return NS_MAX(minDescent, aMetrics.maxDescent); } static gfxFloat ComputeMaxAscent(const gfxFont::Metrics& aMetrics) @@ -279,7 +279,7 @@ nsFontMetrics::GetMaxStringLength() const gfxFont::Metrics& m = GetMetrics(); const double x = 32767.0 / m.maxAdvance; PRInt32 len = (PRInt32)floor(x); - return PR_MAX(1, len); + return NS_MAX(1, len); } nscoord diff --git a/gfx/src/nsMargin.h b/gfx/src/nsMargin.h index 7ae3811b7ca..013ef13d138 100644 --- a/gfx/src/nsMargin.h +++ b/gfx/src/nsMargin.h @@ -41,10 +41,10 @@ #include "nsCoord.h" #include "nsPoint.h" #include "gfxCore.h" -#include "mozilla/BaseMargin.h" +#include "mozilla/gfx/BaseMargin.h" -struct nsMargin : public mozilla::BaseMargin { - typedef mozilla::BaseMargin Super; +struct nsMargin : public mozilla::gfx::BaseMargin { + typedef mozilla::gfx::BaseMargin Super; // Constructors nsMargin() : Super() {} @@ -53,8 +53,8 @@ struct nsMargin : public mozilla::BaseMargin { : Super(aLeft, aTop, aRight, aBottom) {} }; -struct nsIntMargin : public mozilla::BaseMargin { - typedef mozilla::BaseMargin Super; +struct nsIntMargin : public mozilla::gfx::BaseMargin { + typedef mozilla::gfx::BaseMargin Super; // Constructors nsIntMargin() : Super() {} diff --git a/gfx/src/nsPoint.h b/gfx/src/nsPoint.h index d67e15857ff..8a36df5f7b0 100644 --- a/gfx/src/nsPoint.h +++ b/gfx/src/nsPoint.h @@ -39,27 +39,29 @@ #define NSPOINT_H #include "nsCoord.h" -#include "mozilla/BaseSize.h" -#include "mozilla/BasePoint.h" +#include "mozilla/gfx/BaseSize.h" +#include "mozilla/gfx/BasePoint.h" #include "nsSize.h" struct nsIntPoint; -struct nsPoint : public mozilla::BasePoint { - typedef mozilla::BasePoint Super; +struct nsPoint : public mozilla::gfx::BasePoint { + typedef mozilla::gfx::BasePoint Super; nsPoint() : Super() {} nsPoint(const nsPoint& aPoint) : Super(aPoint) {} nsPoint(nscoord aX, nscoord aY) : Super(aX, aY) {} + inline nsIntPoint ScaleToNearestPixels(float aXScale, float aYScale, + nscoord aAppUnitsPerPixel) const; inline nsIntPoint ToNearestPixels(nscoord aAppUnitsPerPixel) const; // Converts this point from aFromAPP, an appunits per pixel ratio, to aToAPP. inline nsPoint ConvertAppUnits(PRInt32 aFromAPP, PRInt32 aToAPP) const; }; -struct nsIntPoint : public mozilla::BasePoint { - typedef mozilla::BasePoint Super; +struct nsIntPoint : public mozilla::gfx::BasePoint { + typedef mozilla::gfx::BasePoint Super; nsIntPoint() : Super() {} nsIntPoint(const nsIntPoint& aPoint) : Super(aPoint) {} @@ -67,14 +69,23 @@ struct nsIntPoint : public mozilla::BasePoint { }; inline nsIntPoint -nsPoint::ToNearestPixels(nscoord aAppUnitsPerPixel) const { +nsPoint::ScaleToNearestPixels(float aXScale, float aYScale, + nscoord aAppUnitsPerPixel) const +{ return nsIntPoint( - NSToIntRoundUp(NSAppUnitsToDoublePixels(x, aAppUnitsPerPixel)), - NSToIntRoundUp(NSAppUnitsToDoublePixels(y, aAppUnitsPerPixel))); + NSToIntRoundUp(NSAppUnitsToDoublePixels(x, aAppUnitsPerPixel) * aXScale), + NSToIntRoundUp(NSAppUnitsToDoublePixels(y, aAppUnitsPerPixel) * aYScale)); +} + +inline nsIntPoint +nsPoint::ToNearestPixels(nscoord aAppUnitsPerPixel) const +{ + return ScaleToNearestPixels(1.0f, 1.0f, aAppUnitsPerPixel); } inline nsPoint -nsPoint::ConvertAppUnits(PRInt32 aFromAPP, PRInt32 aToAPP) const { +nsPoint::ConvertAppUnits(PRInt32 aFromAPP, PRInt32 aToAPP) const +{ if (aFromAPP != aToAPP) { nsPoint point; point.x = NSToCoordRound(NSCoordScale(x, aFromAPP, aToAPP)); diff --git a/gfx/src/nsRect.cpp b/gfx/src/nsRect.cpp index 53885b2f4b1..1c89cb3d116 100644 --- a/gfx/src/nsRect.cpp +++ b/gfx/src/nsRect.cpp @@ -54,27 +54,6 @@ static bool IsFloatInteger(float aFloat) } #endif -nsRect& nsRect::ExtendForScaling(float aXMult, float aYMult) -{ - NS_ASSERTION((IsFloatInteger(aXMult) || IsFloatInteger(1/aXMult)) && - (IsFloatInteger(aYMult) || IsFloatInteger(1/aYMult)), - "Multiplication factors must be integers or 1/integer"); - - // Scale rect by multiplier, snap outwards to integers and then unscale. - // We round the results to the nearest integer to prevent floating point errors. - if (aXMult < 1) { - nscoord right = NSToCoordRound(ceil(float(XMost()) * aXMult) / aXMult); - x = NSToCoordRound(floor(float(x) * aXMult) / aXMult); - width = right - x; - } - if (aYMult < 1) { - nscoord bottom = NSToCoordRound(ceil(float(YMost()) * aYMult) / aYMult); - y = NSToCoordRound(floor(float(y) * aYMult) / aYMult); - height = bottom - y; - } - return *this; -} - #ifdef DEBUG // Diagnostics diff --git a/gfx/src/nsRect.h b/gfx/src/nsRect.h index c736d3acf87..6fa7f42dc76 100644 --- a/gfx/src/nsRect.h +++ b/gfx/src/nsRect.h @@ -46,13 +46,13 @@ #include "nsMargin.h" #include "gfxCore.h" #include "nsTraceRefcnt.h" -#include "mozilla/BaseRect.h" +#include "mozilla/gfx/BaseRect.h" struct nsIntRect; struct NS_GFX nsRect : - public mozilla::BaseRect { - typedef mozilla::BaseRect Super; + public mozilla::gfx::BaseRect { + typedef mozilla::gfx::BaseRect Super; static void VERIFY_COORD(nscoord aValue) { ::VERIFY_COORD(aValue); } @@ -81,26 +81,30 @@ struct NS_GFX nsRect : } #endif - // Extend the rect outwards such that the edges are on integer boundaries - // and the edges scaled by aXMult/aYMult are also on integer boundaries. - // aXMult/aYMult must be N or 1/N for integer N. - nsRect& ExtendForScaling(float aXMult, float aYMult); - // Converts this rect from aFromAPP, an appunits per pixel ratio, to aToAPP. // In the RoundOut version we make the rect the smallest rect containing the // unrounded result. In the RoundIn version we make the rect the largest rect // contained in the unrounded result. + // Note: this can turn an empty rectangle into a non-empty rectangle inline nsRect ConvertAppUnitsRoundOut(PRInt32 aFromAPP, PRInt32 aToAPP) const; inline nsRect ConvertAppUnitsRoundIn(PRInt32 aFromAPP, PRInt32 aToAPP) const; + inline nsIntRect ScaleToNearestPixels(float aXScale, float aYScale, + nscoord aAppUnitsPerPixel) const; inline nsIntRect ToNearestPixels(nscoord aAppUnitsPerPixel) const; + // Note: this can turn an empty rectangle into a non-empty rectangle + inline nsIntRect ScaleToOutsidePixels(float aXScale, float aYScale, + nscoord aAppUnitsPerPixel) const; + // Note: this can turn an empty rectangle into a non-empty rectangle inline nsIntRect ToOutsidePixels(nscoord aAppUnitsPerPixel) const; + inline nsIntRect ScaleToInsidePixels(float aXScale, float aYScale, + nscoord aAppUnitsPerPixel) const; inline nsIntRect ToInsidePixels(nscoord aAppUnitsPerPixel) const; }; struct NS_GFX nsIntRect : - public mozilla::BaseRect { - typedef mozilla::BaseRect Super; + public mozilla::gfx::BaseRect { + typedef mozilla::gfx::BaseRect Super; // Constructors nsIntRect() : Super() @@ -175,46 +179,67 @@ nsRect::ConvertAppUnitsRoundIn(PRInt32 aFromAPP, PRInt32 aToAPP) const // scale the rect but round to preserve centers inline nsIntRect -nsRect::ToNearestPixels(nscoord aAppUnitsPerPixel) const +nsRect::ScaleToNearestPixels(float aXScale, float aYScale, + nscoord aAppUnitsPerPixel) const { nsIntRect rect; - rect.x = NSToIntRoundUp(NSAppUnitsToDoublePixels(x, aAppUnitsPerPixel)); - rect.y = NSToIntRoundUp(NSAppUnitsToDoublePixels(y, aAppUnitsPerPixel)); + rect.x = NSToIntRoundUp(NSAppUnitsToDoublePixels(x, aAppUnitsPerPixel) * aXScale); + rect.y = NSToIntRoundUp(NSAppUnitsToDoublePixels(y, aAppUnitsPerPixel) * aYScale); rect.width = NSToIntRoundUp(NSAppUnitsToDoublePixels(XMost(), - aAppUnitsPerPixel)) - rect.x; + aAppUnitsPerPixel) * aXScale) - rect.x; rect.height = NSToIntRoundUp(NSAppUnitsToDoublePixels(YMost(), - aAppUnitsPerPixel)) - rect.y; + aAppUnitsPerPixel) * aYScale) - rect.y; return rect; } // scale the rect but round to smallest containing rect inline nsIntRect -nsRect::ToOutsidePixels(nscoord aAppUnitsPerPixel) const +nsRect::ScaleToOutsidePixels(float aXScale, float aYScale, + nscoord aAppUnitsPerPixel) const { nsIntRect rect; - rect.x = NSToIntFloor(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel))); - rect.y = NSToIntFloor(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel))); + rect.x = NSToIntFloor(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel)) * aXScale); + rect.y = NSToIntFloor(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel)) * aYScale); rect.width = NSToIntCeil(NSAppUnitsToFloatPixels(XMost(), - float(aAppUnitsPerPixel))) - rect.x; + float(aAppUnitsPerPixel)) * aXScale) - rect.x; rect.height = NSToIntCeil(NSAppUnitsToFloatPixels(YMost(), - float(aAppUnitsPerPixel))) - rect.y; + float(aAppUnitsPerPixel)) * aYScale) - rect.y; return rect; } // scale the rect but round to largest contained rect inline nsIntRect -nsRect::ToInsidePixels(nscoord aAppUnitsPerPixel) const +nsRect::ScaleToInsidePixels(float aXScale, float aYScale, + nscoord aAppUnitsPerPixel) const { nsIntRect rect; - rect.x = NSToIntCeil(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel))); - rect.y = NSToIntCeil(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel))); + rect.x = NSToIntCeil(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel)) * aXScale); + rect.y = NSToIntCeil(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel)) * aYScale); rect.width = NSToIntFloor(NSAppUnitsToFloatPixels(XMost(), - float(aAppUnitsPerPixel))) - rect.x; + float(aAppUnitsPerPixel)) * aXScale) - rect.x; rect.height = NSToIntFloor(NSAppUnitsToFloatPixels(YMost(), - float(aAppUnitsPerPixel))) - rect.y; + float(aAppUnitsPerPixel)) * aYScale) - rect.y; return rect; } +inline nsIntRect +nsRect::ToNearestPixels(nscoord aAppUnitsPerPixel) const +{ + return ScaleToNearestPixels(1.0f, 1.0f, aAppUnitsPerPixel); +} + +inline nsIntRect +nsRect::ToOutsidePixels(nscoord aAppUnitsPerPixel) const +{ + return ScaleToOutsidePixels(1.0f, 1.0f, aAppUnitsPerPixel); +} + +inline nsIntRect +nsRect::ToInsidePixels(nscoord aAppUnitsPerPixel) const +{ + return ScaleToInsidePixels(1.0f, 1.0f, aAppUnitsPerPixel); +} + // app units are integer multiples of pixels, so no rounding needed inline nsRect nsIntRect::ToAppUnits(nscoord aAppUnitsPerPixel) const diff --git a/gfx/src/nsRegion.cpp b/gfx/src/nsRegion.cpp index 858010d0a6c..30757781e72 100644 --- a/gfx/src/nsRegion.cpp +++ b/gfx/src/nsRegion.cpp @@ -71,13 +71,13 @@ inline PRBool nsRegion::nsRectFast::Intersects (const nsRect& aRect) const inline PRBool nsRegion::nsRectFast::IntersectRect (const nsRect& aRect1, const nsRect& aRect2) { - const nscoord xmost = PR_MIN (aRect1.XMost (), aRect2.XMost ()); - x = PR_MAX (aRect1.x, aRect2.x); + const nscoord xmost = NS_MIN (aRect1.XMost (), aRect2.XMost ()); + x = NS_MAX (aRect1.x, aRect2.x); width = xmost - x; if (width <= 0) return PR_FALSE; - const nscoord ymost = PR_MIN (aRect1.YMost (), aRect2.YMost ()); - y = PR_MAX (aRect1.y, aRect2.y); + const nscoord ymost = NS_MIN (aRect1.YMost (), aRect2.YMost ()); + y = NS_MAX (aRect1.y, aRect2.y); height = ymost - y; if (height <= 0) return PR_FALSE; @@ -86,8 +86,8 @@ inline PRBool nsRegion::nsRectFast::IntersectRect (const nsRect& aRect1, const n inline void nsRegion::nsRectFast::UnionRect (const nsRect& aRect1, const nsRect& aRect2) { - const nscoord xmost = PR_MAX (aRect1.XMost (), aRect2.XMost ()); - const nscoord ymost = PR_MAX (aRect1.YMost (), aRect2.YMost ()); + const nscoord xmost = NS_MAX (aRect1.XMost (), aRect2.XMost ()); + const nscoord ymost = NS_MAX (aRect1.YMost (), aRect2.YMost ()); x = PR_MIN (aRect1.x, aRect2.x); y = PR_MIN (aRect1.y, aRect2.y); width = xmost - x; @@ -1293,22 +1293,6 @@ void nsRegion::MoveBy (nsPoint aPt) } } -nsRegion& nsRegion::ExtendForScaling (float aXMult, float aYMult) -{ - nsRegion region; - nsRegionRectIterator iter(*this); - for (;;) { - const nsRect* r = iter.Next(); - if (!r) - break; - nsRect rect = *r; - rect.ExtendForScaling(aXMult, aYMult); - region.Or(region, rect); - } - *this = region; - return *this; -} - nsRegion& nsRegion::ScaleRoundOut (float aXScale, float aYScale) { nsRegion region; @@ -1325,6 +1309,22 @@ nsRegion& nsRegion::ScaleRoundOut (float aXScale, float aYScale) return *this; } +nsRegion& nsRegion::ScaleInverseRoundOut (float aXScale, float aYScale) +{ + nsRegion region; + nsRegionRectIterator iter(*this); + for (;;) { + const nsRect* r = iter.Next(); + if (!r) + break; + nsRect rect = *r; + rect.ScaleInverseRoundOut(aXScale, aYScale); + region.Or(region, rect); + } + *this = region; + return *this; +} + nsRegion nsRegion::ConvertAppUnitsRoundOut (PRInt32 aFromAPP, PRInt32 aToAPP) const { if (aFromAPP == aToAPP) { @@ -1389,6 +1389,20 @@ nsIntRegion nsRegion::ToNearestPixels (nscoord aAppUnitsPerPixel) const return ToPixels(aAppUnitsPerPixel, false); } +nsIntRegion nsRegion::ScaleToOutsidePixels (float aScaleX, float aScaleY, + nscoord aAppUnitsPerPixel) const +{ + nsIntRegion result; + nsRegionRectIterator rgnIter(*this); + const nsRect* currentRect; + while ((currentRect = rgnIter.Next())) { + nsIntRect deviceRect = + currentRect->ScaleToOutsidePixels(aScaleX, aScaleY, aAppUnitsPerPixel); + result.Or(result, deviceRect); + } + return result; +} + // A cell's "value" is a pair consisting of // a) the area of the subrectangle it corresponds to, if it's in // aContainingRect and in the region, 0 otherwise diff --git a/gfx/src/nsRegion.h b/gfx/src/nsRegion.h index abdce9d8b49..f4f058893ad 100644 --- a/gfx/src/nsRegion.h +++ b/gfx/src/nsRegion.h @@ -185,9 +185,10 @@ public: nsRegion ConvertAppUnitsRoundOut (PRInt32 aFromAPP, PRInt32 aToAPP) const; nsRegion ConvertAppUnitsRoundIn (PRInt32 aFromAPP, PRInt32 aToAPP) const; nsRegion& ScaleRoundOut(float aXScale, float aYScale); + nsRegion& ScaleInverseRoundOut(float aXScale, float aYScale); + nsIntRegion ScaleToOutsidePixels (float aXScale, float aYScale, nscoord aAppUnitsPerPixel) const; nsIntRegion ToOutsidePixels (nscoord aAppUnitsPerPixel) const; nsIntRegion ToNearestPixels (nscoord aAppUnitsPerPixel) const; - nsRegion& ExtendForScaling (float aXMult, float aYMult); /** * Gets the largest rectangle contained in the region. @@ -448,12 +449,6 @@ public: return *this; } - nsIntRegion& ExtendForScaling (float aXMult, float aYMult) - { - mImpl.ExtendForScaling(aXMult, aYMult); - return *this; - } - /** * Make sure the region has at most aMaxRects by adding area to it * if necessary. The simplified region will be a superset of the diff --git a/gfx/src/nsRenderingContext.cpp b/gfx/src/nsRenderingContext.cpp index 924cbd324c9..0fab59ebc3d 100644 --- a/gfx/src/nsRenderingContext.cpp +++ b/gfx/src/nsRenderingContext.cpp @@ -78,7 +78,7 @@ static PRInt32 FindSafeLength(const char *aString, PRUint32 aLength, PRUint32 aMaxChunkLength) { // Since it's ASCII, we don't need to worry about clusters or RTL - return PR_MIN(aLength, aMaxChunkLength); + return NS_MIN(aLength, aMaxChunkLength); } ////////////////////////////////////////////////////////////////////// @@ -481,7 +481,7 @@ nsRenderingContext::GetMaxChunkLength() { if (!mFontMetrics) return 1; - return PR_MIN(mFontMetrics->GetMaxStringLength(), MAX_GFX_TEXT_BUF_SIZE); + return NS_MIN(mFontMetrics->GetMaxStringLength(), MAX_GFX_TEXT_BUF_SIZE); } nscoord diff --git a/gfx/src/nsSize.h b/gfx/src/nsSize.h index e3ed1b77e9d..40187f4dd89 100644 --- a/gfx/src/nsSize.h +++ b/gfx/src/nsSize.h @@ -39,28 +39,42 @@ #define NSSIZE_H #include "nsCoord.h" -#include "mozilla/BaseSize.h" +#include "mozilla/gfx/BaseSize.h" // Maximum allowable size #define NS_MAXSIZE nscoord_MAX -struct nsSize : public mozilla::BaseSize { - typedef mozilla::BaseSize Super; +struct nsIntSize; + +struct nsSize : public mozilla::gfx::BaseSize { + typedef mozilla::gfx::BaseSize Super; nsSize() : Super() {} nsSize(nscoord aWidth, nscoord aHeight) : Super(aWidth, aHeight) {} + inline nsIntSize ScaleToNearestPixels(float aXScale, float aYScale, + nscoord aAppUnitsPerPixel) const; + // Converts this size from aFromAPP, an appunits per pixel ratio, to aToAPP. inline nsSize ConvertAppUnits(PRInt32 aFromAPP, PRInt32 aToAPP) const; }; -struct nsIntSize : public mozilla::BaseSize { - typedef mozilla::BaseSize Super; +struct nsIntSize : public mozilla::gfx::BaseSize { + typedef mozilla::gfx::BaseSize Super; nsIntSize() : Super() {} nsIntSize(PRInt32 aWidth, PRInt32 aHeight) : Super(aWidth, aHeight) {} }; +inline nsIntSize +nsSize::ScaleToNearestPixels(float aXScale, float aYScale, + nscoord aAppUnitsPerPixel) const +{ + return nsIntSize( + NSToIntRoundUp(NSAppUnitsToDoublePixels(width, aAppUnitsPerPixel) * aXScale), + NSToIntRoundUp(NSAppUnitsToDoublePixels(height, aAppUnitsPerPixel) * aYScale)); +} + inline nsSize nsSize::ConvertAppUnits(PRInt32 aFromAPP, PRInt32 aToAPP) const { if (aFromAPP != aToAPP) { diff --git a/gfx/thebes/GLContext.cpp b/gfx/thebes/GLContext.cpp index 842c82a0cd3..e648ce587af 100644 --- a/gfx/thebes/GLContext.cpp +++ b/gfx/thebes/GLContext.cpp @@ -53,6 +53,8 @@ #include "gfxCrashReporterUtils.h" +#include "mozilla/Util.h" // for DebugOnly + namespace mozilla { namespace gl { @@ -1777,7 +1779,7 @@ GLContext::SetBlitFramebufferForDestTexture(GLuint aTexture) 0); if (aTexture) { - GLenum status = fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER); + DebugOnly status = fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER); // Note: if you are hitting this assertion, it is likely that // your texture is not texture complete -- that is, you diff --git a/gfx/thebes/GLContextProviderEGL.cpp b/gfx/thebes/GLContextProviderEGL.cpp index b70ba3f6cab..5445ff95eb0 100644 --- a/gfx/thebes/GLContextProviderEGL.cpp +++ b/gfx/thebes/GLContextProviderEGL.cpp @@ -1767,7 +1767,6 @@ GetVendor() already_AddRefed GLContextProviderEGL::CreateForWindow(nsIWidget *aWidget) { - EGLContext context; EGLConfig config; if (!sEGLLibrary.EnsureInitialized()) { @@ -2164,14 +2163,13 @@ ContentTypeToGLFormat(gfxASurface::gfxContentType aCType) already_AddRefed GLContextProviderEGL::CreateForNativePixmapSurface(gfxASurface* aSurface) { - EGLSurface surface = nsnull; - EGLContext context = nsnull; - EGLConfig config = nsnull; - if (!sEGLLibrary.EnsureInitialized()) return nsnull; #ifdef MOZ_X11 + EGLSurface surface = nsnull; + EGLConfig config = nsnull; + if (aSurface->GetType() != gfxASurface::SurfaceTypeXlib) { // Not implemented return nsnull; @@ -2193,9 +2191,6 @@ GLContextProviderEGL::CreateForNativePixmapSurface(gfxASurface* aSurface) return glContext.forget().get(); #else - (void)surface; - (void)context; - // Not implemented return nsnull; #endif diff --git a/gfx/thebes/Makefile.in b/gfx/thebes/Makefile.in index bec60796b00..ca3f5c92d08 100644 --- a/gfx/thebes/Makefile.in +++ b/gfx/thebes/Makefile.in @@ -12,6 +12,7 @@ LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 EXPORTS = \ + gfx2DGlue.h \ gfx3DMatrix.h \ gfxASurface.h \ gfxAlphaRecovery.h \ diff --git a/gfx/thebes/gfx2DGlue.h b/gfx/thebes/gfx2DGlue.h new file mode 100644 index 00000000000..82c70b8ebd1 --- /dev/null +++ b/gfx/thebes/gfx2DGlue.h @@ -0,0 +1,40 @@ + +#include "gfxRect.h" +#include "mozilla/gfx/Rect.h" + +namespace mozilla { +namespace gfx { +class DrawTarget; +class SourceSurface; +class ScaledFont; +} +} + +namespace mozilla { +namespace gfx { + +inline Rect ToRect(const gfxRect &aRect) +{ + return Rect(Float(aRect.x), Float(aRect.y), + Float(aRect.width), Float(aRect.height)); +} + +inline gfxRect GFXRect(const Rect &aRect) +{ + return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height); +} + +inline gfxASurface::gfxContentType ContentForFormat(const SurfaceFormat &aFormat) +{ + switch (aFormat) { + case FORMAT_B8G8R8X8: + return gfxASurface::CONTENT_COLOR; + case FORMAT_A8: + return gfxASurface::CONTENT_ALPHA; + default: + return gfxASurface::CONTENT_COLOR_ALPHA; + } +} + +} +} diff --git a/gfx/thebes/gfxCoreTextShaper.cpp b/gfx/thebes/gfxCoreTextShaper.cpp index c45629b7e60..00b24fd86ec 100644 --- a/gfx/thebes/gfxCoreTextShaper.cpp +++ b/gfx/thebes/gfxCoreTextShaper.cpp @@ -71,10 +71,18 @@ gfxCoreTextShaper::gfxCoreTextShaper(gfxMacFont *aFont) : gfxFontShaper(aFont) { // Create our CTFontRef - mCTFont = ::CTFontCreateWithPlatformFont(aFont->GetATSFontRef(), - aFont->GetAdjustedSize(), - NULL, - GetDefaultFeaturesDescriptor()); + if (gfxMacPlatformFontList::UseATSFontEntry()) { + ATSFontEntry *fe = static_cast(aFont->GetFontEntry()); + mCTFont = ::CTFontCreateWithPlatformFont(fe->GetATSFontRef(), + aFont->GetAdjustedSize(), + NULL, + GetDefaultFeaturesDescriptor()); + } else { + mCTFont = ::CTFontCreateWithGraphicsFont(aFont->GetCGFontRef(), + aFont->GetAdjustedSize(), + NULL, + GetDefaultFeaturesDescriptor()); + } // Set up the default attribute dictionary that we will need each time we create a CFAttributedString mAttributesDict = ::CFDictionaryCreate(kCFAllocatorDefault, @@ -161,10 +169,8 @@ gfxCoreTextShaper::InitTextRun(gfxContext *aContext, if (disableLigatures) { // For letterspacing (or maybe other situations) we need to make a copy of the CTFont // with the ligature feature disabled - gfxMacFont *font = static_cast(mFont); CTFontRef ctFont = - CreateCTFontWithDisabledLigatures(font->GetATSFontRef(), - ::CTFontGetSize(mCTFont)); + CreateCTFontWithDisabledLigatures(::CTFontGetSize(mCTFont)); attrObj = ::CFDictionaryCreate(kCFAllocatorDefault, @@ -595,9 +601,9 @@ gfxCoreTextShaper::CreateDefaultFeaturesDescriptor() ::CFRelease(attributesDict); } -// Create a CTFontRef, with the Common Ligatures feature disabled [static] +// Create a CTFontRef, with the Common Ligatures feature disabled CTFontRef -gfxCoreTextShaper::CreateCTFontWithDisabledLigatures(ATSFontRef aFontRef, CGFloat aSize) +gfxCoreTextShaper::CreateCTFontWithDisabledLigatures(CGFloat aSize) { if (sDisableLigaturesDescriptor == NULL) { // initialize cached descriptor to turn off the Common Ligatures feature @@ -643,11 +649,20 @@ gfxCoreTextShaper::CreateCTFontWithDisabledLigatures(ATSFontRef aFontRef, CGFloa ::CFRelease(featuresArray); sDisableLigaturesDescriptor = - ::CTFontDescriptorCreateCopyWithAttributes(GetDefaultFeaturesDescriptor(), attributesDict); + ::CTFontDescriptorCreateCopyWithAttributes(GetDefaultFeaturesDescriptor(), + attributesDict); ::CFRelease(attributesDict); } - - return ::CTFontCreateWithPlatformFont(aFontRef, aSize, NULL, sDisableLigaturesDescriptor); + + if (gfxMacPlatformFontList::UseATSFontEntry()) { + ATSFontEntry *fe = static_cast(mFont->GetFontEntry()); + return ::CTFontCreateWithPlatformFont(fe->GetATSFontRef(), aSize, NULL, + sDisableLigaturesDescriptor); + } + + gfxMacFont *f = static_cast(mFont); + return ::CTFontCreateWithGraphicsFont(f->GetCGFontRef(), aSize, NULL, + sDisableLigaturesDescriptor); } void diff --git a/gfx/thebes/gfxCoreTextShaper.h b/gfx/thebes/gfxCoreTextShaper.h index 678507c252d..715b4037491 100644 --- a/gfx/thebes/gfxCoreTextShaper.h +++ b/gfx/thebes/gfxCoreTextShaper.h @@ -77,6 +77,8 @@ protected: PRInt32 aLayoutStart, PRInt32 aLayoutLength); + CTFontRef CreateCTFontWithDisabledLigatures(CGFloat aSize); + static void CreateDefaultFeaturesDescriptor(); static CTFontDescriptorRef GetDefaultFeaturesDescriptor() { @@ -86,8 +88,6 @@ protected: return sDefaultFeaturesDescriptor; } - static CTFontRef CreateCTFontWithDisabledLigatures(ATSFontRef aFontRef, CGFloat aSize); - // cached font descriptor, created the first time it's needed static CTFontDescriptorRef sDefaultFeaturesDescriptor; diff --git a/gfx/thebes/gfxD2DSurface.cpp b/gfx/thebes/gfxD2DSurface.cpp index 88aa6600b1d..6b6f7a53a2d 100644 --- a/gfx/thebes/gfxD2DSurface.cpp +++ b/gfx/thebes/gfxD2DSurface.cpp @@ -97,6 +97,12 @@ gfxD2DSurface::Scroll(const nsIntPoint &aDelta, const nsIntRect &aClip) cairo_d2d_scroll(CairoSurface(), aDelta.x, aDelta.y, &rect); } +ID3D10Texture2D* +gfxD2DSurface::GetTexture() +{ + return cairo_d2d_surface_get_texture(CairoSurface()); +} + HDC gfxD2DSurface::GetDC(PRBool aRetainContents) { diff --git a/gfx/thebes/gfxD2DSurface.h b/gfx/thebes/gfxD2DSurface.h index 85aae2b32e7..a1f67385e33 100644 --- a/gfx/thebes/gfxD2DSurface.h +++ b/gfx/thebes/gfxD2DSurface.h @@ -70,6 +70,8 @@ public: void Present(); void Scroll(const nsIntPoint &aDelta, const nsIntRect &aClip); + ID3D10Texture2D *GetTexture(); + HDC GetDC(PRBool aRetainContents); void ReleaseDC(const nsIntRect *aUpdatedRect); }; diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 5304e376280..f11331310b8 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -54,6 +54,7 @@ #include "prtypes.h" #include "gfxTypes.h" +#include "nsAlgorithm.h" #include "gfxContext.h" #include "gfxFontMissingGlyphs.h" #include "gfxUserFontSet.h" @@ -1019,8 +1020,8 @@ gfxFontCache::DestroyFont(gfxFont *aFont) void gfxFont::RunMetrics::CombineWith(const RunMetrics& aOther, PRBool aOtherIsOnLeft) { - mAscent = PR_MAX(mAscent, aOther.mAscent); - mDescent = PR_MAX(mDescent, aOther.mDescent); + mAscent = NS_MAX(mAscent, aOther.mAscent); + mDescent = NS_MAX(mDescent, aOther.mDescent); if (aOtherIsOnLeft) { mBoundingBox = (mBoundingBox + gfxPoint(aOther.mAdvanceWidth, 0)).Union(aOther.mBoundingBox); @@ -1261,8 +1262,8 @@ gfxFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd, static void UnionRange(gfxFloat aX, gfxFloat* aDestMin, gfxFloat* aDestMax) { - *aDestMin = PR_MIN(*aDestMin, aX); - *aDestMax = PR_MAX(*aDestMax, aX); + *aDestMin = NS_MIN(*aDestMin, aX); + *aDestMax = NS_MAX(*aDestMax, aX); } // We get precise glyph extents if the textrun creator requested them, or @@ -1681,8 +1682,8 @@ gfxFont::InitMetricsFromSfntTables(Metrics& aMetrics) PRUint16(os2->version) >= 2) { // version 2 and later includes the x-height field SET_SIGNED(xHeight, os2->sxHeight); - // PR_ABS because of negative xHeight seen in Kokonor (Tibetan) font - aMetrics.xHeight = PR_ABS(aMetrics.xHeight); + // NS_ABS because of negative xHeight seen in Kokonor (Tibetan) font + aMetrics.xHeight = NS_ABS(aMetrics.xHeight); } // this should always be present if (os2data.Length() >= offsetof(OS2Table, yStrikeoutPosition) + @@ -1777,10 +1778,10 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, PRBool aIsBadUnderlineFont) aMetrics->subscriptOffset = aMetrics->xHeight; } - aMetrics->underlineSize = PR_MAX(1.0, aMetrics->underlineSize); - aMetrics->strikeoutSize = PR_MAX(1.0, aMetrics->strikeoutSize); + aMetrics->underlineSize = NS_MAX(1.0, aMetrics->underlineSize); + aMetrics->strikeoutSize = NS_MAX(1.0, aMetrics->strikeoutSize); - aMetrics->underlineOffset = PR_MIN(aMetrics->underlineOffset, -1.0); + aMetrics->underlineOffset = NS_MIN(aMetrics->underlineOffset, -1.0); if (aMetrics->maxAscent < 1.0) { // We cannot draw strikeout line and overline in the ascent... @@ -1802,13 +1803,13 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, PRBool aIsBadUnderlineFont) if (!mStyle.systemFont && aIsBadUnderlineFont) { // First, we need 2 pixels between baseline and underline at least. Because many CJK characters // put their glyphs on the baseline, so, 1 pixel is too close for CJK characters. - aMetrics->underlineOffset = PR_MIN(aMetrics->underlineOffset, -2.0); + aMetrics->underlineOffset = NS_MIN(aMetrics->underlineOffset, -2.0); // Next, we put the underline to bottom of below of the descent space. if (aMetrics->internalLeading + aMetrics->externalLeading > aMetrics->underlineSize) { - aMetrics->underlineOffset = PR_MIN(aMetrics->underlineOffset, -aMetrics->emDescent); + aMetrics->underlineOffset = NS_MIN(aMetrics->underlineOffset, -aMetrics->emDescent); } else { - aMetrics->underlineOffset = PR_MIN(aMetrics->underlineOffset, + aMetrics->underlineOffset = NS_MIN(aMetrics->underlineOffset, aMetrics->underlineSize - aMetrics->emDescent); } } @@ -1816,7 +1817,7 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, PRBool aIsBadUnderlineFont) // will stay within the boundary. else if (aMetrics->underlineSize - aMetrics->underlineOffset > aMetrics->maxDescent) { if (aMetrics->underlineSize > aMetrics->maxDescent) - aMetrics->underlineSize = PR_MAX(aMetrics->maxDescent, 1.0); + aMetrics->underlineSize = NS_MAX(aMetrics->maxDescent, 1.0); // The max underlineOffset is 1px (the min underlineSize is 1px, and min maxDescent is 0px.) aMetrics->underlineOffset = aMetrics->underlineSize - aMetrics->maxDescent; } @@ -1827,11 +1828,11 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, PRBool aIsBadUnderlineFont) gfxFloat halfOfStrikeoutSize = NS_floor(aMetrics->strikeoutSize / 2.0 + 0.5); if (halfOfStrikeoutSize + aMetrics->strikeoutOffset > aMetrics->maxAscent) { if (aMetrics->strikeoutSize > aMetrics->maxAscent) { - aMetrics->strikeoutSize = PR_MAX(aMetrics->maxAscent, 1.0); + aMetrics->strikeoutSize = NS_MAX(aMetrics->maxAscent, 1.0); halfOfStrikeoutSize = NS_floor(aMetrics->strikeoutSize / 2.0 + 0.5); } gfxFloat ascent = NS_floor(aMetrics->maxAscent + 0.5); - aMetrics->strikeoutOffset = PR_MAX(halfOfStrikeoutSize, ascent / 2.0); + aMetrics->strikeoutOffset = NS_MAX(halfOfStrikeoutSize, ascent / 2.0); } // If overline is larger than the ascent, the line should be resized. @@ -2048,7 +2049,7 @@ gfxFontGroup::BuildFontList() if (font->GetFontEntry()->mIsBadUnderlineFont) { gfxFloat first = mFonts[0]->GetMetrics().underlineOffset; gfxFloat bad = font->GetMetrics().underlineOffset; - mUnderlineOffset = PR_MIN(first, bad); + mUnderlineOffset = NS_MIN(first, bad); break; } } @@ -2997,10 +2998,10 @@ gfxTextRun::GlyphRunIterator::NextRun() { if (mGlyphRun->mCharacterOffset >= mEndOffset) return PR_FALSE; - mStringStart = PR_MAX(mStartOffset, mGlyphRun->mCharacterOffset); + mStringStart = NS_MAX(mStartOffset, mGlyphRun->mCharacterOffset); PRUint32 last = mNextIndex + 1 < mTextRun->mGlyphRuns.Length() ? mTextRun->mGlyphRuns[mNextIndex + 1].mCharacterOffset : mTextRun->mCharacterCount; - mStringEnd = PR_MIN(mEndOffset, last); + mStringEnd = NS_MIN(mEndOffset, last); ++mNextIndex; return PR_TRUE; @@ -3025,7 +3026,7 @@ AccountStorageForTextRun(gfxTextRun *aTextRun, PRInt32 aSign) } bytes += sizeof(gfxTextRun); gTextRunStorage += bytes*aSign; - gTextRunStorageHighWaterMark = PR_MAX(gTextRunStorageHighWaterMark, gTextRunStorage); + gTextRunStorageHighWaterMark = NS_MAX(gTextRunStorageHighWaterMark, gTextRunStorage); } #endif @@ -3355,17 +3356,17 @@ ClipPartialLigature(gfxTextRun *aTextRun, gfxFloat *aLeft, gfxFloat *aRight, { if (aLigature->mClipBeforePart) { if (aTextRun->IsRightToLeft()) { - *aRight = PR_MIN(*aRight, aXOrigin); + *aRight = NS_MIN(*aRight, aXOrigin); } else { - *aLeft = PR_MAX(*aLeft, aXOrigin); + *aLeft = NS_MAX(*aLeft, aXOrigin); } } if (aLigature->mClipAfterPart) { gfxFloat endEdge = aXOrigin + aTextRun->GetDirection()*aLigature->mPartWidth; if (aTextRun->IsRightToLeft()) { - *aLeft = PR_MAX(*aLeft, endEdge); + *aLeft = NS_MAX(*aLeft, endEdge); } else { - *aRight = PR_MIN(*aRight, endEdge); + *aRight = NS_MIN(*aRight, endEdge); } } } @@ -3732,12 +3733,12 @@ gfxTextRun::BreakAndMeasureText(PRUint32 aStart, PRUint32 aMaxLength, PRBool aCanWordWrap, gfxBreakPriority *aBreakPriority) { - aMaxLength = PR_MIN(aMaxLength, mCharacterCount - aStart); + aMaxLength = NS_MIN(aMaxLength, mCharacterCount - aStart); NS_ASSERTION(aStart + aMaxLength <= mCharacterCount, "Substring out of range"); PRUint32 bufferStart = aStart; - PRUint32 bufferLength = PR_MIN(aMaxLength, MEASUREMENT_BUFFER_SIZE); + PRUint32 bufferLength = NS_MIN(aMaxLength, MEASUREMENT_BUFFER_SIZE); PropertyProvider::Spacing spacingBuffer[MEASUREMENT_BUFFER_SIZE]; PRBool haveSpacing = aProvider && (mFlags & gfxTextRunFactory::TEXT_ENABLE_SPACING) != 0; if (haveSpacing) { @@ -3776,7 +3777,7 @@ gfxTextRun::BreakAndMeasureText(PRUint32 aStart, PRUint32 aMaxLength, if (i >= bufferStart + bufferLength) { // Fetch more spacing and hyphenation data bufferStart = i; - bufferLength = PR_MIN(aStart + aMaxLength, i + MEASUREMENT_BUFFER_SIZE) - i; + bufferLength = NS_MIN(aStart + aMaxLength, i + MEASUREMENT_BUFFER_SIZE) - i; if (haveSpacing) { GetAdjustedSpacing(this, bufferStart, bufferStart + bufferLength, aProvider, spacingBuffer); @@ -4137,7 +4138,7 @@ gfxTextRun::SetMissingGlyph(PRUint32 aIndex, PRUint32 aChar) // Setting advance width to zero will prevent drawing the hexbox details->mAdvance = 0; } else { - gfxFloat width = PR_MAX(glyphRun->mFont->GetMetrics().aveCharWidth, + gfxFloat width = NS_MAX(glyphRun->mFont->GetMetrics().aveCharWidth, gfxFontMissingGlyphs::GetDesiredMinWidth(aChar)); details->mAdvance = PRUint32(width*GetAppUnitsPerDevUnit()); } diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index f2a64b3a5c9..252c2934ba8 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -42,6 +42,7 @@ #define GFX_FONT_H #include "prtypes.h" +#include "nsAlgorithm.h" #include "gfxTypes.h" #include "nsString.h" #include "gfxPoint.h" @@ -167,8 +168,8 @@ struct THEBES_API gfxFontStyle { // Not meant to be called when sizeAdjust = 0. gfxFloat GetAdjustedSize(gfxFloat aspect) const { NS_ASSERTION(sizeAdjust != 0.0, "Not meant to be called when sizeAdjust = 0"); - gfxFloat adjustedSize = PR_MAX(NS_round(size*(sizeAdjust/aspect)), 1.0); - return PR_MIN(adjustedSize, FONT_MAX_SIZE); + gfxFloat adjustedSize = NS_MAX(NS_round(size*(sizeAdjust/aspect)), 1.0); + return NS_MIN(adjustedSize, FONT_MAX_SIZE); } PLDHashNumber Hash() const { diff --git a/gfx/thebes/gfxFontUtils.h b/gfx/thebes/gfxFontUtils.h index 9f62e5b53e5..59f44a94634 100644 --- a/gfx/thebes/gfxFontUtils.h +++ b/gfx/thebes/gfxFontUtils.h @@ -900,7 +900,7 @@ public: InitLoader(); // start timer - mTimer->InitWithFuncCallback(LoaderTimerCallback, this, aDelay, + mTimer->InitWithFuncCallback(LoaderTimerCallback, this, timerInterval, nsITimer::TYPE_REPEATING_SLACK); } diff --git a/gfx/thebes/gfxGDIFont.cpp b/gfx/thebes/gfxGDIFont.cpp index f66afaa7560..d5f7d22b770 100644 --- a/gfx/thebes/gfxGDIFont.cpp +++ b/gfx/thebes/gfxGDIFont.cpp @@ -271,6 +271,32 @@ gfxGDIFont::SetupCairoFont(gfxContext *aContext) return PR_TRUE; } +gfxFont::RunMetrics +gfxGDIFont::Measure(gfxTextRun *aTextRun, + PRUint32 aStart, PRUint32 aEnd, + BoundingBoxType aBoundingBoxType, + gfxContext *aRefContext, + Spacing *aSpacing) +{ + gfxFont::RunMetrics metrics = + gfxFont::Measure(aTextRun, aStart, aEnd, + aBoundingBoxType, aRefContext, aSpacing); + + // if aBoundingBoxType is LOOSE_INK_EXTENTS + // and the underlying cairo font may be antialiased, + // we can't trust Windows to have considered all the pixels + // so we need to add "padding" to the bounds. + // (see bugs 475968, 439831, compare also bug 445087) + if (aBoundingBoxType == LOOSE_INK_EXTENTS && + mAntialiasOption != kAntialiasNone && + metrics.mBoundingBox.width > 0) { + metrics.mBoundingBox.x -= aTextRun->GetAppUnitsPerDevUnit(); + metrics.mBoundingBox.width += aTextRun->GetAppUnitsPerDevUnit() * 3; + } + + return metrics; +} + void gfxGDIFont::Initialize() { diff --git a/gfx/thebes/gfxGDIFont.h b/gfx/thebes/gfxGDIFont.h index 244756f0b06..924b0843ea8 100644 --- a/gfx/thebes/gfxGDIFont.h +++ b/gfx/thebes/gfxGDIFont.h @@ -73,6 +73,13 @@ public: virtual PRBool SetupCairoFont(gfxContext *aContext); + /* override Measure to add padding for antialiasing */ + virtual RunMetrics Measure(gfxTextRun *aTextRun, + PRUint32 aStart, PRUint32 aEnd, + BoundingBoxType aBoundingBoxType, + gfxContext *aContextForTightBoundingBox, + Spacing *aSpacing); + /* required for MathML to suppress effects of ClearType "padding" */ virtual gfxFont* CopyWithAntialiasOption(AntialiasOption anAAOption); diff --git a/gfx/thebes/gfxMacFont.cpp b/gfx/thebes/gfxMacFont.cpp index b6959149cbf..14a878bcd64 100644 --- a/gfx/thebes/gfxMacFont.cpp +++ b/gfx/thebes/gfxMacFont.cpp @@ -53,7 +53,6 @@ using namespace mozilla; gfxMacFont::gfxMacFont(MacOSFontEntry *aFontEntry, const gfxFontStyle *aFontStyle, PRBool aNeedsBold) : gfxFont(aFontEntry, aFontStyle), - mATSFont(aFontEntry->GetFontRef()), mCGFont(nsnull), mFontFace(nsnull), mScaledFont(nsnull) @@ -62,7 +61,7 @@ gfxMacFont::gfxMacFont(MacOSFontEntry *aFontEntry, const gfxFontStyle *aFontStyl mSyntheticBoldOffset = 1; // devunit offset when double-striking text to fake boldness } - mCGFont = ::CGFontCreateWithPlatformFont(&mATSFont); + mCGFont = aFontEntry->GetFontRef(); if (!mCGFont) { mIsValid = PR_FALSE; return; @@ -148,9 +147,6 @@ gfxMacFont::~gfxMacFont() if (mFontFace) { cairo_font_face_destroy(mFontFace); } - - // this is documented to be safe if mCGFont is null - ::CGFontRelease(mCGFont); } PRBool @@ -194,6 +190,28 @@ gfxMacFont::SetupCairoFont(gfxContext *aContext) return PR_TRUE; } +gfxFont::RunMetrics +gfxMacFont::Measure(gfxTextRun *aTextRun, + PRUint32 aStart, PRUint32 aEnd, + BoundingBoxType aBoundingBoxType, + gfxContext *aRefContext, + Spacing *aSpacing) +{ + gfxFont::RunMetrics metrics = + gfxFont::Measure(aTextRun, aStart, aEnd, + aBoundingBoxType, aRefContext, aSpacing); + + // if aBoundingBoxType is not TIGHT_HINTED_OUTLINE_EXTENTS then we need to add + // a pixel column each side of the bounding box in case of antialiasing "bleed" + if (aBoundingBoxType != TIGHT_HINTED_OUTLINE_EXTENTS && + metrics.mBoundingBox.width > 0) { + metrics.mBoundingBox.x -= aTextRun->GetAppUnitsPerDevUnit(); + metrics.mBoundingBox.width += aTextRun->GetAppUnitsPerDevUnit() * 2; + } + + return metrics; +} + void gfxMacFont::InitMetrics() { @@ -245,7 +263,7 @@ gfxMacFont::InitMetrics() // platform APIs. The InitMetrics...() functions will set mIsValid on success. if (!InitMetricsFromSfntTables(mMetrics) && (!mFontEntry->IsUserFont() || mFontEntry->IsLocalUserFont())) { - InitMetricsFromATSMetrics(); + InitMetricsFromPlatform(); } if (!mIsValid) { return; @@ -269,7 +287,7 @@ gfxMacFont::InitMetrics() mMetrics.xHeight = 0.0; if (!InitMetricsFromSfntTables(mMetrics) && (!mFontEntry->IsUserFont() || mFontEntry->IsLocalUserFont())) { - InitMetricsFromATSMetrics(); + InitMetricsFromPlatform(); } if (!mIsValid) { // this shouldn't happen, as we succeeded earlier before applying @@ -393,19 +411,65 @@ gfxMacFont::GetFontTable(PRUint32 aTag) return nsnull; } -// Try to initialize font metrics via ATS font metrics APIs, +// Try to initialize font metrics via platform APIs (CG/CT), // and set mIsValid = TRUE on success. // We ONLY call this for local (platform) fonts that are not sfnt format; -// for sfnts, including ALL downloadable fonts, use InitMetricsFromSfntTables -// because ATSFontGetHorizontalMetrics() has been known to crash when -// presented with bad fonts. +// for sfnts, including ALL downloadable fonts, we prefer to use +// InitMetricsFromSfntTables and avoid platform APIs. void -gfxMacFont::InitMetricsFromATSMetrics() +gfxMacFont::InitMetricsFromPlatform() +{ + if (gfxMacPlatformFontList::UseATSFontEntry()) { + ATSFontEntry *fe = static_cast(GetFontEntry()); + InitMetricsFromATSMetrics(fe->GetATSFontRef()); + return; + } + + CTFontRef ctFont = ::CTFontCreateWithGraphicsFont(mCGFont, + mAdjustedSize, + NULL, NULL); + if (!ctFont) { + return; + } + + mMetrics.underlineOffset = ::CTFontGetUnderlinePosition(ctFont); + mMetrics.underlineSize = ::CTFontGetUnderlineThickness(ctFont); + + mMetrics.externalLeading = ::CTFontGetLeading(ctFont); + + mMetrics.maxAscent = ::CTFontGetAscent(ctFont); + mMetrics.maxDescent = ::CTFontGetDescent(ctFont); + + // this is not strictly correct, but neither CTFont nor CGFont seems to + // provide maxAdvance, unless we were to iterate over all the glyphs + // (which isn't worth the cost here) + CGRect r = ::CTFontGetBoundingBox(ctFont); + mMetrics.maxAdvance = r.size.width; + + // aveCharWidth is also not provided, so leave it at zero + // (fallback code in gfxMacFont::InitMetrics will then try measuring 'x'); + // this could lead to less-than-"perfect" text field sizing when width is + // specified as a number of characters, and the font in use is a non-sfnt + // legacy font, but that's a sufficiently obscure edge case that we can + // ignore the potential discrepancy. + mMetrics.aveCharWidth = 0; + + mMetrics.xHeight = ::CTFontGetXHeight(ctFont); + + ::CFRelease(ctFont); + + mIsValid = PR_TRUE; +} + +// For OS X 10.5, try to initialize font metrics via ATS font metrics APIs, +// and set mIsValid = TRUE on success. +void +gfxMacFont::InitMetricsFromATSMetrics(ATSFontRef aFontRef) { ATSFontMetrics atsMetrics; OSStatus err; - err = ::ATSFontGetHorizontalMetrics(mATSFont, kATSOptionFlagsDefault, + err = ::ATSFontGetHorizontalMetrics(aFontRef, kATSOptionFlagsDefault, &atsMetrics); if (err != noErr) { #ifdef DEBUG diff --git a/gfx/thebes/gfxMacFont.h b/gfx/thebes/gfxMacFont.h index adbab4e0ac0..f9cfab9dfc1 100644 --- a/gfx/thebes/gfxMacFont.h +++ b/gfx/thebes/gfxMacFont.h @@ -54,7 +54,6 @@ public: virtual ~gfxMacFont(); - ATSFontRef GetATSFontRef() const { return mATSFont; } CGFontRef GetCGFontRef() const { return mCGFont; } /* overrides for the pure virtual methods in gfxFont */ @@ -68,6 +67,13 @@ public: virtual PRBool SetupCairoFont(gfxContext *aContext); + /* override Measure to add padding for antialiasing */ + virtual RunMetrics Measure(gfxTextRun *aTextRun, + PRUint32 aStart, PRUint32 aEnd, + BoundingBoxType aBoundingBoxType, + gfxContext *aContextForTightBoundingBox, + Spacing *aSpacing); + // override gfxFont table access function to bypass gfxFontEntry cache, // use CGFontRef API to get direct access to system font data virtual hb_blob_t *GetFontTable(PRUint32 aTag); @@ -85,7 +91,8 @@ protected: PRBool aPreferPlatformShaping = PR_FALSE); void InitMetrics(); - void InitMetricsFromATSMetrics(); + void InitMetricsFromPlatform(); + void InitMetricsFromATSMetrics(ATSFontRef aFontRef); // Get width and glyph ID for a character; uses aConvFactor // to convert font units as returned by CG to actual dimensions @@ -94,7 +101,8 @@ protected: static void DestroyBlobFunc(void* aUserData); - ATSFontRef mATSFont; + // a weak reference to the CoreGraphics font: this is owned by the + // MacOSFontEntry, it is not retained or released by gfxMacFont CGFontRef mCGFont; cairo_font_face_t *mFontFace; diff --git a/gfx/thebes/gfxMacPlatformFontList.h b/gfx/thebes/gfxMacPlatformFontList.h index 2eb3942eac0..82830698e94 100644 --- a/gfx/thebes/gfxMacPlatformFontList.h +++ b/gfx/thebes/gfxMacPlatformFontList.h @@ -46,6 +46,7 @@ #include "gfxPlatformFontList.h" #include "gfxPlatform.h" +#include "gfxPlatformMac.h" #include @@ -60,33 +61,83 @@ class MacOSFontEntry : public gfxFontEntry public: friend class gfxMacPlatformFontList; - MacOSFontEntry(const nsAString& aPostscriptName, PRInt32 aWeight, - gfxFontFamily *aFamily, PRBool aIsStandardFace = PR_FALSE); + virtual ~MacOSFontEntry() { + ::CGFontRelease(mFontRef); + } + + virtual CGFontRef GetFontRef() = 0; + + virtual nsresult GetFontTable(PRUint32 aTableTag, + FallibleTArray& aBuffer) = 0; - ATSFontRef GetFontRef(); nsresult ReadCMAP(); PRBool RequiresAATLayout() const { return mRequiresAAT; } - virtual nsresult GetFontTable(PRUint32 aTableTag, FallibleTArray& aBuffer); - PRBool IsCFF(); protected: - // for use with data fonts - MacOSFontEntry(const nsAString& aPostscriptName, ATSFontRef aFontRef, - PRUint16 aWeight, PRUint16 aStretch, PRUint32 aItalicStyle, - gfxUserFontData *aUserFontData); + MacOSFontEntry(const nsAString& aPostscriptName, PRInt32 aWeight, + gfxFontFamily *aFamily, PRBool aIsStandardFace = PR_FALSE); virtual gfxFont* CreateFontInstance(const gfxFontStyle *aFontStyle, PRBool aNeedsBold); - ATSFontRef mATSFontRef; - PRPackedBool mATSFontRefInitialized; + virtual PRBool HasFontTable(PRUint32 aTableTag) = 0; + + CGFontRef mFontRef; // owning reference to the CGFont, released on destruction + + PRPackedBool mFontRefInitialized; PRPackedBool mRequiresAAT; PRPackedBool mIsCFF; PRPackedBool mIsCFFInitialized; }; +// concrete subclasses of MacOSFontEntry: ATSFontEntry for 10.5, CGFontEntry for 10.6+ +class ATSFontEntry : public MacOSFontEntry +{ +public: + ATSFontEntry(const nsAString& aPostscriptName, PRInt32 aWeight, + gfxFontFamily *aFamily, PRBool aIsStandardFace = PR_FALSE); + + // for use with data fonts + ATSFontEntry(const nsAString& aPostscriptName, ATSFontRef aFontRef, + PRUint16 aWeight, PRUint16 aStretch, PRUint32 aItalicStyle, + gfxUserFontData *aUserFontData, PRBool aIsLocal); + + ATSFontRef GetATSFontRef(); + + virtual CGFontRef GetFontRef(); + + virtual nsresult GetFontTable(PRUint32 aTableTag, + FallibleTArray& aBuffer); + +protected: + virtual PRBool HasFontTable(PRUint32 aTableTag); + + ATSFontRef mATSFontRef; + PRPackedBool mATSFontRefInitialized; +}; + +class CGFontEntry : public MacOSFontEntry +{ +public: + CGFontEntry(const nsAString& aPostscriptName, PRInt32 aWeight, + gfxFontFamily *aFamily, PRBool aIsStandardFace = PR_FALSE); + + // for use with data fonts + CGFontEntry(const nsAString& aPostscriptName, CGFontRef aFontRef, + PRUint16 aWeight, PRUint16 aStretch, PRUint32 aItalicStyle, + PRBool aIsUserFont, PRBool aIsLocal); + + virtual CGFontRef GetFontRef(); + + virtual nsresult GetFontTable(PRUint32 aTableTag, + FallibleTArray& aBuffer); + +protected: + virtual PRBool HasFontTable(PRUint32 aTableTag); +}; + class gfxMacPlatformFontList : public gfxPlatformFontList { public: static gfxMacPlatformFontList* PlatformFontList() { @@ -107,6 +158,10 @@ public: void ClearPrefFonts() { mPrefFonts.Clear(); } + static PRBool UseATSFontEntry() { + return gfxPlatformMac::GetPlatform()->OSXVersion() < MAC_OS_X_VERSION_10_6_HEX; + } + private: friend class gfxPlatformMac; @@ -118,8 +173,11 @@ private: // special case font faces treated as font families (set via prefs) void InitSingleFaceList(); - // eliminate faces which have the same ATS font reference - void EliminateDuplicateFaces(const nsAString& aFamilyName); + gfxFontEntry* MakePlatformFontCG(const gfxProxyFontEntry *aProxyEntry, + const PRUint8 *aFontData, PRUint32 aLength); + + gfxFontEntry* MakePlatformFontATS(const gfxProxyFontEntry *aProxyEntry, + const PRUint8 *aFontData, PRUint32 aLength); static void ATSNotification(ATSFontNotificationInfoRef aInfo, void* aUserArg); diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm index ed07c27bf58..78ddf8c4edb 100644 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ b/gfx/thebes/gfxMacPlatformFontList.mm @@ -135,7 +135,7 @@ static NSString* GetNSStringForString(const nsAString& aSrc) #endif // PR_LOGGING -/* MacOSFontEntry */ +/* MacOSFontEntry - abstract superclass for ATS and CG font entries */ #pragma mark- MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, @@ -143,8 +143,8 @@ MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, gfxFontFamily *aFamily, PRBool aIsStandardFace) : gfxFontEntry(aPostscriptName, aFamily, aIsStandardFace), - mATSFontRef(0), - mATSFontRefInitialized(PR_FALSE), + mFontRef(NULL), + mFontRefInitialized(PR_FALSE), mRequiresAAT(PR_FALSE), mIsCFF(PR_FALSE), mIsCFFInitialized(PR_FALSE) @@ -152,38 +152,6 @@ MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, mWeight = aWeight; } -MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, ATSFontRef aFontRef, - PRUint16 aWeight, PRUint16 aStretch, PRUint32 aItalicStyle, - gfxUserFontData *aUserFontData) - : gfxFontEntry(aPostscriptName), - mATSFontRef(aFontRef), - mATSFontRefInitialized(PR_TRUE), - mRequiresAAT(PR_FALSE), - mIsCFF(PR_FALSE), - mIsCFFInitialized(PR_FALSE) -{ - // xxx - stretch is basically ignored for now - - mUserFontData = aUserFontData; - mWeight = aWeight; - mStretch = aStretch; - mFixedPitch = PR_FALSE; // xxx - do we need this for downloaded fonts? - mItalic = (aItalicStyle & (FONT_STYLE_ITALIC | FONT_STYLE_OBLIQUE)) != 0; - mIsUserFont = aUserFontData != nsnull; -} - -ATSFontRef -MacOSFontEntry::GetFontRef() -{ - if (!mATSFontRefInitialized) { - mATSFontRefInitialized = PR_TRUE; - NSString *psname = GetNSStringForString(mName); - mATSFontRef = ::ATSFontFindFromPostScriptName(CFStringRef(psname), - kATSOptionFlagsDefault); - } - return mATSFontRef; -} - // ATSUI requires AAT-enabled fonts to render complex scripts correctly. // For now, simple clear out the cmap codepoints for fonts that have // codepoints for complex scripts. (Bug 361986) @@ -212,18 +180,18 @@ const ScriptRange gScriptsThatRequireShaping[] = { nsresult MacOSFontEntry::ReadCMAP() { - ByteCount size; - // attempt this once, if errors occur leave a blank cmap - if (mCmapInitialized) + if (mCmapInitialized) { return NS_OK; + } mCmapInitialized = PR_TRUE; PRUint32 kCMAP = TRUETYPE_TAG('c','m','a','p'); AutoFallibleTArray cmap; - if (GetFontTable(kCMAP, cmap) != NS_OK) + if (GetFontTable(kCMAP, cmap) != NS_OK) { return NS_ERROR_FAILURE; + } PRPackedBool unicodeFont, symbolFont; // currently ignored nsresult rv = gfxFontUtils::ReadCMAP(cmap.Elements(), cmap.Length(), @@ -235,22 +203,17 @@ MacOSFontEntry::ReadCMAP() } mHasCmapTable = PR_TRUE; - ATSFontRef fontRef = GetFontRef(); + CGFontRef fontRef = GetFontRef(); + if (!fontRef) { + return NS_ERROR_FAILURE; + } // for layout support, check for the presence of mort/morx and/or // opentype layout tables - PRBool hasAATLayout = - (::ATSFontGetTable(fontRef, TRUETYPE_TAG('m','o','r','x'), - 0, 0, 0, &size) == noErr) || - (::ATSFontGetTable(fontRef, TRUETYPE_TAG('m','o','r','t'), - 0, 0, 0, &size) == noErr); - - PRBool hasGSUB = - (::ATSFontGetTable(fontRef, TRUETYPE_TAG('G','S','U','B'), - 0, 0, 0, &size) == noErr); - PRBool hasGPOS = - (::ATSFontGetTable(fontRef, TRUETYPE_TAG('G','P','O','S'), - 0, 0, 0, &size) == noErr); + PRBool hasAATLayout = HasFontTable(TRUETYPE_TAG('m','o','r','x')) || + HasFontTable(TRUETYPE_TAG('m','o','r','t')); + PRBool hasGSUB = HasFontTable(TRUETYPE_TAG('G','S','U','B')); + PRBool hasGPOS = HasFontTable(TRUETYPE_TAG('G','P','O','S')); if (hasAATLayout && !(hasGSUB || hasGPOS)) { mRequiresAAT = PR_TRUE; // prefer CoreText if font has no OTL tables @@ -305,13 +268,93 @@ MacOSFontEntry::ReadCMAP() return rv; } +gfxFont* +MacOSFontEntry::CreateFontInstance(const gfxFontStyle *aFontStyle, PRBool aNeedsBold) +{ + return new gfxMacFont(this, aFontStyle, aNeedsBold); +} + +PRBool +MacOSFontEntry::IsCFF() +{ + if (!mIsCFFInitialized) { + mIsCFFInitialized = PR_TRUE; + mIsCFF = HasFontTable(TRUETYPE_TAG('C','F','F',' ')); + } + + return mIsCFF; +} + +/* ATSFontEntry - used on Mac OS X 10.5.x */ +#pragma mark- + +ATSFontEntry::ATSFontEntry(const nsAString& aPostscriptName, + PRInt32 aWeight, + gfxFontFamily *aFamily, + PRBool aIsStandardFace) + : MacOSFontEntry(aPostscriptName, aWeight, aFamily, aIsStandardFace), + mATSFontRef(kInvalidFont), + mATSFontRefInitialized(PR_FALSE) +{ +} + +ATSFontEntry::ATSFontEntry(const nsAString& aPostscriptName, + ATSFontRef aFontRef, + PRUint16 aWeight, PRUint16 aStretch, + PRUint32 aItalicStyle, + gfxUserFontData *aUserFontData, + PRBool aIsLocal) + : MacOSFontEntry(aPostscriptName, aWeight, nsnull, PR_FALSE) +{ + mATSFontRef = aFontRef; + mATSFontRefInitialized = PR_TRUE; + + mWeight = aWeight; + mStretch = aStretch; + mFixedPitch = PR_FALSE; // xxx - do we need this for downloaded fonts? + mItalic = (aItalicStyle & (FONT_STYLE_ITALIC | FONT_STYLE_OBLIQUE)) != 0; + mUserFontData = aUserFontData; + mIsUserFont = (aUserFontData != nsnull) || aIsLocal; + mIsLocalUserFont = aIsLocal; +} + +ATSFontRef +ATSFontEntry::GetATSFontRef() +{ + if (!mATSFontRefInitialized) { + mATSFontRefInitialized = PR_TRUE; + NSString *psname = GetNSStringForString(mName); + mATSFontRef = ::ATSFontFindFromPostScriptName(CFStringRef(psname), + kATSOptionFlagsDefault); + } + return mATSFontRef; +} + +CGFontRef +ATSFontEntry::GetFontRef() +{ + if (mFontRefInitialized) { + return mFontRef; + } + + // GetATSFontRef will initialize mATSFontRef + if (GetATSFontRef() == kInvalidFont) { + return nsnull; + } + + mFontRef = ::CGFontCreateWithPlatformFont(&mATSFontRef); + mFontRefInitialized = PR_TRUE; + + return mFontRef; +} + nsresult -MacOSFontEntry::GetFontTable(PRUint32 aTableTag, FallibleTArray& aBuffer) +ATSFontEntry::GetFontTable(PRUint32 aTableTag, FallibleTArray& aBuffer) { nsAutoreleasePool localPool; - ATSFontRef fontRef = GetFontRef(); - if (fontRef == (ATSFontRef)kATSUInvalidFontID) { + ATSFontRef fontRef = GetATSFontRef(); + if (fontRef == kInvalidFont) { return NS_ERROR_FAILURE; } @@ -331,33 +374,103 @@ MacOSFontEntry::GetFontTable(PRUint32 aTableTag, FallibleTArray& aBuffe return NS_OK; } - -gfxFont* -MacOSFontEntry::CreateFontInstance(const gfxFontStyle *aFontStyle, PRBool aNeedsBold) + +PRBool +ATSFontEntry::HasFontTable(PRUint32 aTableTag) { - return new gfxMacFont(this, aFontStyle, aNeedsBold); + ATSFontRef fontRef = GetATSFontRef(); + ByteCount size; + return fontRef != kInvalidFont && + (::ATSFontGetTable(fontRef, aTableTag, 0, 0, 0, &size) == noErr); +} + +/* CGFontEntry - used on Mac OS X 10.6+ */ +#pragma mark- + +CGFontEntry::CGFontEntry(const nsAString& aPostscriptName, + PRInt32 aWeight, + gfxFontFamily *aFamily, + PRBool aIsStandardFace) + : MacOSFontEntry(aPostscriptName, aWeight, aFamily, aIsStandardFace) +{ +} + +CGFontEntry::CGFontEntry(const nsAString& aPostscriptName, + CGFontRef aFontRef, + PRUint16 aWeight, PRUint16 aStretch, + PRUint32 aItalicStyle, + PRBool aIsUserFont, PRBool aIsLocal) + : MacOSFontEntry(aPostscriptName, aWeight, nsnull, PR_FALSE) +{ + mFontRef = aFontRef; + mFontRefInitialized = PR_TRUE; + ::CFRetain(mFontRef); + + mWeight = aWeight; + mStretch = aStretch; + mFixedPitch = PR_FALSE; // xxx - do we need this for downloaded fonts? + mItalic = (aItalicStyle & (FONT_STYLE_ITALIC | FONT_STYLE_OBLIQUE)) != 0; + mIsUserFont = aIsUserFont; + mIsLocalUserFont = aIsLocal; +} + +CGFontRef +CGFontEntry::GetFontRef() +{ + if (!mFontRefInitialized) { + mFontRefInitialized = PR_TRUE; + NSString *psname = GetNSStringForString(mName); + mFontRef = ::CGFontCreateWithFontName(CFStringRef(psname)); + } + return mFontRef; +} + +nsresult +CGFontEntry::GetFontTable(PRUint32 aTableTag, FallibleTArray& aBuffer) +{ + nsAutoreleasePool localPool; + + CGFontRef fontRef = GetFontRef(); + if (!fontRef) { + return NS_ERROR_FAILURE; + } + + CFDataRef tableData = ::CGFontCopyTableForTag(fontRef, aTableTag); + if (!tableData) { + return NS_ERROR_FAILURE; + } + + nsresult rval = NS_OK; + CFIndex dataLength = ::CFDataGetLength(tableData); + if (aBuffer.AppendElements(dataLength)) { + ::CFDataGetBytes(tableData, ::CFRangeMake(0, dataLength), + aBuffer.Elements()); + } else { + rval = NS_ERROR_OUT_OF_MEMORY; + } + ::CFRelease(tableData); + + return rval; } PRBool -MacOSFontEntry::IsCFF() +CGFontEntry::HasFontTable(PRUint32 aTableTag) { - if (!mIsCFFInitialized) { - mIsCFFInitialized = PR_TRUE; - ATSFontRef fontRef = GetFontRef(); - if (fontRef != (ATSFontRef)kATSUInvalidFontID) { - ByteCount dataLength; - OSStatus status = ::ATSFontGetTable(fontRef, - TRUETYPE_TAG('C','F','F',' '), - 0, 0, 0, &dataLength); - if (status == noErr && dataLength > 0) { - mIsCFF = PR_TRUE; - } - } + nsAutoreleasePool localPool; + + CGFontRef fontRef = GetFontRef(); + if (!fontRef) { + return PR_FALSE; } - return mIsCFF; -} + CFDataRef tableData = ::CGFontCopyTableForTag(fontRef, aTableTag); + if (!tableData) { + return PR_FALSE; + } + ::CFRelease(tableData); + return PR_TRUE; +} /* gfxMacFontFamily */ #pragma mark- @@ -374,8 +487,6 @@ public: virtual void LocalizedName(nsAString& aLocalizedName); virtual void FindStyleVariations(); - - void EliminateDuplicateFaces(); }; void @@ -455,9 +566,17 @@ gfxMacFontFamily::FindStyleVariations() } // create a font entry - MacOSFontEntry *fontEntry = new MacOSFontEntry(postscriptFontName, - cssWeight, this, isStandardFace); - if (!fontEntry) break; + MacOSFontEntry *fontEntry; + if (gfxMacPlatformFontList::UseATSFontEntry()) { + fontEntry = new ATSFontEntry(postscriptFontName, + cssWeight, this, isStandardFace); + } else { + fontEntry = new CGFontEntry(postscriptFontName, + cssWeight, this, isStandardFace); + } + if (!fontEntry) { + break; + } // set additional properties based on the traits reported by Cocoa if (macTraits & (NSCondensedFontMask | NSNarrowFontMask | NSCompressedFontMask)) { @@ -502,54 +621,6 @@ gfxMacFontFamily::FindStyleVariations() } } -void -gfxMacFontFamily::EliminateDuplicateFaces() -{ - PRUint32 i, bold, numFonts, italicIndex; - MacOSFontEntry *italic, *nonitalic; - - FindStyleVariations(); - - // if normal and italic have the same ATS font ref, delete italic - // if bold and bold-italic have the same ATS font ref, delete bold-italic - - // two iterations, one for normal, one for bold - for (bold = 0; bold < 2; bold++) { - numFonts = mAvailableFonts.Length(); - - // find the non-italic face - nonitalic = nsnull; - for (i = 0; i < numFonts; i++) { - if ((mAvailableFonts[i]->IsBold() == (bold == 1)) && - !mAvailableFonts[i]->IsItalic()) { - nonitalic = static_cast(mAvailableFonts[i].get()); - break; - } - } - - // find the italic face - if (nonitalic) { - italic = nsnull; - for (i = 0; i < numFonts; i++) { - if ((mAvailableFonts[i]->IsBold() == (bold == 1)) && - mAvailableFonts[i]->IsItalic()) { - italic = static_cast(mAvailableFonts[i].get()); - italicIndex = i; - break; - } - } - - // if italic face and non-italic face have matching ATS refs, - // or if the italic returns 0 rather than an actual ATSFontRef, - // then the italic face is bogus so remove it - if (italic && (italic->GetFontRef() == 0 || - italic->GetFontRef() == nonitalic->GetFontRef())) { - mAvailableFonts.RemoveElementAt(italicIndex); - } - } - } -} - /* gfxSingleFaceMacFontFamily */ #pragma mark- @@ -686,19 +757,6 @@ gfxMacPlatformFontList::InitFontList() // a font lookup miss earlier. this is a simple optimization, it's not required for correctness PreloadNamesList(); - // clean up various minor 10.4 font problems for specific fonts - if (gfxPlatformMac::GetPlatform()->OSXVersion() < MAC_OS_X_VERSION_10_5_HEX) { - // Cocoa calls report that italic faces exist for Courier and Helvetica, - // even though only bold faces exist so test for this using ATS font refs (10.5 has proper faces) - EliminateDuplicateFaces(NS_LITERAL_STRING("Courier")); - EliminateDuplicateFaces(NS_LITERAL_STRING("Helvetica")); - - // Cocoa reports that Courier and Monaco are not fixed-pitch fonts - // so explicitly tweak these settings - SetFixedPitch(NS_LITERAL_STRING("Courier")); - SetFixedPitch(NS_LITERAL_STRING("Monaco")); - } - // start the delayed cmap loader StartLoader(kDelayBeforeLoadingCmaps, kIntervalBetweenLoadingCmaps); @@ -747,16 +805,6 @@ gfxMacPlatformFontList::InitSingleFaceList() } } -void -gfxMacPlatformFontList::EliminateDuplicateFaces(const nsAString& aFamilyName) -{ - gfxMacFontFamily *family = - static_cast(FindFamily(aFamilyName)); - - if (family) - family->EliminateDuplicateFaces(); -} - PRBool gfxMacPlatformFontList::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) { @@ -773,7 +821,7 @@ gfxMacPlatformFontList::GetStandardFamilyName(const nsAString& aFontName, nsAStr // convert the name to a Pascal-style Str255 to try as Quickdraw name Str255 qdname; NS_ConvertUTF16toUTF8 utf8name(aFontName); - qdname[0] = PR_MAX(255, strlen(utf8name.get())); + qdname[0] = NS_MAX(255, strlen(utf8name.get())); memcpy(&qdname[1], utf8name.get(), qdname[0]); // look up the Quickdraw name @@ -841,41 +889,132 @@ gfxMacPlatformFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry, nsAutoreleasePool localPool; NSString *faceName = GetNSStringForString(aFontName); - - // first lookup a single face based on postscript name - ATSFontRef fontRef = ::ATSFontFindFromPostScriptName(CFStringRef(faceName), - kATSOptionFlagsDefault); - - // if not found, lookup using full font name - if (fontRef == kInvalidFont) - fontRef = ::ATSFontFindFromName(CFStringRef(faceName), - kATSOptionFlagsDefault); - - // not found - if (fontRef == kInvalidFont) - return nsnull; - MacOSFontEntry *newFontEntry; - if (aProxyEntry) { - PRUint16 w = aProxyEntry->mWeight; - NS_ASSERTION(w >= 100 && w <= 900, "bogus font weight value!"); - newFontEntry = - new MacOSFontEntry(aFontName, fontRef, - w, aProxyEntry->mStretch, - aProxyEntry->mItalic ? - FONT_STYLE_ITALIC : FONT_STYLE_NORMAL, - nsnull); - newFontEntry->mIsUserFont = newFontEntry->mIsLocalUserFont = PR_TRUE; + if (UseATSFontEntry()) { + // first lookup a single face based on postscript name + ATSFontRef fontRef = ::ATSFontFindFromPostScriptName(CFStringRef(faceName), + kATSOptionFlagsDefault); + + // if not found, lookup using full font name + if (fontRef == kInvalidFont) { + fontRef = ::ATSFontFindFromName(CFStringRef(faceName), + kATSOptionFlagsDefault); + if (fontRef == kInvalidFont) { + return nsnull; + } + } + + if (aProxyEntry) { + PRUint16 w = aProxyEntry->mWeight; + NS_ASSERTION(w >= 100 && w <= 900, "bogus font weight value!"); + + newFontEntry = + new ATSFontEntry(aFontName, fontRef, + w, aProxyEntry->mStretch, + aProxyEntry->mItalic ? + FONT_STYLE_ITALIC : FONT_STYLE_NORMAL, + nsnull, PR_TRUE); + } else { + newFontEntry = + new ATSFontEntry(aFontName, fontRef, + 400, 0, FONT_STYLE_NORMAL, nsnull, PR_FALSE); + } } else { - newFontEntry = - new MacOSFontEntry(aFontName, fontRef, - 400, 0, FONT_STYLE_NORMAL, nsnull); + // lookup face based on postscript or full name + CGFontRef fontRef = ::CGFontCreateWithFontName(CFStringRef(faceName)); + if (!fontRef) { + return nsnull; + } + + if (aProxyEntry) { + PRUint16 w = aProxyEntry->mWeight; + NS_ASSERTION(w >= 100 && w <= 900, "bogus font weight value!"); + + newFontEntry = + new CGFontEntry(aFontName, fontRef, + w, aProxyEntry->mStretch, + aProxyEntry->mItalic ? + FONT_STYLE_ITALIC : FONT_STYLE_NORMAL, + PR_TRUE, PR_TRUE); + } else { + newFontEntry = + new CGFontEntry(aFontName, fontRef, + 400, 0, FONT_STYLE_NORMAL, + PR_FALSE, PR_FALSE); + } + ::CFRelease(fontRef); } return newFontEntry; } +gfxFontEntry* +gfxMacPlatformFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, + const PRUint8 *aFontData, + PRUint32 aLength) +{ + return UseATSFontEntry() + ? MakePlatformFontATS(aProxyEntry, aFontData, aLength) + : MakePlatformFontCG(aProxyEntry, aFontData, aLength); +} + +static void ReleaseData(void *info, const void *data, size_t size) +{ + NS_Free((void*)data); +} + +gfxFontEntry* +gfxMacPlatformFontList::MakePlatformFontCG(const gfxProxyFontEntry *aProxyEntry, + const PRUint8 *aFontData, + PRUint32 aLength) +{ + NS_ASSERTION(aFontData, "MakePlatformFont called with null data"); + + PRUint16 w = aProxyEntry->mWeight; + NS_ASSERTION(w >= 100 && w <= 900, "bogus font weight value!"); + + // create the font entry + nsAutoString uniqueName; + + nsresult rv = gfxFontUtils::MakeUniqueUserFontName(uniqueName); + if (NS_FAILED(rv)) { + return nsnull; + } + + CGDataProviderRef provider = + ::CGDataProviderCreateWithData(nsnull, aFontData, aLength, + &ReleaseData); + CGFontRef fontRef = ::CGFontCreateWithDataProvider(provider); + ::CGDataProviderRelease(provider); + + if (!fontRef) { + return nsnull; + } + + nsAutoPtr + newFontEntry(new CGFontEntry(uniqueName, fontRef, w, + aProxyEntry->mStretch, + aProxyEntry->mItalic ? + FONT_STYLE_ITALIC : FONT_STYLE_NORMAL, + PR_TRUE, PR_FALSE)); + + // if succeeded and font cmap is good, return the new font + if (newFontEntry->mIsValid && NS_SUCCEEDED(newFontEntry->ReadCMAP())) { + return newFontEntry.forget(); + } + + // if something is funky about this font, delete immediately +#if DEBUG + char warnBuf[1024]; + sprintf(warnBuf, "downloaded font not loaded properly, removed face for (%s)", + NS_ConvertUTF16toUTF8(aProxyEntry->mFamily->Name()).get()); + NS_WARNING(warnBuf); +#endif + + return nsnull; +} + // grumble, another non-publised Apple API dependency (found in Webkit code) // activated with this value, font will not be found via system lookup routines // it can only be used via the created ATSFontRef @@ -885,26 +1024,27 @@ enum { kPrivateATSFontContextPrivate = 3 }; -class MacOSUserFontData : public gfxUserFontData { +class ATSUserFontData : public gfxUserFontData { public: - MacOSUserFontData(ATSFontContainerRef aContainerRef) + ATSUserFontData(ATSFontContainerRef aContainerRef) : mContainerRef(aContainerRef) { } - virtual ~MacOSUserFontData() + virtual ~ATSUserFontData() { // deactivate font - if (mContainerRef) + if (mContainerRef) { ::ATSFontDeactivate(mContainerRef, NULL, kATSOptionFlagsDefault); + } } ATSFontContainerRef mContainerRef; }; gfxFontEntry* -gfxMacPlatformFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, - const PRUint8 *aFontData, - PRUint32 aLength) +gfxMacPlatformFontList::MakePlatformFontATS(const gfxProxyFontEntry *aProxyEntry, + const PRUint8 *aFontData, + PRUint32 aLength) { OSStatus err; @@ -982,42 +1122,30 @@ gfxMacPlatformFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, continue; } - // font entry will own this - MacOSUserFontData *userFontData = new MacOSUserFontData(containerRef); - - if (!userFontData) { - ::ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault); - return nsnull; - } - PRUint16 w = aProxyEntry->mWeight; NS_ASSERTION(w >= 100 && w <= 900, "bogus font weight value!"); - // create the font entry nsAutoString uniqueName; - nsresult rv = gfxFontUtils::MakeUniqueUserFontName(uniqueName); if (NS_FAILED(rv)) { - delete userFontData; return nsnull; } - MacOSFontEntry *newFontEntry = - new MacOSFontEntry(uniqueName, - fontRef, - w, aProxyEntry->mStretch, - aProxyEntry->mItalic ? - FONT_STYLE_ITALIC : FONT_STYLE_NORMAL, - userFontData); + // font entry will own this + ATSUserFontData *userFontData = new ATSUserFontData(containerRef); - if (!newFontEntry) { - delete userFontData; - return nsnull; - } + ATSFontEntry *newFontEntry = + new ATSFontEntry(uniqueName, + fontRef, + w, aProxyEntry->mStretch, + aProxyEntry->mItalic ? + FONT_STYLE_ITALIC : FONT_STYLE_NORMAL, + userFontData, PR_FALSE); // if succeeded and font cmap is good, return the new font - if (newFontEntry->mIsValid && NS_SUCCEEDED(newFontEntry->ReadCMAP())) + if (newFontEntry->mIsValid && NS_SUCCEEDED(newFontEntry->ReadCMAP())) { return newFontEntry; + } // if something is funky about this font, delete immediately #if DEBUG @@ -1039,4 +1167,3 @@ gfxMacPlatformFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, // if we get here, the activation failed (even with possible retries); can't use this font return nsnull; } - diff --git a/gfx/thebes/gfxPangoFonts.cpp b/gfx/thebes/gfxPangoFonts.cpp index bfd45443bf8..78f9b9657fa 100644 --- a/gfx/thebes/gfxPangoFonts.cpp +++ b/gfx/thebes/gfxPangoFonts.cpp @@ -161,6 +161,14 @@ FindFunctionSymbol(const char *name) return result; } +static PRBool HasChar(FcPattern *aFont, FcChar32 wc) +{ + FcCharSet *charset = NULL; + FcPatternGetCharSet(aFont, FC_CHARSET, 0, &charset); + + return charset && FcCharSetHasChar(charset, wc); +} + /** * gfxFcFontEntry: * @@ -199,6 +207,17 @@ public: // GetFontTable() here virtual nsString RealFaceName(); + // This is needed to make gfxFontEntry::HasCharacter(aCh) work. + virtual PRBool TestCharacterMap(PRUint32 aCh) + { + for (PRUint32 i = 0; i < mPatterns.Length(); ++i) { + if (HasChar(mPatterns[i], aCh)) { + return PR_TRUE; + } + } + return PR_FALSE; + } + protected: gfxFcFontEntry(const nsAString& aName) : gfxFontEntry(aName), @@ -1634,14 +1653,6 @@ gfxFcFontSet::GetFontPatternAt(PRUint32 i) return mFonts[i].mPattern; } -static PRBool HasChar(FcPattern *aFont, FcChar32 wc) -{ - FcCharSet *charset = NULL; - FcPatternGetCharSet(aFont, FC_CHARSET, 0, &charset); - - return charset && FcCharSetHasChar(charset, wc); -} - /** * gfxPangoFontMap: An implementation of a PangoFontMap. * diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 99d3b09daf8..ab35a62f26f 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -44,6 +44,7 @@ #if defined(XP_WIN) #include "gfxWindowsPlatform.h" +#include "gfxD2DSurface.h" #elif defined(XP_MACOSX) #include "gfxPlatformMac.h" #elif defined(MOZ_WIDGET_GTK2) @@ -114,6 +115,8 @@ static const char *CMForceSRGBPrefName = "gfx.color_management.force_srgb"; static void ShutdownCMS(); static void MigratePrefs(); +#include "mozilla/gfx/2D.h" +using namespace mozilla::gfx; // logs shared across gfx #ifdef PR_LOGGING @@ -415,6 +418,101 @@ gfxPlatform::OptimizeImage(gfxImageSurface *aSurface, return ret; } +cairo_user_data_key_t kDrawTarget; + +RefPtr +gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface) +{ +#ifdef XP_WIN + if (aSurface->GetType() == gfxASurface::SurfaceTypeD2D) { + RefPtr drawTarget = + Factory::CreateDrawTargetForD3D10Texture(static_cast(aSurface)->GetTexture(), FORMAT_B8G8R8A8); + aSurface->SetData(&kDrawTarget, drawTarget, NULL); + return drawTarget; + } +#endif + + // Can't create a draw target for general cairo surfaces yet. + return NULL; +} + +cairo_user_data_key_t kSourceSurface; + +void SourceBufferDestroy(void *srcBuffer) +{ + static_cast(srcBuffer)->Release(); +} + +RefPtr +gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurface) +{ + void *userData = aSurface->GetData(&kSourceSurface); + + if (userData) { + return static_cast(userData); + } + + SurfaceFormat format; + if (aSurface->GetContentType() == gfxASurface::CONTENT_ALPHA) { + format = FORMAT_A8; + } else if (aSurface->GetContentType() == gfxASurface::CONTENT_COLOR) { + format = FORMAT_B8G8R8X8; + } else { + format = FORMAT_B8G8R8A8; + } + + RefPtr srcBuffer; + +#ifdef XP_WIN + if (aSurface->GetType() == gfxASurface::SurfaceTypeD2D) { + NativeSurface surf; + surf.mFormat = format; + surf.mType = NATIVE_SURFACE_D3D10_TEXTURE; + surf.mSurface = static_cast(aSurface)->GetTexture(); + mozilla::gfx::DrawTarget *dt = static_cast(aSurface->GetData(&kDrawTarget)); + if (dt) { + dt->Flush(); + } + srcBuffer = aTarget->CreateSourceSurfaceFromNativeSurface(surf); + } +#endif + + if (!srcBuffer) { + nsRefPtr imgSurface = aSurface->GetAsImageSurface(); + + if (!imgSurface) { + imgSurface = new gfxImageSurface(aSurface->GetSize(), gfxASurface::FormatFromContent(aSurface->GetContentType())); + nsRefPtr ctx = new gfxContext(imgSurface); + ctx->SetSource(aSurface); + ctx->SetOperator(gfxContext::OPERATOR_SOURCE); + ctx->Paint(); + } + + srcBuffer = aTarget->CreateSourceSurfaceFromData(imgSurface->Data(), + IntSize(imgSurface->GetSize().width, imgSurface->GetSize().height), + imgSurface->Stride(), + format); + } + + srcBuffer->AddRef(); + aSurface->SetData(&kSourceSurface, srcBuffer, SourceBufferDestroy); + + return srcBuffer; +} + +RefPtr +gfxPlatform::GetScaledFontForFont(gfxFont *aFont) +{ + return NULL; +} + +already_AddRefed +gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget) +{ + // Don't know how to do this outside of Windows with D2D yet. + return NULL; +} + nsresult gfxPlatform::GetFontList(nsIAtom *aLangGroup, const nsACString& aGenericFamily, diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index de1d1496dde..f4b4a83ded2 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -66,6 +66,11 @@ class gfxTextRun; class nsIURI; class nsIAtom; +#include "gfx2DGlue.h" +#include "mozilla/RefPtr.h" + +extern cairo_user_data_key_t kDrawTarget; + // pref lang id's for font prefs // !!! needs to match the list of pref font.default.xx entries listed in all.js !!! // !!! don't use as bit mask, this may grow larger !!! @@ -167,6 +172,18 @@ public: virtual already_AddRefed OptimizeImage(gfxImageSurface *aSurface, gfxASurface::gfxImageFormat format); + virtual mozilla::RefPtr + CreateDrawTargetForSurface(gfxASurface *aSurface); + + virtual mozilla::RefPtr + GetSourceSurfaceForSurface(mozilla::gfx::DrawTarget *aTarget, gfxASurface *aSurface); + + virtual mozilla::RefPtr + GetScaledFontForFont(gfxFont *aFont); + + virtual already_AddRefed + GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget); + /* * Font bits */ diff --git a/gfx/thebes/gfxPoint.h b/gfx/thebes/gfxPoint.h index 610ae4b0860..dfbf3594b94 100644 --- a/gfx/thebes/gfxPoint.h +++ b/gfx/thebes/gfxPoint.h @@ -39,8 +39,8 @@ #define GFX_POINT_H #include "nsMathUtils.h" -#include "mozilla/BaseSize.h" -#include "mozilla/BasePoint.h" +#include "mozilla/gfx/BaseSize.h" +#include "mozilla/gfx/BasePoint.h" #include "nsSize.h" #include "nsPoint.h" @@ -48,16 +48,16 @@ typedef nsIntSize gfxIntSize; -struct THEBES_API gfxSize : public mozilla::BaseSize { - typedef mozilla::BaseSize Super; +struct THEBES_API gfxSize : public mozilla::gfx::BaseSize { + typedef mozilla::gfx::BaseSize Super; gfxSize() : Super() {} gfxSize(gfxFloat aWidth, gfxFloat aHeight) : Super(aWidth, aHeight) {} gfxSize(const nsIntSize& aSize) : Super(aSize.width, aSize.height) {} }; -struct THEBES_API gfxPoint : public mozilla::BasePoint { - typedef mozilla::BasePoint Super; +struct THEBES_API gfxPoint : public mozilla::gfx::BasePoint { + typedef mozilla::gfx::BasePoint Super; gfxPoint() : Super() {} gfxPoint(gfxFloat aX, gfxFloat aY) : Super(aX, aY) {} diff --git a/gfx/thebes/gfxRect.h b/gfx/thebes/gfxRect.h index 91b1de0f06b..c63dd78386d 100644 --- a/gfx/thebes/gfxRect.h +++ b/gfx/thebes/gfxRect.h @@ -43,12 +43,12 @@ #include "gfxPoint.h" #include "gfxCore.h" #include "nsDebug.h" -#include "mozilla/BaseMargin.h" -#include "mozilla/BaseRect.h" +#include "mozilla/gfx/BaseMargin.h" +#include "mozilla/gfx/BaseRect.h" #include "nsRect.h" -struct gfxMargin : public mozilla::BaseMargin { - typedef mozilla::BaseMargin Super; +struct gfxMargin : public mozilla::gfx::BaseMargin { + typedef mozilla::gfx::BaseMargin Super; // Constructors gfxMargin() : Super() {} @@ -88,8 +88,8 @@ static inline mozilla::css::Corner operator++(mozilla::css::Corner& corner, int) } struct THEBES_API gfxRect : - public mozilla::BaseRect { - typedef mozilla::BaseRect Super; + public mozilla::gfx::BaseRect { + typedef mozilla::gfx::BaseRect Super; gfxRect() : Super() {} gfxRect(const gfxPoint& aPos, const gfxSize& aSize) : diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h index 15dd786826e..75ab02a2c4d 100644 --- a/gfx/thebes/gfxUtils.h +++ b/gfx/thebes/gfxUtils.h @@ -119,7 +119,8 @@ public: static PRBool GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut); /** - * Clamp aVal to a power of kScaleResolution. + * Return the smallest power of kScaleResolution (2) greater than or equal to + * aVal. */ static gfxFloat ClampToScaleFactor(gfxFloat aVal); }; diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index ca717ee79da..c527839ff08 100644 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -73,11 +73,15 @@ #include +using namespace mozilla::gfx; + #ifdef CAIRO_HAS_D2D_SURFACE #include "gfxD2DSurface.h" #include +#include "mozilla/gfx/2D.h" + #include "nsIMemoryReporter.h" #include "nsMemory.h" #endif @@ -402,8 +406,10 @@ gfxWindowsPlatform::VerifyD2DDevice(PRBool aAttemptForce) mD2DDevice = cairo_d2d_create_device(); } - if (mD2DDevice) + if (mD2DDevice) { reporter.SetSuccessful(); + mozilla::gfx::Factory::SetDirect3D10Device(cairo_d2d_device_get_device(mD2DDevice)); + } #endif } @@ -483,6 +489,48 @@ gfxWindowsPlatform::CreateOffscreenSurface(const gfxIntSize& size, return surf; } +RefPtr +gfxWindowsPlatform::GetScaledFontForFont(gfxFont *aFont) +{ + if(mUseDirectWrite) { + gfxDWriteFont *font = static_cast(aFont); + + NativeFont nativeFont; + nativeFont.mType = NATIVE_FONT_DWRITE_FONT_FACE; + nativeFont.mFont = font->GetFontFace(); + RefPtr scaledFont = + mozilla::gfx::Factory::CreateScaledFontForNativeFont(nativeFont, font->GetAdjustedSize()); + + return scaledFont; + } +} + +already_AddRefed +gfxWindowsPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget) +{ +#ifdef XP_WIN + if (aTarget->GetType() == BACKEND_DIRECT2D) { + RefPtr texture = + static_cast(aTarget->GetNativeSurface(NATIVE_SURFACE_D3D10_TEXTURE)); + + if (!texture) { + return gfxPlatform::GetThebesSurfaceForDrawTarget(aTarget); + } + + aTarget->Flush(); + + nsRefPtr surf = + new gfxD2DSurface(texture, ContentForFormat(aTarget->GetFormat())); + + surf->SetData(&kDrawTarget, aTarget, NULL); + + return surf.forget(); + } +#endif + + return gfxPlatform::GetThebesSurfaceForDrawTarget(aTarget); +} + nsresult gfxWindowsPlatform::GetFontList(nsIAtom *aLangGroup, const nsACString& aGenericFamily, diff --git a/gfx/thebes/gfxWindowsPlatform.h b/gfx/thebes/gfxWindowsPlatform.h index a70ffea8bc6..9684e317e29 100644 --- a/gfx/thebes/gfxWindowsPlatform.h +++ b/gfx/thebes/gfxWindowsPlatform.h @@ -127,6 +127,10 @@ public: already_AddRefed CreateOffscreenSurface(const gfxIntSize& size, gfxASurface::gfxContentType contentType); + virtual mozilla::RefPtr + GetScaledFontForFont(gfxFont *aFont); + virtual already_AddRefed + GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget); enum RenderMode { /* Use GDI and windows surfaces */ diff --git a/gfx/thebes/nsCoreAnimationSupport.h b/gfx/thebes/nsCoreAnimationSupport.h index 4d2f9e544f2..a850e0b5f9b 100644 --- a/gfx/thebes/nsCoreAnimationSupport.h +++ b/gfx/thebes/nsCoreAnimationSupport.h @@ -74,7 +74,7 @@ public: nsIOSurface *surf, CGColorSpaceRef aColorSpace, int aX, int aY, - int aWidth, int aHeight); + size_t aWidth, size_t aHeight); private: void Destroy(); diff --git a/gfx/thebes/nsCoreAnimationSupport.mm b/gfx/thebes/nsCoreAnimationSupport.mm index 4a882ff065f..08bb4e0aa0d 100644 --- a/gfx/thebes/nsCoreAnimationSupport.mm +++ b/gfx/thebes/nsCoreAnimationSupport.mm @@ -713,7 +713,7 @@ nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext, nsIOSurface *surf, CGColorSpaceRef aColorSpace, int aX, int aY, - int aWidth, int aHeight) { + size_t aWidth, size_t aHeight) { surf->Lock(); size_t bytesPerRow = surf->GetBytesPerRow(); size_t ioWidth = surf->GetWidth(); @@ -729,11 +729,16 @@ nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext, // We get rendering glitches if we use a width/height that falls // outside of the IOSurface. - if (aWidth > ioWidth - aX) + if (aWidth + aX > ioWidth) aWidth = ioWidth - aX; - if (aHeight > ioHeight - aY) + if (aHeight + aY > ioHeight) aHeight = ioHeight - aY; + if (aX < 0 || aX >= ioWidth || + aY < 0 || aY >= ioHeight) { + return NS_ERROR_FAILURE; + } + CGImageRef cgImage = ::CGImageCreate(ioWidth, ioHeight, 8, 32, bytesPerRow, aColorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, dataProvider, NULL, true, kCGRenderingIntentDefault); @@ -751,7 +756,10 @@ nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext, } ::CGContextScaleCTM(aContext, 1.0f, -1.0f); - ::CGContextDrawImage(aContext, CGRectMake(aX, -aY-aHeight, aWidth, aHeight), subImage); + ::CGContextDrawImage(aContext, + CGRectMake(aX, -(CGFloat)aY - (CGFloat)aHeight, + aWidth, aHeight), + subImage); ::CGImageRelease(subImage); ::CGImageRelease(cgImage); diff --git a/intl/build/nsI18nModule.cpp b/intl/build/nsI18nModule.cpp index fc88eff2d8c..40491caeab8 100644 --- a/intl/build/nsI18nModule.cpp +++ b/intl/build/nsI18nModule.cpp @@ -96,7 +96,6 @@ NS_DEFINE_NAMED_CID(NS_COLLATION_CID); NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID); #endif #ifdef USE_UNIX_LOCALE -NS_DEFINE_NAMED_CID(NS_POSIXLOCALE_CID); NS_DEFINE_NAMED_CID(NS_COLLATION_CID); NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID); #endif @@ -132,7 +131,6 @@ static const mozilla::Module::CIDEntry kIntlCIDs[] = { { &kNS_DATETIMEFORMAT_CID, false, NULL, nsDateTimeFormatWinConstructor }, #endif #ifdef USE_UNIX_LOCALE - { &kNS_POSIXLOCALE_CID, false, NULL, nsPosixLocaleConstructor }, { &kNS_COLLATION_CID, false, NULL, nsCollationUnixConstructor }, { &kNS_DATETIMEFORMAT_CID, false, NULL, nsDateTimeFormatUnixConstructor }, #endif @@ -170,7 +168,6 @@ static const mozilla::Module::ContractIDEntry kIntlContracts[] = { { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, #endif #ifdef USE_UNIX_LOCALE - { NS_POSIXLOCALE_CONTRACTID, &kNS_POSIXLOCALE_CID }, { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, #endif diff --git a/intl/locale/public/Makefile.in b/intl/locale/public/Makefile.in index b4a7947beaa..aafb09d2d7a 100644 --- a/intl/locale/public/Makefile.in +++ b/intl/locale/public/Makefile.in @@ -49,7 +49,7 @@ EXPORTS = \ nsDateTimeFormatCID.h \ nsIDateTimeFormat.h \ nsILanguageAtomService.h \ - nsIPosixLocale.h \ + nsPosixLocale.h \ nsIOS2Locale.h \ nsWin32Locale.h \ nsICharsetAlias.h \ diff --git a/intl/locale/public/nsIPosixLocale.h b/intl/locale/public/nsIPosixLocale.h deleted file mode 100644 index 2cbe9e8a9aa..00000000000 --- a/intl/locale/public/nsIPosixLocale.h +++ /dev/null @@ -1,69 +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): - * Henry Sobotka - * - * 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 nsIPosixLocale_h__ -#define nsIPosixLocale_h__ - - -#include "nsISupports.h" -#include "nscore.h" -#include "nsString.h" - -/* a434957c-6514-447c-991b-2117b633359c */ -#define NS_IPOSIXLOCALE_IID \ -{ 0xa434957c, \ - 0x6514, \ - 0x447c, \ - {0x99, 0x1b, 0x21, 0x17, 0xb6, 0x33, 0x35, 0x9c} } - -#define MAX_LANGUAGE_CODE_LEN 3 -#define MAX_COUNTRY_CODE_LEN 3 -#define MAX_LOCALE_LEN 128 -#define MAX_EXTRA_LEN 65 - -class nsIPosixLocale : public nsISupports { - -public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPOSIXLOCALE_IID) - - NS_IMETHOD GetPlatformLocale(const nsAString& locale, nsACString& posixLocale) = 0; - NS_IMETHOD GetXPLocale(const char* posixLocale, nsAString& locale) = 0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIPosixLocale, NS_IPOSIXLOCALE_IID) - -#endif diff --git a/intl/locale/public/nsLocaleCID.h b/intl/locale/public/nsLocaleCID.h index b21db93a97b..de547c5307b 100644 --- a/intl/locale/public/nsLocaleCID.h +++ b/intl/locale/public/nsLocaleCID.h @@ -37,27 +37,6 @@ #ifndef nsLocaleCID_h__ #define nsLocaleCID_h__ -// {D92D57C3-BA1D-11d2-AF0C-0060089FE59B} -#define NS_WIN32LOCALE_CID \ -{ 0xd92d57c3, 0xba1d, 0x11d2, \ -{ 0xaf, 0xc, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b } } - -#define NS_WIN32LOCALE_CONTRACTID "@mozilla.org/locale/win32-locale;1" - -// {D92D57C4-BA1D-11d2-AF0C-0060089FE59B} -#define NS_MACLOCALE_CID \ -{ 0xd92d57c4, 0xba1d, 0x11d2, \ -{ 0xaf, 0xc, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b } } - -#define NS_MACLOCALE_CONTRACTID "@mozilla.org/locale/mac-locale;1" - -// {D92D57C5-BA1D-11d2-AF0C-0060089FE59B} -#define NS_POSIXLOCALE_CID \ -{ 0xd92d57c5, 0xba1d, 0x11d2, \ -{ 0xaf, 0xc, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b } } - -#define NS_POSIXLOCALE_CONTRACTID "@mozilla.org/locale/posix-locale;1" - // {F25F74F1-FB59-11d3-A9F2-00203522A03C} #define NS_OS2LOCALE_CID \ { 0xf25f74f1, 0xfb59, 0x11d3, \ diff --git a/intl/locale/src/unix/nsPosixLocale.h b/intl/locale/public/nsPosixLocale.h similarity index 78% rename from intl/locale/src/unix/nsPosixLocale.h rename to intl/locale/public/nsPosixLocale.h index 7fa25095189..3e6f7f56a7c 100644 --- a/intl/locale/src/unix/nsPosixLocale.h +++ b/intl/locale/public/nsPosixLocale.h @@ -20,6 +20,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Henry Sobotka * * 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"), @@ -34,33 +35,23 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ -#ifndef nsPosixLocale_h__ -#define nsPosixLocale_h__ +#ifndef nsIPosixLocale_h__ +#define nsIPosixLocale_h__ -#include "nsISupports.h" #include "nscore.h" #include "nsString.h" -#include "nsIPosixLocale.h" +#define MAX_LANGUAGE_CODE_LEN 3 +#define MAX_COUNTRY_CODE_LEN 3 +#define MAX_LOCALE_LEN 128 +#define MAX_EXTRA_LEN 65 - -class nsPosixLocale : public nsIPosixLocale { - - NS_DECL_ISUPPORTS +class nsPosixLocale { public: - - nsPosixLocale(); - virtual ~nsPosixLocale(); - - NS_IMETHOD GetPlatformLocale(const nsAString& locale, nsACString& posixLocale); - NS_IMETHOD GetXPLocale(const char* posixLocale, nsAString& locale); - -protected: - inline PRBool ParseLocaleString(const char* locale_string, char* language, char* country, char* extra, char separator); - + static nsresult GetPlatformLocale(const nsAString& locale, nsACString& posixLocale); + static nsresult GetXPLocale(const char* posixLocale, nsAString& locale); }; - #endif diff --git a/intl/locale/src/nsLocaleConstructors.h b/intl/locale/src/nsLocaleConstructors.h index 5966eee9d3b..448c018860a 100644 --- a/intl/locale/src/nsLocaleConstructors.h +++ b/intl/locale/src/nsLocaleConstructors.h @@ -77,7 +77,6 @@ #ifdef USE_UNIX_LOCALE #include "nsCollationUnix.h" #include "nsDateTimeFormatUnix.h" -#include "nsPosixLocale.h" #endif #define NSLOCALE_MAKE_CTOR(ctor_, iface_, func_) \ @@ -110,7 +109,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatWin) #endif #ifdef USE_UNIX_LOCALE -NS_GENERIC_FACTORY_CONSTRUCTOR(nsPosixLocale) NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationUnix) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatUnix) #endif diff --git a/intl/locale/src/nsLocaleService.cpp b/intl/locale/src/nsLocaleService.cpp index ead92154310..b2a794bc251 100644 --- a/intl/locale/src/nsLocaleService.cpp +++ b/intl/locale/src/nsLocaleService.cpp @@ -64,7 +64,7 @@ #elif defined(XP_UNIX) # include # include -# include "nsIPosixLocale.h" +# include "nsPosixLocale.h" #endif // @@ -157,55 +157,47 @@ nsLocaleService::nsLocaleService(void) NS_ENSURE_SUCCESS(rv, ); #endif #if defined(XP_UNIX) && !defined(XP_MACOSX) - nsCOMPtr posixConverter = do_GetService(NS_POSIXLOCALE_CONTRACTID); - - nsAutoString xpLocale, platformLocale; - if (posixConverter) { - nsAutoString category, category_platform; - int i; - - nsRefPtr resultLocale(new nsLocale()); - if ( resultLocale == NULL ) { - return; - } - + nsRefPtr resultLocale(new nsLocale()); + NS_ENSURE_TRUE(resultLocale, ); #ifdef MOZ_WIDGET_QT - const char* lang = QLocale::system().name().toAscii(); + const char* lang = QLocale::system().name().toAscii(); #else - // Get system configuration - const char* lang = getenv("LANG"); + // Get system configuration + const char* lang = getenv("LANG"); #endif - for( i = 0; i < LocaleListLength; i++ ) { - nsresult result; - // setlocale( , "") evaluates LC_* and LANG - char* lc_temp = setlocale(posix_locale_category[i], ""); - CopyASCIItoUTF16(LocaleList[i], category); - category_platform = category; - category_platform.AppendLiteral("##PLATFORM"); - if (lc_temp != nsnull) { - result = posixConverter->GetXPLocale(lc_temp, xpLocale); - CopyASCIItoUTF16(lc_temp, platformLocale); + nsAutoString xpLocale, platformLocale; + nsAutoString category, category_platform; + int i; + + for( i = 0; i < LocaleListLength; i++ ) { + nsresult result; + // setlocale( , "") evaluates LC_* and LANG + char* lc_temp = setlocale(posix_locale_category[i], ""); + CopyASCIItoUTF16(LocaleList[i], category); + category_platform = category; + category_platform.AppendLiteral("##PLATFORM"); + if (lc_temp != nsnull) { + result = nsPosixLocale::GetXPLocale(lc_temp, xpLocale); + CopyASCIItoUTF16(lc_temp, platformLocale); + } else { + if ( lang == nsnull ) { + platformLocale.AssignLiteral("en_US"); + result = nsPosixLocale::GetXPLocale("en-US", xpLocale); } else { - if ( lang == nsnull ) { - platformLocale.AssignLiteral("en_US"); - result = posixConverter->GetXPLocale("en-US", xpLocale); - } - else { - CopyASCIItoUTF16(lang, platformLocale); - result = posixConverter->GetXPLocale(lang, xpLocale); - } + CopyASCIItoUTF16(lang, platformLocale); + result = nsPosixLocale::GetXPLocale(lang, xpLocale); } - if (NS_FAILED(result)) { - return; - } - resultLocale->AddCategory(category, xpLocale); - resultLocale->AddCategory(category_platform, platformLocale); } - mSystemLocale = do_QueryInterface(resultLocale); - mApplicationLocale = do_QueryInterface(resultLocale); - } // if ( NS_SUCCEEDED )... + if (NS_FAILED(result)) { + return; + } + resultLocale->AddCategory(category, xpLocale); + resultLocale->AddCategory(category_platform, platformLocale); + } + mSystemLocale = do_QueryInterface(resultLocale); + mApplicationLocale = do_QueryInterface(resultLocale); #endif // XP_UNIX #ifdef XP_OS2 diff --git a/intl/locale/src/unix/nsCollationUnix.cpp b/intl/locale/src/unix/nsCollationUnix.cpp index ed5e4a6a73a..7940db89e71 100644 --- a/intl/locale/src/unix/nsCollationUnix.cpp +++ b/intl/locale/src/unix/nsCollationUnix.cpp @@ -41,10 +41,9 @@ #include "nsCollationUnix.h" #include "nsIServiceManager.h" #include "nsIComponentManager.h" -#include "nsLocaleCID.h" #include "nsILocaleService.h" #include "nsIPlatformCharset.h" -#include "nsIPosixLocale.h" +#include "nsPosixLocale.h" #include "nsCOMPtr.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" @@ -126,10 +125,7 @@ nsresult nsCollationUnix::Initialize(nsILocale* locale) localeStr.AssignLiteral("C"); } - nsCOMPtr posixLocale = do_GetService(NS_POSIXLOCALE_CONTRACTID, &res); - if (NS_SUCCEEDED(res)) { - res = posixLocale->GetPlatformLocale(localeStr, mLocale); - } + nsPosixLocale::GetPlatformLocale(localeStr, mLocale); nsCOMPtr platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &res); if (NS_SUCCEEDED(res)) { diff --git a/intl/locale/src/unix/nsDateTimeFormatUnix.cpp b/intl/locale/src/unix/nsDateTimeFormatUnix.cpp index 02db84ed4e7..35b733face2 100644 --- a/intl/locale/src/unix/nsDateTimeFormatUnix.cpp +++ b/intl/locale/src/unix/nsDateTimeFormatUnix.cpp @@ -41,10 +41,9 @@ #include "nsIServiceManager.h" #include "nsDateTimeFormatUnix.h" #include "nsIComponentManager.h" -#include "nsLocaleCID.h" #include "nsILocaleService.h" #include "nsIPlatformCharset.h" -#include "nsIPosixLocale.h" +#include "nsPosixLocale.h" #include "nsCRT.h" #include "nsReadableUtils.h" #include "nsUnicharUtils.h" @@ -103,10 +102,7 @@ nsresult nsDateTimeFormatUnix::Initialize(nsILocale* locale) if (NS_SUCCEEDED(res) && !localeStr.IsEmpty()) { mLocale = localeStr; // cache locale name - nsCOMPtr posixLocale = do_GetService(NS_POSIXLOCALE_CONTRACTID, &res); - if (NS_SUCCEEDED(res)) { - res = posixLocale->GetPlatformLocale(mLocale, mPlatformLocale); - } + nsPosixLocale::GetPlatformLocale(mLocale, mPlatformLocale); nsCOMPtr platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &res); if (NS_SUCCEEDED(res)) { diff --git a/intl/locale/src/unix/nsPosixLocale.cpp b/intl/locale/src/unix/nsPosixLocale.cpp index 04835ec30c3..b9ad905a04b 100644 --- a/intl/locale/src/unix/nsPosixLocale.cpp +++ b/intl/locale/src/unix/nsPosixLocale.cpp @@ -35,28 +35,17 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsISupports.h" #include "nscore.h" #include "nsString.h" #include "nsPosixLocale.h" -#include "nsLocaleCID.h" #include "prprf.h" #include "plstr.h" #include "nsReadableUtils.h" -/* nsPosixLocale ISupports */ -NS_IMPL_ISUPPORTS1(nsPosixLocale, nsIPosixLocale) +static PRBool +ParseLocaleString(const char* locale_string, char* language, char* country, char* extra, char separator); -nsPosixLocale::nsPosixLocale(void) -{ -} - -nsPosixLocale::~nsPosixLocale(void) -{ - -} - -NS_IMETHODIMP +nsresult nsPosixLocale::GetPlatformLocale(const nsAString& locale, nsACString& posixLocale) { char country_code[MAX_COUNTRY_CODE_LEN+1]; @@ -96,7 +85,7 @@ nsPosixLocale::GetPlatformLocale(const nsAString& locale, nsACString& posixLocal return NS_ERROR_FAILURE; } -NS_IMETHODIMP +nsresult nsPosixLocale::GetXPLocale(const char* posixLocale, nsAString& locale) { char country_code[MAX_COUNTRY_CODE_LEN+1]; @@ -140,8 +129,8 @@ nsPosixLocale::GetXPLocale(const char* posixLocale, nsAString& locale) // // returns PR_FALSE/PR_TRUE depending on if it was of the form LL-CC.Extra -PRBool -nsPosixLocale::ParseLocaleString(const char* locale_string, char* language, char* country, char* extra, char separator) +static PRBool +ParseLocaleString(const char* locale_string, char* language, char* country, char* extra, char separator) { const char *src = locale_string; char modifier[MAX_EXTRA_LEN+1]; diff --git a/intl/locale/src/unix/nsUNIXCharset.cpp b/intl/locale/src/unix/nsUNIXCharset.cpp index a3c9516fac3..2c04a494aca 100644 --- a/intl/locale/src/unix/nsUNIXCharset.cpp +++ b/intl/locale/src/unix/nsUNIXCharset.cpp @@ -41,7 +41,6 @@ #include "nsUConvPropertySearch.h" #include "nsCOMPtr.h" #include "nsReadableUtils.h" -#include "nsLocaleCID.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" #include "nsIUnicodeDecoder.h" diff --git a/ipc/glue/IPCMessageUtils.h b/ipc/glue/IPCMessageUtils.h index a8d2d0263a3..046aaafb31d 100644 --- a/ipc/glue/IPCMessageUtils.h +++ b/ipc/glue/IPCMessageUtils.h @@ -42,6 +42,8 @@ #include "chrome/common/ipc_message_utils.h" #include "prtypes.h" +#include "nsID.h" +#include "nsMemory.h" #include "nsStringGlue.h" #include "nsTArray.h" #include "gfx3DMatrix.h" @@ -687,6 +689,48 @@ struct ParamTraits } }; +template<> +struct ParamTraits +{ + typedef nsID paramType; + + static void Write(Message* aMsg, const paramType& aParam) + { + WriteParam(aMsg, aParam.m0); + WriteParam(aMsg, aParam.m1); + WriteParam(aMsg, aParam.m2); + for (unsigned int i = 0; i < NS_ARRAY_LENGTH(aParam.m3); i++) { + WriteParam(aMsg, aParam.m3[i]); + } + } + + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) + { + if(!ReadParam(aMsg, aIter, &(aResult->m0)) || + !ReadParam(aMsg, aIter, &(aResult->m1)) || + !ReadParam(aMsg, aIter, &(aResult->m2))) + return false; + + for (unsigned int i = 0; i < NS_ARRAY_LENGTH(aResult->m3); i++) + if (!ReadParam(aMsg, aIter, &(aResult->m3[i]))) + return false; + + return true; + } + + static void Log(const paramType& aParam, std::wstring* aLog) + { + aLog->append(L"{"); + aLog->append(StringPrintf(L"%8.8X-%4.4X-%4.4X-", + aParam.m0, + aParam.m1, + aParam.m2)); + for (unsigned int i = 0; i < NS_ARRAY_LENGTH(aParam.m3); i++) + aLog->append(StringPrintf(L"%2.2X", aParam.m3[i])); + aLog->append(L"}"); + } +}; + } /* namespace IPC */ #endif /* __IPC_GLUE_IPCMESSAGEUTILS_H__ */ diff --git a/ipc/glue/Shmem.cpp b/ipc/glue/Shmem.cpp index d8ab314525e..6fe37587bbf 100644 --- a/ipc/glue/Shmem.cpp +++ b/ipc/glue/Shmem.cpp @@ -45,6 +45,7 @@ #include "SharedMemorySysV.h" #include "nsAutoPtr.h" +#include "mozilla/unused.h" namespace mozilla { @@ -356,7 +357,10 @@ Shmem::AssertInvariants() const // trigger SIGSEGV char checkMappingFront = *reinterpret_cast(mData); char checkMappingBack = *(reinterpret_cast(mData) + mSize - 1); - checkMappingFront = checkMappingBack; // avoid "unused" warnings + + // avoid "unused" warnings for these variables: + unused << checkMappingFront; + unused << checkMappingBack; } void diff --git a/js/jsd/jsd_xpc.cpp b/js/jsd/jsd_xpc.cpp index 3a0c73fdf93..d999aeb033c 100644 --- a/js/jsd/jsd_xpc.cpp +++ b/js/jsd/jsd_xpc.cpp @@ -2673,8 +2673,10 @@ jsdService::ActivateDebugger (JSRuntime *rt) printf ("+++ JavaScript debugging hooks installed.\n"); #endif - if (mActivationCallback) - return mActivationCallback->OnDebuggerActivated(); + nsCOMPtr activationCallback; + mActivationCallback.swap(activationCallback); + if (activationCallback) + return activationCallback->OnDebuggerActivated(); return NS_OK; } diff --git a/js/src/SpiderMonkey.rsp b/js/src/SpiderMonkey.rsp deleted file mode 100644 index eb93040c703..00000000000 --- a/js/src/SpiderMonkey.rsp +++ /dev/null @@ -1,3 +0,0 @@ -mozilla/js/src/* -mozilla/js/src/config/* -mozilla/js/src/macbuild/* diff --git a/js/src/bench.sh b/js/src/bench.sh deleted file mode 100755 index c5b1ec5ad03..00000000000 --- a/js/src/bench.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -X="var d = Date.now();"; -for i in t/*.js; do X="$X load(\"$i\");"; done -X="$X print(Date.now() - d);" -echo $X | $1 -j diff --git a/js/src/configure.in b/js/src/configure.in index 505581eb012..e8c03b1086e 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -2241,6 +2241,9 @@ ia64*-hpux*) CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)" # MSVC warnings C4244 and C4800 are ubiquitous, useless, and annoying. CXXFLAGS="$CXXFLAGS -wd4244 -wd4800" + # make 'foo == bar;' error out + CFLAGS="$CFLAGS -we4553" + CXXFLAGS="$CXXFLAGS -we4553" LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib" MOZ_DEBUG_FLAGS='-Zi' MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV' diff --git a/js/src/find-child.py b/js/src/find-child.py index 49807674462..fbe8c7bfd96 100644 --- a/js/src/find-child.py +++ b/js/src/find-child.py @@ -1,4 +1,40 @@ #!/usr/bin/python +# ***** 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 SpiderMonkey JavaScript engine. +# +# The Initial Developer of the Original Code is +# Mozilla Corporation. +# Portions created by the Initial Developer are Copyright (C) 2009 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Graydon Hoare +# +# 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 ***** # # The output of this script is a splicemap. # diff --git a/js/src/js-config.in b/js/src/js-config.in index 59b47198a51..1dc71ea2a8e 100644 --- a/js/src/js-config.in +++ b/js/src/js-config.in @@ -1,4 +1,40 @@ #!/bin/sh +# ***** 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 SpiderMonkey JavaScript engine. +# +# The Initial Developer of the Original Code is +# Mozilla Corporation. +# Portions created by the Initial Developer are Copyright (C) 2008 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Jim Blandy +# +# 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 ***** prefix='@prefix@' mozilla_version='@MOZILLA_VERSION@' diff --git a/js/src/jsify.pl b/js/src/jsify.pl deleted file mode 100644 index 0ce2186935d..00000000000 --- a/js/src/jsify.pl +++ /dev/null @@ -1,483 +0,0 @@ -#!/usr/local/bin/perl - -# This script modifies C code to use the hijacked NSPR routines that are -# now baked into the JavaScript engine rather than using the NSPR -# routines that they were based on, i.e. types like PRArenaPool are changed -# to JSArenaPool. -# -# This script was used in 9/98 to facilitate the incorporation of some NSPR -# code into the JS engine so as to minimize dependency on NSPR. -# - -# Command-line: jsify.pl [options] [filename]* -# -# Options: -# -r Reverse direction of transformation, i.e. JS ==> NSPR2 -# -outdir Directory in which to place output files - - -# NSPR2 symbols that will be modified to JS symbols, e.g. -# PRArena <==> JSArena - -@NSPR_symbols = ( -"PRArena", -"PRArenaPool", -"PRArenaStats", -"PR_ARENAMETER", -"PR_ARENA_", -"PR_ARENA_ALIGN", -"PR_ARENA_ALLOCATE", -"PR_ARENA_CONST_ALIGN_MASK", -"PR_ARENA_DEFAULT_ALIGN", -"PR_ARENA_DESTROY", -"PR_ARENA_GROW", -"PR_ARENA_MARK", -"PR_ARENA_RELEASE", - -"PR_smprintf", -"PR_smprintf_free", -"PR_snprintf", -"PR_sprintf_append", -"PR_sscanf", -"PR_sxprintf", -"PR_vsmprintf", -"PR_vsnprintf", -"PR_vsprintf_append", -"PR_vsxprintf", - -"PRCList", -"PRCListStr", -"PRCLists", - -"PRDestroyEventProc", -"PREvent", -"PREventFunProc", -"PREventQueue", -"PRHandleEventProc", -"PR_PostEvent", -"PR_PostSynchronousEvent", -"PR_ProcessPendingEvents", -"PR_CreateEventQueue", -"PR_DequeueEvent", -"PR_DestroyEvent", -"PR_DestroyEventQueue", -"PR_EventAvailable", -"PR_EventLoop", -"PR_GetEvent", -"PR_GetEventOwner", -"PR_GetEventQueueMonitor", -"PR_GetEventQueueSelectFD", -"PR_GetMainEventQueue", -"PR_HandleEvent", -"PR_InitEvent", -"PR_ENTER_EVENT_QUEUE_MONITOR", -"PR_EXIT_EVENT_QUEUE_MONITOR", -"PR_MapEvents", -"PR_RevokeEvents", - -"PR_cnvtf", -"PR_dtoa", -"PR_strtod", - -"PRFileDesc", - -"PR_HASH_BITS", -"PR_GOLDEN_RATIO", -"PRHashAllocOps", -"PRHashComparator", -"PRHashEntry", -"PRHashEnumerator", -"PRHashFunction", -"PRHashNumber", -"PRHashTable", -"PR_HashString", -"PR_HashTableAdd", -"PR_HashTableDestroy", -"PR_HashTableDump", -"PR_HashTableEnumerateEntries", -"PR_HashTableLookup", -"PR_HashTableRawAdd", -"PR_HashTableRawLookup", -"PR_HashTableRawRemove", -"PR_HashTableRemove", - -"PRBool", -"PRFloat64", -"PRInt16", -"PRInt32", -"PRInt64", -"PRInt8", -"PRIntn", -"PRUint16", -"PRUint32", -"PRUint64", -"PRUint8", -"PRUintn", -"PRPtrDiff", -"PRPtrdiff", -"PRUptrdiff", -"PRUword", -"PRWord", -"PRPackedBool", -"PRSize", -"PRStatus", -"pruword", -"prword", -"prword_t", - -"PR_ALIGN_OF_DOUBLE", -"PR_ALIGN_OF_FLOAT", -"PR_ALIGN_OF_INT", -"PR_ALIGN_OF_INT64", -"PR_ALIGN_OF_LONG", -"PR_ALIGN_OF_POINTER", -"PR_ALIGN_OF_SHORT", -"PR_ALIGN_OF_WORD", -"PR_BITS_PER_BYTE", -"PR_BITS_PER_BYTE_LOG2", -"PR_BITS_PER_DOUBLE", -"PR_BITS_PER_DOUBLE_LOG2", -"PR_BITS_PER_FLOAT", -"PR_BITS_PER_FLOAT_LOG2", -"PR_BITS_PER_INT", -"PR_BITS_PER_INT64", -"PR_BITS_PER_INT64_LOG2", -"PR_BITS_PER_INT_LOG2", -"PR_BITS_PER_LONG", -"PR_BITS_PER_LONG_LOG2", -"PR_BITS_PER_SHORT", -"PR_BITS_PER_SHORT_LOG2", -"PR_BITS_PER_WORD", -"PR_BITS_PER_WORD_LOG2", -"PR_BYTES_PER_BYTE", -"PR_BYTES_PER_DOUBLE", -"PR_BYTES_PER_DWORD", -"PR_BYTES_PER_DWORD_LOG2", -"PR_BYTES_PER_FLOAT", -"PR_BYTES_PER_INT", -"PR_BYTES_PER_INT64", -"PR_BYTES_PER_LONG", -"PR_BYTES_PER_SHORT", -"PR_BYTES_PER_WORD", -"PR_BYTES_PER_WORD_LOG2", - -"PRSegment", -"PRSegmentAccess", -"PRStuffFunc", -"PRThread", - -"PR_APPEND_LINK", - -"PR_ASSERT", - -"PR_ATOMIC_DWORD_LOAD", -"PR_ATOMIC_DWORD_STORE", - -"PR_Abort", - -"PR_ArenaAllocate", -"PR_ArenaCountAllocation", -"PR_ArenaCountGrowth", -"PR_ArenaCountInplaceGrowth", -"PR_ArenaCountRelease", -"PR_ArenaCountRetract", -"PR_ArenaFinish", -"PR_ArenaGrow", -"PR_ArenaRelease", -"PR_CompactArenaPool", -"PR_DumpArenaStats", -"PR_FinishArenaPool", -"PR_FreeArenaPool", -"PR_InitArenaPool", - -"PR_Assert", - -"PR_AttachThread", - -"PR_BEGIN_EXTERN_C", -"PR_BEGIN_MACRO", - -"PR_BIT", -"PR_BITMASK", - -"PR_BUFFER_OVERFLOW_ERROR", - -"PR_CALLBACK", -"PR_CALLBACK_DECL", -"PR_CALLOC", -"PR_CEILING_LOG2", -"PR_CLEAR_ARENA", -"PR_CLEAR_BIT", -"PR_CLEAR_UNUSED", -"PR_CLIST_IS_EMPTY", -"PR_COUNT_ARENA", -"PR_CURRENT_THREAD", - -"PR_GetSegmentAccess", -"PR_GetSegmentSize", -"PR_GetSegmentVaddr", -"PR_GrowSegment", -"PR_DestroySegment", -"PR_MapSegment", -"PR_NewSegment", -"PR_Segment", -"PR_Seg", -"PR_SEGMENT_NONE", -"PR_SEGMENT_RDONLY", -"PR_SEGMENT_RDWR", - -"PR_Calloc", -"PR_CeilingLog2", -"PR_CompareStrings", -"PR_CompareValues", -"PR_DELETE", -"PR_END_EXTERN_C", -"PR_END_MACRO", -"PR_ENUMERATE_STOP", -"PR_FAILURE", -"PR_FALSE", -"PR_FLOOR_LOG2", -"PR_FREEIF", -"PR_FREE_PATTERN", -"PR_FloorLog2", -"PR_FormatTime", -"PR_Free", - -"PR_GetEnv", -"PR_GetError", -"PR_INIT_ARENA_POOL", -"PR_INIT_CLIST", -"PR_INIT_STATIC_CLIST", -"PR_INLINE", -"PR_INSERT_AFTER", -"PR_INSERT_BEFORE", -"PR_INSERT_LINK", -"PR_INT32", -"PR_INTERVAL_NO_TIMEOUT", -"PR_INTERVAL_NO_WAIT", -"PR_Init", -"PR_LIST_HEAD", -"PR_LIST_TAIL", -"PR_LOG", -"PR_LOGGING", -"PR_LOG_ALWAYS", -"PR_LOG_BEGIN", -"PR_LOG_DEBUG", -"PR_LOG_DEFINE", -"PR_LOG_END", -"PR_LOG_ERROR", -"PR_LOG_MAX", -"PR_LOG_MIN", -"PR_LOG_NONE", -"PR_LOG_NOTICE", -"PR_LOG_TEST", -"PR_LOG_WARN", -"PR_LOG_WARNING", -"PR_LogFlush", -"PR_LogPrint", -"PR_MALLOC", -"PR_MAX", -"PR_MD_calloc", -"PR_MD_free", -"PR_MD_malloc", -"PR_MD_realloc", -"PR_MIN", -"PR_Malloc", -"PR_NEW", -"PR_NEWZAP", -"PR_NEXT_LINK", -"PR_NOT_REACHED", -"PR_NewCondVar", -"PR_NewHashTable", -"PR_NewLogModule", -"PR_PREV_LINK", -"PR_PUBLIC_API", -"PR_PUBLIC_DATA", -"PR_RANGE_ERROR", -"PR_REALLOC", -"PR_REMOVE_AND_INIT_LINK", -"PR_REMOVE_LINK", -"PR_ROUNDUP", -"PR_Realloc", - -"PR_SET_BIT", -"PR_STATIC_CALLBACK", -"PR_SUCCESS", -"PR_SetError", -"PR_SetLogBuffering", -"PR_SetLogFile", - -"PR_TEST_BIT", -"PR_TRUE", -"PR_UINT32", -"PR_UPTRDIFF", - -"prarena_h___", -"prbit_h___", -"prclist_h___", -"prdtoa_h___", -"prlog_h___", -"prlong_h___", -"prmacos_h___", -"prmem_h___", -"prprf_h___", -"prtypes_h___", - -"prarena", -"prbit", -"prbitmap_t", -"prclist", -"prcpucfg", -"prdtoa", -"prhash", -"plhash", -"prlong", -"prmacos", -"prmem", -"prosdep", -"protypes", -"prprf", -"prtypes" -); - -while ($ARGV[0] =~ /^-/) { - if ($ARGV[0] eq "-r") { - shift; - $reverse_conversion = 1; - } elsif ($ARGV[0] eq "-outdir") { - shift; - $outdir = shift; - } -} - -# Given an NSPR symbol compute the JS equivalent or -# vice-versa -sub subst { - local ($replacement); - local ($sym) = @_; - - $replacement = substr($sym,0,2) eq "pr" ? "js" : "JS"; - $replacement .= substr($sym, 2); - return $replacement; -} - -# Build the regular expression that will convert between the NSPR -# types and the JS types -if ($reverse_conversion) { - die "Not implemented yet"; -} else { - foreach $sym (@NSPR_symbols) { - $regexp .= $sym . "|" - } - # Get rid of the last "!" - chop $regexp; - - # Replace PR* with JS* and replace pr* with js* - $regexp = 's/(^|\\W)(' . $regexp . ')/$1 . &subst($2)/eg'; -# print $regexp; -} - -# Pre-compile a little subroutine to perform the regexp substitution -# between NSPR types and JS types -eval('sub convert_from_NSPR {($line) = @_; $line =~ ' . $regexp . ';}'); - -sub convert_mallocs { - ($line) = @_; - $line =~ s/PR_MALLOC/malloc/g; - $line =~ s/PR_REALLOC/realloc/g; - $line =~ s/PR_FREE/free/g; - return $line; -} - -sub convert_includes { - ($line) = @_; - if ($line !~ /include/) { - return $line; - } - - if ($line =~ /prlog\.h/) { - $line = '#include "jsutil.h"'. " /* Added by JSIFY */\n"; - } elsif ($line =~ /plhash\.h/) { - $line = '#include "jshash.h"'. " /* Added by JSIFY */\n"; - } elsif ($line =~ /plarena\.h/) { - $line = '#include "jsarena.h"'. " /* Added by JSIFY */\n"; - } elsif ($line =~ /prmem\.h/) { - $line = ""; - } elsif ($line =~ /jsmsg\.def/) { - $line = '#include "js.msg"' . "\n"; - } elsif ($line =~ /shellmsg\.def/) { - $line = '#include "jsshell.msg"' . "\n"; - } elsif ($line =~ /jsopcode\.def/) { - $line = '#include "jsopcode.tbl"' . "\n"; - } - return $line; -} - -sub convert_declarations { - ($line) = @_; - $line =~ s/PR_EXTERN/JS_EXTERN_API/g; - $line =~ s/PR_IMPLEMENT_DATA/JS_EXPORT_DATA/g; - $line =~ s/PR_IMPLEMENT/JS_EXPORT_API/g; - $line =~ s/PR_IMPORT/JS_IMPORT/g; - $line =~ s/PR_PUBLIC_API/JS_EXPORT_API/g; - $line =~ s/PR_PUBLIC_DATA/JS_EXPORT_DATA/g; - return $line; -} - -sub convert_long_long_macros { - ($line) = @_; - $line =~ s/\b(LL_)/JSLL_/g; - return $line; -} - -sub convert_asserts { - ($line) = @_; - $line =~ s/\bPR_ASSERT/JS_ASSERT/g; - return $line; -} - -while ($#ARGV >= 0) { - $infile = shift; - - # Change filename, e.g. prtime.h to jsprtime.h, except for legacy - # files that start with 'prmj', like prmjtime.h. - $outfile = $infile; - if ($infile !~ /^prmj/) { - $outfile =~ s/^pr/js/; - $outfile =~ s/^pl/js/; - } - - if ($outdir) { - $outfile = $outdir . '/' . $outfile; - } - - if ($infile eq $outfile) { - die "Error: refuse to overwrite $outfile, use -outdir option." - } - die "Can't open $infile" if !open(INFILE, "<$infile"); - die "Can't open $outfile for writing" if !open(OUTFILE, ">$outfile"); - - while () { - $line = $_; - - #Get rid of #include "prlog.h" - &convert_includes($line); - - # Rename PR_EXTERN, PR_IMPORT, etc. - &convert_declarations($line); - - # Convert from PR_MALLOC to malloc, etc. - &convert_mallocs($line); - - # Convert from PR_ASSERT to JS_ASSERT -# &convert_asserts($line); - - # Convert from, e.g. PRArena to JSPRArena - &convert_from_NSPR($line); - - # Change LL_* macros to JSLL_* - &convert_long_long_macros($line); - - print OUTFILE $line; - } -} diff --git a/js/src/plify_jsdhash.sed b/js/src/plify_jsdhash.sed deleted file mode 100644 index 90b36923dc4..00000000000 --- a/js/src/plify_jsdhash.sed +++ /dev/null @@ -1,39 +0,0 @@ -/ * Double hashing implementation./a\ -\ * GENERATED BY js/src/plify_jsdhash.sed -- DO NOT EDIT!!! -/ * Double hashing, a la Knuth 6./a\ -\ * GENERATED BY js/src/plify_jsdhash.sed -- DO NOT EDIT!!! -s/jsdhash_h___/pldhash_h___/ -s/jsdhash\.bigdump/pldhash.bigdump/ -s/jstypes\.h/nscore.h/ -s/jsbit\.h/prbit.h/ -s/jsdhash\.h/pldhash.h/ -s/jsdhash\.c/pldhash.c/ -s/jsdhash:/pldhash:/ -s/jsutil\.h/nsDebug.h/ -s/JS_DHASH/PL_DHASH/g -s/JS_DHash/PL_DHash/g -s/JSDHash/PLDHash/g -s/JSHash/PLHash/g -s/uint8 /PRUint8/g -s/uint16 /PRUint16/g -s/uint32 /PRUint32/g -s/\([^U]\)int8 /\1PRInt8/g -s/\([^U]\)int16 /\1PRInt16/g -s/\([^U]\)int32 /\1PRInt32/g -s/uint8/PRUint8/g -s/uint16/PRUint16/g -s/uint32/PRUint32/g -s/\([^U]\)int8/\1PRInt8/g -s/\([^U]\)int16/\1PRInt16/g -s/\([^U]\)int32/\1PRInt32/g -s/JSBool/PRBool/g -s/extern JS_PUBLIC_API(\([^()]*\))/NS_COM_GLUE \1/ -s/JS_PUBLIC_API(\([^()]*\))/\1/ -s/JS_NewDHashTable/PL_NewDHashTable/ -s/JS_ASSERT(0)/NS_NOTREACHED("0")/ -s/\( *\)JS_ASSERT(\(.*\));/\1NS_ASSERTION(\2,\n\1 "\2");/ -s/JSDHASH_ONELINE_ASSERT(\(.*\));/NS_ASSERTION(\1, "\1");/ -s/JS_UNLIKELY/NS_UNLIKELY/g -s/JS_LIKELY/NS_LIKELY/g -s/JS_/PR_/g -s/fprintf(stderr,/printf_stderr(/ diff --git a/js/src/tests/js1_1/regress/jstests.list b/js/src/tests/js1_1/regress/jstests.list index fff82ced1f0..49229c18ecc 100644 --- a/js/src/tests/js1_1/regress/jstests.list +++ b/js/src/tests/js1_1/regress/jstests.list @@ -1,2 +1,3 @@ url-prefix ../../jsreftest.html?test=js1_1/regress/ +script perfect.js script function-001.js diff --git a/js/src/perfect.js b/js/src/tests/js1_1/regress/perfect.js similarity index 83% rename from js/src/perfect.js rename to js/src/tests/js1_1/regress/perfect.js index aeca121186b..ceb340d7a74 100644 --- a/js/src/perfect.js +++ b/js/src/tests/js1_1/regress/perfect.js @@ -1,3 +1,8 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + // Some simple testing of new, eval and some string stuff. // constructor -- expression array initialization @@ -14,6 +19,7 @@ function ExprArray(n,v) function perfect(n) { print("The perfect numbers up to " + n + " are:"); + var results = []; // We build sumOfDivisors[i] to hold a string expression for // the sum of the divisors of i, excluding i itself. @@ -27,13 +33,15 @@ function perfect(n) // already by evaluating. if (eval(sumOfDivisors[divisor]) == divisor) { print("" + divisor + " = " + sumOfDivisors[divisor]); + results.push(divisor); } } print("That's all."); + return results; } print("\nA number is 'perfect' if it is equal to the sum of its") print("divisors (excluding itself).\n"); -perfect(500); +reportCompare(perfect(500).join(), "6,28,496"); diff --git a/js/src/time.sh b/js/src/time.sh deleted file mode 100755 index 05b34993bf1..00000000000 --- a/js/src/time.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -echo -n interp:' ' -for i in 1 2 3 4 5; do - INTERP=`Darwin_OPT.OBJ/js -e 'var d = Date.now(); load("'$1'"); print(Date.now() - d);'` - echo -n $INTERP' ' -done -echo -ne '\njit: ' -for i in 1 2 3 4 5; do - JIT=`Darwin_OPT.OBJ/js -j -e 'var d = Date.now(); load("'$1'"); print(Date.now() - d);'` - echo -n $JIT' ' -done -echo -ne '\njit factor: ' -(echo scale=2; echo $INTERP / $JIT ) | bc diff --git a/js/src/xpconnect/idl/Makefile.in b/js/src/xpconnect/idl/Makefile.in index 575a38a208d..974d6351fab 100644 --- a/js/src/xpconnect/idl/Makefile.in +++ b/js/src/xpconnect/idl/Makefile.in @@ -63,17 +63,9 @@ XPIDLSRCS = \ nsIScriptError.idl \ nsIXPCScriptNotify.idl \ nsIScriptableInterfaces.idl \ - XPCIDispatch.idl \ xpcIJSWeakReference.idl \ xpcIJSGetFactory.idl \ $(NULL) -ifdef XPC_IDISPATCH_SUPPORT -XPIDLSRCS += \ - nsIDispatchSupport.idl \ - nsIActiveXSecurityPolicy.idl \ - $(NULL) -endif - include $(topsrcdir)/config/rules.mk diff --git a/js/src/xpconnect/idl/nsIDispatchSupport.idl b/js/src/xpconnect/idl/nsIDispatchSupport.idl deleted file mode 100644 index a5d0e6419d0..00000000000 --- a/js/src/xpconnect/idl/nsIDispatchSupport.idl +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 "nsISupports.idl" -#include "nsIVariant.idl" - -%{ C++ -// Pull in jsval definition -#include "jspubtd.h" - -// {40c4883d-079f-43db-82a9-df0a59d37998} -#define NS_IDISPATCH_SUPPORT_CID \ - { 0x40c4883d, 0x079f, 0x43db, \ - { 0x82, 0xa9, 0xdf, 0x0a, 0x59, 0xd3, 0x79, 0x98 } } -#ifdef XPC_IDISPATCH_SUPPORT -#define NS_IDISPATCH_SUPPORT_CONTRACTID "@mozilla.org/nsdispatchsupport;1" -// Disable the warning concerning IDispatch being a struct but now defined -// as a class -#pragma warning(push) -#pragma warning(disable : 4099) -#endif -%} - -native COMVARIANT(VARIANT); -[ptr] native COMVARIANTPtr(VARIANT); -[ptr] native JSContextPtr(JSContext); - -interface IDispatch; - -[uuid(38df70e9-12f8-4732-af91-df36c38dc6f6)] -interface nsIDispatchSupport : nsISupports -{ - /** - * Converts a COM Variant to a jsval. - * @param comvar The COM Variant to be converted. - * @param val The jsval to receive the converted value. - */ - void COMVariant2JSVal(in COMVARIANTPtr comvar, out jsval val); - - /** - * Converts a jsval to a COM Variant - * @param var The jsval to be converted. - * @param comvar The COM Variant to receive the converted value - */ - void JSVal2COMVariant(in jsval var, out COMVARIANT comvar); - - /** - * Test if the class is safe to host. - * @param clsid The nsID representation of the CLSID to test. - * @param classExists Returns containing PR_FALSE if the class is - * not registered. - */ - boolean isClassSafeToHost(in JSContextPtr cx, in nsCIDRef cid, - in boolean capsCheck, out boolean classExists); - - /** - * Test if the specified class is marked safe for scripting. - * @param cid The nsID representation of the CLSID to test. - * @param classExists Returns containing PR_FALSE if the class is not - * registered. - */ - boolean isClassMarkedSafeForScripting(in nsCIDRef cid, - out boolean classExists); - - /** - * Test if the instantiated object is safe for scripting on the specified - * interface. - * @param theObject The object to test (an IUnknown cast into a void *). - * @param iid The interface to test if it is safe for scripting on. - */ - boolean isObjectSafeForScripting(in voidPtr theObject, in nsIIDRef id); - - /** - * Return the ActiveX security and hosting flags. See nsIActiveXSecurityPolicy - * for list of flags. - * @param context The context for which flags are requested. At present the - * only valid value is nsnull. - */ - unsigned long getHostingFlags(in string aContext); -}; - -%{ C++ -#pragma warning(pop) -%} diff --git a/js/src/xpconnect/idl/nsIXPConnect.idl b/js/src/xpconnect/idl/nsIXPConnect.idl index 990856472f0..45547f3d304 100644 --- a/js/src/xpconnect/idl/nsIXPConnect.idl +++ b/js/src/xpconnect/idl/nsIXPConnect.idl @@ -137,14 +137,6 @@ class nsWrapperCache; #define NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN GENERATE_XPC_FAILURE(52) #define NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL GENERATE_XPC_FAILURE(53) -#ifdef XPC_IDISPATCH_SUPPORT -// IDispatch support related errors -#define NS_ERROR_XPC_COM_UNKNOWN GENERATE_XPC_FAILURE(54) -#define NS_ERROR_XPC_COM_ERROR GENERATE_XPC_FAILURE(55) -#define NS_ERROR_XPC_COM_INVALID_CLASS_ID GENERATE_XPC_FAILURE(56) -#define NS_ERROR_XPC_COM_CREATE_FAILED GENERATE_XPC_FAILURE(57) -#define NS_ERROR_XPC_IDISPATCH_NOT_ENABLED GENERATE_XPC_FAILURE(58) -#endif // any new errors here should have an associated entry added in xpc.msg /***************************************************************************/ %} diff --git a/js/src/xpconnect/src/Makefile.in b/js/src/xpconnect/src/Makefile.in index 7ca36b97351..8a7adaddd93 100644 --- a/js/src/xpconnect/src/Makefile.in +++ b/js/src/xpconnect/src/Makefile.in @@ -93,18 +93,6 @@ CPPSRCS = \ xpcquickstubs.cpp \ dom_quickstubs.cpp \ $(NULL) -ifdef XPC_IDISPATCH_SUPPORT -CPPSRCS += XPCDispObject.cpp \ - XPCDispInterface.cpp \ - XPCDispConvert.cpp \ - XPCDispTypeInfo.cpp \ - XPCDispTearOff.cpp \ - XPCIDispatchExtension.cpp \ - XPCDispParams.cpp \ - XPCIDispatchClassInfo.cpp \ - nsDispatchSupport.cpp \ - $(NULL) -endif include $(topsrcdir)/config/config.mk @@ -121,6 +109,7 @@ LOCAL_INCLUDES = \ -I$(topsrcdir)/layout/style \ -I$(topsrcdir)/layout/base \ -I$(topsrcdir)/dom/base \ + -I$(topsrcdir)/xpcom/ds \ $(NULL) SHARED_LIBRARY_LIBS = \ @@ -154,14 +143,6 @@ ENABLE_TRACEABLE_FLAGS = --enable-traceables endif # ENABLE_JIT -ifdef XPC_IDISPATCH_SUPPORT -DEFINES += -DXPC_IDISPATCH_SUPPORT -ifdef XPC_COMOBJECT -DEFINES += -DXPC_COMOBJECT -endif - -endif - ifeq ($(OS_ARCH),WINNT) ifndef GNU_CXX ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER))) diff --git a/js/src/xpconnect/src/XPCDispConvert.cpp b/js/src/xpconnect/src/XPCDispConvert.cpp deleted file mode 100644 index a4e99e67eb3..00000000000 --- a/js/src/xpconnect/src/XPCDispConvert.cpp +++ /dev/null @@ -1,593 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -/** - * \file XPCDispConvert.cpp - * Contains the implementation of the XPCDispConvert class - */ - -#include "xpcprivate.h" - -VARTYPE XPCDispConvert::JSTypeToCOMType(XPCCallContext& ccx, jsval val) -{ - if(JSVAL_IS_PRIMITIVE(val)) - { - if(JSVAL_IS_STRING(val)) - { - return VT_BSTR; - } - if(JSVAL_IS_INT(val)) - { - return VT_I4; - } - if(JSVAL_IS_DOUBLE(val)) - { - return VT_R8; - } - if(JSVAL_IS_BOOLEAN(val)) - { - return VT_BOOL; - } - if(JSVAL_IS_VOID(val)) - { - return VT_EMPTY; - } - if(JSVAL_IS_NULL(val)) - { - return VT_NULL; - } - } - else - { - if(JS_IsArrayObject(ccx, JSVAL_TO_OBJECT(val))) - return VT_ARRAY | VT_VARIANT; - return VT_DISPATCH; - } - NS_ERROR("XPCDispConvert::JSTypeToCOMType was unable to identify the type of the jsval"); - return VT_EMPTY; -} - -JSBool XPCDispConvert::JSArrayToCOMArray(XPCCallContext& ccx, JSObject *obj, - VARIANT & var, nsresult& err) -{ - err = NS_OK; - jsuint len; - if(!JS_GetArrayLength(ccx, obj, &len)) - { - // TODO: I think we should create a specific error for this - err = NS_ERROR_XPC_NOT_ENOUGH_ELEMENTS_IN_ARRAY; - return PR_FALSE; - } - // Create the safe array of variants and populate it - SAFEARRAY * array = nsnull; - VARIANT* varArray = 0; - for(jsuint index = 0; index < len; ++index) - { - jsval val; - if(JS_GetElement(ccx, obj, index, &val)) - { - if(!JSVAL_IS_VOID(val)) - { - if(!array) - { - // Create an array that starts at index, and has len - // elements - array = SafeArrayCreateVector(VT_VARIANT, index, len - index); - if(!array) - { - err = NS_ERROR_OUT_OF_MEMORY; - return JS_FALSE; - } - if(FAILED(SafeArrayAccessData(array, reinterpret_cast(&varArray)))) - { - err = NS_ERROR_FAILURE; - return JS_FALSE; - } - } - if(!JSToCOM(ccx, val, *varArray, err)) - { - SafeArrayUnaccessData(array); - err = NS_ERROR_FAILURE; - // This cleans up the elements as well - SafeArrayDestroyData(array); - return JS_FALSE; - } - } - if(varArray) - ++varArray; - } - } - if(!array) - { - array = SafeArrayCreateVector(VT_VARIANT, 0, 0); - if(!array) - { - err = NS_ERROR_OUT_OF_MEMORY; - return JS_FALSE; - } - } - else - { - SafeArrayUnaccessData(array); - } - var.vt = VT_ARRAY | VT_VARIANT; - var.parray = array; - return JS_TRUE; -} - -#define XPC_ASSIGN(src, dest, data) *dest.p##data = src.data - -/** - * Copies a variant to a by ref variant - * NOTE: This does not perform any reference counting. It simply does - * a copy of the values, it's up to the caller to manage any ownership issues - * @param src the variant to be copied - * @param dest the destination for the copy - * @return JS_TRUE if the copy was performed JS_FALSE if it failed - */ -inline -JSBool xpc_CopyVariantByRef(VARIANT & src, VARIANT & dest) -{ - VARIANT temp; - VARTYPE vt = dest.vt & ~(VT_BYREF); - if(vt != src.vt) - { - // TODO: This fails more than I had hoped, we may want to - // add some logic to handle more conversions - if(FAILED(VariantChangeType(&temp, &src, VARIANT_ALPHABOOL, vt))) - { - return JS_FALSE; - } - } - else - temp = src; - switch (vt) - { - case VT_I2: - { - XPC_ASSIGN(temp, dest, iVal); - } - break; - case VT_I4: - { - XPC_ASSIGN(temp, dest, lVal); - } - break; - case VT_R4: - { - XPC_ASSIGN(temp, dest, fltVal); - } - break; - case VT_R8: - { - XPC_ASSIGN(temp, dest, dblVal); - } - break; - case VT_CY: - { - XPC_ASSIGN(temp, dest, cyVal); - } - break; - case VT_DATE: - { - XPC_ASSIGN(temp, dest, date); - } - break; - case VT_BSTR: - { - XPC_ASSIGN(temp, dest, bstrVal); - } - break; - case VT_DISPATCH: - { - XPC_ASSIGN(temp, dest, pdispVal); - } - break; - case VT_ERROR: - { - XPC_ASSIGN(temp, dest, scode); - } - break; - case VT_BOOL: - { - XPC_ASSIGN(temp, dest, boolVal); - } - break; - case VT_VARIANT: - { - // Not Supported right now - return JS_FALSE; - } - break; - case VT_I1: - { - XPC_ASSIGN(temp, dest, cVal); - } - break; - case VT_UI1: - { - XPC_ASSIGN(temp, dest, bVal); - } - break; - case VT_UI2: - { - XPC_ASSIGN(temp, dest, iVal); - } - break; - case VT_UI4: - { - XPC_ASSIGN(temp, dest, uiVal); - } - break; - case VT_INT: - { - XPC_ASSIGN(temp, dest, intVal); - } - break; - case VT_UINT: - { - XPC_ASSIGN(temp, dest, uintVal); - } - break; - default: - { - return JS_FALSE; - } - } - return JS_TRUE; -} - -JSBool XPCDispConvert::JSToCOM(XPCCallContext& ccx, - jsval src, - VARIANT & dest, - nsresult& err, - JSBool isByRef) -{ - err = NS_OK; - VARIANT byRefVariant; - VARIANT * varDest = isByRef ? &byRefVariant : &dest; - varDest->vt = JSTypeToCOMType(ccx, src); - switch (varDest->vt) - { - case VT_BSTR: - { - JSString* str = JSVAL_TO_STRING(src); - jschar * chars = JS_GetStringChars(str); - if(!chars) - { - err = NS_ERROR_XPC_BAD_CONVERT_NATIVE; - // Avoid cleaning up garbage - varDest->vt = VT_EMPTY; - return JS_FALSE; - } - - CComBSTR val(JS_GetStringLength(str), - reinterpret_cast(chars)); - varDest->bstrVal = val.Detach(); - } - break; - case VT_I4: - { - varDest->vt = VT_I4; - varDest->lVal = JSVAL_TO_INT(src); - } - break; - case VT_R8: - { - varDest->vt = VT_R8; - varDest->dblVal = JSVAL_TO_DOUBLE(src); - } - break; - case VT_EMPTY: - case VT_NULL: - break; - case VT_ARRAY | VT_VARIANT: - { - JSObject * obj = JSVAL_TO_OBJECT(src); - return JSArrayToCOMArray(ccx, obj, *varDest, err); - } - break; - case VT_DISPATCH: - { - JSObject * obj = JSVAL_TO_OBJECT(src); - IUnknown * pUnknown = nsnull; - if(!XPCConvert::JSObject2NativeInterface( - ccx, - (void**)&pUnknown, - obj, - &NSID_IDISPATCH, - nsnull, - &err)) - { - // Avoid cleaning up garbage - varDest->vt = VT_EMPTY; - return JS_FALSE; - } - varDest->vt = VT_DISPATCH; - pUnknown->QueryInterface(IID_IDispatch, - reinterpret_cast - (&varDest->pdispVal)); - NS_IF_RELEASE(pUnknown); - } - break; - case VT_BOOL: - { - varDest->boolVal = JSVAL_TO_BOOLEAN(src) ? VARIANT_TRUE : VARIANT_FALSE; - } - break; - default: - { - NS_ERROR("This is out of synce with XPCDispConvert::JSTypeToCOMType"); - err = NS_ERROR_XPC_BAD_CONVERT_NATIVE; - // Avoid cleaning up garbage - varDest->vt = VT_EMPTY; - return JS_FALSE; - } - break; - } - if(isByRef) - { - if(!xpc_CopyVariantByRef(byRefVariant, dest)) - { - // Avoid cleaning up garbage - dest.vt = VT_EMPTY; - } - } - return JS_TRUE; -} - -JSBool XPCDispConvert::COMArrayToJSArray(XPCCallContext& ccx, - const VARIANT & src, - jsval & dest, nsresult& err) -{ - err = NS_OK; - // We only support one dimensional arrays for now - if(SafeArrayGetDim(src.parray) != 1) - { - err = NS_ERROR_FAILURE; - return JS_FALSE; - } - // Get the upper bound; - long ubound; - if(FAILED(SafeArrayGetUBound(src.parray, 1, &ubound))) - { - err = NS_ERROR_FAILURE; - return JS_FALSE; - } - // Get the lower bound - long lbound; - if(FAILED(SafeArrayGetLBound(src.parray, 1, &lbound))) - { - err = NS_ERROR_FAILURE; - return JS_FALSE; - } - // Create the JS Array - JSObject * array = JS_NewArrayObject(ccx, ubound - lbound + 1, nsnull); - if(!array) - { - err = NS_ERROR_OUT_OF_MEMORY; - return JS_FALSE; - } - AUTO_MARK_JSVAL(ccx, OBJECT_TO_JSVAL(array)); - // Divine the type of our array - VARTYPE vartype; - if((src.vt & VT_ARRAY) != 0) - { - vartype = src.vt & ~VT_ARRAY; - } - else // This was maybe a VT_SAFEARRAY - { - if(FAILED(SafeArrayGetVartype(src.parray, &vartype))) - return JS_FALSE; - } - jsval val = JSVAL_NULL; - AUTO_MARK_JSVAL(ccx, &val); - for(long index = lbound; index <= ubound; ++index) - { - HRESULT hr; - _variant_t var; - if(vartype == VT_VARIANT) - { - hr = SafeArrayGetElement(src.parray, &index, &var); - } - else - { - var.vt = vartype; - hr = SafeArrayGetElement(src.parray, &index, &var.byref); - } - if(FAILED(hr)) - { - err = NS_ERROR_FAILURE; - return JS_FALSE; - } - if(!COMToJS(ccx, var, val, err)) - return JS_FALSE; - JS_SetElement(ccx, array, index, &val); - } - dest = OBJECT_TO_JSVAL(array); - return JS_TRUE; -} - -/** - * Converts a string to a jsval - * @param cx the JSContext - * @param str the unicode string to be converted - * @param len the length of the string being converted - * @return the jsval representing the string - */ -inline -jsval StringToJSVal(JSContext* cx, const PRUnichar * str, PRUint32 len) -{ - JSString * s = JS_NewUCStringCopyN(cx, - reinterpret_cast(str), - len); - if(s) - return STRING_TO_JSVAL(s); - else - return JSVAL_NULL; -} - - -#define VALUE(val) (isPtr ? *src.p##val : src.val) -JSBool XPCDispConvert::COMToJS(XPCCallContext& ccx, const VARIANT& src, - jsval& dest, nsresult& err) -{ - err = NS_OK; - if(src.vt & VT_ARRAY || src.vt == VT_SAFEARRAY) - { - return COMArrayToJSArray(ccx, src, dest, err); - } - PRBool isPtr = src.vt & VT_BYREF; - switch (src.vt & ~(VT_BYREF)) - { - case VT_UINT: - { - return JS_NewNumberValue(ccx, VALUE(uintVal), &dest); - } - break; - case VT_UI4: - { - return JS_NewNumberValue(ccx, VALUE(ulVal), &dest); - } - break; - case VT_INT: - { - return JS_NewNumberValue(ccx, VALUE(intVal), &dest); - } - break; - case VT_I4: - { - return JS_NewNumberValue(ccx, VALUE(lVal), &dest); - } - break; - case VT_UI1: - { - dest = INT_TO_JSVAL(VALUE(bVal)); - } - break; - case VT_I1: - { - dest = INT_TO_JSVAL(VALUE(cVal)); - } - break; - case VT_UI2: - { - dest = INT_TO_JSVAL(VALUE(uiVal)); - } - break; - case VT_I2: - { - dest = INT_TO_JSVAL(VALUE(iVal)); - } - break; - case VT_R4: - { - return JS_NewNumberValue(ccx, VALUE(fltVal), &dest); - } - break; - case VT_R8: - { - return JS_NewNumberValue(ccx, VALUE(dblVal), &dest); - } - break; - case VT_BOOL: - { - dest = BOOLEAN_TO_JSVAL(VALUE(boolVal) != VARIANT_FALSE ? JS_TRUE : JS_FALSE); - } - break; - case VT_DISPATCH: - { - XPCDispObject::WrapIDispatch(VALUE(pdispVal), ccx, - JS_GetGlobalObject(ccx), &dest); - } - break; - case VT_DATE: - { - // Convert date to string and frees it when we're done - _bstr_t str(src); - dest = StringToJSVal(ccx, str, str.length()); - } - break; - case VT_EMPTY: - { - dest = JSVAL_VOID; - } - break; - case VT_NULL: - { - dest = JSVAL_NULL; - } - break; - case VT_ERROR: - { - return JS_NewNumberValue(ccx, VALUE(scode), &dest); - } - break; - case VT_CY: - { - return JS_NewNumberValue( - ccx, - static_cast - (isPtr ? src.pcyVal->int64 : - src.cyVal.int64) / 100.0, - &dest); - } - break; - /** - * Currently unsupported conversion types - */ - case VT_UNKNOWN: - default: - { - // Last ditch effort to convert to string - if(FAILED(VariantChangeType(const_cast(&src), - const_cast(&src), - VARIANT_ALPHABOOL, VT_BSTR))) - { - err = NS_ERROR_XPC_BAD_CONVERT_JS; - return JS_FALSE; - } - isPtr = FALSE; - } // Fall through on success - case VT_BSTR: - { - dest = StringToJSVal(ccx, VALUE(bstrVal), SysStringLen(VALUE(bstrVal))); - } - break; - } - return JS_TRUE; -} diff --git a/js/src/xpconnect/src/XPCDispInlines.h b/js/src/xpconnect/src/XPCDispInlines.h deleted file mode 100644 index 02fe287f7e7..00000000000 --- a/js/src/xpconnect/src/XPCDispInlines.h +++ /dev/null @@ -1,654 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -/** - * \file XPCDispInlines.h inline implementations - * Implementations for inline members of classes found in DispPrivate.h - */ - - -inline -PRBool nsXPConnect::IsIDispatchEnabled() -{ - return XPCIDispatchExtension::IsEnabled(); -} - -//============================================================================= -// XPCDispInterface::Member:ParamInfo inlines - -inline -XPCDispInterface::Member::ParamInfo::ParamInfo( - const ELEMDESC * paramInfo) : mParamInfo(paramInfo) -{ -} - -inline -JSBool XPCDispInterface::Member::ParamInfo::InitializeOutputParam( - void * varBuffer, VARIANT & var) const -{ - var.vt = GetType() | VT_BYREF; - var.byref = varBuffer; - return JS_TRUE; -} - -inline -PRBool XPCDispInterface::Member::ParamInfo::IsFlagSet( - unsigned short flag) const -{ - return mParamInfo->paramdesc.wParamFlags & flag ? PR_TRUE : PR_FALSE; -} - -inline -PRBool XPCDispInterface::Member::ParamInfo::IsIn() const -{ - return IsFlagSet(PARAMFLAG_FIN) || mParamInfo->paramdesc.wParamFlags == 0; -} - -inline -PRBool XPCDispInterface::Member::ParamInfo::IsOut() const -{ - return IsFlagSet(PARAMFLAG_FOUT); -} - -inline -PRBool XPCDispInterface::Member::ParamInfo::IsOptional() const -{ - return IsFlagSet(PARAMFLAG_FOPT); -} - -inline -PRBool XPCDispInterface::Member::ParamInfo::IsRetVal() const -{ - return IsFlagSet(PARAMFLAG_FRETVAL); -} - -// TODO: Handle VT_ARRAY as well -inline -VARTYPE XPCDispInterface::Member::ParamInfo::GetType() const -{ - return mParamInfo->tdesc.vt == VT_PTR ? mParamInfo->tdesc.lptdesc->vt : mParamInfo->tdesc.vt; -} - -//============================================================================= -// XPCDispInterface::Member inlines - -inline -XPCDispInterface::Member::Member() : - mType(UNINITIALIZED), mFuncDesc(nsnull), mGetterFuncDesc(nsnull), - mTypeInfo(reinterpret_cast(nsnull)) -{ -} - -inline -XPCDispInterface::Member::~Member() -{ - if(mTypeInfo) - { - // Test to see if we have a separate getter. If we only have a getter they can - // be the same - PRBool releaseGetter = mGetterFuncDesc != nsnull && mFuncDesc != mGetterFuncDesc; - if(mFuncDesc) - mTypeInfo->ReleaseFuncDesc(mFuncDesc); - if(releaseGetter) - mTypeInfo->ReleaseFuncDesc(mGetterFuncDesc); - } -} - -inline -void* XPCDispInterface::Member::operator new(size_t, Member* p) -{ - return p; -} - -inline -void XPCDispInterface::Member::MakeGetter() -{ - NS_ASSERTION(!IsFunction(), "Can't be function and property"); - mType |= GET_PROPERTY; -} - -inline -void XPCDispInterface::Member::MakeSetter() -{ - NS_ASSERTION(!IsFunction(), "Can't be function and property"); - mType |= SET_PROPERTY; -} - -inline -void XPCDispInterface::Member::ResetType() -{ - mType = UNINITIALIZED; -} - -inline -void XPCDispInterface::Member::SetFunction() -{ - NS_ASSERTION(!IsProperty(), "Can't be function and property"); - mType = FUNCTION; -} - -inline -PRBool XPCDispInterface::Member::IsFlagSet(unsigned short flag) const -{ - return mType & flag ? PR_TRUE : PR_FALSE; -} - -inline -PRBool XPCDispInterface::Member::IsSetter() const -{ - return IsFlagSet(SET_PROPERTY); -} - -inline -PRBool XPCDispInterface::Member::IsGetter() const -{ - return IsFlagSet(GET_PROPERTY); -} - -inline -PRBool XPCDispInterface::Member::IsProperty() const -{ - return IsSetter() || IsGetter(); -} - -inline -PRBool XPCDispInterface::Member::IsFunction() const -{ - return IsFlagSet(FUNCTION); -} - -inline -PRBool XPCDispInterface::Member::IsParameterizedSetter() const -{ - return IsSetter() && GetParamCount() > 1; -} - -inline -PRBool XPCDispInterface::Member::IsParameterizedGetter() const -{ - return IsGetter() && (GetParamCount(PR_TRUE) > 1 || - (GetParamCount(PR_TRUE) == 1 && !GetParamInfo(0, PR_TRUE).IsRetVal())); -} - -inline -PRBool XPCDispInterface::Member::IsParameterizedProperty() const -{ - return IsParameterizedSetter() || IsParameterizedGetter(); -} - -inline -jsid XPCDispInterface::Member::GetName() const -{ - return mName; -} - -inline -void XPCDispInterface::Member::SetName(jsid name) -{ - mName = name; -} - -inline -PRUint32 XPCDispInterface::Member::GetDispID() const -{ - return mFuncDesc->memid; -} - -inline -PRUint32 XPCDispInterface::Member::GetParamCount(PRBool getter) const -{ - return (getter && mGetterFuncDesc) ? mGetterFuncDesc->cParams : mFuncDesc->cParams; -} - -inline -XPCDispInterface::Member::ParamInfo XPCDispInterface::Member::GetParamInfo(PRUint32 index, PRBool getter) const -{ - NS_ASSERTION(index < GetParamCount(getter), "Array bounds error"); - return ParamInfo(((getter && mGetterFuncDesc) ? mGetterFuncDesc->lprgelemdescParam : mFuncDesc->lprgelemdescParam) + index); -} - -inline -void XPCDispInterface::Member::SetTypeInfo(DISPID dispID, - ITypeInfo* pTypeInfo, - FUNCDESC* funcdesc) -{ - mTypeInfo = pTypeInfo; - mFuncDesc = funcdesc; -} - -inline -void XPCDispInterface::Member::SetGetterFuncDesc(FUNCDESC* funcdesc) -{ - mGetterFuncDesc = funcdesc; -} - -inline -PRUint16 XPCDispInterface::Member::GetParamType(PRUint32 index) const -{ - return mFuncDesc->lprgelemdescParam[index].paramdesc.wParamFlags; -} - -inline -void XPCDispInterface::Member::SetMemID(DISPID memID) -{ - mMemID = memID; -} - -inline -DISPID XPCDispInterface::Member::GetMemID() const -{ - return mMemID; -} - -//============================================================================= -// XPCDispInterface::Allocator - -inline -XPCDispInterface* XPCDispInterface::Allocator::Allocate() -{ - return Valid() ? new (Count()) XPCDispInterface(mCX, mTypeInfo, mIDispatchMembers) : nsnull; -} - -inline -XPCDispInterface::Allocator::~Allocator() -{ - delete [] mMemIDs; -} - -PRBool XPCDispInterface::Allocator::Valid() const -{ - return mMemIDs ? PR_TRUE : PR_FALSE; -} - -//============================================================================= -// XPCDispInterface inlines - -inline -JSObject* XPCDispInterface::GetJSObject() const -{ - return mJSObject; -} - -inline -void XPCDispInterface::SetJSObject(JSObject* jsobj) -{ - mJSObject = jsobj; -} - -inline -const XPCDispInterface::Member* XPCDispInterface::FindMember(jsid name) const -{ - // Iterate backwards to save time - const Member* member = mMembers + mMemberCount; - while(member > mMembers) - { - --member; - if(name == member->GetName()) - { - return member; - } - } - return nsnull; -} - - -inline -const XPCDispInterface::Member& XPCDispInterface::GetMember(PRUint32 index) -{ - NS_ASSERTION(index < mMemberCount, "invalid index"); - return mMembers[index]; -} - -inline -PRUint32 XPCDispInterface::GetMemberCount() const -{ - return mMemberCount; -} - -inline -void XPCDispInterface::operator delete(void * p) -{ - PR_Free(p); -} - -inline -XPCDispInterface::~XPCDispInterface() -{ - // Cleanup our members, the first gets cleaned up by the destructor - // We have to cleanup the rest manually. These members are allocated - // as part of the XPCIDispInterface object at the end - for(PRUint32 index = 1; index < GetMemberCount(); ++index) - { - mMembers[index].~Member(); - } -} - -inline -XPCDispInterface::XPCDispInterface(JSContext* cx, ITypeInfo * pTypeInfo, - PRUint32 members) : mJSObject(nsnull) -{ - InspectIDispatch(cx, pTypeInfo, members); -} - -inline -void * XPCDispInterface::operator new (size_t, PRUint32 members) -{ - // Must allow for the member in XPCDispInterface - if(!members) - members = 1; - // Calculate the size needed for the base XPCDispInterface and its members - return PR_Malloc(sizeof(XPCDispInterface) + sizeof(Member) * (members - 1)); -} - -//============================================================================= -// XPCDispNameArray inlines - -inline -XPCDispNameArray::XPCDispNameArray() : mCount(0), mNames(0) -{ -} - -inline -XPCDispNameArray::~XPCDispNameArray() -{ - delete [] mNames; -} - -inline -void XPCDispNameArray::SetSize(PRUint32 size) -{ - NS_ASSERTION(mCount == 0, "SetSize called more than once"); - mCount = size; - mNames = (size ? new nsString[size] : 0); -} - -inline -PRUint32 XPCDispNameArray::GetSize() const -{ - return mCount; -} - -inline -void XPCDispNameArray::SetName(DISPID dispid, nsAString const & name) -{ - NS_ASSERTION(dispid <= (PRInt32)mCount, "Array bounds error in XPCDispNameArray::SetName"); - mNames[dispid - 1] = name; -} - -inline -const nsAString & XPCDispNameArray::GetName(DISPID dispid) const -{ - NS_ASSERTION(dispid <= (PRInt32)mCount, "Array bounds error in XPCDispNameArray::Get"); - if(dispid > 0) - return mNames[dispid - 1]; - return EmptyString(); -} - -inline -DISPID XPCDispNameArray::Find(const nsAString &target) const -{ - for(PRUint32 index = 0; index < mCount; ++index) - { - if(mNames[index].Equals(target)) - return static_cast(index + 1); - } - return 0; -} - -//============================================================================= -// XPCDispIDArray inlines - -inline -PRUint32 XPCDispIDArray::Length() const -{ - return mIDArray.Length(); -} - -inline -jsval XPCDispIDArray::Item(JSContext* cx, PRUint32 index) const -{ - jsval val; - if(!JS_IdToValue(cx, mIDArray.ElementAt(index), &val)) - return JSVAL_NULL; - return val; -} - -inline -void XPCDispIDArray::Unmark() -{ - mMarked = JS_FALSE; -} - -inline -JSBool XPCDispIDArray::IsMarked() const -{ - return mMarked; -} - -//============================================================================= -// XPCDispTypeInfo inlines - -inline -FUNCDESC* XPCDispTypeInfo::FuncDescArray::Get(PRUint32 index) -{ - return &mArray[index]; -} - -inline -void XPCDispTypeInfo::FuncDescArray::Release(FUNCDESC *) -{ -} - -inline -PRUint32 XPCDispTypeInfo::FuncDescArray::Length() const -{ - return mArray.Length(); -} - -inline -const nsAString & XPCDispTypeInfo::GetNameForDispID(DISPID dispID) -{ - return mNameArray.GetName(dispID); -} - -//============================================================================= -// XPCDispJSPropertyInfo inlines - -inline -PRBool XPCDispJSPropertyInfo::Valid() const -{ - return mPropertyType != INVALID; -} - -inline -PRUint32 XPCDispJSPropertyInfo::GetParamCount() const -{ - return IsSetter() ? 1 : mParamCount; -} - -inline -PRUint32 XPCDispJSPropertyInfo::GetMemID() const -{ - return mMemID; -} - -inline -INVOKEKIND XPCDispJSPropertyInfo::GetInvokeKind() const -{ - return IsSetter() ? INVOKE_PROPERTYPUT : - (IsProperty() ? INVOKE_PROPERTYGET : INVOKE_FUNC); -} - -inline -PRBool XPCDispJSPropertyInfo::IsProperty() const -{ - return PropertyType() == PROPERTY || PropertyType() == READONLY_PROPERTY; -} - -inline -PRBool XPCDispJSPropertyInfo::IsReadOnly() const -{ - return PropertyType()== READONLY_PROPERTY; -} - -inline -PRBool XPCDispJSPropertyInfo::IsSetter() const -{ - return (mPropertyType & SETTER_MODE) != 0; -} -inline -void XPCDispJSPropertyInfo::SetSetter() -{ - mPropertyType |= SETTER_MODE; -} - -inline -const nsAString & XPCDispJSPropertyInfo::GetName() const -{ - return mName; -} - -inline -XPCDispJSPropertyInfo::property_type XPCDispJSPropertyInfo::PropertyType() const -{ - return static_cast(mPropertyType & ~SETTER_MODE); -} - -//============================================================================= -// GUID/nsIID/nsCID conversion functions - -inline -const nsIID & XPCDispIID2nsIID(const IID & iid) -{ - NS_ASSERTION(sizeof(IID) == sizeof(nsIID), "IID is not the same size as nsIID"); - return reinterpret_cast(iid); -} - -inline -const IID & XPCDispIID2IID(const nsIID & iid) -{ - NS_ASSERTION(sizeof(IID) == sizeof(nsIID), "IID is not the same size as nsIID"); - return reinterpret_cast(iid); -} - -inline -const nsCID & XPCDispCLSID2nsCID(const CLSID & clsid) -{ - NS_ASSERTION(sizeof(CLSID) == sizeof(nsCID), "CLSID is not the same size as nsCID"); - return reinterpret_cast(clsid); -} - -inline -const CLSID & XPCDispnsCID2CLSID(const nsCID & clsid) -{ - NS_ASSERTION(sizeof(CLSID) == sizeof(nsCID), "CLSID is not the same size as nsCID"); - return reinterpret_cast(clsid); -} - -//============================================================================= -// XPCDispParams inlines - -inline -void XPCDispParams::SetNamedPropID() -{ - mDispParams.rgdispidNamedArgs = &mPropID; - mDispParams.cNamedArgs = 1; -} - -inline -VARIANT & XPCDispParams::GetParamRef(PRUint32 index) -{ - NS_ASSERTION(index < mDispParams.cArgs, "XPCDispParams::GetParam bounds error"); - return mDispParams.rgvarg[mDispParams.cArgs - index - 1]; -} - -inline -_variant_t XPCDispParams::GetParam(PRUint32 index) const -{ - return const_cast(this)->GetParamRef(index); -} - -inline -void * XPCDispParams::GetOutputBuffer(PRUint32 index) -{ - NS_ASSERTION(index < mDispParams.cArgs, "XPCDispParams::GetParam bounds error"); - return mRefBuffer + sizeof(VARIANT) * index; -} - -//============================================================================= -// Other helper functions - -/** - * Converts a jsval that is a string to a char const * - * @param cx a JS context - * @param val The JS value to be converted - * @return a C string (Does not need to be freed) - */ -inline -jschar * xpc_JSString2String(JSContext * cx, jsval val, PRUint32 * len = 0) -{ - JSString* str = JSVAL_IS_STRING(val) ? JSVAL_TO_STRING(val) : - JS_ValueToString(cx, val); - if(str) - { - if(len) - *len = JS_GetStringLength(str); - return JS_GetStringChars(str); - } - if(len) - *len = 0; - return nsnull; -} - -/** - * Converts a JSString * to a PRUnichar * - * @param cx a JS context - * @param str the JSString to be converted - * @param length optional pointer to a variable to hold the length - * @return a PRUnichar buffer (Does not need to be freed) - */ -inline -PRUnichar* xpc_JSString2PRUnichar(XPCCallContext& ccx, JSString* str, - size_t* length = nsnull) -{ - if(!str) - return nsnull; - if(length) - *length = JS_GetStringLength(str); - return reinterpret_cast(JS_GetStringChars(str)); -} - diff --git a/js/src/xpconnect/src/XPCDispInterface.cpp b/js/src/xpconnect/src/XPCDispInterface.cpp deleted file mode 100644 index b98d73be283..00000000000 --- a/js/src/xpconnect/src/XPCDispInterface.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -/** \file XPCDispInterface.cpp - * XPCDispInterface implementation - * This file contains the implementation of the XPCDispInterface class - */ - -#include "xpcprivate.h" - -/** - * Is this function reflectable - * This function determines if we should reflect a particular method of an - * interface - */ -inline -PRBool IsReflectable(FUNCDESC * pFuncDesc) -{ - return (pFuncDesc->wFuncFlags&FUNCFLAG_FRESTRICTED) == 0 && - pFuncDesc->funckind == FUNC_DISPATCH || - pFuncDesc->funckind == FUNC_PUREVIRTUAL || - pFuncDesc->funckind == FUNC_VIRTUAL; -} - -XPCDispInterface::Allocator::Allocator(JSContext * cx, ITypeInfo * pTypeInfo) : - mMemIDs(nsnull), mCount(0), mIDispatchMembers(0), mCX(cx), - mTypeInfo(pTypeInfo) -{ - TYPEATTR * attr; - HRESULT hr = pTypeInfo->GetTypeAttr(&attr); - if(SUCCEEDED(hr)) - { - mIDispatchMembers = attr->cFuncs; - mMemIDs = new DISPID[mIDispatchMembers]; - pTypeInfo->ReleaseTypeAttr(attr); - // Bail if we couldn't create the buffer - if(!mMemIDs) - return; - } - for(UINT iMethod = 0; iMethod < mIDispatchMembers; iMethod++ ) - { - FUNCDESC* pFuncDesc; - if(SUCCEEDED(pTypeInfo->GetFuncDesc(iMethod, &pFuncDesc))) - { - // Only add the function to our list if it is at least at nesting level - // 2 (i.e. defined in an interface derived from IDispatch). - if(IsReflectable(pFuncDesc)) - Add(pFuncDesc->memid); - pTypeInfo->ReleaseFuncDesc(pFuncDesc); - } - } -} - -void XPCDispInterface::Allocator::Add(DISPID memID) -{ - NS_ASSERTION(Valid(), "Add should never be called if out of memory"); - // Start from the end and work backwards, the last item is the most - // likely to match - PRUint32 index = mCount; - while(index > 0) - { - if(mMemIDs[--index] == memID) - return; - }; - NS_ASSERTION(Count() < mIDispatchMembers, "mCount should always be less " - "than the IDispatch member count " - "here"); - mMemIDs[mCount++] = memID; - return; -} - -inline -PRUint32 XPCDispInterface::Allocator::Count() const -{ - return mCount; -} - -XPCDispInterface* -XPCDispInterface::NewInstance(JSContext* cx, nsISupports * pIface) -{ - CComQIPtr pDispatch(reinterpret_cast(pIface)); - - if(pDispatch) - { - unsigned int count; - HRESULT hr = pDispatch->GetTypeInfoCount(&count); - if(SUCCEEDED(hr) && count > 0) - { - CComPtr pTypeInfo; - hr = pDispatch->GetTypeInfo(0,LOCALE_SYSTEM_DEFAULT, &pTypeInfo); - if(SUCCEEDED(hr)) - { - Allocator allocator(cx, pTypeInfo); - return allocator.Allocate(); - } - } - } - return nsnull; -} - -/** - * Sets a members type based on COM's INVOKEKIND - */ -static -void ConvertInvokeKind(INVOKEKIND invokeKind, XPCDispInterface::Member & member) -{ - switch (invokeKind) - { - case INVOKE_FUNC: - { - member.SetFunction(); - } - break; - case INVOKE_PROPERTYGET: - { - member.MakeGetter(); - } - break; - case INVOKE_PROPERTYPUT: - { - member.MakeSetter(); - } - break; - // TODO: Handle putref - default: - { - NS_ERROR("Invalid invoke kind found in COM type info"); - } - break; - } -} - -static -PRBool InitializeMember(JSContext * cx, ITypeInfo * pTypeInfo, - FUNCDESC * pFuncDesc, - XPCDispInterface::Member * pInfo) -{ - pInfo->SetMemID(pFuncDesc->memid); - BSTR name; - UINT nameCount; - if(FAILED(pTypeInfo->GetNames( - pFuncDesc->memid, - &name, - 1, - &nameCount))) - return PR_FALSE; - if(nameCount != 1) - return PR_FALSE; - JSString* str = JS_InternUCStringN(cx, - reinterpret_cast(name), - ::SysStringLen(name)); - ::SysFreeString(name); - if(!str) - return PR_FALSE; - // Initialize - pInfo = new (pInfo) XPCDispInterface::Member; - if(!pInfo) - return PR_FALSE; - pInfo->SetName(INTERNED_STRING_TO_JSID(cx, str)); - pInfo->ResetType(); - ConvertInvokeKind(pFuncDesc->invkind, *pInfo); - pInfo->SetTypeInfo(pFuncDesc->memid, pTypeInfo, pFuncDesc); - return PR_TRUE; -} - -static -XPCDispInterface::Member * FindExistingMember(XPCDispInterface::Member * first, - XPCDispInterface::Member * last, - MEMBERID memberID) -{ - // Iterate backward since the last one in is the most likely match - XPCDispInterface::Member * cur = last; - if (cur != first) - { - do - { - --cur; - if(cur->GetMemID() == memberID) - return cur; - } while(cur != first); - } - // no existing property, return the new one - return last; -} - -PRBool XPCDispInterface::InspectIDispatch(JSContext * cx, ITypeInfo * pTypeInfo, PRUint32 members) -{ - HRESULT hResult; - - XPCDispInterface::Member * pInfo = mMembers; - mMemberCount = 0; - for(PRUint32 index = 0; index < members; index++ ) - { - FUNCDESC* pFuncDesc; - hResult = pTypeInfo->GetFuncDesc(index, &pFuncDesc ); - if(FAILED(hResult)) - continue; - if(IsReflectable(pFuncDesc)) - { - switch(pFuncDesc->invkind) - { - case INVOKE_PROPERTYPUT: - case INVOKE_PROPERTYPUTREF: - case INVOKE_PROPERTYGET: - { - XPCDispInterface::Member * pExisting = FindExistingMember(mMembers, pInfo, pFuncDesc->memid); - if(pExisting == pInfo) - { - if(InitializeMember(cx, pTypeInfo, pFuncDesc, pInfo)) - { - ++pInfo; - ++mMemberCount; - } - } - else - { - ConvertInvokeKind(pFuncDesc->invkind, *pExisting); - } - if(pFuncDesc->invkind == INVOKE_PROPERTYGET) - { - pExisting->SetGetterFuncDesc(pFuncDesc); - } - } - break; - case INVOKE_FUNC: - { - if(InitializeMember(cx, pTypeInfo, pFuncDesc, pInfo)) - { - ++pInfo; - ++mMemberCount; - } - } - break; - default: - pTypeInfo->ReleaseFuncDesc(pFuncDesc); - break; - } - } - else - { - pTypeInfo->ReleaseFuncDesc(pFuncDesc); - } - } - return PR_TRUE; -} - -/** - * Compares a PRUnichar and a JS string ignoring case - * @param ccx an XPConnect call context - * @param lhr the PRUnichar string to be compared - * @param lhsLength the length of the PRUnichar string - * @param rhs the jsid that is the other string to compare - * @return true if the strings are equal - */ -inline -PRBool CaseInsensitiveCompare(XPCCallContext& ccx, const PRUnichar* lhs, size_t lhsLength, jsid rhs) -{ - if(lhsLength == 0) - return PR_FALSE; - size_t rhsLength; - PRUnichar* rhsString = xpc_JSString2PRUnichar(ccx, JSID_TO_STRING(rhs), &rhsLength); - return rhsString && - lhsLength == rhsLength && - _wcsnicmp(lhs, rhsString, lhsLength) == 0; -} - -const XPCDispInterface::Member* XPCDispInterface::FindMemberCI(XPCCallContext& ccx, jsid name) const -{ - size_t nameLength; - PRUnichar* sName = xpc_JSString2PRUnichar(ccx, JSID_TO_STRING(name), &nameLength); - if(!sName) - return nsnull; - // Iterate backwards over the members array (more efficient) - const Member* member = mMembers + mMemberCount; - while(member > mMembers) - { - --member; - if(CaseInsensitiveCompare(ccx, sName, nameLength, member->GetName())) - { - return member; - } - } - return nsnull; -} - -JSBool XPCDispInterface::Member::GetValue(XPCCallContext& ccx, - XPCNativeInterface * iface, - jsval * retval) const -{ - // This is a method or attribute - we'll be needing a function object - - // We need to use the safe context for this thread because we don't want - // to parent the new (and cached forever!) function object to the current - // JSContext's global object. That would be bad! - if((mType & RESOLVED) == 0) - { - JSContext* cx = ccx.GetSafeJSContext(); - if(!cx) - return JS_FALSE; - - intN argc; - JSNative callback; - // Is this a function or a parameterized getter/setter - if(IsFunction() || IsParameterizedProperty()) - { - argc = GetParamCount(); - callback = XPC_IDispatch_CallMethod; - } - else - { - argc = 0; - callback = XPC_IDispatch_GetterSetter; - } - - JSFunction *fun = JS_NewFunctionById(cx, callback, argc, 0, nsnull, mName); - if(!fun) - return JS_FALSE; - - JSObject* funobj = JS_GetFunctionObject(fun); - if(!funobj) - return JS_FALSE; - - // Store ourselves and our native interface within the JSObject - if(!JS_SetReservedSlot(ccx, funobj, 0, PRIVATE_TO_JSVAL((void *) this))) - return JS_FALSE; - - if(!JS_SetReservedSlot(ccx, funobj, 1, PRIVATE_TO_JSVAL(iface))) - return JS_FALSE; - - { // scoped lock - XPCAutoLock lock(ccx.GetRuntime()->GetMapLock()); - const_cast(this)->mVal = OBJECT_TO_JSVAL(funobj); - const_cast(this)->mType |= RESOLVED; - } - } - *retval = mVal; - return JS_TRUE; -} diff --git a/js/src/xpconnect/src/XPCDispObject.cpp b/js/src/xpconnect/src/XPCDispObject.cpp deleted file mode 100644 index a83c908cd60..00000000000 --- a/js/src/xpconnect/src/XPCDispObject.cpp +++ /dev/null @@ -1,496 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -/** - * \file XPCDispObject.cpp - * Contains the XPCDispObject class implementation, - * XPC_IDispatch_GetterSetter, and XPC_IDispatch_CallMethod - */ -#include "xpcprivate.h" -#include "nsIActiveXSecurityPolicy.h" - -/** - * This is COM's IDispatch IID, but in XPCOM's nsID type - */ -const nsID NSID_IDISPATCH = { 0x00020400, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }; - -PRBool -XPCDispObject::WrapIDispatch(IDispatch *pDispatch, XPCCallContext &ccx, - JSObject *obj, jsval *rval) -{ - if(!pDispatch) - { - return PR_FALSE; - } - - // Wrap the desired COM object - nsCOMPtr holder; - nsresult rv = ccx.GetXPConnect()->WrapNative( - ccx, obj, reinterpret_cast(pDispatch), NSID_IDISPATCH, - getter_AddRefs(holder)); - if(NS_FAILED(rv) || !holder) - { - return PR_FALSE; - } - JSObject * jsobj; - if(NS_FAILED(holder->GetJSObject(&jsobj))) - return PR_FALSE; - *rval = OBJECT_TO_JSVAL(jsobj); - return PR_TRUE; -} - -HRESULT XPCDispObject::SecurityCheck(XPCCallContext & ccx, const CLSID & aCID, - IDispatch ** createdObject) -{ - nsresult rv; - nsCOMPtr dispSupport = do_GetService(NS_IDISPATCH_SUPPORT_CONTRACTID, &rv); - if(NS_FAILED(rv)) return E_UNEXPECTED; - - PRUint32 hostingFlags = nsIActiveXSecurityPolicy::HOSTING_FLAGS_HOST_NOTHING; - dispSupport->GetHostingFlags(nsnull, &hostingFlags); - PRBool allowSafeObjects; - if(hostingFlags & (nsIActiveXSecurityPolicy::HOSTING_FLAGS_SCRIPT_SAFE_OBJECTS)) - allowSafeObjects = PR_TRUE; - else - allowSafeObjects = PR_FALSE; - PRBool allowAnyObjects; - if(hostingFlags & (nsIActiveXSecurityPolicy::HOSTING_FLAGS_SCRIPT_ALL_OBJECTS)) - allowAnyObjects = PR_TRUE; - else - allowAnyObjects = PR_FALSE; - if(!allowSafeObjects && !allowAnyObjects) - return E_FAIL; - - PRBool classExists = PR_FALSE; - PRBool ok = PR_FALSE; - const nsCID & ourCID = XPCDispCLSID2nsCID(aCID); - dispSupport->IsClassSafeToHost(ccx, ourCID, PR_FALSE, &classExists, &ok); - if(classExists && !ok) - return E_FAIL; - - // Test if the object is scriptable - PRBool isScriptable = PR_FALSE; - if(!allowAnyObjects) - { - PRBool classExists = PR_FALSE; - dispSupport->IsClassMarkedSafeForScripting(ourCID, &classExists, &isScriptable); - if(!classExists) - return REGDB_E_CLASSNOTREG; - } - - // Create the object - CComPtr disp; - // If createdObject isn't null we need to create the object - if (createdObject) - { - HRESULT hr = disp.CoCreateInstance(aCID); - if(FAILED(hr)) - return hr; - // if we don't allow just any object, and it wasn't marked - // safe for scripting then ask the object (MS idea of security) - if (!allowAnyObjects && !isScriptable) - { - dispSupport->IsObjectSafeForScripting(disp, NSID_IDISPATCH, &isScriptable); - if(!isScriptable) - return E_FAIL; - } - disp.CopyTo(createdObject); - } - - return S_OK; -} - -HRESULT XPCDispObject::COMCreateInstance(XPCCallContext & ccx, BSTR className, - PRBool enforceSecurity, - IDispatch ** result) -{ - NS_ENSURE_ARG_POINTER(result); - // Turn the string into a CLSID - _bstr_t bstrName(className); - CLSID classID = CLSID_NULL; - HRESULT hr = CLSIDFromString(bstrName, &classID); - if(FAILED(hr)) - hr = CLSIDFromProgID(bstrName, &classID); - if(FAILED(hr) || ::IsEqualCLSID(classID, CLSID_NULL)) - return hr; - - // If the caller cares about security do the necessary checks - // This results in the object being instantiated, so we'll use - // it - if(enforceSecurity) - return SecurityCheck(ccx, classID, result); - - CComPtr disp; - hr = disp.CoCreateInstance(classID); - if(FAILED(hr)) - return hr; - - disp.CopyTo(result); - - return S_OK; -} - -// static -JSBool XPCDispObject::Dispatch(XPCCallContext& ccx, IDispatch * disp, - DISPID dispID, CallMode mode, - XPCDispParams * params, - jsval* retval, - XPCDispInterface::Member * member, - XPCJSRuntime* rt) -{ - _variant_t dispResult; - jsval val; - uintN err; - uintN argc = params->GetParamCount(); - // Figure out what we're doing (getter/setter/method) - WORD dispFlags; - if(mode == CALL_SETTER) - { - dispFlags = DISPATCH_PROPERTYPUT; - } - else if(mode == CALL_GETTER) - { - dispFlags = DISPATCH_PROPERTYGET; - } - else - { - dispFlags = DISPATCH_METHOD; - } - HRESULT invokeResult; - EXCEPINFO exception; - // Scope the lock - { - // avoid deadlock in case the native method blocks somehow - JSAutoSuspendRequest req(ccx); // scoped suspend of request - // call IDispatch's invoke - invokeResult= disp->Invoke( - dispID, // IDispatch ID - IID_NULL, // Reserved must be IID_NULL - LOCALE_SYSTEM_DEFAULT, // The locale context, use the system's - dispFlags, // Type of Invoke call - params->GetDispParams(), // Parameters - &dispResult, // Where the result is stored - &exception, // Exception information - 0); // Index of an argument error - } - if(SUCCEEDED(invokeResult)) - { - *retval = JSVAL_VOID; - if(mode == CALL_METHOD) - { - NS_ASSERTION(member, "member must not be null if this is a method"); - for(PRUint32 index = 0; index < argc; ++index) - { - const XPCDispInterface::Member::ParamInfo & paramInfo = member->GetParamInfo(index); - if(paramInfo.IsOut()) - { - if(!XPCDispConvert::COMToJS(ccx, params->GetParamRef(index), val, err)) - return ThrowBadParam(err, index, ccx); - - if(paramInfo.IsRetVal()) - { - *retval = val; - } - else - { - jsval * argv = ccx.GetArgv(); - // Out, in/out parameters must be objects - if(!JSVAL_IS_OBJECT(argv[index]) || - !JS_SetPropertyById(ccx, JSVAL_TO_OBJECT(argv[index]), - rt->GetStringID(XPCJSRuntime::IDX_VALUE), &val)) - return ThrowBadParam(NS_ERROR_XPC_CANT_SET_OUT_VAL, index, ccx); - } - } - } - } - if(dispResult.vt != VT_EMPTY) - { - if(!XPCDispConvert::COMToJS(ccx, dispResult, val, err)) - { - ThrowBadParam(err, 0, ccx); - } - *retval = val; - } - } - // Set the result and throw the error if one occurred - ccx.GetXPCContext()->SetLastResult(invokeResult); - - if(NS_FAILED(invokeResult)) - { - XPCThrower::ThrowCOMError(ccx, invokeResult, NS_ERROR_XPC_COM_ERROR, - invokeResult == DISP_E_EXCEPTION ? - &exception : nsnull); - return JS_FALSE; - } - return JS_TRUE; -} - -JSBool XPCDispObject::Invoke(XPCCallContext & ccx, CallMode mode) -{ - nsresult rv = ccx.CanCallNow(); - if(NS_FAILED(rv)) - { - // If the security manager is complaining then this is not really an - // internal error in xpconnect. So, no reason to botch the assertion. - NS_ASSERTION(rv == NS_ERROR_XPC_SECURITY_MANAGER_VETO, - "hmm? CanCallNow failed in XPCDispObject::Invoke. " - "We are finding out about this late!"); - XPCThrower::Throw(rv, ccx); - return JS_FALSE; - } - - // TODO: Remove type cast and change GetIDispatchMember to use the correct type - XPCDispInterface::Member* member = reinterpret_cast(ccx.GetIDispatchMember()); - XPCJSRuntime* rt = ccx.GetRuntime(); - XPCContext* xpcc = ccx.GetXPCContext(); - XPCPerThreadData* tls = ccx.GetThreadData(); - - jsval* argv = ccx.GetArgv(); - uintN argc = ccx.GetArgc(); - - tls->SetException(nsnull); - xpcc->SetLastResult(NS_ERROR_UNEXPECTED); - - // set up the method index and do the security check if needed - - PRUint32 secFlag; - PRUint32 secAction; - - switch(mode) - { - case CALL_METHOD: - secFlag = nsIXPCSecurityManager::HOOK_CALL_METHOD; - secAction = nsIXPCSecurityManager::ACCESS_CALL_METHOD; - break; - case CALL_GETTER: - secFlag = nsIXPCSecurityManager::HOOK_GET_PROPERTY; - secAction = nsIXPCSecurityManager::ACCESS_GET_PROPERTY; - break; - case CALL_SETTER: - secFlag = nsIXPCSecurityManager::HOOK_SET_PROPERTY; - secAction = nsIXPCSecurityManager::ACCESS_SET_PROPERTY; - break; - default: - NS_ERROR("bad value"); - return JS_FALSE; - } - jsid name = member->GetName(); - - nsIXPCSecurityManager* sm = xpcc->GetAppropriateSecurityManager(secFlag); - XPCWrappedNative* wrapper = ccx.GetWrapper(); - if(sm && NS_FAILED(sm->CanAccess(secAction, &ccx, ccx, - ccx.GetFlattenedJSObject(), - wrapper->GetIdentityObject(), - wrapper->GetClassInfo(), name, - wrapper->GetSecurityInfoAddr()))) - { - // the security manager vetoed. It should have set an exception. - return JS_FALSE; - } - - IDispatch * pObj = reinterpret_cast - (ccx.GetTearOff()->GetNative()); - PRUint32 args = member->GetParamCount(); - uintN err; - // Make sure setter has one argument - if(mode == CALL_SETTER) - args = 1; - // Allow for optional parameters. We'll let COM handle the error if there - // are not enough parameters - if(argc < args) - args = argc; - XPCDispParams * params = new XPCDispParams(args); - jsval val; - // If this is a setter, we just need to convert the first parameter - if(mode == CALL_SETTER) - { - params->SetNamedPropID(); - if(!XPCDispConvert::JSToCOM(ccx, argv[0], params->GetParamRef(0), err)) - { - delete params; - return ThrowBadParam(err, 0, ccx); - } - } - else if(mode != CALL_GETTER) // This is a function - { - // Convert the arguments to the function - for(PRUint32 index = 0; index < args; ++index) - { - const XPCDispInterface::Member::ParamInfo & paramInfo = member->GetParamInfo(index); - if(paramInfo.IsIn()) - { - val = argv[index]; - if(paramInfo.IsOut()) - { - if(JSVAL_IS_PRIMITIVE(val) || - !JS_GetPropertyById(ccx, JSVAL_TO_OBJECT(val), - rt->GetStringID(XPCJSRuntime::IDX_VALUE), &val)) - { - delete params; - return ThrowBadParam(NS_ERROR_XPC_NEED_OUT_OBJECT, index, ccx); - } - paramInfo.InitializeOutputParam(params->GetOutputBuffer(index), params->GetParamRef(index)); - } - if(!XPCDispConvert::JSToCOM(ccx, val, params->GetParamRef(index), err, paramInfo.IsOut())) - { - delete params; - return ThrowBadParam(err, index, ccx); - } - } - else - { - paramInfo.InitializeOutputParam(params->GetOutputBuffer(index), params->GetParamRef(index)); - } - } - } - if(member->IsParameterizedProperty()) - { - mode = CALL_GETTER; - } - JSBool retval = Dispatch(ccx, pObj, member->GetDispID(), mode, params, &val, member, rt); - if(retval && mode == CALL_SETTER) - { - ccx.SetRetVal(argv[0]); - } - else - { - ccx.SetRetVal(val); - } - delete params; - return retval; -} - -static -JSBool GetMember(XPCCallContext& ccx, JSObject* funobj, XPCNativeInterface*& iface, XPCDispInterface::Member*& member) -{ - jsval val; - if(!JS_GetReservedSlot(ccx, funobj, 1, &val)) - return JS_FALSE; - if(JSVAL_IS_VOID(val)) - return JS_FALSE; - iface = reinterpret_cast(JSVAL_TO_PRIVATE(val)); - if(!JS_GetReservedSlot(ccx, funobj, 0, &val)) - return JS_FALSE; - if(JSVAL_IS_VOID(val)) - return JS_FALSE; - member = reinterpret_cast(JSVAL_TO_PRIVATE(val)); - return JS_TRUE; -} - -// Handy macro used in callbacks below. -#define THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper) \ - PR_BEGIN_MACRO \ - if(!wrapper) \ - { \ - XPCThrower::Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx); \ - return JS_FALSE; \ - } \ - if(!wrapper->IsValid()) \ - { \ - XPCThrower::Throw(NS_ERROR_XPC_HAS_BEEN_SHUTDOWN, cx); \ - return JS_FALSE; \ - } \ - PR_END_MACRO - -/** - * Callback for functions - * This callback is called by JS when a function on a JSObject proxying - * for an IDispatch instance - * @param cx A pointer to a JS context - * @param obj JS object that the parameterized property is on - * @param argc Number of arguments in this call - * @param argv The parameters passed in if any - * @param vp The return value - * @return Returns JS_TRUE if the operation succeeded - */ -JSBool -XPC_IDispatch_CallMethod(JSContext* cx, JSObject* obj, uintN argc, - jsval* argv, jsval* vp) -{ - NS_ASSERTION(JS_TypeOfValue(cx, argv[-2]) == JSTYPE_FUNCTION, "bad function"); - JSObject* funobj = JSVAL_TO_OBJECT(argv[-2]); - XPCCallContext ccx(JS_CALLER, cx, obj, funobj, INT_TO_JSID(0), argc, argv, vp); - XPCWrappedNative* wrapper = ccx.GetWrapper(); - THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper); - ccx.SetArgsAndResultPtr(argc, argv, vp); - - XPCDispInterface::Member* member; - XPCNativeInterface* iface; -#ifdef DEBUG - PRBool ok = -#endif - GetMember(ccx, funobj, iface, member); - NS_ASSERTION(ok, "GetMember faild in XPC_IDispatch_CallMethod"); - ccx.SetIDispatchInfo(iface, member); - - return XPCDispObject::Invoke(ccx, XPCDispObject::CALL_METHOD); -} - -/** - * Callback for properties - * This callback is called by JS when a property is set or retrieved on a - * JSObject proxying for an IDispatch instance - * @param cx A pointer to a JS context - * @param obj JS object that the parameterized property is on - * @param argc Number of arguments in this call - * @param argv The parameters passed in if any - * @param vp The return value - * @return Returns JS_TRUE if the operation succeeded - */ -JSBool -XPC_IDispatch_GetterSetter(JSContext *cx, JSObject *obj, uintN argc, - jsval *argv, jsval *vp) -{ - NS_ASSERTION(JS_TypeOfValue(cx, argv[-2]) == JSTYPE_FUNCTION, "bad function"); - JSObject* funobj = JSVAL_TO_OBJECT(argv[-2]); - - XPCCallContext ccx(JS_CALLER, cx, obj, funobj); - XPCWrappedNative* wrapper = ccx.GetWrapper(); - THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper); - - ccx.SetArgsAndResultPtr(argc, argv, vp); - XPCDispInterface::Member* member; - XPCNativeInterface* iface; -#ifdef DEBUG - PRBool ok = -#endif - GetMember(ccx, funobj, iface, member); - NS_ASSERTION(ok, "GetMember faild in XPC_IDispatch_CallMethod"); - - ccx.SetIDispatchInfo(iface, member); - return XPCDispObject::Invoke(ccx, argc != 0 ? XPCDispObject::CALL_SETTER : XPCDispObject::CALL_GETTER); -} diff --git a/js/src/xpconnect/src/XPCDispParams.cpp b/js/src/xpconnect/src/XPCDispParams.cpp deleted file mode 100644 index 7898f0805d5..00000000000 --- a/js/src/xpconnect/src/XPCDispParams.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -/** - * \file XPCDispParams.cpp - * Implementation of the helper class XPCDispParams - */ - -#include "xpcprivate.h" - -XPCDispParams::XPCDispParams(PRUint32 args) : - mRefBuffer(mStackRefBuffer + sizeof(VARIANT)), - mDispParamsAllocated(nsnull), - mRefBufferAllocated(nsnull), - mPropID(DISPID_PROPERTYPUT) -#ifdef DEBUG - ,mInserted(PR_FALSE) -#endif -{ - if(args >= DEFAULT_ARG_ARRAY_SIZE) - { - mRefBufferAllocated = new char[RefBufferSize(args)]; - mRefBuffer = mRefBufferAllocated + sizeof(VARIANT); - } - // Initialize the full buffer that was allocated - memset(mRefBuffer - sizeof(VARIANT), 0, RefBufferSize(args)); - // Initialize the IDispatch parameters - mDispParams.cArgs = args; - if(args == 0) - mDispParams.rgvarg = nsnull; - else if (args <= DEFAULT_ARG_ARRAY_SIZE) - mDispParams.rgvarg = mStackArgs + 1; - else - { - mDispParamsAllocated = new VARIANT[args + 1]; - mDispParams.rgvarg = mDispParamsAllocated + 1; - } - mDispParams.rgdispidNamedArgs = nsnull; - mDispParams.cNamedArgs = 0; -} - - -XPCDispParams::~XPCDispParams() -{ - // Cleanup the variants - for(PRUint32 index = 0; index < mDispParams.cArgs; ++index) - VariantClear(mDispParams.rgvarg + index); - // Cleanup if we allocated the variant array. Remember that - // our buffer may point one element into the allocate buffer - delete [] mRefBufferAllocated; - delete [] mDispParamsAllocated; -} - -void XPCDispParams::InsertParam(_variant_t & var) -{ -#ifdef DEBUG - NS_ASSERTION(!mInserted, - "XPCDispParams::InsertParam cannot be called more than once"); - mInserted = PR_TRUE; -#endif - // Bump the pointer back and increment the arg count - --mDispParams.rgvarg; - mRefBuffer -= sizeof(VARIANT); - ++mDispParams.cArgs; - // Assign the value - mDispParams.rgvarg[0] = var.Detach(); - // initialize the ref buffer - memset(mRefBuffer, 0, sizeof(VARIANT)); -} diff --git a/js/src/xpconnect/src/XPCDispPrivate.h b/js/src/xpconnect/src/XPCDispPrivate.h deleted file mode 100644 index 15800b121c4..00000000000 --- a/js/src/xpconnect/src/XPCDispPrivate.h +++ /dev/null @@ -1,1330 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -#ifndef XPCDispPrivate_h__ -#define XPCDispPrivate_h__ - -/** - * \file XPCDispPrivate.h - * \brief Contains all the private class declarations - */ - -#ifndef xpcprivate_h___ -#error "DispPrivate.h should not be included directly, please use XPCPrivate.h" -#endif - -/** - * Needed for CComPtr and friends - */ -#include -/** - * Needed for _variant_t and _bstr_t - */ -#include -/** - * IObjectSafety interface and friends - */ -#include "objsafe.h" - -// MS clutters the global namespace with so many macro names :-( -// I tried to keep these includes in the CPP's but it became too -// convoluted -#undef GetClassInfo -#undef GetClassName -#undef GetMessage - -// We need IDispatch -#include "nsIDispatchSupport.h" - -// The following are macro helpers pulled from XPCOM but tailored to COM -#define NS_DECL_IUNKNOWN \ -public: \ - STDMETHOD(QueryInterface)(REFIID aIID, \ - void** aInstancePtr); \ - STDMETHODIMP_(ULONG) AddRef(void); \ - STDMETHODIMP_(ULONG) Release(void); \ -protected: \ - ULONG mRefCnt; - -#define NS_IMPL_COM_QUERY_HEAD(_class) \ -STDMETHODIMP _class::QueryInterface(REFIID aIID, void** aInstancePtr) \ -{ \ - NS_ASSERTION(aInstancePtr, \ - "QueryInterface requires a non-NULL destination!"); \ - if( !aInstancePtr ) \ - return E_POINTER; \ - IUnknown* foundInterface; - -#define NS_IMPL_COM_QUERY_BODY(_interface) \ - if(IsEqualIID(aIID, __uuidof(_interface)) ) \ - foundInterface = static_cast<_interface*>(this); \ - else - -#define NS_IMPL_COM_QUERY_TAIL_GUTS \ - foundInterface = 0; \ - HRESULT status; \ - if( !foundInterface ) \ - status = E_NOINTERFACE; \ - else \ - { \ - NS_ADDREF(foundInterface); \ - status = S_OK; \ - } \ - *aInstancePtr = foundInterface; \ - return status; \ -} - -#define NS_COM_MAP_BEGIN(_implClass) NS_IMPL_COM_QUERY_HEAD(_implClass) -#define NS_COM_MAP_ENTRY(_interface) NS_IMPL_COM_QUERY_BODY(_interface) -#define NS_COM_MAP_END NS_IMPL_COM_QUERY_TAIL_GUTS - -#define NS_COM_IMPL_ADDREF(_class) \ -STDMETHODIMP_(ULONG) _class::AddRef(void) \ -{ \ - NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \ - NS_ASSERT_OWNINGTHREAD(_class); \ - ++mRefCnt; \ - NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this)); \ - return mRefCnt; \ -} - -#define NS_COM_IMPL_RELEASE(_class) \ -STDMETHODIMP_(ULONG) _class::Release(void) \ -{ \ - NS_PRECONDITION(0 != mRefCnt, "dup release"); \ - NS_ASSERT_OWNINGTHREAD(_class); \ - --mRefCnt; \ - NS_LOG_RELEASE(this, mRefCnt, #_class); \ - if(mRefCnt == 0) { \ - mRefCnt = 1; /* stabilize */ \ - delete this; \ - return 0; \ - } \ - return mRefCnt; \ -} - -extern const nsID NSID_IDISPATCH; - -/** - * JS<>COM Conversion functions. XPCDispConvert serves more as a namespace than - * a class. It contains the functions to convert between JS and COM data and - * any helper functions needed - */ -class XPCDispConvert -{ -public: - /** - * Returns the COM type for a given jsval - * @param ccx XPConnect call context - * @param val Value to look up the type for - * @return the COM variant type - */ - static - VARTYPE JSTypeToCOMType(XPCCallContext& ccx, jsval val); - - /** - * Converts a JSVal to a COM variant - * @param ccx XPConnect call context - * @param src JS Value to convert - * @param dest COM variant to receive the converted value - * @param err receives the error code if any of a failed conversion - * @return True if the conversion succeeded - */ - static - JSBool JSToCOM(XPCCallContext& ccx, jsval src, VARIANT & dest, - nsresult& err, JSBool isByRef = JS_FALSE); - - /** - * Converts a COM variant to a jsval - * @param ccx XPConnect call context - * @param src COM variant to convert - * @param dest jsval to receive the converted value - * @param err receives the error code if any of a failed conversion - * @return Returns true if the conversion succeeded - */ - static - JSBool COMToJS(XPCCallContext& ccx, const VARIANT & src, jsval & dest, - nsresult& err); -private: - /** - * Converts a JS Array to a safe array - * @param ccx XPConnect call context - * @param obj JSObject that is the array - * @param var the variant to receive the array - * @param err receives the error code if any of a failed conversion - * @return True if the conversion succeeded - */ - static - JSBool JSArrayToCOMArray(XPCCallContext& ccx, JSObject *obj, VARIANT & var, - nsresult& err); - /** - * Converts a COM Array to a JS Array - * @param ccx XPConnect call context - * @param src the variant holding the array - * @param dest the jsval to receive the array - * @param err receives the error code if any of a failed conversion - * @return True if the conversion succeeded - */ - static - JSBool COMArrayToJSArray(XPCCallContext& ccx, const VARIANT & src, - jsval & dest, nsresult& err); -}; - -/** - * JS callback function that is called when a function is invoked - * @param cx the JS context the function is invoked with - * @param obj the object the function is invoked on - * @param argc the number of parameters passed to the function - * @param argv the array of parameters passed to the function - * @param vp holds the result of the function - * @return true if the function completes without error - */ -JSBool -XPC_IDispatch_CallMethod(JSContext *cx, JSObject *obj, uintN argc, - jsval *argv, jsval *vp); -/** - * JS callback function that is called when a getter/setter is invoked - * @param cx the JS context the function is invoked with - * @param obj the object the function is invoked on - * @param argc the number of parameters passed to the function - * @param argv the array of parameters passed to the function - * @param vp holds the result of the function - * @return true if the function completes without error - */ -JSBool -XPC_IDispatch_GetterSetter(JSContext *cx, JSObject *obj, uintN argc, - jsval *argv, jsval *vp); - -/** - * This class holds an array of names. This is only used in wrapped - * JS objects, so the dispid's are not arbitrary. They begin with 1 - * and so dispid - 1 is the index into the array mNames - */ -class XPCDispNameArray -{ -public: - /** - * Intializes the array to zero elements - */ - XPCDispNameArray(); - /** - * Cleans up the mNames array - */ - ~XPCDispNameArray(); - /** - * Sets the size of the array - * @param size the new size of the array - */ - void SetSize(PRUint32 size); - /** - * Returns the current size of the array - * @return the current size of the array - */ - PRUint32 GetSize() const; - /** - * Assigns a name/string to a given element. This function will not - * expand the array and performs bounds checking in debug builds. - * @param dispid IDispatch id for the name - * @param name the name to assign - */ - void SetName(DISPID dispid, nsAString const & name); - /** - * Retrieves a name/string for a dispid. This function - * performs bounds checking in debug builds - * @param dispid dispatch ID of the name to retrieve - */ - const nsAString& GetName(DISPID dispid) const; - /** - * Performs a search of the array for the target returning the - * the id for the name - * @param target the name to find - */ - DISPID Find(const nsAString &target) const; -private: - PRUint32 mCount; - nsString* mNames; -}; - -/** - * This class represents an array of JSID's. - * It takes care of marking the ID's during GC - */ -class XPCDispIDArray -{ -public: - /** - * Initializes the array from the JSIdArray passed in - * @param ccx XPConnect call context - * @param array a JS array of ID's - */ - XPCDispIDArray(XPCCallContext& ccx, JSIdArray* array); - - /** - * Returns the length of the array - * @return length of the array - */ - PRUint32 Length() const; - - /** - * Returns an ID within the array - * @param cx a JS context - * @param index index into the array - * @return the ID as a jsval - */ - jsval Item(JSContext* cx, PRUint32 index) const; - - /** - * Called to trace jsval associated with the ID's - */ - void TraceJS(JSTracer* trc); - - /** - * Called to unmark the ID's marked during GC marking trace - */ - void Unmark(); - - /** - * Tests whether the ID is marked - */ - JSBool IsMarked() const; -private: - JSBool mMarked; - nsTArray mIDArray; -}; - -/** - * Implements ITypeInfo interface for JSObjects - */ -class XPCDispTypeInfo : public ITypeInfo -{ - NS_DECL_IUNKNOWN -public: - /** - * Manages an array of FUNCDESC structs - */ - class FuncDescArray - { - public: - /** - * Initializes the function description array - */ - FuncDescArray(XPCCallContext& ccx, JSObject* obj, - const XPCDispIDArray& array, XPCDispNameArray & names); - /** - * cleans up the function description array - */ - ~FuncDescArray(); - /** - * Retrieves a function description from the array. - * @param index index into the array - * @return pointer to the function description - */ - FUNCDESC* Get(PRUint32 index); - /** - * Releases a function description object. Currently there is nothing - * to do as ownership is maintained by the object and the objects - * returned never live longer than the FuncDescArray instance they - * were created on - */ - void Release(FUNCDESC *); - /** - * Returns the length of the array - * @return the length of the array - */ - PRUint32 Length() const; - private: - nsTArray mArray; - /** - * Initializes a function description object - * @param ccx XPConnect context - * @param obj Array to used for the initialization - * @param propInfo property information for the element/function - */ - PRBool BuildFuncDesc(XPCCallContext& ccx, JSObject* obj, - XPCDispJSPropertyInfo & propInfo); - }; - /** - * Creates an instance of XPCDispTypeInfo - * This static function is to be used to create instances of XPCDispTypeInfo. - */ - static - XPCDispTypeInfo* New(XPCCallContext& ccx, JSObject* obj); - virtual ~XPCDispTypeInfo(); - // ITypeInfo methods, see MSDN for detail information - STDMETHOD(GetTypeAttr)( - /* [out] */ TYPEATTR __RPC_FAR *__RPC_FAR *ppTypeAttr); - - STDMETHOD(GetTypeComp)( - /* [out] */ ITypeComp __RPC_FAR *__RPC_FAR *ppTComp); - - STDMETHOD(GetFuncDesc)( - /* [in] */ UINT index, - /* [out] */ FUNCDESC __RPC_FAR *__RPC_FAR *ppFuncDesc); - - STDMETHOD(GetVarDesc)( - /* [in] */ UINT index, - /* [out] */ VARDESC __RPC_FAR *__RPC_FAR *ppVarDesc); - - STDMETHOD(GetNames)( - /* [in] */ MEMBERID memid, - /* [length_is][size_is][out] */ BSTR __RPC_FAR *rgBstrNames, - /* [in] */ UINT cMaxNames, - /* [out] */ UINT __RPC_FAR *pcNames); - - STDMETHOD(GetRefTypeOfImplType)( - /* [in] */ UINT index, - /* [out] */ HREFTYPE __RPC_FAR *pRefType); - - STDMETHOD(GetImplTypeFlags)( - /* [in] */ UINT index, - /* [out] */ INT __RPC_FAR *pImplTypeFlags); - - STDMETHOD(GetIDsOfNames)( - /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, - /* [in] */ UINT cNames, - /* [size_is][out] */ MEMBERID __RPC_FAR *pMemId); - - STDMETHOD(Invoke)( - /* [in] */ PVOID pvInstance, - /* [in] */ MEMBERID memid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, - /* [out] */ VARIANT __RPC_FAR *pVarResult, - /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, - /* [out] */ UINT __RPC_FAR *puArgErr); - - STDMETHOD(GetDocumentation)( - /* [in] */ MEMBERID memid, - /* [out] */ BSTR __RPC_FAR *pBstrName, - /* [out] */ BSTR __RPC_FAR *pBstrDocString, - /* [out] */ DWORD __RPC_FAR *pdwHelpContext, - /* [out] */ BSTR __RPC_FAR *pBstrHelpFile); - - STDMETHOD(GetDllEntry)( - /* [in] */ MEMBERID memid, - /* [in] */ INVOKEKIND invKind, - /* [out] */ BSTR __RPC_FAR *pBstrDllName, - /* [out] */ BSTR __RPC_FAR *pBstrName, - /* [out] */ WORD __RPC_FAR *pwOrdinal); - - STDMETHOD(GetRefTypeInfo)( - /* [in] */ HREFTYPE hRefType, - /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); - - STDMETHOD(AddressOfMember)( - /* [in] */ MEMBERID memid, - /* [in] */ INVOKEKIND invKind, - /* [out] */ PVOID __RPC_FAR *ppv); - - STDMETHOD(CreateInstance)( - /* [in] */ IUnknown __RPC_FAR *pUnkOuter, - /* [in] */ REFIID riid, - /* [iid_is][out] */ PVOID __RPC_FAR *ppvObj); - - STDMETHOD(GetMops)( - /* [in] */ MEMBERID memid, - /* [out] */ BSTR __RPC_FAR *pBstrMops); - - STDMETHOD(GetContainingTypeLib)( - /* [out] */ ITypeLib __RPC_FAR *__RPC_FAR *ppTLib, - /* [out] */ UINT __RPC_FAR *pIndex); - - virtual /* [local] */ void STDMETHODCALLTYPE ReleaseTypeAttr( - /* [in] */ TYPEATTR __RPC_FAR *pTypeAttr); - - virtual /* [local] */ void STDMETHODCALLTYPE ReleaseFuncDesc( - /* [in] */ FUNCDESC __RPC_FAR *pFuncDesc); - - virtual /* [local] */ void STDMETHODCALLTYPE ReleaseVarDesc( - /* [in] */ VARDESC __RPC_FAR *pVarDesc); - /** - * Returns the name of a function given a DISPID - * @param dispID the DISPID to look up - * @return the name of the function - */ - const nsAString& GetNameForDispID(DISPID dispID); -private: - /** - * Initializes the object - * @param ccx an XPConnect call context - * @param obj the JS object being wrapped - * @param array the array of JS ID's for the object - */ - XPCDispTypeInfo(XPCCallContext& ccx, JSObject* obj, XPCDispIDArray* array); - JSObject* mJSObject; - XPCDispIDArray* mIDArray; - XPCDispNameArray mNameArray; - // mFuncDescArray must occur after - // TODO: We should probably refactor this so this isn't a requirement - FuncDescArray mFuncDescArray; -}; - -/** - * Helper class that describes a JS function or property - */ -class XPCDispJSPropertyInfo -{ -public: - /** - * Inspects a JS Function or property - * @param cx A JS Context - * @param memid the ID of the property or function - * @param obj the JS object the property or function resides on - * @param val ID val of the property or function - */ - XPCDispJSPropertyInfo(JSContext*cx, PRUint32 memid, JSObject* obj, jsval val); - /** - * Returns true if the property information was initialized property - * @return true if the property information was initialized property - */ - PRBool Valid() const; - /** - * Returns the number of parameters - * If this is a setter, the parameter count is always one - * @return the number of parameters - */ - PRUint32 GetParamCount() const; - /** - * Returns the generated member ID/dispid - * This is based on the order of the function/property within the object - * @return the memid of the property - */ - PRUint32 GetMemID() const; - /** - * Returns the COM's INVOKEKIND for the property/method - * @return the COM's INVOKEKIND for the property/method - */ - INVOKEKIND GetInvokeKind() const; - /** - * Assigns the return type in elemDesc - * @param ccx an xpconnect call context - * @param elemDesc the element description to set the return type - */ - void GetReturnType(XPCCallContext& ccx, ELEMDESC & elemDesc); - /** - * Returns an element description for the property - * @return the element descriptoin object, ownership is assumed by - * the caller. - */ - ELEMDESC * GetParamInfo(); - /** - * Tests whether this is a property - * @return true if this is a property - */ - PRBool IsProperty() const; - /** - * Test whether this is read-only - * @return true if this is read-only - */ - PRBool IsReadOnly() const; - /** - * Tests whether this is a setter - * @return true if this is a setter - */ - PRBool IsSetter() const; - /** - * Denotes this property has a setter (is not read-only) - */ - void SetSetter(); - /** - * returns the name of the property/method - * @return the name of the property/method - */ - nsAString const & GetName() const; -private: - enum property_type - { - INVALID, - PROPERTY, - READONLY_PROPERTY, - FUNCTION, - SETTER_MODE = 0x20 - }; - - PRUint32 mPropertyType; - PRUint32 mParamCount; - PRUint32 mMemID; - jsval mProperty; - nsString mName; - - /** - * Accessor for the property type mProperty - * @return property_type for the property - */ - inline - property_type PropertyType() const; -}; - -/** - * Tearoff for nsXPCWrappedJS to use - */ -class XPCDispatchTearOff : public IDispatch, public ISupportErrorInfo -{ -public: - /** - * Constructor initializes our COM pointer back to our main object - */ - XPCDispatchTearOff(nsIXPConnectWrappedJS * wrappedJS); - /** - * Release the our allocated data, and decrements our main objects refcnt - */ - virtual ~XPCDispatchTearOff(); - /** - * Error handling function - * @param riid the interface IID of the error - */ - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - /** - * Thread safe AddRef - */ - STDMETHODIMP_(ULONG) AddRef(); - /** - * Thread safe Release - */ - STDMETHODIMP_(ULONG) Release(); - /** - * QueryInterface that returns us or the main object - * See MSDN for form information - * @param IID interface ID we're querying to - * @param pPtr a pointer to the pointer that will receive the resultant - * interface pointer - * @return HRESULT - */ - STDMETHOD(QueryInterface)(REFIID IID,void ** pPtr); - /** - * Returns the number of type info's for this IDispatch instance. - * See MSDN for form information - * @param pctinfo pointer to the variable to receive the count - * @return HRESULT - */ - STDMETHOD(GetTypeInfoCount)(unsigned int * pctinfo); - /** - * Returns the type information for this IDispatch instance - * See MSDN for form information - * @return HRESULT - */ - STDMETHOD(GetTypeInfo)(unsigned int iTInfo, LCID lcid, - ITypeInfo FAR* FAR* ppTInfo); - /** - * Returns the ID's for the given names of methods - * See MSDN for form information - * @return HRESULT - */ - STDMETHOD(GetIDsOfNames)(REFIID riid, OLECHAR FAR* FAR* rgszNames, - unsigned int cNames, LCID lcid, - DISPID FAR* rgDispId); - /** - * Invokes an interface method - * See MSDN for form information - * @return HRESULT - */ - STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, - DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, - EXCEPINFO FAR* pExcepInfo, unsigned int FAR* puArgErr); - -private: - // Pointer back to our main object - nsCOMPtr mWrappedJS; - // The Type information for our instance - XPCDispTypeInfo * mCOMTypeInfo; - // Reference count - ULONG mRefCnt; - // Returns the type information - XPCDispTypeInfo * GetCOMTypeInfo(); - // Returns the JS Object being used to wrap - inline - JSObject* GetJSObject(); - - NS_DECL_OWNINGTHREAD; -}; - -/** - * IDispatch interface information. - * This is used within the XPCWrappedNativeTearOff to collect and maintain - * information for a specific IDispatch interface. This is similar to - * XPCNativeInterface - */ -class XPCDispInterface -{ -public: - /** - * Member information. This class is used within the XPCDispInterface - * to describe a specific method of an IDispatch interface. - */ - class Member - { - public: - /** - * Parameter Information. This class is mainly a wrapper around - * ELEMDESC that allows easier inspection - */ - class ParamInfo - { - public: - /** - * Initializes mParamInfo to the element description passed in - * @param paramInfo the parameter information being wrapped - */ - ParamInfo(const ELEMDESC * paramInfo); - /** - * Initializes an output parameter - * @param varBuffer a pointer to the variant's buffer - * @param var Pointer to the variant being initialized - */ - JSBool InitializeOutputParam(void * varBuffer, - VARIANT & var) const; - /** - * Tests if a specific flag is set - * @param flag the flag to be tested - * @return true if the flag is set - */ - PRBool IsFlagSet(unsigned short flag) const; - /** - * Returns true if this is an input parameter - * @return true if this is an input parameter - */ - PRBool IsIn() const; - /** - * Returns true if this is an output parameter - * @return true if this is an output parameter - */ - PRBool IsOut() const; - /** - * Returns true if this is an optional parameter - * @return true if this is an optional parameter - */ - PRBool IsOptional() const; - /** - * Returns true if this is a return value parameter - * @return true if this is a return value parameter - */ - PRBool IsRetVal() const; - // TODO: Handle VT_ARRAY as well - /** - * Returns the type of the parameter - * @return VARTYPE, the type of the parameter - */ - VARTYPE GetType() const; - private: - const ELEMDESC * mParamInfo; - }; - Member(); - ~Member(); - /** - * Placement new is needed to initialize array in class XPCDispInterface - * @param p the address of the member to construct - * @return p - */ - void* operator new(size_t, Member* p) CPP_THROW_NEW; - /** - * Is this a setter - * @return true if this is a setter - */ - PRBool IsSetter() const; - /** - * Is this a getter - * @return true if this is a getter - */ - PRBool IsGetter() const; - /** - * Is this a property - * @return true if this is a property - */ - PRBool IsProperty() const; - /** - * Is this a parameterized setter - * @return true if this is a parameterized property - */ - PRBool IsParameterizedSetter() const; - /** - * Is this a parameterized getter - * @return true if this is a parameterized property - */ - PRBool IsParameterizedGetter() const; - /** - * Is this a parameterized property - * @return true if this is a parameterized property - */ - PRBool IsParameterizedProperty() const; - /** - * Is this a function - * @return true if this is a function - */ - PRBool IsFunction() const; - /** - * Returns the name of the method as a jsid - * @return the name of the method as a jsid - */ - jsid GetName() const; - /** - * Returns the function object as a value for the method - * @param ccx an XPConnect call context - * @param iface The native interface of the function - * @param retval pointer to the jsval to receive the name - * @return JS_TRUE if the function object was return - */ - JSBool GetValue(XPCCallContext& ccx, XPCNativeInterface* iface, - jsval * retval) const; - /** - * returns the dispid of the method - * @return the dispid of the method - */ - PRUint32 GetDispID() const; - /** - * returns the number of parameters of the method - * @param Ask from getter instead of setter version of the function - * @return the number of parameters of the method - */ - PRUint32 GetParamCount(PRBool getter = PR_FALSE) const; - /** - * Returns parameter information for the specified parameter - * @param index the index of the parameter - * @param Ask from getter instead of setter version of the function - * @return Parameter information - */ - ParamInfo GetParamInfo(PRUint32 index, PRBool getter = PR_FALSE) const; - // === Setup functions === - /** - * Sets the name of the method - * @param name the name to assign - */ - void SetName(jsid name); - /** - * Marks the member as a getter. - * Both MakeGetter and MakeSetter can be called, making it a setter/getter - */ - void MakeGetter(); - /** - * Marks the member as a setter - */ - void MakeSetter(); - /** - * Marks the member as a function - * Should not be called if MakeGetter/Setter is called. Will assert - */ - void SetFunction(); - /** - * Used to reset the type of of member - */ - void ResetType(); - /** - * Sets the type information for the parameter - * @param dispID the DISPID of the member - * @param pTypeInfo Pointer to the COM type information - * @param fundesc function description - */ - void SetTypeInfo(DISPID dispID, ITypeInfo* pTypeInfo, - FUNCDESC* funcdesc); - /** - * Sets the function description for the getter version of the function. - * @param funcdesc function description - */ - void SetGetterFuncDesc(FUNCDESC* funcdesc); - /** - * Sets the member ID - * @param memID the IDispatch ID of the member - */ - void SetMemID(DISPID memID); - /** - * Returns the IDispatch ID of the member - * @return the IDispatch ID of the member - */ - DISPID GetMemID() const; - - private: - DISPID mMemID; - /** - * Our internal flags identify the type of member - * A member can be both getter/setter - */ - enum member_type - { - UNINITIALIZED = 0, - SET_PROPERTY = 1, - GET_PROPERTY = 2, - FUNCTION = 4, - RESOLVED = 8 - }; - PRUint16 mType; - jsval mVal; // Mutable - jsid mName; // Mutable - CComPtr mTypeInfo; - FUNCDESC* mFuncDesc; // We own this - FUNCDESC* mGetterFuncDesc; // We own this - /** - * Helper function to return the parameter type - * @param index index of the parameter to return the type of - * @return The parameter type - */ - PRUint16 GetParamType(PRUint32 index) const; - /** - * Helper function to test if a flag is set in mType - * @param flag the flag to test for - * @return true if the flag is set - */ - PRBool IsFlagSet(unsigned short flag) const; - }; - /** - * Returns the JSObject for the tearoff - * @return pointer to the JSObject - * @see mJSObject - */ - JSObject* GetJSObject() const; - /** - * Sets the JSObject for the tearoff - * @param jsobj the object being assigned - * @see GetJSObject() const - */ - void SetJSObject(JSObject* jsobj); - /** - * Locates the member by name - * @param name the name of the member to be returned - * @return pointer to the member found, nsnull if not found - */ - const Member * FindMember(jsid name) const; - /** - * Looksup a member ignoring case - * TODO: We should look at performance issues concerning this - * @param ccx A call context - * @param name The name of the member - * @return A pointer to a member or nsnull if not found - */ - const Member* FindMemberCI(XPCCallContext& ccx, jsid name) const; - /** - * Returns a member via index - * @param index the index of the parameter - * @return reference to the member in the array - */ - const Member & GetMember(PRUint32 index); - /** - * Returns the number of members - * @return the number of members - */ - PRUint32 GetMemberCount() const; - /** - * Creates a new instance of XPCDispInterface - * @param cx a JS Context - * @param pIface the interface pointer to the object - * @return new instance of XPCDispInterface - */ - static - XPCDispInterface* NewInstance(JSContext* cx, nsISupports * pIface); - /** - * Delete operator that frees up the memory allocated to the object - * @param p pointer to the objects memory - */ - void operator delete(void * p); - /** - * Cleans up the members - */ - ~XPCDispInterface(); -private: - /** - * Initializes the object's members - * @param cx a JS context - * @param pTypeInfo pointer to the type type information - * @param members number of members for the object - */ - XPCDispInterface(JSContext* cx, - ITypeInfo * pTypeInfo, - PRUint32 members); - /** - * Allocates the memory for the object - * @param members number of members in this interface - * @return pointer to the memory for the object - */ - void * operator new (size_t, PRUint32 members) CPP_THROW_NEW; - - /** - * This stores the JSObject for the tearoff, since this object - * is stored as the JSObject * in the tearoff - */ - JSObject* mJSObject; - PRUint32 mMemberCount; - Member mMembers[1]; - /** - * Inspects the type information and stores it in this object - * @param cx a JS context - * @param pTypeInfo pointer to the type information for the object - * @param members number of members in the interface - * @return PR_TRUE if it worked, PR_FALSE if it didn't (usually out of - * memory) - */ - PRBool InspectIDispatch(JSContext * cx, ITypeInfo * pTypeInfo, - PRUint32 members); - - /** - * Small utility to count members needed for XPConnect - * XPConnect has one entry for a property while IDispatch can have two - * Generally interfaces are small enough, that linear searching should - * be ok - */ - class Allocator - { - public: - /** - * Constructor, creates the initial buffer - * @param cx a JS context - * @param pTypeInfo pointer to IDispatch type info, our caller holds - * the reference we don't need to - */ - Allocator(JSContext * cx, ITypeInfo * pTypeInfo); - /** - * Destructor, frees the buffer we allocated - */ - inline - ~Allocator(); - /** - * Returns the allocated XPCDispInterface object - * @return the allocated XPCDispInterface object - */ - inline - XPCDispInterface* Allocate(); - private: - DISPID * mMemIDs; - PRUint32 mCount; // Total unique ID's found - PRUint32 mIDispatchMembers; // Total entries reported by ITypeInfo - JSContext* mCX; - ITypeInfo* mTypeInfo; - - /** - * Returns the number of members found - * @return The number of members found - */ - inline - PRUint32 Count() const; - /** - * Adds the member ID to the list - * @param memID The member ID to test - */ - void Add(DISPID memID); - /** - * Allows our caller to handle unexpected problems like out of memory - * @return PR_TRUE if the buffer was allocated - */ - inline - PRBool Valid() const; - - // No copying or assigning allowed - Allocator(const Allocator&); - Allocator& operator =(const Allocator&); - }; - /** - * Friendship need to gain access to private operator new - */ - friend class Allocator; -}; - -/** - * Used to invoke IDispatch methods - * This has turned into kind of a catch all, and probably should be - * cleaned up - */ -class XPCDispObject -{ -public: - enum CallMode {CALL_METHOD, CALL_GETTER, CALL_SETTER}; - /** - * This invokes an IDispatch method - * @param ccx an XPConnect call context - * @param pDisp the IDispatch pointer - * @param dispID the DISPID of the method/property - * @param mode the call mode, method/property - * @param params the parameters need for the method/property - * @param retval pointer to a jsval to receive the return value - * @param member a pointer to an interface member - * @param rt a pointer to the XPConnect JS Runtime - * @return true if the method/property was invoked properly - */ - static - JSBool Dispatch(XPCCallContext& ccx, IDispatch * pDisp, - DISPID dispID, CallMode mode, XPCDispParams * params, - jsval* retval, XPCDispInterface::Member* member = nsnull, - XPCJSRuntime* rt = nsnull); - /** - * Used to invoke an IDispatch method using the XPCCallContext - * @param ccx an XPConnect call context - * @param mode call mode for the call - */ - static - JSBool Invoke(XPCCallContext & ccx, CallMode mode); - /** - * Performs the various security checks, caps, hosting flags, etc. - * Instantiates the object and will return that object if createdObject - * result is not null - * @param ccx an XPConnect call context - * @param aCID the class ID to be tested - * @param createdObject is the optional object to be returned - */ - static - HRESULT SecurityCheck(XPCCallContext & ccx, const CLSID & aCID, - IDispatch ** createdObject = nsnull); - /** - * Instantiates a COM object given a class ID or a prog ID - * @param ccx an XPConnect call context - * @param className a prog ID or a class ID in the form of - * {00000000-0000-0000-0000-000000000000} - * @param enforceSecurity if true, will apply checks to ensure - * the object can be created giving the current - * security settings. - * @param result pointer to the pointer to receive the interface pointer - */ - static - HRESULT COMCreateInstance(XPCCallContext & ccx, BSTR className, - PRBool enforceSecurity, IDispatch ** result); - /** - * Wraps an IDispatch interface, returning the object as a jsval - * @param pDispatch IDispatch pointer - * @param cx a JS Context - * @param obj A pointer to a JS object serving as the global object - * @param rval is a pointer to a jsval to receive the JS object wrapper - */ - static - PRBool WrapIDispatch(IDispatch *pDispatch, XPCCallContext & ccx, - JSObject *obj, jsval *rval); -}; - -class XPCIDispatchExtension -{ -public: - /** - * Reset the enabled flag if xpconnect is re-initialized. - */ - static void InitStatics() { mIsEnabled = PR_TRUE; } - - /** - * returns true if IDispatch extension is enabled - * @return true if IDispatch extension is enabled - */ - static PRBool IsEnabled() { return mIsEnabled; } - /** - * Enables the IDispatch extension - */ - static void Enable() { mIsEnabled = PR_TRUE; } - /** - * Disables the IDispatch extension - */ - static void Disable() { mIsEnabled = PR_FALSE; } - /** - * This is the define property for the IDispatch system. It called from - * the XPConnect's DefineProperty - * @param ccx an XPConnect call context - * @param obj the JS object receiving the property - * @param idval ID of the property to add - * @param wrapperToReflectInterfaceNames the wrapper - * @param propFlags JS property flags - * @param resolved a pointer to a JSBool, set to true if properly resolved - */ - static JSBool DefineProperty(XPCCallContext & ccx, - JSObject *obj, jsid id, - XPCWrappedNative* wrapperToReflectInterfaceNames, - uintN propFlags, JSBool* resolved); - /** - * IDispatch system's enumeration function. This is called - * from XPC_WN_Shared_Enumerate - * @param ccx a XPConnect call context - * @param obj pointer to the JSObject - * @param wrapper pointer to the wrapper - * @return true if the enumeration was successful - */ - static JSBool Enumerate(XPCCallContext& ccx, JSObject* obj, - XPCWrappedNative * wrapper); - /** - * This is the delegated QI called from the wrapped JS class - * DelegatedQueryInterface - * @param self pointer to the object - * @param aInstancePtr pointer to an interface pointer to receive the QI'd - * pointer - * @return an XPCOM result - */ - static nsresult IDispatchQIWrappedJS(nsXPCWrappedJS * self, - void ** aInstancePtr); - -private: - static PRBool mIsEnabled; -}; - -/** - * This is a helper class that factored out the parameter cleanup code - */ -class XPCDispParams -{ -public: - /** - * Initializes the parameters object - * @param args the number of parameters this object will hold - */ - XPCDispParams(PRUint32 args); - /** - * Cleans up the parameters' data - */ - ~XPCDispParams(); - /** - * This sets the named prop ID to our local mPropId. This is used for - * setters. - */ - void SetNamedPropID(); - /** - * Returns a reference to a parameter - * @param index index of the parameter - * @return a reference to the parameter at index - */ - VARIANT & GetParamRef(PRUint32 index); - /** - * Returns the parameter by value - * @param index index of the parameter - * @return a copy of the parameter - */ - _variant_t GetParam(PRUint32 index) const; - /** - * Returns the output buffer for an output parameter - * @param index index of the output parameter - * @return a pointer to the buffer for the output parameter - */ - void * GetOutputBuffer(PRUint32 index); - /** - * Returns a DISPPARAMS structure pointer for the parameters - * @return a DISPPARAMS structure pointer for the parameters - */ - DISPPARAMS* GetDispParams() const { return &const_cast(this)->mDispParams; } - /** - * Returns the number of parameters - * @return the number of parameters - */ - uintN GetParamCount() const { return mDispParams.cArgs; } - /** - * Inserts a parameter - * This is mainly used for parameterized properties - * @param var the parameter to insert - */ - void InsertParam(_variant_t & var); -private: - /** - * Don't allow copying - */ - XPCDispParams(const XPCDispParams & other) { - NS_ERROR("XPCDispParams can't be copied"); } - /** - * We don't allow assignments - */ - XPCDispParams& operator =(const XPCDispParams&) { - NS_ERROR("XPCDispParams can't be assigned"); } - - enum - { - DEFAULT_ARG_ARRAY_SIZE = 8, - DEFAULT_REF_BUFFER_SIZE = 8 * sizeof(VARIANT) - }; - static - PRUint32 RefBufferSize(PRUint32 args) { return (args + 1) * sizeof(VARIANT); } - - DISPPARAMS mDispParams; - char* mRefBuffer; - VARIANT* mDispParamsAllocated; - char* mRefBufferAllocated; - /** - * Used by output/ref variant types - */ - char mStackRefBuffer[DEFAULT_REF_BUFFER_SIZE]; - VARIANT mStackArgs[DEFAULT_ARG_ARRAY_SIZE]; - DISPID mPropID; -#ifdef DEBUG - PRBool mInserted; -#endif -}; - -/** - * This class is a service that exposes some handy utility methods for - * IDispatch users - */ -class nsDispatchSupport : public nsIDispatchSupport -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIDISPATCHSUPPORT - /** - * Initialize nsISupports base objects - */ - nsDispatchSupport(); - /** - * Cleansup nsISupports - */ - virtual ~nsDispatchSupport(); - /** - * Returns the existing instance or creates a new one - * @return an nsDispatchSupport object - */ - static nsDispatchSupport* GetSingleton(); - /** - * Called on shutdown to free the instance - */ - static void FreeSingleton() { NS_IF_RELEASE(mInstance); } - -private: - static nsDispatchSupport* mInstance; -}; - -/** - * Provides class info for IDispatch based objects - */ -class XPCIDispatchClassInfo : public nsIClassInfo -{ -public: - /** - * Returns a single instance of XPCIDispatchClassInfo - * @return the lone instance - */ - static XPCIDispatchClassInfo* GetSingleton(); - /** - * Releases our hold on the instance - */ - static void FreeSingleton(); - NS_DECL_ISUPPORTS - NS_DECL_NSICLASSINFO -private: - /** - * Only our methods create and destroy instances - */ - XPCIDispatchClassInfo() {} - virtual ~XPCIDispatchClassInfo() {} - - static XPCIDispatchClassInfo* sInstance; -}; - -#include "XPCDispInlines.h" - -#endif diff --git a/js/src/xpconnect/src/XPCDispTearOff.cpp b/js/src/xpconnect/src/XPCDispTearOff.cpp deleted file mode 100644 index 316c4ad1e2b..00000000000 --- a/js/src/xpconnect/src/XPCDispTearOff.cpp +++ /dev/null @@ -1,539 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -/** - * \file XPCDispTearOff.cpp - * Contains the implementation of the XPCDispTearoff class - */ -#include "xpcprivate.h" - -/** - * Sets the COM error from a result code and text message. This is the base - * implementation for subsequent string based overrides - * @param hResult the COM error code to be used - * @param message the message to put in the error - * @return the error code passed in via hResult - */ -static HRESULT Error(HRESULT hResult, const CComBSTR & message) -{ - CComPtr pCreateError; - CComPtr pError; - HRESULT result = CreateErrorInfo(&pCreateError); - if(FAILED(result)) - return E_NOTIMPL; - result = pCreateError->QueryInterface(&pError); - if(FAILED(result)) - return E_NOTIMPL; - result = pCreateError->SetDescription(message); - if(FAILED(result)) - return E_NOTIMPL; - result = pCreateError->SetGUID(IID_IDispatch); - if(FAILED(result)) - return E_NOTIMPL; - CComBSTR source(L"@mozilla.XPCDispatchTearOff"); - result = pCreateError->SetSource(source); - if(FAILED(result)) - return E_NOTIMPL; - result = SetErrorInfo(0, pError); - if(FAILED(result)) - return E_NOTIMPL; - return hResult; -} - - -/** - * Sets the COM error from a result code and text message - * @param hResult the COM error code to be used - * @param message the message to put in the error - * @return the error code passed in via hResult - */ -inline -HRESULT Error(HRESULT hResult, const char * message) -{ - CComBSTR someText(message); - return Error(hResult, someText); -} - -/** - * Helper function that converts an exception to a string - * @param exception - * @return the description of the exception - */ -static void BuildMessage(nsIException * exception, nsCString & result) -{ - nsXPIDLCString msg; - exception->GetMessageMoz(getter_Copies(msg)); - nsXPIDLCString filename; - exception->GetFilename(getter_Copies(filename)); - - PRUint32 lineNumber; - if(NS_FAILED(exception->GetLineNumber(&lineNumber))) - lineNumber = 0; - result = "Error in file "; - result += filename; - result += ",#"; - result.AppendInt(lineNumber); - result += " : "; - result += msg; -} - -/** - * Sets the COM error given an nsIException - * @param exception the exception being set - */ -inline -static void SetCOMError(nsIException * exception) -{ - nsCString message; - BuildMessage(exception, message); - Error(E_FAIL, message.get()); -} - -XPCDispatchTearOff::XPCDispatchTearOff(nsIXPConnectWrappedJS * wrappedJS) : - mWrappedJS(wrappedJS), - mCOMTypeInfo(nsnull), - mRefCnt(0) -{ -} - -XPCDispatchTearOff::~XPCDispatchTearOff() -{ - NS_IF_RELEASE(mCOMTypeInfo); -} - -NS_COM_IMPL_ADDREF(XPCDispatchTearOff) -NS_COM_IMPL_RELEASE(XPCDispatchTearOff) - -// See bug 127982: -// -// Microsoft's InlineIsEqualGUID global function is multiply defined -// in ATL and/or SDKs with varying namespace requirements. To save the control -// from future grief, this method is used instead. -static inline BOOL _IsEqualGUID(REFGUID rguid1, REFGUID rguid2) -{ - return ( - ((PLONG) &rguid1)[0] == ((PLONG) &rguid2)[0] && - ((PLONG) &rguid1)[1] == ((PLONG) &rguid2)[1] && - ((PLONG) &rguid1)[2] == ((PLONG) &rguid2)[2] && - ((PLONG) &rguid1)[3] == ((PLONG) &rguid2)[3]); -} - -STDMETHODIMP XPCDispatchTearOff::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_IDispatch, - }; - - for(int i=0;i(this); - NS_ADDREF_THIS(); - return NS_OK; - } - - if(IsEqualIID(guid, IID_ISupportErrorInfo)) - { - *pPtr = static_cast(this); - NS_ADDREF_THIS(); - return NS_OK; - } - - return mWrappedJS->QueryInterface(XPCDispIID2nsIID(guid), pPtr); -} - -STDMETHODIMP XPCDispatchTearOff::GetTypeInfoCount(unsigned int FAR * pctinfo) -{ - *pctinfo = 1; - return S_OK; -} - -XPCDispTypeInfo * XPCDispatchTearOff::GetCOMTypeInfo() -{ - // If one was already created return it - if(mCOMTypeInfo) - return mCOMTypeInfo; - // Build a new one, save the pointer and return it - XPCCallContext ccx(NATIVE_CALLER); - if(!ccx.IsValid()) - return nsnull; - JSObject* obj = GetJSObject(); - if(!obj) - return nsnull; - mCOMTypeInfo = XPCDispTypeInfo::New(ccx, obj); - NS_IF_ADDREF(mCOMTypeInfo); - return mCOMTypeInfo; -} - -STDMETHODIMP XPCDispatchTearOff::GetTypeInfo(unsigned int, LCID, - ITypeInfo FAR* FAR* ppTInfo) -{ - *ppTInfo = GetCOMTypeInfo(); - NS_ADDREF(*ppTInfo); - return S_OK; -} - -STDMETHODIMP XPCDispatchTearOff::GetIDsOfNames(REFIID riid, - OLECHAR FAR* FAR* rgszNames, - unsigned int cNames, LCID lcid, - DISPID FAR* rgDispId) -{ - ITypeInfo * pTypeInfo = GetCOMTypeInfo(); - if(pTypeInfo != nsnull) - { - return pTypeInfo->GetIDsOfNames(rgszNames, cNames, rgDispId); - } - return S_OK; -} - -void -xpcWrappedJSErrorReporter(JSContext *cx, const char *message, - JSErrorReport *report); - -STDMETHODIMP XPCDispatchTearOff::Invoke(DISPID dispIdMember, REFIID riid, - LCID lcid, WORD wFlags, - DISPPARAMS FAR* pDispParams, - VARIANT FAR* pVarResult, - EXCEPINFO FAR* pExcepInfo, - unsigned int FAR* puArgErr) -{ - XPCDispTypeInfo* pTypeInfo = GetCOMTypeInfo(); - if(!pTypeInfo) - { - return E_FAIL; - } - XPCCallContext ccx(NATIVE_CALLER); - XPCContext* xpcc; - JSContext* cx; - if(ccx.IsValid()) - { - xpcc = ccx.GetXPCContext(); - cx = ccx.GetJSContext(); - } - else - { - xpcc = nsnull; - cx = nsnull; - } - // Get the name as a flat string - // This isn't that efficient, but we have to make the conversion somewhere - NS_LossyConvertUTF16toASCII name(pTypeInfo->GetNameForDispID(dispIdMember)); - if(name.IsEmpty()) - return E_FAIL; - // Decide if this is a getter or setter - PRBool getter = (wFlags & DISPATCH_PROPERTYGET) != 0; - PRBool setter = (wFlags & DISPATCH_PROPERTYPUT) != 0; - // It's a property - if(getter || setter) - { - jsval val; - uintN err; - JSObject* obj; - if(getter) - { - // Get the property and convert the value - obj = GetJSObject(); - if(!obj) - return E_FAIL; - if(!JS_GetProperty(cx, obj, name.get(), &val)) - { - nsCString msg("Unable to retrieve property "); - msg += name; - return Error(E_FAIL, msg.get()); - } - if(!XPCDispConvert::JSToCOM(ccx, val, *pVarResult, err)) - { - nsCString msg("Failed to convert value from JS property "); - msg += name; - return Error(E_FAIL, msg.get()); - } - } - else if(pDispParams->cArgs > 0) - { - // Convert the property and then set it - if(!XPCDispConvert::COMToJS(ccx, pDispParams->rgvarg[0], val, err)) - { - nsCString msg("Failed to convert value for JS property "); - msg += name; - return Error(E_FAIL, msg.get()); - } - AUTO_MARK_JSVAL(ccx, &val); - obj = GetJSObject(); - if(!obj) - return Error(E_FAIL, "The JS wrapper did not return a JS object"); - if(!JS_SetProperty(cx, obj, name.get(), &val)) - { - nsCString msg("Unable to set property "); - msg += name; - return Error(E_FAIL, msg.get()); - } - } - } - else // We're invoking a function - { - jsval* stackbase = nsnull; - jsval* sp = nsnull; - uint8 i; - uint8 argc = pDispParams->cArgs; - uint8 stack_size; - jsval result; - uint8 paramCount=0; - nsresult retval = NS_ERROR_FAILURE; - nsresult pending_result = NS_OK; - JSBool success; - JSBool readyToDoTheCall = JS_FALSE; - uint8 outConversionFailedIndex; - JSObject* obj; - jsval fval; - nsCOMPtr xpc_exception; - void* mark; - JSBool foundDependentParam; - JSObject* thisObj; - AutoScriptEvaluate scriptEval(ccx); - XPCJSRuntime* rt = ccx.GetRuntime(); - int j; - - js::InvokeArgsGuard args; - - thisObj = obj = GetJSObject();; - - if(!cx || !xpcc) - goto pre_call_clean_up; - - scriptEval.StartEvaluating(xpcWrappedJSErrorReporter); - - xpcc->SetPendingResult(pending_result); - xpcc->SetException(nsnull); - ccx.GetThreadData()->SetException(nsnull); - - // We use js_Invoke so that the gcthings we use as args will be rooted - // by the engine as we do conversions and prepare to do the function - // call. - - js::LeaveTrace(cx); - - // In the xpidl [function] case we are making sure now that the - // JSObject is callable. If it is *not* callable then we silently - // fallback to looking up the named property... - // (because jst says he thinks this fallback is 'The Right Thing'.) - // - // In the normal (non-function) case we just lookup the property by - // name and as long as the object has such a named property we go ahead - // and try to make the call. If it turns out the named property is not - // a callable object then the JS engine will throw an error and we'll - // pass this along to the caller as an exception/result code. - fval = OBJECT_TO_JSVAL(obj); - if(JS_TypeOfValue(ccx, fval) != JSTYPE_FUNCTION && - !JS_GetProperty(cx, obj, name.get(), &fval)) - { - // XXX We really want to factor out the error reporting better and - // specifically report the failure to find a function with this name. - // This is what we do below if the property is found but is not a - // function. We just need to factor better so we can get to that - // reporting path from here. - goto pre_call_clean_up; - } - - if (!cx->stack().pushInvokeArgsFriendAPI(cx, argc, args)) - { - retval = NS_ERROR_OUT_OF_MEMORY; - goto pre_call_clean_up; - } - - sp = stackbase = Jsvalify(args.getvp()); - - // this is a function call, so push function and 'this' - *sp++ = fval; - *sp++ = OBJECT_TO_JSVAL(thisObj); - - // make certain we leave no garbage in the stack - for(i = 0; i < argc; i++) - { - sp[i] = JSVAL_VOID; - } - - uintN err; - // build the args - // NOTE: COM expects args in DISPPARAMS to be in reverse order - for (j = argc - 1; j >= 0; --j ) - { - jsval val; - if((pDispParams->rgvarg[j].vt & VT_BYREF) == 0) - { - if(!XPCDispConvert::COMToJS(ccx, pDispParams->rgvarg[j], val, err)) - goto pre_call_clean_up; - *sp++ = val; - } - else - { - // create an 'out' object - JSObject* out_obj = JS_NewObject(cx, nsnull, nsnull, nsnull); - if(!out_obj) - { - retval = NS_ERROR_OUT_OF_MEMORY; - goto pre_call_clean_up; - } - // We'll assume in/out - // TODO: I'm not sure we tell out vs in/out - JS_SetPropertyById(cx, out_obj, - rt->GetStringID(XPCJSRuntime::IDX_VALUE), - &val); - *sp++ = OBJECT_TO_JSVAL(out_obj); - } - } - - readyToDoTheCall = JS_TRUE; - -pre_call_clean_up: - - if(!readyToDoTheCall) - goto done; - - // do the deed - note exceptions - - JS_ClearPendingException(cx); - - if(!JSVAL_IS_PRIMITIVE(fval)) - { - success = js::InvokeFriendAPI(cx, args, 0); - result = stackbase[0]; - } - else - { - // The property was not an object so can't be a function. - // Let's build and 'throw' an exception. - - static const nsresult code = - NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED; - static const char format[] = "%s \"%s\""; - const char * msg; - char* sz = nsnull; - - if(nsXPCException::NameAndFormatForNSResult(code, nsnull, &msg) && msg) - sz = JS_smprintf(format, msg, name); - - nsCOMPtr e; - - XPCConvert::ConstructException(code, sz, "IDispatch", name.get(), - nsnull, getter_AddRefs(e), nsnull, nsnull); - xpcc->SetException(e); - if(sz) - JS_smprintf_free(sz); - } - - if(!success) - { - retval = nsXPCWrappedJSClass::CheckForException(ccx, name.get(), - "IDispatch", - PR_FALSE); - goto done; - } - - ccx.GetThreadData()->SetException(nsnull); // XXX necessary? - - // convert out args and result - // NOTE: this is the total number of native params, not just the args - // Convert independent params only. - // When we later convert the dependent params (if any) we will know that - // the params upon which they depend will have already been converted - - // regardless of ordering. - - outConversionFailedIndex = paramCount; - foundDependentParam = JS_FALSE; - if(JSVAL_IS_VOID(result) || XPCDispConvert::JSToCOM(ccx, result, *pVarResult, err)) - { - for(i = 0; i < paramCount; i++) - { - jsval val; - if(JSVAL_IS_PRIMITIVE(stackbase[i+2]) || - !JS_GetPropertyById(cx, JSVAL_TO_OBJECT(stackbase[i+2]), - rt->GetStringID(XPCJSRuntime::IDX_VALUE), - &val)) - { - outConversionFailedIndex = i; - break; - } - - } - } - - if(outConversionFailedIndex != paramCount) - { - // We didn't manage all the result conversions! - // We have to cleanup any junk that *did* get converted. - - for(PRUint32 index = 0; index < outConversionFailedIndex; index++) - { - if((pDispParams->rgvarg[index].vt & VT_BYREF) != 0) - { - VariantClear(pDispParams->rgvarg + i); - } - } - } - else - { - // set to whatever the JS code might have set as the result - retval = pending_result; - } - -done: - // TODO: I think we may need to translate this error, - // for now we'll pass through - return retval; - } - return S_OK; -} - -inline -JSObject* XPCDispatchTearOff::GetJSObject() -{ - JSObject* obj; - if(NS_SUCCEEDED(mWrappedJS->GetJSObject(&obj))) - return obj; - return nsnull; -} diff --git a/js/src/xpconnect/src/XPCDispTypeInfo.cpp b/js/src/xpconnect/src/XPCDispTypeInfo.cpp deleted file mode 100644 index f573bb1ecd2..00000000000 --- a/js/src/xpconnect/src/XPCDispTypeInfo.cpp +++ /dev/null @@ -1,466 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -/** - * \file XPCDispTypeInfo.cpp - * Is the implementation for XPCDispTypeInfo and supporting classes - */ - -/** - * \file XPCDispTypeInfo.cpp - * \brief implementation of XPCDispTypeInfo - * This file contains the implementations for XPCDispTypeInfo class and - * associated helper classes and functions - */ - -#include "xpcprivate.h" - -/** - * Helper function that initializes the element description - * @param vt The type of variant - * @param paramFlags flats for the type of parameter, in, out, etc. - * @param elemDesc The element being initialized - */ -inline -void FillOutElemDesc(VARTYPE vt, PRUint16 paramFlags, ELEMDESC & elemDesc) -{ - elemDesc.tdesc.vt = vt; - elemDesc.paramdesc.wParamFlags = paramFlags; - elemDesc.paramdesc.pparamdescex = 0; - elemDesc.tdesc.lptdesc = 0; - elemDesc.tdesc.lpadesc = 0; - elemDesc.tdesc.hreftype = 0; -} - -XPCDispTypeInfo::~XPCDispTypeInfo() -{ - delete mIDArray; -} - -void XPCDispJSPropertyInfo::GetReturnType(XPCCallContext& ccx, ELEMDESC & elemDesc) -{ - VARTYPE vt; - if(IsSetter()) // if this is a setter - { - vt = VT_EMPTY; - } - else if(IsProperty()) // If this is a property - { - vt = XPCDispConvert::JSTypeToCOMType(ccx, mProperty); - } - else // if this is a function - { - vt = VT_VARIANT; - } - FillOutElemDesc(vt, PARAMFLAG_FRETVAL, elemDesc); -} - -ELEMDESC* XPCDispJSPropertyInfo::GetParamInfo() -{ - PRUint32 paramCount = GetParamCount(); - ELEMDESC* elemDesc; - if(paramCount != 0) - { - elemDesc = new ELEMDESC[paramCount]; - if(elemDesc) - { - for(PRUint32 index = 0; index < paramCount; ++index) - { - FillOutElemDesc(VT_VARIANT, PARAMFLAG_FIN, elemDesc[index]); - } - } - } - else - elemDesc = 0; - // Caller becomes owner - return elemDesc; -} - -XPCDispJSPropertyInfo::XPCDispJSPropertyInfo(JSContext* cx, PRUint32 memid, - JSObject* obj, jsval val) : - mPropertyType(INVALID), mMemID(memid) -{ - PRUint32 len; - jschar * chars = xpc_JSString2String(cx, val, &len); - if(!chars) - return; - - mName = nsString(reinterpret_cast(chars), len); - JSBool found; - uintN attr; - // Get the property's attributes, and make sure it's found and enumerable - if(!JS_GetUCPropertyAttributes(cx, obj, chars, len, &attr, &found) || - !found || (attr & JSPROP_ENUMERATE) == 0) - return; - - // Retrieve the property - if(!chars || !JS_GetUCProperty(cx, obj, chars, len, &mProperty) || - JSVAL_IS_NULL(mProperty)) - return; - - // If this is a function - if(JSVAL_IS_OBJECT(mProperty) && - JS_ObjectIsFunction(cx, JSVAL_TO_OBJECT(mProperty))) - { - mPropertyType = FUNCTION; - JSObject * funcObj = JSVAL_TO_OBJECT(mProperty); - JSIdArray * funcObjArray = JS_Enumerate(cx, funcObj); - if(funcObjArray) - { - mParamCount = funcObjArray->length; - } - } - else // It's a property - { - mParamCount = 0; - if((attr & JSPROP_READONLY) != 0) - { - mPropertyType = READONLY_PROPERTY; - } - else - { - mPropertyType = PROPERTY; - } - } -} - -PRBool XPCDispTypeInfo::FuncDescArray::BuildFuncDesc(XPCCallContext& ccx, JSObject* obj, - XPCDispJSPropertyInfo & propInfo) -{ - // While this memory is passed out, we're ultimately responsible to free it - FUNCDESC* funcDesc = mArray.AppendElement(); - if(!funcDesc) - return PR_FALSE; - // zero is reserved - funcDesc->memid = propInfo.GetMemID(); - funcDesc->lprgscode = 0; // Not used (for 16 bit systems) - funcDesc->funckind = FUNC_DISPATCH; - funcDesc->invkind = propInfo.GetInvokeKind(); - funcDesc->callconv = CC_STDCALL; - funcDesc->cParams = propInfo.GetParamCount(); - funcDesc->lprgelemdescParam = propInfo.GetParamInfo(); - // We might want to make all parameters optional since JS can handle that - funcDesc->cParamsOpt = 0; // Optional parameters - // This could be a problem, supposed to be used for functions of - // type FUNC_VIRTUAL which we aren't, so zero should be ok - funcDesc->oVft = 0; // Specifies offset in VTBL for FUNC_VIRTUAL - funcDesc->cScodes = 0; // Counts the permitted return values. - funcDesc->wFuncFlags = 0; // Indicates the FUNCFLAGS of a function. - propInfo.GetReturnType(ccx, funcDesc->elemdescFunc); - return PR_TRUE; -} - -XPCDispTypeInfo::FuncDescArray::FuncDescArray(XPCCallContext& ccx, JSObject* obj, const XPCDispIDArray& array, XPCDispNameArray & names) -{ - PRUint32 size = array.Length(); - names.SetSize(size); - PRUint32 memid = 0; - JSContext* cx = ccx; - // Initialize each function description in the array - for(PRUint32 index = 0; index < size; ++index) - { - XPCDispJSPropertyInfo propInfo(cx, ++memid, obj, array.Item(cx, index)); - names.SetName(index + 1, propInfo.GetName()); - if(!BuildFuncDesc(ccx, obj, propInfo)) - return; - // non-readonly Properties get two function descriptions - if(propInfo.IsProperty() && !propInfo.IsReadOnly()) - { - propInfo.SetSetter(); - if(!BuildFuncDesc(ccx, obj, propInfo)) - return; - } - } -} - -XPCDispTypeInfo::FuncDescArray::~FuncDescArray() -{ - PRUint32 size = mArray.Length(); - for(PRUint32 index = 0; index < size; ++index) - { - delete [] mArray[index].lprgelemdescParam; - } -} - -XPCDispTypeInfo::XPCDispTypeInfo(XPCCallContext& ccx, JSObject* obj, - XPCDispIDArray* array) : - mRefCnt(0), mJSObject(obj), mIDArray(array), - mFuncDescArray(ccx, obj, *array, mNameArray) -{ -} - -XPCDispTypeInfo * XPCDispTypeInfo::New(XPCCallContext& ccx, JSObject* obj) -{ - XPCDispTypeInfo * pTypeInfo = 0; - JSIdArray * jsArray = JS_Enumerate(ccx, obj); - if(!jsArray) - return nsnull; - XPCDispIDArray* array = new XPCDispIDArray(ccx, jsArray); - if(!array) - return nsnull; - pTypeInfo = new XPCDispTypeInfo(ccx, obj, array); - if(!pTypeInfo) - { - delete array; - return nsnull; - } - NS_ADDREF(pTypeInfo); - return pTypeInfo; -} - -NS_COM_MAP_BEGIN(XPCDispTypeInfo) - NS_COM_MAP_ENTRY(ITypeInfo) - NS_COM_MAP_ENTRY(IUnknown) -NS_COM_MAP_END - -NS_IMPL_THREADSAFE_ADDREF(XPCDispTypeInfo) -NS_IMPL_THREADSAFE_RELEASE(XPCDispTypeInfo) - - -STDMETHODIMP XPCDispTypeInfo::GetTypeAttr( - /* [out] */ TYPEATTR __RPC_FAR *__RPC_FAR *ppTypeAttr) -{ - return E_NOTIMPL; -} - -STDMETHODIMP XPCDispTypeInfo::GetTypeComp( - /* [out] */ ITypeComp __RPC_FAR *__RPC_FAR *ppTComp) -{ - return E_NOTIMPL; -} - -STDMETHODIMP XPCDispTypeInfo::GetFuncDesc( - /* [in] */ UINT index, - /* [out] */ FUNCDESC __RPC_FAR *__RPC_FAR *ppFuncDesc) -{ - return E_NOTIMPL; -} - -STDMETHODIMP XPCDispTypeInfo::GetVarDesc( - /* [in] */ UINT index, - /* [out] */ VARDESC __RPC_FAR *__RPC_FAR *ppVarDesc) -{ - return E_NOTIMPL; -} - -STDMETHODIMP XPCDispTypeInfo::GetNames( - /* [in] */ MEMBERID memid, - /* [length_is][size_is][out] */ BSTR __RPC_FAR *rgBstrNames, - /* [in] */ UINT cMaxNames, - /* [out] */ UINT __RPC_FAR *pcNames) -{ - return E_NOTIMPL; -} - -STDMETHODIMP XPCDispTypeInfo::GetRefTypeOfImplType( - /* [in] */ UINT index, - /* [out] */ HREFTYPE __RPC_FAR *pRefType) -{ - return E_NOTIMPL; -} - -STDMETHODIMP XPCDispTypeInfo::GetImplTypeFlags( - /* [in] */ UINT index, - /* [out] */ INT __RPC_FAR *pImplTypeFlags) -{ - return E_NOTIMPL; -} - -STDMETHODIMP XPCDispTypeInfo::GetIDsOfNames( - /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, - /* [in] */ UINT cNames, - /* [size_is][out] */ MEMBERID __RPC_FAR *pMemId) -{ - // lookup each name - for(UINT index = 0; index < cNames; ++index) - { - nsDependentString buffer(static_cast - (rgszNames[index]), - wcslen(rgszNames[index])); - pMemId[index] = mNameArray.Find(buffer); - - } - return S_OK; -} - -STDMETHODIMP XPCDispTypeInfo::Invoke( - /* [in] */ PVOID pvInstance, - /* [in] */ MEMBERID memid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, - /* [out] */ VARIANT __RPC_FAR *pVarResult, - /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, - /* [out] */ UINT __RPC_FAR *puArgErr) -{ - CComQIPtr pDisp(reinterpret_cast(pvInstance)); - if(pDisp) - { - return pDisp->Invoke(memid, IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, - pDispParams, pVarResult, pExcepInfo, puArgErr); - } - return E_NOINTERFACE; -} - -STDMETHODIMP XPCDispTypeInfo::GetDocumentation( - /* [in] */ MEMBERID memid, - /* [out] */ BSTR __RPC_FAR *pBstrName, - /* [out] */ BSTR __RPC_FAR *pBstrDocString, - /* [out] */ DWORD __RPC_FAR *pdwHelpContext, - /* [out] */ BSTR __RPC_FAR *pBstrHelpFile) -{ - PRUint32 index = memid; - if(index < mIDArray->Length()) - return E_FAIL; - - XPCCallContext ccx(NATIVE_CALLER); - PRUnichar * chars = xpc_JSString2PRUnichar(ccx, JSVAL_TO_STRING(mIDArray->Item(ccx, index))); - if(!chars) - { - return E_FAIL; - } - CComBSTR name(chars); - *pBstrName = name.Detach(); - pBstrDocString = 0; - pdwHelpContext = 0; - pBstrHelpFile = 0; - return S_OK; -} - -STDMETHODIMP XPCDispTypeInfo::GetDllEntry( - /* [in] */ MEMBERID memid, - /* [in] */ INVOKEKIND invKind, - /* [out] */ BSTR __RPC_FAR *pBstrDllName, - /* [out] */ BSTR __RPC_FAR *pBstrName, - /* [out] */ WORD __RPC_FAR *pwOrdinal) -{ - // We are not supporting this till a need arrises - return E_NOTIMPL; -} - -STDMETHODIMP XPCDispTypeInfo::GetRefTypeInfo( - /* [in] */ HREFTYPE hRefType, - /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) -{ - return E_NOTIMPL; -} - -STDMETHODIMP XPCDispTypeInfo::AddressOfMember( - /* [in] */ MEMBERID memid, - /* [in] */ INVOKEKIND invKind, - /* [out] */ PVOID __RPC_FAR *ppv) -{ - // We are not supporting this till a need arrises - return E_NOTIMPL; -} - -STDMETHODIMP XPCDispTypeInfo::CreateInstance( - /* [in] */ IUnknown __RPC_FAR *pUnkOuter, - /* [in] */ REFIID riid, - /* [iid_is][out] */ PVOID __RPC_FAR *ppvObj) -{ - // We are not supporting this till a need arrises - return E_NOTIMPL; -} - -STDMETHODIMP XPCDispTypeInfo::GetMops( - /* [in] */ MEMBERID memid, - /* [out] */ BSTR __RPC_FAR *pBstrMops) -{ - return E_NOTIMPL; -} - -STDMETHODIMP XPCDispTypeInfo::GetContainingTypeLib( - /* [out] */ ITypeLib __RPC_FAR *__RPC_FAR *ppTLib, - /* [out] */ UINT __RPC_FAR *pIndex) -{ - // We are not supporting this till a need arrises - return E_NOTIMPL; -} - -void STDMETHODCALLTYPE XPCDispTypeInfo::ReleaseTypeAttr( - /* [in] */ TYPEATTR __RPC_FAR *pTypeAttr) -{ - // Nothing for us to do -} - -void STDMETHODCALLTYPE XPCDispTypeInfo::ReleaseFuncDesc( - /* [in] */ FUNCDESC __RPC_FAR *pFuncDesc) -{ - // Nothing for us to do -} - -void STDMETHODCALLTYPE XPCDispTypeInfo::ReleaseVarDesc( - /* [in] */ VARDESC __RPC_FAR *pVarDesc) -{ - // Nothing for us to do -} - -XPCDispIDArray::XPCDispIDArray(XPCCallContext& ccx, JSIdArray* array) : - mMarked(JS_FALSE), mIDArray(array->length) -{ - mIDArray.SetLength(array->length); - - // copy the JS ID Array to our internal array - for(jsint index = 0; index < array->length; ++index) - { - mIDArray[index] = array->vector[index]; - } -} - -void XPCDispIDArray::TraceJS(JSTracer* trc) -{ - // If already marked nothing to do - if(JS_IsGCMarkingTracer(trc)) - { - if (IsMarked()) - return; - mMarked = JS_TRUE; - } - - PRInt32 count = Length(); - jsval val; - - // Iterate each of the ID's and mark them - for(PRInt32 index = 0; index < count; ++index) - { - if(JS_IdToValue(trc->context, mIDArray.ElementAt(index), &val)) - { - JS_CALL_VALUE_TRACER(trc, val, "disp_id_array_element"); - } - } -} - diff --git a/js/src/xpconnect/src/XPCIDispatchClassInfo.cpp b/js/src/xpconnect/src/XPCIDispatchClassInfo.cpp deleted file mode 100644 index 4b6bf0d9e14..00000000000 --- a/js/src/xpconnect/src/XPCIDispatchClassInfo.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 "xpcprivate.h" -#include "nsCRT.h" - -NS_IMPL_ISUPPORTS1(XPCIDispatchClassInfo, nsIClassInfo) - -XPCIDispatchClassInfo* XPCIDispatchClassInfo::sInstance = nsnull; - -XPCIDispatchClassInfo* XPCIDispatchClassInfo::GetSingleton() -{ - if(!sInstance) - { - sInstance = new XPCIDispatchClassInfo; - NS_IF_ADDREF(sInstance); - } - NS_IF_ADDREF(sInstance); - return sInstance; -} - -void XPCIDispatchClassInfo::FreeSingleton() -{ - NS_IF_RELEASE(sInstance); - sInstance = nsnull; -} - -/* void getInterfaces (out PRUint32 count, [array, size_is (count), retval] - out nsIIDPtr array); */ -NS_IMETHODIMP -XPCIDispatchClassInfo::GetInterfaces(PRUint32 *count, nsIID * **array) -{ - *count = 0; - *array = static_cast(nsMemory::Alloc(sizeof(nsIID*))); - NS_ENSURE_TRUE(*array, NS_ERROR_OUT_OF_MEMORY); - - **array = static_cast(nsMemory::Clone(&NSID_IDISPATCH, - sizeof(NSID_IDISPATCH))); - if(!**array) - { - nsMemory::Free(*array); - *array = nsnull; - return NS_ERROR_OUT_OF_MEMORY; - } - - *count = 1; - return NS_OK; -} - -/* nsISupports getHelperForLanguage (in PRUint32 language); */ -NS_IMETHODIMP -XPCIDispatchClassInfo::GetHelperForLanguage(PRUint32 language, - nsISupports **retval) -{ - *retval = nsnull; - return NS_OK; -} - -/* readonly attribute string contractID; */ -NS_IMETHODIMP -XPCIDispatchClassInfo::GetContractID(char * *aContractID) -{ - *aContractID = nsnull; - return NS_OK; -} - -/* readonly attribute string classDescription; */ -NS_IMETHODIMP -XPCIDispatchClassInfo::GetClassDescription(char * *aClassDescription) -{ - *aClassDescription = nsCRT::strdup("IDispatch"); - return *aClassDescription ? NS_OK : NS_ERROR_OUT_OF_MEMORY; -} - -/* readonly attribute nsCIDPtr classID; */ -NS_IMETHODIMP -XPCIDispatchClassInfo::GetClassID(nsCID * *aClassID) -{ - *aClassID = nsnull; - return NS_OK; -} - -/* readonly attribute PRUint32 implementationLanguage; */ -NS_IMETHODIMP -XPCIDispatchClassInfo::GetImplementationLanguage( - PRUint32 *aImplementationLanguage) -{ - *aImplementationLanguage = nsIProgrammingLanguage::UNKNOWN; - return NS_OK; -} - -/* readonly attribute PRUint32 flags; */ -NS_IMETHODIMP -XPCIDispatchClassInfo::GetFlags(PRUint32 *aFlags) -{ - *aFlags = nsIClassInfo::DOM_OBJECT; - return NS_OK; -} - -/* [notxpcom] readonly attribute nsCID classIDNoAlloc; */ -NS_IMETHODIMP -XPCIDispatchClassInfo::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) -{ - return NS_ERROR_NOT_AVAILABLE; -} diff --git a/js/src/xpconnect/src/XPCIDispatchExtension.cpp b/js/src/xpconnect/src/XPCIDispatchExtension.cpp deleted file mode 100644 index a75644258f2..00000000000 --- a/js/src/xpconnect/src/XPCIDispatchExtension.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 "xpcprivate.h" - -static const char* const IDISPATCH_NAME = "IDispatch"; - -#define XPC_IDISPATCH_CTOR_MAX_ARG_LEN 2000 - -PRBool XPCIDispatchExtension::mIsEnabled = PR_TRUE; - -JSBool XPCIDispatchExtension::DefineProperty(XPCCallContext & ccx, - JSObject *obj, jsid id, - XPCWrappedNative* wrapperToReflectInterfaceNames, - uintN propFlags, JSBool* resolved) -{ - // Look up the native interface for IDispatch and then find a tearoff - XPCNativeInterface* iface = XPCNativeInterface::GetNewOrUsed(ccx, - "IDispatch"); - // The native interface isn't defined so just exit with an error - if(iface == nsnull) - return JS_FALSE; - XPCWrappedNativeTearOff* to = - wrapperToReflectInterfaceNames->LocateTearOff(ccx, iface); - // This object has no IDispatch interface so bail. - if(to == nsnull) - return JS_FALSE; - // Look up the member in the interface - const XPCDispInterface::Member * member = to->GetIDispatchInfo()->FindMember(id); - if(!member) - { - // IDispatch is case insensitive, so if we don't find a case sensitive - // match, we'll try a more expensive case-insensisitive search - // TODO: We need to create cleaner solution that doesn't create - // multiple properties of different case on the JS Object - member = to->GetIDispatchInfo()->FindMemberCI(ccx, id); - if(!member) - return JS_FALSE; - } - // Get the function object - jsval funval; - if(!member->GetValue(ccx, iface, &funval)) - return JS_FALSE; - // Protect the jsval - AUTO_MARK_JSVAL(ccx, funval); - // clone a function we can use for this object - JSObject* funobj = xpc_CloneJSFunction(ccx, JSVAL_TO_OBJECT(funval), obj); - if(!funobj) - return JS_FALSE; - // If this is a function or a parameterized property - if(member->IsFunction() || member->IsParameterizedProperty()) - { - // define the function on the object - AutoResolveName arn(ccx, id); - if(resolved) - *resolved = JS_TRUE; - return JS_DefinePropertyById(ccx, obj, id, OBJECT_TO_JSVAL(funobj), - nsnull, nsnull, propFlags); - } - // Define the property on the object - NS_ASSERTION(member->IsProperty(), "way broken!"); - propFlags |= JSPROP_GETTER | JSPROP_SHARED; - JSPropertyOp getter = JS_DATA_TO_FUNC_PTR(JSPropertyOp, funobj); - JSPropertyOp setter; - if(member->IsSetter()) - { - propFlags |= JSPROP_SETTER; - propFlags &= ~JSPROP_READONLY; - setter = getter; - } - else - { - setter = js_GetterOnlyPropertyStub; - } - AutoResolveName arn(ccx, id); - if(resolved) - *resolved = JS_TRUE; - return JS_DefinePropertyById(ccx, obj, id, JSVAL_VOID, getter, setter, - propFlags); - -} - -JSBool XPCIDispatchExtension::Enumerate(XPCCallContext& ccx, JSObject* obj, - XPCWrappedNative * wrapper) -{ - XPCNativeInterface* iface = XPCNativeInterface::GetNewOrUsed( - ccx,&NSID_IDISPATCH); - if(!iface) - return JS_FALSE; - - XPCWrappedNativeTearOff* tearoff = wrapper->FindTearOff(ccx, iface); - if(!tearoff) - return JS_FALSE; - - if(!tearoff->IsIDispatch()) - return JS_FALSE; - - XPCDispInterface* pInfo = tearoff->GetIDispatchInfo(); - - PRUint32 members = pInfo->GetMemberCount(); - // Iterate over the members and force the properties to be resolved - for(PRUint32 index = 0; index < members; ++index) - { - const XPCDispInterface::Member & member = pInfo->GetMember(index); - jsid name = member.GetName(); - if(!xpc_ForcePropertyResolve(ccx, obj, name)) - return JS_FALSE; - } - return JS_TRUE; -} - -nsresult XPCIDispatchExtension::IDispatchQIWrappedJS(nsXPCWrappedJS * self, - void ** aInstancePtr) -{ - // Lookup the root and create a tearoff based on that - nsXPCWrappedJS* root = self->GetRootWrapper(); - - if(!root->IsValid()) - { - *aInstancePtr = nsnull; - return NS_NOINTERFACE; - } - XPCDispatchTearOff* tearOff = new XPCDispatchTearOff(root); - if(!tearOff) - return NS_ERROR_OUT_OF_MEMORY; - tearOff->AddRef(); - *aInstancePtr = tearOff; - - return NS_OK; -} diff --git a/js/src/xpconnect/src/dom_quickstubs.qsconf b/js/src/xpconnect/src/dom_quickstubs.qsconf index 27b30404507..e8fb2d4ac06 100644 --- a/js/src/xpconnect/src/dom_quickstubs.qsconf +++ b/js/src/xpconnect/src/dom_quickstubs.qsconf @@ -159,9 +159,9 @@ members = [ 'nsIDOMCSSStyleDeclaration.*', # dom/interfaces/events - 'nsIDOMEventTarget.dispatchEvent', + 'nsIDOMEventTarget.addEventListener', 'nsIDOMEventTarget.removeEventListener', - 'nsIDOMNSEventTarget.addEventListener', + 'nsIDOMEventTarget.dispatchEvent', 'nsIDOMEvent.*', 'nsIDOMMouseEvent.*', @@ -780,6 +780,10 @@ customMethodCalls = { ' rv = nsGenericElement::doQuerySelectorAll(self, ' 'arg0, getter_AddRefs(result));' }, + 'nsIDOMNode_Normalize': { + 'thisType': 'nsINode', + 'canFail': False + }, 'nsIDOMNode_GetBaseURI': { 'thisType': 'nsINode', 'canFail': False diff --git a/js/src/xpconnect/src/nsDispatchSupport.cpp b/js/src/xpconnect/src/nsDispatchSupport.cpp deleted file mode 100644 index 8374577cb15..00000000000 --- a/js/src/xpconnect/src/nsDispatchSupport.cpp +++ /dev/null @@ -1,349 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -/** - * \file nsDispatchSupport.cpp - * Contains the implementation for the nsDispatchSupport class - * this is an XPCOM service - */ - -#include "XPCPrivate.h" - -#include "nsIActiveXSecurityPolicy.h" - -static PRBool -ClassIsListed(HKEY hkeyRoot, const TCHAR *szKey, const CLSID &clsid, PRBool &listIsEmpty) -{ - // Test if the specified CLSID is found in the specified registry key - - listIsEmpty = PR_TRUE; - - CRegKey keyList; - if(keyList.Open(hkeyRoot, szKey, KEY_READ) != ERROR_SUCCESS) - { - // Class is not listed, because there is no key to read! - return PR_FALSE; - } - - // Enumerate CLSIDs looking for this one - int i = 0; - do { - USES_CONVERSION; - TCHAR szCLSID[64]; - DWORD kBufLength = sizeof(szCLSID) / sizeof(szCLSID[0]); - DWORD len = kBufLength; - memset(szCLSID, 0, sizeof(szCLSID)); - if(::RegEnumKeyEx(keyList, i, szCLSID, &len, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) - { - // End of list - break; - } - ++i; - listIsEmpty = PR_FALSE; - szCLSID[len - 1] = TCHAR('\0'); - CLSID clsidToCompare = GUID_NULL; - if(SUCCEEDED(::CLSIDFromString(T2OLE(szCLSID), &clsidToCompare)) && - ::IsEqualCLSID(clsid, clsidToCompare)) - { - // Class is listed - return PR_TRUE; - } - } while(1); - - // Class not found - return PR_FALSE; -} - -static PRBool -ClassExists(const CLSID &clsid) -{ - // Test if there is a CLSID entry. If there isn't then obviously - // the object doesn't exist. - CRegKey key; - if(key.Open(HKEY_CLASSES_ROOT, _T("CLSID"), KEY_READ) != ERROR_SUCCESS) - return PR_FALSE; // Must fail if we can't even open this! - - LPOLESTR szCLSID = NULL; - if(FAILED(StringFromCLSID(clsid, &szCLSID))) - return PR_FALSE; // Can't allocate string from CLSID - - USES_CONVERSION; - CRegKey keyCLSID; - LONG lResult = keyCLSID.Open(key, W2CT(szCLSID), KEY_READ); - CoTaskMemFree(szCLSID); - if(lResult != ERROR_SUCCESS) - return PR_FALSE; // Class doesn't exist - - return PR_TRUE; -} - -static PRBool -ClassImplementsCategory(const CLSID &clsid, const CATID &catid, PRBool &bClassExists) -{ - bClassExists = ClassExists(clsid); - // Non existent classes won't implement any category... - if(!bClassExists) - return PR_FALSE; - - // CLSID exists, so try checking what categories it implements - bClassExists = PR_TRUE; - CComPtr catInfo; - HRESULT hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, - CLSCTX_INPROC_SERVER, __uuidof(ICatInformation), (LPVOID*) &catInfo); - if(catInfo == NULL) - return PR_FALSE; // Must fail if we can't open the category manager - - // See what categories the class implements - CComPtr enumCATID; - if(FAILED(catInfo->EnumImplCategoriesOfClass(clsid, &enumCATID))) - return PR_FALSE; // Can't enumerate classes in category so fail - - // Search for matching categories - BOOL bFound = FALSE; - CATID catidNext = GUID_NULL; - while(enumCATID->Next(1, &catidNext, NULL) == S_OK) - { - if(::IsEqualCATID(catid, catidNext)) - return PR_TRUE; // Match - } - return PR_FALSE; -} - -nsDispatchSupport* nsDispatchSupport::mInstance = nsnull; - -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDispatchSupport, nsIDispatchSupport) - -nsDispatchSupport::nsDispatchSupport() -{ - /* member initializers and constructor code */ -} - -nsDispatchSupport::~nsDispatchSupport() -{ - /* destructor code */ -} - -/** - * Converts a COM variant to a jsval - * @param comvar the variant to convert - * @param val pointer to the jsval to receive the value - * @return nsresult - */ -NS_IMETHODIMP nsDispatchSupport::COMVariant2JSVal(VARIANT * comvar, jsval *val) -{ - XPCCallContext ccx(NATIVE_CALLER); - nsresult retval; - XPCDispConvert::COMToJS(ccx, *comvar, *val, retval); - return retval; -} - -/** - * Converts a jsval to a COM variant - * @param val the jsval to be converted - * @param comvar pointer to the variant to receive the value - * @return nsresult - */ -NS_IMETHODIMP nsDispatchSupport::JSVal2COMVariant(jsval val, VARIANT * comvar) -{ - XPCCallContext ccx(NATIVE_CALLER); - nsresult retval; - XPCDispConvert::JSToCOM(ccx, val, *comvar, retval); - return retval; -} - -/* boolean isClassSafeToHost (in nsCIDRef clsid, out boolean classExists); */ -NS_IMETHODIMP nsDispatchSupport::IsClassSafeToHost(JSContext * cx, - const nsCID & cid, - PRBool ignoreException, - PRBool *classExists, - PRBool *aResult) -{ - NS_ENSURE_ARG_POINTER(aResult); - NS_ENSURE_ARG_POINTER(classExists); - - *aResult = PR_FALSE; - - CLSID clsid = XPCDispnsCID2CLSID(cid); - - // Ask security manager if it's ok to create this object - XPCCallContext ccx(JS_CALLER, cx); - nsIXPCSecurityManager* sm = - ccx.GetXPCContext()->GetAppropriateSecurityManager( - nsIXPCSecurityManager::HOOK_CREATE_INSTANCE); - *aResult = !sm || - NS_SUCCEEDED(sm->CanCreateInstance(ccx, cid)); - - if(!*aResult) - { - if (ignoreException) - JS_ClearPendingException(ccx); - *classExists = PR_TRUE; - return NS_OK; - } - *classExists = ClassExists(clsid); - - // Test the Internet Explorer black list - const TCHAR kIEControlsBlacklist[] = _T("SOFTWARE\\Microsoft\\Internet Explorer\\ActiveX Compatibility"); - CRegKey keyExplorer; - if(keyExplorer.Open(HKEY_LOCAL_MACHINE, - kIEControlsBlacklist, KEY_READ) == ERROR_SUCCESS) - { - LPOLESTR szCLSID = NULL; - ::StringFromCLSID(clsid, &szCLSID); - if(szCLSID) - { - CRegKey keyCLSID; - USES_CONVERSION; - if(keyCLSID.Open(keyExplorer, W2T(szCLSID), KEY_READ) == ERROR_SUCCESS) - { - DWORD dwType = REG_DWORD; - DWORD dwFlags = 0; - DWORD dwBufSize = sizeof(dwFlags); - if(::RegQueryValueEx(keyCLSID, _T("Compatibility Flags"), - NULL, &dwType, (LPBYTE) &dwFlags, &dwBufSize) == ERROR_SUCCESS) - { - // Documented flags for this reg key - const DWORD kKillBit = 0x00000400; // MS Knowledge Base 240797 - if(dwFlags & kKillBit) - { - ::CoTaskMemFree(szCLSID); - *aResult = PR_FALSE; - return NS_OK; - } - } - } - ::CoTaskMemFree(szCLSID); - } - } - - *aResult = PR_TRUE; - return NS_OK; -} - -/* boolean isClassMarkedSafeForScripting (in nsCIDRef clsid, out boolean classExists); */ -NS_IMETHODIMP nsDispatchSupport::IsClassMarkedSafeForScripting(const nsCID & cid, PRBool *classExists, PRBool *aResult) -{ - NS_ENSURE_ARG_POINTER(aResult); - NS_ENSURE_ARG_POINTER(classExists); - // Test the category the object belongs to - CLSID clsid = XPCDispnsCID2CLSID(cid); - *aResult = ClassImplementsCategory(clsid, CATID_SafeForScripting, *classExists); - return NS_OK; -} - -/* boolean isObjectSafeForScripting (in voidPtr theObject, in nsIIDRef iid); */ -NS_IMETHODIMP nsDispatchSupport::IsObjectSafeForScripting(void * theObject, const nsIID & id, PRBool *aResult) -{ - NS_ENSURE_ARG_POINTER(theObject); - NS_ENSURE_ARG_POINTER(aResult); - - // Test if the object implements IObjectSafety and is marked safe for scripting - IUnknown *pObject = (IUnknown *) theObject; - IID iid = XPCDispIID2IID(id); - - // Ask the control if its safe for scripting - CComQIPtr objectSafety = pObject; - if(!objectSafety) - { - *aResult = PR_TRUE; - return NS_OK; - } - - DWORD dwSupported = 0; // Supported options (mask) - DWORD dwEnabled = 0; // Enabled options - - // Assume scripting via IDispatch - if(FAILED(objectSafety->GetInterfaceSafetyOptions( - iid, &dwSupported, &dwEnabled))) - { - // Interface is not safe or failure. - *aResult = PR_FALSE; - return NS_OK; - } - - // Test if safe for scripting - if(!(dwEnabled & dwSupported) & INTERFACESAFE_FOR_UNTRUSTED_CALLER) - { - // Object says it is not set to be safe, but supports unsafe calling, - // try enabling it and asking again. - - if(!(dwSupported & INTERFACESAFE_FOR_UNTRUSTED_CALLER) || - FAILED(objectSafety->SetInterfaceSafetyOptions( - iid, INTERFACESAFE_FOR_UNTRUSTED_CALLER, INTERFACESAFE_FOR_UNTRUSTED_CALLER)) || - FAILED(objectSafety->GetInterfaceSafetyOptions( - iid, &dwSupported, &dwEnabled)) || - !(dwEnabled & dwSupported) & INTERFACESAFE_FOR_UNTRUSTED_CALLER) - { - *aResult = PR_FALSE; - return NS_OK; - } - } - - *aResult = PR_TRUE; - return NS_OK; -} - -static const PRUint32 kDefaultHostingFlags = - nsIActiveXSecurityPolicy::HOSTING_FLAGS_HOST_NOTHING; - -/* unsigned long getHostingFlags (in string aContext); */ -NS_IMETHODIMP nsDispatchSupport::GetHostingFlags(const char *aContext, PRUint32 *aResult) -{ - NS_ENSURE_ARG_POINTER(aResult); - - // Ask the activex security policy what the hosting flags are - nsresult rv; - nsCOMPtr securityPolicy = - do_GetService(NS_IACTIVEXSECURITYPOLICY_CONTRACTID, &rv); - if(NS_SUCCEEDED(rv) && securityPolicy) - return securityPolicy->GetHostingFlags(aContext, aResult); - - // No policy so use the defaults - *aResult = kDefaultHostingFlags; - return NS_OK; -} - -nsDispatchSupport* nsDispatchSupport::GetSingleton() -{ - if(!mInstance) - { - mInstance = new nsDispatchSupport; - NS_IF_ADDREF(mInstance); - } - NS_IF_ADDREF(mInstance); - return mInstance; -} diff --git a/js/src/xpconnect/src/nsXPConnect.cpp b/js/src/xpconnect/src/nsXPConnect.cpp index 8d76ea09b18..359b00c7256 100644 --- a/js/src/xpconnect/src/nsXPConnect.cpp +++ b/js/src/xpconnect/src/nsXPConnect.cpp @@ -747,7 +747,7 @@ nsXPConnect::Traverse(void *p, nsCycleCollectionTraversalCallback &cb) } } - CCNodeType type; + PRBool isMarked; #ifdef DEBUG_CC // Note that the conditions under which we specify GCMarked vs. @@ -765,14 +765,13 @@ nsXPConnect::Traverse(void *p, nsCycleCollectionTraversalCallback &cb) // ExplainLiveExpectedGarbage codepath PLDHashEntryHdr* entry = PL_DHashTableOperate(&mJSRoots, p, PL_DHASH_LOOKUP); - type = markJSObject || PL_DHASH_ENTRY_IS_BUSY(entry) ? GCMarked : - GCUnmarked; + isMarked = markJSObject || PL_DHASH_ENTRY_IS_BUSY(entry); } else #endif { // Normal codepath (matches non-DEBUG_CC codepath). - type = !markJSObject && xpc_IsGrayGCThing(p) ? GCUnmarked : GCMarked; + isMarked = markJSObject || !xpc_IsGrayGCThing(p); } if (cb.WantDebugInfo()) { @@ -845,19 +844,19 @@ nsXPConnect::Traverse(void *p, nsCycleCollectionTraversalCallback &cb) char fullname[100]; JS_snprintf(fullname, sizeof(fullname), "%s (global=%p)", name, global); - cb.DescribeNode(type, 0, sizeof(JSObject), fullname); + cb.DescribeGCedNode(isMarked, sizeof(JSObject), fullname); } else { - cb.DescribeNode(type, 0, sizeof(JSObject), name); + cb.DescribeGCedNode(isMarked, sizeof(JSObject), name); } } else { - cb.DescribeNode(type, 0, sizeof(JSObject), "JS Object"); + cb.DescribeGCedNode(isMarked, sizeof(JSObject), "JS Object"); } // There's no need to trace objects that have already been marked by the JS // GC. Any JS objects hanging from them will already be marked. Only do this // if DEBUG_CC is not defined, else we do want to know about all JS objects // to get better graphs and explanations. - if(!cb.WantAllTraces() && type == GCMarked) + if(!cb.WantAllTraces() && isMarked) return NS_OK; TraversalTracer trc(cb); @@ -932,8 +931,7 @@ public: // edges will ensure that any cycles this context is in won't be // collected. unsigned refCount = nsXPConnect::GetXPConnect()->GetOutstandingRequests(cx) + 1; - - cb.DescribeNode(RefCounted, refCount, sizeof(JSContext), "JSContext"); + NS_IMPL_CYCLE_COLLECTION_DESCRIBE(JSContext, refCount) NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "[global object]"); if (cx->globalObject) { cb.NoteScriptChild(nsIProgrammingLanguage::JAVASCRIPT, diff --git a/js/src/xpconnect/src/xpc.msg b/js/src/xpconnect/src/xpc.msg index b60ec04b8a4..103c50a1e0f 100644 --- a/js/src/xpconnect/src/xpc.msg +++ b/js/src/xpconnect/src/xpc.msg @@ -162,14 +162,6 @@ XPC_MSG_DEF(NS_ERROR_OBJECT_IS_IMMUTABLE , "Can not modify immutable XPC_MSG_DEF(NS_ERROR_LOSS_OF_SIGNIFICANT_DATA , "Data conversion failed because significant data would be lost") XPC_MSG_DEF(NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA , "Data conversion succeeded but data was rounded to fit") -#ifdef XPC_IDISPATCH_SUPPORT -XPC_MSG_DEF(NS_ERROR_XPC_COM_UNKNOWN , "Unknown COM error occurred") -XPC_MSG_DEF(NS_ERROR_XPC_COM_ERROR , "COM Error") -XPC_MSG_DEF(NS_ERROR_XPC_COM_INVALID_CLASS_ID , "Invalid class ID") -XPC_MSG_DEF(NS_ERROR_XPC_COM_CREATE_FAILED , "Unable to create an instance of the desired COM class") -XPC_MSG_DEF(NS_ERROR_XPC_IDISPATCH_NOT_ENABLED , "IDispatch support is not enabled") -#endif - /* network related codes (from nsNetError.h) */ XPC_MSG_DEF(NS_BINDING_FAILED , "The async request failed for some unknown reason") diff --git a/js/src/xpconnect/src/xpccallcontext.cpp b/js/src/xpconnect/src/xpccallcontext.cpp index 91b692de458..182de8febb3 100644 --- a/js/src/xpconnect/src/xpccallcontext.cpp +++ b/js/src/xpconnect/src/xpccallcontext.cpp @@ -216,9 +216,6 @@ XPCCallContext::SetName(jsid name) mName = name; -#ifdef XPC_IDISPATCH_SUPPORT - mIDispatchMember = nsnull; -#endif if(mTearOff) { mSet = nsnull; @@ -274,9 +271,6 @@ XPCCallContext::SetCallInfo(XPCNativeInterface* iface, XPCNativeMember* member, if(mState < HAVE_NAME) mState = HAVE_NAME; -#ifdef XPC_IDISPATCH_SUPPORT - mIDispatchMember = nsnull; -#endif } void @@ -291,9 +285,6 @@ XPCCallContext::SetArgsAndResultPtr(uintN argc, mSet = nsnull; mInterface = nsnull; mMember = nsnull; -#ifdef XPC_IDISPATCH_SUPPORT - mIDispatchMember = nsnull; -#endif mStaticMemberIsLocal = JS_FALSE; } @@ -553,33 +544,6 @@ XPCCallContext::SetReturnValueWasSet(PRBool aReturnValueWasSet) return NS_OK; } -#ifdef XPC_IDISPATCH_SUPPORT - -void -XPCCallContext::SetIDispatchInfo(XPCNativeInterface* iface, - void * member) -{ - CHECK_STATE(HAVE_CONTEXT); - - // We are going straight to the method info and need not do a lookup - // by id. - - // don't be tricked if method is called with wrong 'this' - if(mTearOff && mTearOff->GetInterface() != iface) - mTearOff = nsnull; - - mSet = nsnull; - mInterface = iface; - mMember = nsnull; - mIDispatchMember = member; - mName = reinterpret_cast(member)->GetName(); - - if(mState < HAVE_NAME) - mState = HAVE_NAME; -} - -#endif - NS_IMETHODIMP XPCCallContext::GetPreviousCallContext(nsAXPCNativeCallContext **aResult) { diff --git a/js/src/xpconnect/src/xpcforwards.h b/js/src/xpconnect/src/xpcforwards.h index 490d1ceeaf5..08a1c5401ac 100644 --- a/js/src/xpconnect/src/xpcforwards.h +++ b/js/src/xpconnect/src/xpcforwards.h @@ -101,14 +101,4 @@ class AutoMarkingPtr; class xpcProperty; -#ifdef XPC_IDISPATCH_SUPPORT -class XPCDispInterface; -struct IDispatch; -class XPCDispParams; -class XPCDispJSPropertyInfo; -class nsIXPConnectWrappedJS; -class XPCIDispatchExtension; -#endif - - #endif /* xpcforwards_h___ */ diff --git a/js/src/xpconnect/src/xpcinlines.h b/js/src/xpconnect/src/xpcinlines.h index dc49d7b08e4..2f2b5a45890 100644 --- a/js/src/xpconnect/src/xpcinlines.h +++ b/js/src/xpconnect/src/xpcinlines.h @@ -271,11 +271,7 @@ XPCCallContext::GetMember() const inline JSBool XPCCallContext::HasInterfaceAndMember() const { - return mState >= HAVE_NAME && mInterface && (mMember -#ifdef XPC_IDISPATCH_SUPPORT - || mIDispatchMember -#endif - ); + return mState >= HAVE_NAME && mInterface && mMember; } inline jsid @@ -612,65 +608,19 @@ inline void XPCNativeSet::ASSERT_NotMarked() inline JSObject* XPCWrappedNativeTearOff::GetJSObject() const { -#ifdef XPC_IDISPATCH_SUPPORT - if(IsIDispatch()) - { - XPCDispInterface * iface = GetIDispatchInfo(); - return iface ? iface->GetJSObject() : nsnull; - } -#endif return mJSObject; } inline void XPCWrappedNativeTearOff::SetJSObject(JSObject* JSObj) { -#ifdef XPC_IDISPATCH_SUPPORT - if(IsIDispatch()) - { - XPCDispInterface* iface = GetIDispatchInfo(); - if(iface) - iface->SetJSObject(JSObj); - } - else -#endif mJSObject = JSObj; } -#ifdef XPC_IDISPATCH_SUPPORT -inline void -XPCWrappedNativeTearOff::SetIDispatch(JSContext* cx) -{ - mJSObject = (JSObject*)(((jsword) - ::XPCDispInterface::NewInstance(cx, - mNative)) | 2); -} - -inline XPCDispInterface* -XPCWrappedNativeTearOff::GetIDispatchInfo() const -{ - NS_ASSERTION((jsword)mJSObject & 2, "XPCWrappedNativeTearOff::GetIDispatchInfo " - "called on a non IDispatch interface"); - return reinterpret_cast - ((((jsword)mJSObject) & ~JSOBJECT_MASK)); -} - -inline JSBool -XPCWrappedNativeTearOff::IsIDispatch() const -{ - return (JSBool)(((jsword)mJSObject) & IDISPATCH_BIT); -} - -#endif - inline XPCWrappedNativeTearOff::~XPCWrappedNativeTearOff() { NS_ASSERTION(!(GetInterface()||GetNative()||GetJSObject()), "tearoff not empty in dtor"); -#ifdef XPC_IDISPATCH_SUPPORT - if(IsIDispatch()) - delete GetIDispatchInfo(); -#endif } /***************************************************************************/ diff --git a/js/src/xpconnect/src/xpcmodule.cpp b/js/src/xpconnect/src/xpcmodule.cpp index f2c192153f8..67e3a082d14 100644 --- a/js/src/xpconnect/src/xpcmodule.cpp +++ b/js/src/xpconnect/src/xpcmodule.cpp @@ -49,10 +49,6 @@ xpcModuleCtor() XPCWrappedNativeScope::InitStatics(); XPCPerThreadData::InitStatics(); -#ifdef XPC_IDISPATCH_SUPPORT - XPCIDispatchExtension::InitStatics(); -#endif - return NS_OK; } @@ -62,8 +58,4 @@ xpcModuleDtor() // Release our singletons nsXPConnect::ReleaseXPConnectSingleton(); xpc_DestroyJSxIDClassObjects(); -#ifdef XPC_IDISPATCH_SUPPORT - nsDispatchSupport::FreeSingleton(); - XPCIDispatchClassInfo::FreeSingleton(); -#endif } diff --git a/js/src/xpconnect/src/xpcmodule.h b/js/src/xpconnect/src/xpcmodule.h index 62d356e134d..6ecb73a860a 100644 --- a/js/src/xpconnect/src/xpcmodule.h +++ b/js/src/xpconnect/src/xpcmodule.h @@ -67,11 +67,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPCComponents_Interfaces) NS_GENERIC_FACTORY_CONSTRUCTOR(mozJSComponentLoader) NS_GENERIC_FACTORY_CONSTRUCTOR(mozJSSubScriptLoader) -#ifdef XPC_IDISPATCH_SUPPORT -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIDispatchSupport, - nsDispatchSupport::GetSingleton) -#endif // XPC_IDISPATCH_SUPPORT - NS_DEFINE_NAMED_CID(NS_JS_ID_CID); NS_DEFINE_NAMED_CID(NS_XPCONNECT_CID); NS_DEFINE_NAMED_CID(NS_XPCEXCEPTION_CID); @@ -80,16 +75,6 @@ NS_DEFINE_NAMED_CID(SCRIPTABLE_INTERFACES_CID); NS_DEFINE_NAMED_CID(NS_XPC_JSCONTEXT_STACK_ITERATOR_CID); NS_DEFINE_NAMED_CID(MOZJSCOMPONENTLOADER_CID); NS_DEFINE_NAMED_CID(MOZ_JSSUBSCRIPTLOADER_CID); -#ifdef XPC_IDISPATCH_SUPPORT -NS_DEFINE_NAMED_CID(NS_IDISPATCH_SUPPORT_CID); -#define XPCIDISPATCH_CIDS \ - { &kNS_IDISPATCH_SUPPORT_CID, false, NULL, nsIDispatchSupportConstructor }, -#define XPCIDISPATCH_CONTRACTS \ - { NS_IDISPATCH_SUPPORT_CONTRACTID, &kNS_IDISPATCH_SUPPORT_CID }, -#else -#define XPCIDISPATCH_CIDS -#define XPCIDISPATCH_CONTRACTS -#endif #define XPCONNECT_CIDENTRIES \ { &kNS_JS_ID_CID, false, NULL, nsJSIDConstructor }, \ @@ -99,8 +84,7 @@ NS_DEFINE_NAMED_CID(NS_IDISPATCH_SUPPORT_CID); { &kSCRIPTABLE_INTERFACES_CID, false, NULL, nsXPCComponents_InterfacesConstructor }, \ { &kNS_XPC_JSCONTEXT_STACK_ITERATOR_CID, false, NULL, nsXPCJSContextStackIteratorConstructor }, \ { &kMOZJSCOMPONENTLOADER_CID, false, NULL, mozJSComponentLoaderConstructor }, \ - { &kMOZ_JSSUBSCRIPTLOADER_CID, false, NULL, mozJSSubScriptLoaderConstructor }, \ - XPCIDISPATCH_CIDS + { &kMOZ_JSSUBSCRIPTLOADER_CID, false, NULL, mozJSSubScriptLoaderConstructor }, #define XPCONNECT_CONTRACTS \ { XPC_ID_CONTRACTID, &kNS_JS_ID_CID }, \ @@ -112,8 +96,7 @@ NS_DEFINE_NAMED_CID(NS_IDISPATCH_SUPPORT_CID); { NS_SCRIPTABLE_INTERFACES_CONTRACTID, &kSCRIPTABLE_INTERFACES_CID }, \ { XPC_JSCONTEXT_STACK_ITERATOR_CONTRACTID, &kNS_XPC_JSCONTEXT_STACK_ITERATOR_CID }, \ { MOZJSCOMPONENTLOADER_CONTRACTID, &kMOZJSCOMPONENTLOADER_CID }, \ - { MOZJSSUBSCRIPTLOADER_CONTRACTID, &kMOZ_JSSUBSCRIPTLOADER_CID }, \ - XPCIDISPATCH_CONTRACTS + { MOZJSSUBSCRIPTLOADER_CONTRACTID, &kMOZ_JSSUBSCRIPTLOADER_CID }, #define XPCONNECT_CATEGORIES \ { "module-loader", "js", MOZJSCOMPONENTLOADER_CONTRACTID }, diff --git a/js/src/xpconnect/src/xpcprivate.h b/js/src/xpconnect/src/xpcprivate.h index 9b7b324fa8a..6a97ef7fbc9 100644 --- a/js/src/xpconnect/src/xpcprivate.h +++ b/js/src/xpconnect/src/xpcprivate.h @@ -130,13 +130,6 @@ #include "nsIThreadInternal.h" -#ifdef XPC_IDISPATCH_SUPPORT -// This goop was added because of EXCEPINFO in ThrowCOMError -// This include is here, because it needs to occur before the undefines below -#include -#include "oaidl.h" -#endif - #ifdef XP_WIN // Nasty MS defines #ifdef GetClassInfo @@ -585,10 +578,6 @@ public: return gReportAllJSExceptions > 0; } -#ifdef XPC_IDISPATCH_SUPPORT -public: - static PRBool IsIDispatchEnabled(); -#endif protected: nsXPConnect(); @@ -1112,15 +1101,6 @@ public: XPCReadableJSStringWrapper *NewStringWrapper(const PRUnichar *str, PRUint32 len); void DeleteString(nsAString *string); -#ifdef XPC_IDISPATCH_SUPPORT - /** - * Sets the IDispatch information for the context - * This has to be void* because of icky Microsoft macros that - * would be introduced if we included the DispatchInterface header - */ - void SetIDispatchInfo(XPCNativeInterface* iface, void * member); - void* GetIDispatchMember() const { return mIDispatchMember; } -#endif private: // no copy ctor or assignment allowed @@ -1209,9 +1189,6 @@ private: jsval* mRetVal; JSBool mReturnValueWasSet; -#ifdef XPC_IDISPATCH_SUPPORT - void* mIDispatchMember; -#endif PRUint16 mMethodIndex; #define XPCCCX_STRING_CACHE_SIZE 2 @@ -2362,16 +2339,6 @@ public: void Unmark() {mJSObject = (JSObject*)(((jsword)mJSObject) & ~1);} JSBool IsMarked() const {return (JSBool)(((jsword)mJSObject) & 1);} -#ifdef XPC_IDISPATCH_SUPPORT - enum JSObject_flags - { - IDISPATCH_BIT = 2, - JSOBJECT_MASK = 3 - }; - void SetIDispatch(JSContext* cx); - JSBool IsIDispatch() const; - XPCDispInterface* GetIDispatchInfo() const; -#endif private: XPCWrappedNativeTearOff(const XPCWrappedNativeTearOff& r); // not implemented XPCWrappedNativeTearOff& operator= (const XPCWrappedNativeTearOff& r); // not implemented @@ -3363,11 +3330,6 @@ public: static void Throw(nsresult rv, XPCCallContext& ccx); static void ThrowBadResult(nsresult rv, nsresult result, XPCCallContext& ccx); static void ThrowBadParam(nsresult rv, uintN paramNum, XPCCallContext& ccx); -#ifdef XPC_IDISPATCH_SUPPORT - static void ThrowCOMError(JSContext* cx, unsigned long COMErrorCode, - nsresult rv = NS_ERROR_XPC_COM_ERROR, - const EXCEPINFO * exception = nsnull); -#endif static JSBool SetVerbosity(JSBool state) {JSBool old = sVerbose; sVerbose = state; return old;} @@ -4504,11 +4466,6 @@ ParticipatesInCycleCollection(JSContext *cx, js::gc::Cell *cell) } -#ifdef XPC_IDISPATCH_SUPPORT -// IDispatch specific classes -#include "XPCDispPrivate.h" -#endif - /***************************************************************************/ // Inlines use the above - include last. diff --git a/js/src/xpconnect/src/xpcthrower.cpp b/js/src/xpconnect/src/xpcthrower.cpp index 36f0e0f7634..d90151f9edc 100644 --- a/js/src/xpconnect/src/xpcthrower.cpp +++ b/js/src/xpconnect/src/xpcthrower.cpp @@ -179,26 +179,7 @@ XPCThrower::Verbosify(XPCCallContext& ccx, if(ccx.HasInterfaceAndMember()) { XPCNativeInterface* iface = ccx.GetInterface(); - jsid id = JSID_VOID; -#ifdef XPC_IDISPATCH_SUPPORT - NS_ASSERTION(ccx.GetIDispatchMember() == nsnull || - ccx.GetMember() == nsnull, - "Both IDispatch member and regular XPCOM member " - "were set in XPCCallContext"); - if(ccx.GetIDispatchMember()) - { - XPCDispInterface::Member * member = - reinterpret_cast(ccx.GetIDispatchMember()); - if(member && JSID_IS_STRING(member->GetName())) - { - id = member->GetName(); - } - } - else -#endif - { - id = ccx.GetMember()->GetName(); - } + jsid id = ccx.GetMember()->GetName(); JSAutoByteString bytes; const char *name = JSID_IS_VOID(id) ? "Unknown" : bytes.encode(ccx, JSID_TO_STRING(id)); if(!name) @@ -339,60 +320,3 @@ XPCThrower::ThrowExceptionObject(JSContext* cx, nsIException* e) } return success; } - -#ifdef XPC_IDISPATCH_SUPPORT -// static -void -XPCThrower::ThrowCOMError(JSContext* cx, unsigned long COMErrorCode, - nsresult rv, const EXCEPINFO * exception) -{ - nsCAutoString msg; - IErrorInfo * pError; - const char * format; - if(!nsXPCException::NameAndFormatForNSResult(rv, nsnull, &format)) - format = ""; - msg = format; - if(exception) - { - msg += static_cast - (_bstr_t(exception->bstrSource, false)); - msg += " : "; - msg.AppendInt(static_cast(COMErrorCode)); - msg += " - "; - msg += static_cast - (_bstr_t(exception->bstrDescription, false)); - } - else - { - // Get the current COM error object - unsigned long result = GetErrorInfo(0, &pError); - if(SUCCEEDED(result) && pError) - { - // Build an error message from the COM error object - BSTR bstrSource = NULL; - if(SUCCEEDED(pError->GetSource(&bstrSource)) && bstrSource) - { - _bstr_t src(bstrSource, false); - msg += static_cast(src); - msg += " : "; - } - msg.AppendInt(static_cast(COMErrorCode), 16); - BSTR bstrDesc = NULL; - if(SUCCEEDED(pError->GetDescription(&bstrDesc)) && bstrDesc) - { - msg += " - "; - _bstr_t desc(bstrDesc, false); - msg += static_cast(desc); - } - } - else - { - // No error object, so just report the result - msg += "COM Error Result = "; - msg.AppendInt(static_cast(COMErrorCode), 16); - } - } - XPCThrower::BuildAndThrowException(cx, rv, msg.get()); -} - -#endif diff --git a/js/src/xpconnect/src/xpcwrappedjs.cpp b/js/src/xpconnect/src/xpcwrappedjs.cpp index a86af154e27..c2e0e4776c4 100644 --- a/js/src/xpconnect/src/xpcwrappedjs.cpp +++ b/js/src/xpconnect/src/xpcwrappedjs.cpp @@ -67,10 +67,9 @@ NS_CYCLE_COLLECTION_CLASSNAME(nsXPCWrappedJS)::Traverse tmp->GetClass()->GetInterfaceName()); else JS_snprintf(name, sizeof(name), "nsXPCWrappedJS"); - cb.DescribeNode(RefCounted, refcnt, sizeof(nsXPCWrappedJS), name); + cb.DescribeRefCountedNode(refcnt, sizeof(nsXPCWrappedJS), name); } else { - cb.DescribeNode(RefCounted, refcnt, sizeof(nsXPCWrappedJS), - "nsXPCWrappedJS"); + NS_IMPL_CYCLE_COLLECTION_DESCRIBE(nsXPCWrappedJS, refcnt) } // nsXPCWrappedJS keeps its own refcount artificially at or above 1, see the diff --git a/js/src/xpconnect/src/xpcwrappedjsclass.cpp b/js/src/xpconnect/src/xpcwrappedjsclass.cpp index 24218d14a7f..12058a2948c 100644 --- a/js/src/xpconnect/src/xpcwrappedjsclass.cpp +++ b/js/src/xpconnect/src/xpcwrappedjsclass.cpp @@ -166,8 +166,9 @@ nsXPCWrappedJSClass::GetNewOrUsed(XPCCallContext& ccx, REFNSIID aIID, ccx.GetXPConnect()->GetInfoForIID(&aIID, getter_AddRefs(info)); if(info) { - PRBool canScript; + PRBool canScript, isBuiltin; if(NS_SUCCEEDED(info->IsScriptable(&canScript)) && canScript && + NS_SUCCEEDED(info->IsBuiltinClass(&isBuiltin)) && !isBuiltin && nsXPConnect::IsISupportsDescendant(info)) { clazz = new nsXPCWrappedJSClass(ccx, aIID, info); @@ -295,8 +296,9 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(XPCCallContext& ccx, ccx.GetXPConnect()->GetInfoForIID(&aIID, getter_AddRefs(info)); if(!info) return nsnull; - PRBool canScript; - if(NS_FAILED(info->IsScriptable(&canScript)) || !canScript) + PRBool canScript, isBuiltin; + if(NS_FAILED(info->IsScriptable(&canScript)) || !canScript || + NS_FAILED(info->IsBuiltinClass(&isBuiltin)) || isBuiltin) return nsnull; } @@ -661,13 +663,6 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self, return NS_OK; } -#ifdef XPC_IDISPATCH_SUPPORT - // If IDispatch is enabled and we're QI'ing to IDispatch - if(nsXPConnect::IsIDispatchEnabled() && aIID.Equals(NSID_IDISPATCH)) - { - return XPCIDispatchExtension::IDispatchQIWrappedJS(self, aInstancePtr); - } -#endif if(aIID.Equals(NS_GET_IID(nsIPropertyBag))) { // We only want to expose one implementation from our aggregate. diff --git a/js/src/xpconnect/src/xpcwrappednative.cpp b/js/src/xpconnect/src/xpcwrappednative.cpp index b74b941fba5..c19a84613a1 100644 --- a/js/src/xpconnect/src/xpcwrappednative.cpp +++ b/js/src/xpconnect/src/xpcwrappednative.cpp @@ -115,11 +115,10 @@ NS_CYCLE_COLLECTION_CLASSNAME(XPCWrappedNative)::Traverse(void *p, else JS_snprintf(name, sizeof(name), "XPCWrappedNative"); - cb.DescribeNode(RefCounted, tmp->mRefCnt.get(), - sizeof(XPCWrappedNative), name); + cb.DescribeRefCountedNode(tmp->mRefCnt.get(), + sizeof(XPCWrappedNative), name); } else { - cb.DescribeNode(RefCounted, tmp->mRefCnt.get(), - sizeof(XPCWrappedNative), "XPCWrappedNative"); + NS_IMPL_CYCLE_COLLECTION_DESCRIBE(XPCWrappedNative, tmp->mRefCnt.get()) } if(tmp->mRefCnt.get() > 1) { @@ -356,20 +355,7 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx, NS_ASSERTION(!Scope->GetRuntime()->GetThreadRunningGC(), "XPCWrappedNative::GetNewOrUsed called during GC"); - nsISupports *identity; -#ifdef XPC_IDISPATCH_SUPPORT - // XXX This is done for the benefit of some warped COM implementations - // where QI(IID_IUnknown, a.b) == QI(IID_IUnknown, a). If someone passes - // in a pointer that hasn't been QI'd to IDispatch properly this could - // create multiple wrappers for the same object, creating a fair bit of - // confusion. - PRBool isIDispatch = Interface && - Interface->GetIID()->Equals(NSID_IDISPATCH); - if(isIDispatch) - identity = helper.Object(); - else -#endif - identity = helper.GetCanonical(); + nsISupports *identity = helper.GetCanonical(); if(!identity) { @@ -435,18 +421,6 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx, nsIClassInfo *info = helper.GetClassInfo(); -#ifdef XPC_IDISPATCH_SUPPORT - // If this is an IDispatch wrapper and it didn't give us a class info - // we'll provide a default one - nsCOMPtr dispatchInfo; - if(isIDispatch && !info) - { - dispatchInfo = dont_AddRef(static_cast - (XPCIDispatchClassInfo::GetSingleton())); - info = dispatchInfo; - } -#endif - XPCNativeScriptableCreateInfo sciProto; XPCNativeScriptableCreateInfo sci; @@ -845,14 +819,7 @@ XPCWrappedNative::GetUsedOnly(XPCCallContext& ccx, } else { - nsCOMPtr identity; -#ifdef XPC_IDISPATCH_SUPPORT - // XXX See GetNewOrUsed for more info on this - if(Interface->GetIID()->Equals(NSID_IDISPATCH)) - identity = Object; - else -#endif - identity = do_QueryInterface(Object); + nsCOMPtr identity = do_QueryInterface(Object); if(!identity) { @@ -1466,10 +1433,6 @@ XPCWrappedNative::SystemIsBeingShutDown(JSContext* cx) if(to->GetJSObject()) { JS_SetPrivate(cx, to->GetJSObject(), nsnull); -#ifdef XPC_IDISPATCH_SUPPORT - if(to->IsIDispatch()) - delete to->GetIDispatchInfo(); -#endif to->SetJSObject(nsnull); } // We leak the tearoff mNative @@ -2174,13 +2137,6 @@ XPCWrappedNative::InitTearOff(XPCCallContext& ccx, aTearOff->SetInterface(aInterface); aTearOff->SetNative(obj); -#ifdef XPC_IDISPATCH_SUPPORT - // Are we building a tearoff for IDispatch? - if(iid->Equals(NSID_IDISPATCH)) - { - aTearOff->SetIDispatch(ccx); - } -#endif if(needJSObject && !InitTearOffJSObject(ccx, aTearOff)) return NS_ERROR_OUT_OF_MEMORY; diff --git a/js/src/xpconnect/src/xpcwrappednativejsops.cpp b/js/src/xpconnect/src/xpcwrappednativejsops.cpp index b99564324ff..09052869e3d 100644 --- a/js/src/xpconnect/src/xpcwrappednativejsops.cpp +++ b/js/src/xpconnect/src/xpcwrappednativejsops.cpp @@ -406,14 +406,6 @@ DefinePropertyIfFound(XPCCallContext& ccx, nsnull, propFlags); } -#ifdef XPC_IDISPATCH_SUPPORT - // Check to see if there's an IDispatch tearoff - if(wrapperToReflectInterfaceNames && - XPCIDispatchExtension::DefineProperty(ccx, obj, - id, wrapperToReflectInterfaceNames, propFlags, resolved)) - return JS_TRUE; -#endif - if(resolved) *resolved = JS_FALSE; return JS_TRUE; @@ -634,13 +626,6 @@ XPC_WN_Shared_Enumerate(JSContext *cx, JSObject *obj) for(PRUint16 i = 0; i < interface_count; i++) { XPCNativeInterface* iface = interfaceArray[i]; -#ifdef XPC_IDISPATCH_SUPPORT - if(iface->GetIID()->Equals(NSID_IDISPATCH)) - { - XPCIDispatchExtension::Enumerate(ccx, obj, wrapper); - continue; - } -#endif PRUint16 member_count = iface->GetMemberCount(); for(PRUint16 k = 0; k < member_count; k++) { diff --git a/js/src/xpconnect/tests/idispatch/COM/StdAfx.cpp b/js/src/xpconnect/tests/idispatch/COM/StdAfx.cpp deleted file mode 100644 index a5eea178f78..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/StdAfx.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// stdafx.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -#ifdef _ATL_STATIC_REGISTRY -#include -#include -#endif - -#include diff --git a/js/src/xpconnect/tests/idispatch/COM/StdAfx.h b/js/src/xpconnect/tests/idispatch/COM/StdAfx.h deleted file mode 100644 index 5b2adc54322..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/StdAfx.h +++ /dev/null @@ -1,28 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__3B3A8A37_A147_4D96_BFA3_51B0F69B5D8D__INCLUDED_) -#define AFX_STDAFX_H__3B3A8A37_A147_4D96_BFA3_51B0F69B5D8D__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define STRICT -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0400 -#endif -#define _ATL_APARTMENT_THREADED - -#include -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#include -#include - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__3B3A8A37_A147_4D96_BFA3_51B0F69B5D8D__INCLUDED) diff --git a/js/src/xpconnect/tests/idispatch/COM/XPCDispUtilities.h b/js/src/xpconnect/tests/idispatch/COM/XPCDispUtilities.h deleted file mode 100644 index 552bec03d20..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/XPCDispUtilities.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef XPCDispUtilities_h -#define XPCDispUtilities_h - -template -inline -HRESULT XPCCreateInstance(const CLSID & clsid, const IID & iid, T ** result) -{ - return CoCreateInstance(clsid, 0, CLSCTX_ALL, iid, reinterpret_cast(result)); -} - -DISPID GetIDsOfNames(IDispatch * pIDispatch , CComBSTR const & name) -{ - DISPID dispid; - OLECHAR * pName = name; - HRESULT hresult = pIDispatch->GetIDsOfNames( - IID_NULL, - &pName, - 1, - LOCALE_SYSTEM_DEFAULT, - &dispid); - if (!SUCCEEDED(hresult)) - { - dispid = 0; - } - return dispid; -} - -#endif \ No newline at end of file diff --git a/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.cpp b/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.cpp deleted file mode 100644 index 9835a7672df..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// XPCIDispatchTest.cpp : Implementation of DLL Exports. - - -// Note: Proxy/Stub Information -// To build a separate proxy/stub DLL, -// run nmake -f IDispatchTestps.mk in the project directory. - -#include "stdafx.h" -#include "resource.h" -#include -#include "XPCIDispatchTest.h" - -#include "XPCIDispatchTest_i.c" -#include "nsXPCDispTestMethods.h" -#include "nsXPCDispSimple.h" -#include "nsXPCDispTestNoIDispatch.h" -#include "nsXPCDispTestProperties.h" -#include "nsXPCDispTestArrays.h" -#include "nsXPCDispTestScriptOn.h" -#include "nsXPCDispTestScriptOff.h" -#include "nsXPCDispTestWrappedJS.h" - -CComModule _Module; - -BEGIN_OBJECT_MAP(ObjectMap) -OBJECT_ENTRY(CLSID_nsXPCDispTestMethods, nsXPCDispTestMethods) -OBJECT_ENTRY(CLSID_nsXPCDispSimple, nsXPCDispSimple) -OBJECT_ENTRY(CLSID_nsXPCDispTestNoIDispatch, nsXPCDispTestNoIDispatch) -OBJECT_ENTRY(CLSID_nsXPCDispTestProperties, nsXPCDispTestProperties) -OBJECT_ENTRY(CLSID_nsXPCDispTestArrays, nsXPCDispTestArrays) -OBJECT_ENTRY(CLSID_nsXPCDispTestScriptOn, nsXPCDispTestScriptOn) -OBJECT_ENTRY(CLSID_nsXPCDispTestScriptOff, nsXPCDispTestScriptOff) -OBJECT_ENTRY(CLSID_nsXPCDispTestWrappedJS, nsXPCDispTestWrappedJS) -END_OBJECT_MAP() - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - _Module.Init(ObjectMap, hInstance, &LIBID_IDispatchTestLib); - DisableThreadLibraryCalls(hInstance); - } - else if (dwReason == DLL_PROCESS_DETACH) - _Module.Term(); - return TRUE; // ok -} - -///////////////////////////////////////////////////////////////////////////// -// Used to determine whether the DLL can be unloaded by OLE - -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ - return _Module.GetClassObject(rclsid, riid, ppv); -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -STDAPI DllRegisterServer(void) -{ - // registers object, typelib and all interfaces in typelib - return _Module.RegisterServer(TRUE); -} - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry - -STDAPI DllUnregisterServer(void) -{ - return _Module.UnregisterServer(TRUE); -} - - -#include "nsXPCDispTestWrappedJS.h" diff --git a/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.def b/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.def deleted file mode 100644 index 4fa5e1f09ad..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.def +++ /dev/null @@ -1,9 +0,0 @@ -; XPCIDispatchTest.def : Declares the module parameters. - -LIBRARY "XPCIDispatchTest.DLL" - -EXPORTS - DllCanUnloadNow @1 PRIVATE - DllGetClassObject @2 PRIVATE - DllRegisterServer @3 PRIVATE - DllUnregisterServer @4 PRIVATE diff --git a/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.dsp b/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.dsp deleted file mode 100644 index d8e4abc1367..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.dsp +++ /dev/null @@ -1,318 +0,0 @@ -# Microsoft Developer Studio Project File - Name="XPCIDispatchTest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=XPCIDispatchTest - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "XPCIDispatchTest.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "XPCIDispatchTest.mak" CFG="XPCIDispatchTest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "XPCIDispatchTest - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "XPCIDispatchTest - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "XPCIDispatchTest - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W4 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# Begin Custom Build - Performing registration -OutDir=.\Debug -TargetPath=.\Debug\XPCIDispatchTest.dll -InputPath=.\Debug\XPCIDispatchTest.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "XPCIDispatchTest - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "XPCIDispatchTest___Win32_Release" -# PROP BASE Intermediate_Dir "XPCIDispatchTest___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\Release -TargetPath=.\Release\XPCIDispatchTest.dll -InputPath=.\Release\XPCIDispatchTest.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ENDIF - -# Begin Target - -# Name "XPCIDispatchTest - Win32 Debug" -# Name "XPCIDispatchTest - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\nsXPCDispSimple.cpp -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestArrays.cpp -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestMethods.cpp -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestNoIDispatch.cpp -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestProperties.cpp -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestScriptOff.cpp -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestScriptOn.cpp -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestWrappedJS.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# Begin Source File - -SOURCE=.\XPCIDispatchTest.cpp -# End Source File -# Begin Source File - -SOURCE=.\XPCIDispatchTest.def -# End Source File -# Begin Source File - -SOURCE=.\XPCIDispatchTest.idl -# ADD MTL /tlb ".\XPCIDispatchTest.tlb" /h "XPCIDispatchTest.h" /iid "XPCIDispatchTest_i.c" /Oicf -# End Source File -# Begin Source File - -SOURCE=.\XPCIDispatchTest.rc -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\nsXPCDispSimple.h -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestArrays.h -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestMethods.h -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestNoIDispatch.h -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestProperties.h -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestScriptOff.h -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestScriptOn.h -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestWrappedJS.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\XPCDispUtilities.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\nsXPCDispSimple.rgs -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestArrays.rgs -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestMethods.rgs -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestNoIDispatch.rgs -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestNoScript.rgs -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestProperties.rgs -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestScriptOff.rgs -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestScriptOn.rgs -# End Source File -# Begin Source File - -SOURCE=.\nsXPCDispTestWrappedJS.rgs -# End Source File -# End Group -# Begin Group "JS Files" - -# PROP Default_Filter "js" -# Begin Group "WrappedCOM" - -# PROP Default_Filter "" -# Begin Group "Arrays" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Tests\WrappedCOM\Arrays\XPCIDispatchArrayTests.js -# End Source File -# End Group -# Begin Group "Attributes" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Tests\WrappedCOM\Attributes\XPCIDispatchAttributeTests.js -# End Source File -# End Group -# Begin Group "General" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Tests\WrappedCOM\General\XPCIDispatchInstantiations.js -# End Source File -# Begin Source File - -SOURCE=..\Tests\WrappedCOM\General\XPCStress.js -# End Source File -# End Group -# Begin Group "Methods" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Tests\WrappedCOM\Methods\XPCIDispatchMethodTests.js -# End Source File -# End Group -# Begin Source File - -SOURCE=..\Tests\WrappedCOM\shell.js -# End Source File -# End Group -# Begin Group "WrappedJS" - -# PROP Default_Filter "" -# Begin Group "General (WJS)" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Tests\WrappedJS\General\XPCIDispatchTestWrappedJS.js -# End Source File -# End Group -# Begin Source File - -SOURCE=..\Tests\WrappedJS\shell.js -# End Source File -# End Group -# End Group -# End Target -# End Project diff --git a/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.dsw b/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.dsw deleted file mode 100644 index 4ef0b8c6351..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "XPCIDispatchTest"=.\XPCIDispatchTest.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.idl b/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.idl deleted file mode 100644 index 7c16746f03a..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.idl +++ /dev/null @@ -1,454 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -// XPCIDispatchTest.idl : IDL source for XPCIDispatchTest.dll -// - -// This file will be processed by the MIDL tool to -// produce the type library (XPCIDispatchTest.tlb) and marshalling code. - -import "oaidl.idl"; -import "ocidl.idl"; -import "objsafe.idl"; - -[ - uuid(83A51226-F49D-488A-8F78-75BB2F927F4C), - version(1.0), - helpstring("XPCIDispatchTest 1.0 Type Library") -] -library IDispatchTestLib -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - - [ - object, - uuid(0de5dbae-1d78-45cb-91a2-24516fef2837), - dual, - helpstring("nsIXPCDispSimple interface"), - pointer_default(unique) - ] - interface nsIXPCDispSimple : IDispatch - { - [id(1), helpstring("Simple method returning the name of the class")] - HRESULT ClassName([out]BSTR * name); - [propget, id(2), helpstring("Simple number property")] - HRESULT Number([out, retval]long * result); - [propput, id(2), helpstring("Simple number property")] - HRESULT Number([in]long result); - } - [ - uuid(9F39237C-D179-4260-8EF3-4B6D4D7D5570), - helpstring("nsXPCDispSimple Class") - ] - coclass nsXPCDispSimple - { - [default] interface nsIXPCDispSimple; - }; - [ - object, - uuid(47bf6c99-a30c-4105-8af6-de76dcfdd6dd), - dual, - helpstring("nsIXPCDispTestMethods interface"), - pointer_default(unique) - ] - interface nsIXPCDispTestMethods : IDispatch - { - /* Return values test */ - [id(1), helpstring("method with no parameters")] - HRESULT NoParameters(); - [id(2), helpstring("method that returns a string")] - HRESULT ReturnBSTR([out, retval]BSTR * result); - [id(3), helpstring("method that returns a 32 bit signed integer")] - HRESULT ReturnI4([out, retval]int * result); - [id(4), helpstring("method that returns an 8 bit unsigned integer")] - HRESULT ReturnUI1([out, retval]unsigned char * result); - [id(5), helpstring("method that returns a 16 bit signed integer")] - HRESULT ReturnI2([out, retval]short * result); - [id(6), helpstring("method that returns a 32 bit floating point number")] - HRESULT ReturnR4([out, retval]float * result); - [id(7), helpstring("method that returns a 64 bit floating point number")] - HRESULT ReturnR8([out, retval]double * result); - [id(8), helpstring("method that returns a boolean")] - HRESULT ReturnBool([out, retval]VARIANT_BOOL * result); - [id(9), helpstring("method that returns an IDispatch pointer")] - HRESULT ReturnIDispatch([out, retval]IDispatch ** result); - [id(10), helpstring("method that returns an error")] - HRESULT ReturnError([out, retval]SCODE * result); - [id(12), helpstring("method that returns a date")] - HRESULT ReturnDate([out, retval]DATE * result); - [id(13), helpstring("method that returns an IUnknown")] - HRESULT ReturnIUnknown([out, retval]IUnknown ** result); - [id(14), helpstring("method that returns a signed 8 bit integer")] - HRESULT ReturnI1([out, retval]char * result); - [id(15), helpstring("method that returns an unsigned 16 bit integer")] - HRESULT ReturnUI2([out, retval]unsigned short * result); - [id(16), helpstring("method that returns an unsigned 32 bit integer")] - HRESULT ReturnUI4([out, retval]unsigned long * result); - [id(17), helpstring("method that returns an integer")] - HRESULT ReturnInt([out, retval]int * result); - [id(18), helpstring("method that returns an unsigned integer")] - HRESULT ReturnUInt([out, retval]unsigned int * result); - - /* Single input parameter tests */ - [id(19), helpstring("method that takes a string")] - HRESULT TakesBSTR([in]BSTR result); - [id(20), helpstring("method that takes a 32 bit signed integer")] - HRESULT TakesI4([in]int result); - [id(21), helpstring("method that takes an 8 bit unsigned integer")] - HRESULT TakesUI1([in]unsigned char result); - [id(22), helpstring("method that takes a 16 bit signed integer")] - HRESULT TakesI2([in]short result); - [id(23), helpstring("method that takes a 32 bit floating point number")] - HRESULT TakesR4([in]float result); - [id(24), helpstring("method that takes a 64 bit floating point number")] - HRESULT TakesR8([in]double result); - [id(25), helpstring("method that takes a boolean")] - HRESULT TakesBool([in]VARIANT_BOOL result); - [id(26), helpstring("method that takes an IDispatch pointer")] - HRESULT TakesIDispatch([in]IDispatch * result); - [id(27), helpstring("method that takes an error")] - HRESULT TakesError([in]SCODE result); - [id(29), helpstring("method that takes a date")] - HRESULT TakesDate([in]DATE result); - [id(30), helpstring("method that takes an IUnknown")] - HRESULT TakesIUnknown([in]IUnknown * result); - [id(31), helpstring("method that takes a signed 8 bit integer")] - HRESULT TakesI1([in]char result); - [id(32), helpstring("method that takes an unsigned 16 bit integer")] - HRESULT TakesUI2([in]unsigned short result); - [id(33), helpstring("method that takes an unsigned 32 bit integer")] - HRESULT TakesUI4([in]unsigned long result); - [id(34), helpstring("method that takes an integer")] - HRESULT TakesInt([in]int result); - [id(35), helpstring("method that takes an unsigned integer")] - HRESULT TakesUInt([in]unsigned int result); - - /* output parameter tests */ - [id(36), helpstring("method that outputs a string")] - HRESULT OutputsBSTR([out]BSTR * result); - [id(37), helpstring("method that outputs a 32 bit signed integer")] - HRESULT OutputsI4([out]long * result); - [id(38), helpstring("method that outputs an 8 bit unsigned integer")] - HRESULT OutputsUI1([out]unsigned char * result); - [id(39), helpstring("method that outputs a 16 bit signed integer")] - HRESULT OutputsI2([out]short * result); - [id(40), helpstring("method that outputs a 32 bit floating point number")] - HRESULT OutputsR4([out]float * result); - [id(41), helpstring("method that outputs a 64 bit floating point number")] - HRESULT OutputsR8([out]double * result); - [id(42), helpstring("method that outputs a boolean")] - HRESULT OutputsBool([out]VARIANT_BOOL * result); - [id(43), helpstring("method that outputs an IDispatch pointer")] - HRESULT OutputsIDispatch([out]IDispatch ** result); - [id(44), helpstring("method that outputs an error")] - HRESULT OutputsError([out]SCODE * result); - [id(46), helpstring("method that outputs a date")] - HRESULT OutputsDate([out]DATE * result); - [id(47), helpstring("method that outputs an IUnknown")] - HRESULT OutputsIUnknown([out]IUnknown ** result); - [id(48), helpstring("method that outputs a signed 8 bit integer")] - HRESULT OutputsI1([out]char * result); - [id(49), helpstring("method that outputs an unsigned 16 bit integer")] - HRESULT OutputsUI2([out]unsigned short * result); - [id(50), helpstring("method that outputs an unsigned 32 bit integer")] - HRESULT OutputsUI4([out]unsigned long * result); - - /* in/outparameter tests */ - [id(53), helpstring("method that in/outs a string")] - HRESULT InOutsBSTR([in, out]BSTR * result); - [id(54), helpstring("method that in/outs a 32 bit signed integer")] - HRESULT InOutsI4([in, out]long * result); - [id(55), helpstring("method that in/outs an 8 bit unsigned integer")] - HRESULT InOutsUI1([in, out]unsigned char * result); - [id(56), helpstring("method that in/outs a 16 bit signed integer")] - HRESULT InOutsI2([in, out]short * result); - [id(57), helpstring("method that in/outs a 32 bit floating point number")] - HRESULT InOutsR4([in, out]float * result); - [id(58), helpstring("method that in/outs a 64 bit floating point number")] - HRESULT InOutsR8([in, out]double * result); - [id(59), helpstring("method that in/outs a boolean")] - HRESULT InOutsBool([in, out]VARIANT_BOOL * result); - [id(60), helpstring("method that in/outs an IDispatch pointer")] - HRESULT InOutsIDispatch([in, out]IDispatch ** result); - [id(61), helpstring("method that in/outs an error")] - HRESULT InOutsError([in, out]SCODE * result); - [id(63), helpstring("method that in/outs a date")] - HRESULT InOutsDate([in, out]DATE * result); - [id(64), helpstring("method that in/outs an IUnknown")] - HRESULT InOutsIUnknown([in, out]IUnknown ** result); - [id(65), helpstring("method that in/outs a signed 8 bit integer")] - HRESULT InOutsI1([in, out]char * result); - [id(66), helpstring("method that in/outs an unsigned 16 bit integer")] - HRESULT InOutsUI2([in, out]unsigned short * result); - [id(67), helpstring("method that in/outs an unsigned 32 bit integer")] - HRESULT InOutsUI4([in, out]unsigned long * result); - - /* input and return tests*/ - [id(70), helpstring("method that takes an long and returns it")] - HRESULT OneParameterWithReturn([in]long input, [out,retval]long* result); - [id(71), helpstring("method that takes a string and returns it")] - HRESULT StringInputAndReturn([in]BSTR str, [out, retval]BSTR* result); - [id(72), helpstring("method that takes an IDispatch and returns it")] - HRESULT IDispatchInputAndReturn([in]IDispatch* input, [out,retval]IDispatch** result); - - /* Multiple parameters */ - [id(73), helpstring("method that takes two parameters")] - HRESULT TwoParameters([in]long one, [in]long two); - [id(74), helpstring("method that takes 12 input parameters")] - HRESULT TwelveInParameters([in]long one, [in]long two, [in]long three, - [in]long four, [in]long five, [in]long six, - [in]long seven, [in]long eight, - [in]long nine, [in]long ten, - [in]long eleven, [in]long twelve); - [id(75), helpstring("method that takes 12 out parameters")] - HRESULT TwelveOutParameters([out]long *one, [out]long *two, - [out]long *three, [out]long *four, - [out]long *five, [out]long *six, - [out]long *seven, [out]long *eight, - [out]long *nine, [out]long *ten, - [out]long *eleven, [out]long *twelve); - [id(76), helpstring("method that takes 12 input string parameters")] - HRESULT TwelveStrings([in]BSTR one, [in]BSTR two, [in]BSTR three, - [in]BSTR four, [in]BSTR five, [in]BSTR six, - [in]BSTR seven, [in]BSTR eight, [in]BSTR nine, - [in]BSTR ten, [in]BSTR eleven, [in]BSTR twelve); - [id(77), helpstring("method that takes 12 input string parameters")] - HRESULT TwelveOutStrings([out]BSTR* one, [out]BSTR* two, - [out]BSTR* three, [out]BSTR* four, - [out]BSTR* five, [out]BSTR* six, - [out]BSTR* seven, [out]BSTR* eight, - [out]BSTR* nine, [out]BSTR* ten, - [out]BSTR* eleven, [out]BSTR* twelve); - [id(78), helpstring("method that takes 12 input string parameters")] - HRESULT TwelveIDispatch([in]IDispatch* one, [in]IDispatch* two, - [in]IDispatch* three, [in]IDispatch* four, - [in]IDispatch* five, [in]IDispatch* six, - [in]IDispatch* seven, [in]IDispatch* eight, - [in]IDispatch* nine, [in]IDispatch* ten, - [in]IDispatch* eleven, - [in]IDispatch* twelve); - [id(79), helpstring("method that takes 12 input string parameters")] - HRESULT TwelveOutIDispatch([out]IDispatch** one, - [out]IDispatch** two, - [out]IDispatch** three, - [out]IDispatch** four, - [out]IDispatch** five, - [out]IDispatch** six, - [out]IDispatch** seven, - [out]IDispatch** eight, - [out]IDispatch** nine, - [out]IDispatch** ten, - [out]IDispatch** eleven, - [out]IDispatch** twelve); - [id(80), helpstring("method that generates an error")] - HRESULT CreateError(); - } - [ - uuid(745D1149-9F46-418C-B176-71EAA98974BA), - helpstring("nsXPCDispTestMethods Class") - ] - coclass nsXPCDispTestMethods - { - [default] interface nsIXPCDispTestMethods; - }; - [ - object, - uuid(f876c083-ae00-4b78-93b8-8305980f0864), - dual, - helpstring("nsIXPCDispTestArrays interface"), - pointer_default(unique) - ] - interface nsIXPCDispTestArrays : IDispatch - { - [id(1), helpstring("returns a SAFEARRAY")] - HRESULT ReturnSafeArray([out, retval]SAFEARRAY(VARIANT)* result); - [id(2), helpstring("returns a SAFEARRAY")] - HRESULT ReturnSafeArrayBSTR([out, retval]SAFEARRAY(VARIANT)* result); - [id(3), helpstring("returns a SAFEARRAY")] - HRESULT ReturnSafeArrayIDispatch([out, retval]SAFEARRAY(VARIANT)* result); - [id(4), helpstring("method that takes a SAFEARRAY")] - HRESULT TakesSafeArray([in]SAFEARRAY(VARIANT) array); - [id(5), helpstring("method that takes a SAFEARRAY")] - HRESULT TakesSafeArrayBSTR([in]SAFEARRAY(VARIANT) array); - [id(6), helpstring("method that takes a SAFEARRAY")] - HRESULT TakesSafeArrayIDispatch([in]SAFEARRAY(VARIANT) array); - [id(7), helpstring("method that takes a SAFEARRAY")] - HRESULT InOutSafeArray([in, out]SAFEARRAY(VARIANT) * array); - [id(8), helpstring("method that takes a SAFEARRAY")] - HRESULT InOutSafeArrayBSTR([in, out]SAFEARRAY(VARIANT) * array); - [id(9), helpstring("method that takes a SAFEARRAY")] - HRESULT InOutSafeArrayIDispatch([in, out]SAFEARRAY(VARIANT) * array); - } - [ - uuid(AB085C43-C619-48C8-B68C-C495BDE12DFB), - helpstring("nsXPCDispTestArrays Class") - ] - coclass nsXPCDispTestArrays - { - [default] interface nsIXPCDispTestArrays; - }; - [ - object, - uuid(9782107f-14cc-40b2-b0cd-988d81a46e9e), - dual, - helpstring("nsIXPCDispTestNoIDispatch interface"), - pointer_default(unique) - ] - interface nsIXPCDispTestNoIDispatch : IUnknown - { - } - [ - uuid(7414404F-A4CC-4E3C-9B32-BB20CB22F541), - helpstring("nsXPCDispTestNoIDispatch Class") - ] - coclass nsXPCDispTestNoIDispatch - { - [default] interface nsIXPCDispTestNoIDispatch; - }; - [ - object, - uuid(7830CACE-5019-489D-8B69-029E70CF39B7), - dual, - helpstring("nsIXPCDispTestProperties Interface"), - pointer_default(unique) - ] - interface nsIXPCDispTestProperties : IDispatch - { - [propget, id(1), helpstring("property Short")] HRESULT Short([out, retval] short *pVal); - [propput, id(1), helpstring("property Short")] HRESULT Short([in] short newVal); - [propget, id(2), helpstring("property Long")] HRESULT Long([out, retval] long *pVal); - [propput, id(2), helpstring("property Long")] HRESULT Long([in] long newVal); - [propget, id(3), helpstring("property Float")] HRESULT Float([out, retval] float *pVal); - [propput, id(3), helpstring("property Float")] HRESULT Float([in] float newVal); - [propget, id(4), helpstring("property Double")] HRESULT Double([out, retval] double *pVal); - [propput, id(4), helpstring("property Double")] HRESULT Double([in] double newVal); - [propget, id(5), helpstring("property Currency")] HRESULT Currency([out, retval] CURRENCY *pVal); - [propput, id(5), helpstring("property Currency")] HRESULT Currency([in] CURRENCY newVal); - [propget, id(6), helpstring("property Date")] HRESULT Date([out, retval] DATE *pVal); - [propput, id(6), helpstring("property Date")] HRESULT Date([in] DATE newVal); - [propget, id(7), helpstring("property String")] HRESULT String([out, retval] BSTR *pVal); - [propput, id(7), helpstring("property String")] HRESULT String([in] BSTR newVal); - [propget, id(8), helpstring("property DispatchPtr")] HRESULT DispatchPtr([out, retval] IDispatch* *pVal); - [propput, id(8), helpstring("property DispatchPtr")] HRESULT DispatchPtr([in] IDispatch* newVal); - [propget, id(9), helpstring("property SCode")] HRESULT SCode([out, retval] SCODE *pVal); - [propput, id(9), helpstring("property SCode")] HRESULT SCode([in] SCODE newVal); - [propget, id(10), helpstring("property Boolean")] HRESULT Boolean([out, retval] BOOL *pVal); - [propput, id(10), helpstring("property Boolean")] HRESULT Boolean([in] BOOL newVal); - [propget, id(11), helpstring("property Variant")] HRESULT Variant([out, retval] VARIANT *pVal); - [propput, id(11), helpstring("property Variant")] HRESULT Variant([in] VARIANT newVal); - [propget, id(12), helpstring("property COMPtr")] HRESULT COMPtr([out, retval] IUnknown* *pVal); - [propput, id(12), helpstring("property COMPtr")] HRESULT COMPtr([in] IUnknown* newVal); - [propget, id(13), helpstring("property Char")] HRESULT Char([out, retval] unsigned char *pVal); - [propput, id(13), helpstring("property Char")] HRESULT Char([in] unsigned char newVal); - [propget, id(14), helpstring("property ParameterizedProperty")] HRESULT ParameterizedProperty([in]long aIndex, [out, retval] long *pVal); - [propput, id(14), helpstring("property ParameterizedProperty")] HRESULT ParameterizedProperty([in]long aIndex, [in] long newVal); - [propget, id(15), helpstring("property ParameterizedPropertyCount")] HRESULT ParameterizedPropertyCount([out, retval] long *pVal); - }; - - [ - object, - uuid(0797788A-CB08-4995-BD45-7BF8C468DE21), - dual, - helpstring("nsIXPCDispTestScriptOn Interface"), - pointer_default(unique) - ] - interface nsIXPCDispTestScriptOn : IDispatch - { - }; - - [ - uuid(2A06373F-3E61-4882-A3D7-A104F70B09ED), - helpstring("nsXPCDispTestScriptOn Class") - ] - coclass nsXPCDispTestScriptOn - { - [default] interface nsIXPCDispTestScriptOn; - }; - - [ - object, - uuid(EE6F9DB5-890F-422D-B9DC-9C5AB5A1D654), - dual, - helpstring("nsIXPCDispTestScriptOff Interface"), - pointer_default(unique) - ] - interface nsIXPCDispTestScriptOff : IDispatch - { - }; - - [ - object, - uuid(D84352CA-1A01-4E72-9072-77AFA669B3AD), - dual, - helpstring("nsIXPCDispTestWrappedJS Interface"), - pointer_default(unique) - ] - interface nsIXPCDispTestWrappedJS : IDispatch - { - [id(1), helpstring("method TestParamTypes")] HRESULT TestParamTypes([in] IDispatch * obj, [out, retval]BSTR * errMsg); - }; - - [ - uuid(EAEE6BB2-C005-4B91-BCA7-6613236F6F69), - helpstring("nsXPCDispTestWrappedJS Class") - ] - coclass nsXPCDispTestWrappedJS - { - [default] interface nsIXPCDispTestWrappedJS; - }; - - [ - uuid(959CD122-9826-4757-BA09-DE327D55F9E7), - helpstring("nsXPCDispTestScriptOff Class") - ] - coclass nsXPCDispTestScriptOff - { - [default] interface nsIXPCDispTestScriptOff; - }; - - [ - uuid(D8B4265B-1768-4CA9-A285-7CCAEEB51C74), - helpstring("nsXPCDispTestProperties Class") - ] - coclass nsXPCDispTestProperties - { - [default] interface nsIXPCDispTestProperties; - }; - - -}; diff --git a/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.rc b/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.rc deleted file mode 100644 index 41dfd3ce6ac..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/XPCIDispatchTest.rc +++ /dev/null @@ -1,145 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "1 TYPELIB ""XPCIDispatchTest.tlb""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "XPCIDispatchTest Module\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "XPCIDispatchTest\0" - VALUE "LegalCopyright", "Copyright 2002\0" - VALUE "OriginalFilename", "XPCIDispatchTest.DLL\0" - VALUE "ProductName", "XPCIDispatchTest Module\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - VALUE "OLESelfRegister", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_nsXPCDispTestMethods REGISTRY DISCARDABLE "nsXPCDispTestMethods.rgs" -IDR_nsXPCDispSimple REGISTRY DISCARDABLE "nsXPCDispSimple.rgs" -IDR_nsXPCDispTestNoIDispatch REGISTRY DISCARDABLE "nsXPCDispTestNoIDispatch.rgs" -IDR_nsXPCDispTestProperties REGISTRY DISCARDABLE "nsXPCDispTestProperties.rgs" -IDR_nsXPCDispTestArrays REGISTRY DISCARDABLE "nsXPCDispTestArrays.rgs" -IDR_nsXPCDispTestScriptOn REGISTRY DISCARDABLE "nsXPCDispTestScriptOn.rgs" -IDR_nsXPCDispTestScriptOff REGISTRY DISCARDABLE "nsXPCDispTestScriptOff.rgs" -IDR_nsXPCDispTestWrappedJS REGISTRY DISCARDABLE "nsXPCDispTestWrappedJS.rgs" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_PROJNAME "XPCIDispatchTest" - IDS_NSXPCDISPTTESTMETHODS_DESC "nsXPCDisptTestMethods Class" - IDS_NSXPCDISPTESTMETHODS_DESC "nsXPCDispTestMethods Class" - IDS_NSXPCDISPSIMPLE_DESC "nsXPCDispSimple Class" - IDS_NSXPCDISPTESTNOIDISPATCH_DESC "nsXPCDispTestNoIDispatch Class" - IDS_NSXPCDISPTESTNOSCRIPT_DESC "nsXPCDispTestNoScript Class" - IDS_NSXPCDISPTESTPROPERTIES_DESC "nsXPCDispTestProperties Class" -END - -STRINGTABLE DISCARDABLE -BEGIN - IDS_NSXPCDISPTESTARRAYS_DESC "nsXPCDispTestArrays Class" - IDS_NSXPCDISPTESTSCRIPTON_DESC "nsXPCDispTestScriptOn Class" - IDS_NSXPCDISPTESTSCRIPTOFF_DESC "nsXPCDispTestScriptOff Class" - IDS_NSXPCDISPTESTWRAPPEDJS_DESC "nsXPCDispTestWrappedJS Class" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "XPCIDispatchTest.tlb" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispSimple.cpp b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispSimple.cpp deleted file mode 100644 index d0a797d48ca..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispSimple.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// nsXPCDispSimple.cpp : Implementation of CXPCIDispatchTestApp and DLL registration. - -#include "stdafx.h" -#include "XPCIDispatchTest.h" -#include "nsXPCDispSimple.h" - -///////////////////////////////////////////////////////////////////////////// -// - -STDMETHODIMP nsXPCDispSimple::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_nsIXPCDispSimple, - }; - - for (int i=0;i 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// nsXPCDispSimple - -class nsXPCDispSimple : - public ISupportErrorInfo, - public CComObjectRoot, - public CComCoClass, - public IDispatchImpl -{ -public: - nsXPCDispSimple() : mNumber(5) {} -BEGIN_CATEGORY_MAP(nsXPCDispSimple) - IMPLEMENTED_CATEGORY(CATID_SafeForScripting) -END_CATEGORY_MAP() -BEGIN_COM_MAP(nsXPCDispSimple) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY(nsIXPCDispSimple) -END_COM_MAP() -DECLARE_NOT_AGGREGATABLE(nsXPCDispSimple) - -DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispSimple) -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// nsIXPCDispSimple -public: -// nsIXPCDispSimple - STDMETHOD(ClassName)(BSTR * name); - STDMETHOD(get_Number)(LONG * result); - STDMETHOD(put_Number)(LONG result); - template - static HRESULT CreateInstance(T ** result) - { - return CoCreateInstance(CLSID_nsXPCDispSimple, 0, CLSCTX_ALL, - __uuidof(T), - reinterpret_cast(result)); - } -private: - long mNumber; -}; - -#endif // !defined(AFX_NSXPCDISPSIMPLE_H__5502A675_46D9_4762_A7F9_1A023A052152__INCLUDED_) diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispSimple.rgs b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispSimple.rgs deleted file mode 100644 index af5012a7c40..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispSimple.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - XPCIDispatchTest.nsXPCDispSimple.1 = s 'nsXPCDispSimple Class' - { - CLSID = s '{9F39237C-D179-4260-8EF3-4B6D4D7D5570}' - } - XPCIDispatchTest.nsXPCDispSimple = s 'nsXPCDispSimple Class' - { - CLSID = s '{9F39237C-D179-4260-8EF3-4B6D4D7D5570}' - } - NoRemove CLSID - { - ForceRemove {9F39237C-D179-4260-8EF3-4B6D4D7D5570} = s 'nsXPCDispSimple Class' - { - ProgID = s 'XPCIDispatchTest.nsXPCDispSimple.1' - VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispSimple' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'both' - } - } - } -} diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.cpp b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.cpp deleted file mode 100644 index f813568964f..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.cpp +++ /dev/null @@ -1,221 +0,0 @@ -// nsXPCDispTestArrays.cpp : Implementation of CXPCIDispatchTestApp and DLL registration. - -#include "stdafx.h" -#include "XPCIDispatchTest.h" -#include "nsXPCDispTestArrays.h" - -unsigned int zero = 0; - -///////////////////////////////////////////////////////////////////////////// -// - -STDMETHODIMP nsXPCDispTestArrays::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_nsIXPCDispTestArrays, - }; - - for (int i=0;i ptr; - ptr.CoCreateInstance(CLSID_nsXPCDispSimple); - SafeArrayPutElement(*result, &index, ptr.p); - } - return S_OK; -} - -#define RETURN_IF_FAIL(x) hr = x; if (FAILED(hr)) return hr; - -STDMETHODIMP nsXPCDispTestArrays::TakesSafeArray(LPSAFEARRAY array) -{ - long lbound; - long ubound; - HRESULT hr; - - RETURN_IF_FAIL(SafeArrayGetLBound(array, 1, &lbound)); - if (lbound != 0) - return E_FAIL; - RETURN_IF_FAIL(SafeArrayGetUBound(array, 1, &ubound)); - if (ubound != 3) - return E_FAIL; - for (long index = lbound; index <= ubound; ++index) - { - _variant_t value; - RETURN_IF_FAIL(SafeArrayGetElement(array, &index, &value)); - if (value != _variant_t(index)) - return E_FAIL; - } - return S_OK; -} -STDMETHODIMP nsXPCDispTestArrays::TakesSafeArrayBSTR(LPSAFEARRAY array) -{ - long lbound; - long ubound; - HRESULT hr; - - RETURN_IF_FAIL(SafeArrayGetLBound(array, 1, &lbound)); - if (lbound != 0) - return E_FAIL; - RETURN_IF_FAIL(SafeArrayGetUBound(array, 1, &ubound)); - if (ubound != 3) - return E_FAIL; - for (long index = lbound; index <= ubound; ++index) - { - _variant_t value; - RETURN_IF_FAIL(SafeArrayGetElement(array, &index, &value)); - _variant_t test(index); - if (_bstr_t(value) != _bstr_t(test)) - return E_FAIL; - } - return S_OK; -} -STDMETHODIMP nsXPCDispTestArrays::TakesSafeArrayIDispatch(LPSAFEARRAY array) -{ - long lbound; - long ubound; - HRESULT hr; - - RETURN_IF_FAIL(SafeArrayGetLBound(array, 0, &lbound)); - if (lbound != 0) - return E_FAIL; - RETURN_IF_FAIL(SafeArrayGetUBound(array, 0, &ubound)); - if (ubound != 3) - return E_FAIL; - for (long index = lbound; index <= ubound; ++index) - { - _variant_t value; - RETURN_IF_FAIL(SafeArrayGetElement(array, &index, &value)); - // We need to do more here, but this is good enough for now - if (!value.pdispVal) - return E_FAIL; - } - return S_OK; -} -STDMETHODIMP nsXPCDispTestArrays::InOutSafeArray(LPSAFEARRAY * array) -{ - if (array == NULL) - return E_POINTER; - long lbound; - long ubound; - HRESULT hr; - - RETURN_IF_FAIL(SafeArrayGetLBound(*array, 0, &lbound)); - if (lbound != 0) - return E_FAIL; - RETURN_IF_FAIL(SafeArrayGetUBound(*array, 0, &ubound)); - if (ubound != 3) - return E_FAIL; - LPSAFEARRAY newArray = SafeArrayCreateVector(VT_I4, lbound, ubound); - for (long index = lbound; index <= ubound; ++index) - { - long value; - RETURN_IF_FAIL(SafeArrayGetElement(*array, &index, &value)); - if (value != index) - return E_FAIL; - value += 42; - RETURN_IF_FAIL(SafeArrayPutElement(newArray, &index, &value)); - } - SafeArrayDestroy(*array); - *array = newArray; - return S_OK; -} -STDMETHODIMP nsXPCDispTestArrays::InOutSafeArrayBSTR(LPSAFEARRAY * array) -{ - if (array == NULL) - return E_POINTER; - - long lbound; - long ubound; - HRESULT hr; - - RETURN_IF_FAIL(SafeArrayGetLBound(*array, 0, &lbound)); - if (lbound != 0) - return E_FAIL; - RETURN_IF_FAIL(SafeArrayGetUBound(*array, 0, &ubound)); - if (ubound != 3) - return E_FAIL; - LPSAFEARRAY newArray = SafeArrayCreateVector(VT_BSTR, lbound, ubound); - for (long index = lbound; index <= ubound; ++index) - { - BSTR value; - RETURN_IF_FAIL(SafeArrayGetElement(*array, &index, &value)); - _bstr_t newValue(value, TRUE); - newValue += L"Appended"; - RETURN_IF_FAIL(SafeArrayPutElement(newArray, &index, newValue.copy())); - } - SafeArrayDestroy(*array); - *array = newArray; - return S_OK; -} -STDMETHODIMP nsXPCDispTestArrays::InOutSafeArrayIDispatch(LPSAFEARRAY * array) -{ - if (array == NULL) - return E_POINTER; - - long lbound; - long ubound; - HRESULT hr; - - RETURN_IF_FAIL(SafeArrayGetLBound(*array, 0, &lbound)); - if (lbound != 0) - return E_FAIL; - RETURN_IF_FAIL(SafeArrayGetUBound(*array, 0, &ubound)); - if (ubound != 3) - return E_FAIL; - LPSAFEARRAY newArray = SafeArrayCreateVector(VT_DISPATCH, lbound, ubound); - for (long index = lbound; index <= ubound; ++index) - { - IDispatch* value; - RETURN_IF_FAIL(SafeArrayGetElement(*array, &index, &value)); - RETURN_IF_FAIL(SafeArrayPutElement(newArray, &index, &value)); - } - SafeArrayDestroy(*array); - *array = newArray; - return S_OK; -} diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.h b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.h deleted file mode 100644 index ef7525780a4..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.h +++ /dev/null @@ -1,53 +0,0 @@ -// nsXPCDispTestArrays.h: Definition of the nsXPCDispTestArrays class -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_NSXPCDISPTESTARRAYS_H__5F59BD4C_16A4_4BD6_8281_796DE6A2889C__INCLUDED_) -#define AFX_NSXPCDISPTESTARRAYS_H__5F59BD4C_16A4_4BD6_8281_796DE6A2889C__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// nsXPCDispTestArrays - -class nsXPCDispTestArrays : - public IDispatchImpl, - public ISupportErrorInfo, - public CComObjectRoot, - public CComCoClass -{ -public: - nsXPCDispTestArrays() {} -BEGIN_CATEGORY_MAP(nsXPCDispTestArrays) - IMPLEMENTED_CATEGORY(CATID_SafeForScripting) -END_CATEGORY_MAP() -BEGIN_COM_MAP(nsXPCDispTestArrays) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY(nsIXPCDispTestArrays) -END_COM_MAP() -DECLARE_NOT_AGGREGATABLE(nsXPCDispTestArrays) - -DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestArrays) -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// nsIXPCDispTestArrays -public: -// nsIXPCDispTestArrays - STDMETHOD(ReturnSafeArray)(LPSAFEARRAY * result); - STDMETHOD(ReturnSafeArrayBSTR)(LPSAFEARRAY * result); - STDMETHOD(ReturnSafeArrayIDispatch)(LPSAFEARRAY * result); - STDMETHOD(TakesSafeArray)(LPSAFEARRAY array); - STDMETHOD(TakesSafeArrayBSTR)(LPSAFEARRAY array); - STDMETHOD(TakesSafeArrayIDispatch)(LPSAFEARRAY array); - STDMETHOD(InOutSafeArray)(LPSAFEARRAY * array); - STDMETHOD(InOutSafeArrayBSTR)(LPSAFEARRAY * array); - STDMETHOD(InOutSafeArrayIDispatch)(LPSAFEARRAY * array); -}; - -#endif // !defined(AFX_NSXPCDISPTESTARRAYS_H__5F59BD4C_16A4_4BD6_8281_796DE6A2889C__INCLUDED_) diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.rgs b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.rgs deleted file mode 100644 index 11c83d9cd58..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestArrays.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - XPCIDispatchTest.nsXPCDispTestArrays.1 = s 'nsXPCDispTestArrays Class' - { - CLSID = s '{AB085C43-C619-48C8-B68C-C495BDE12DFB}' - } - XPCIDispatchTest.nsXPCDispTestArrays = s 'nsXPCDispTestArrays Class' - { - CLSID = s '{AB085C43-C619-48C8-B68C-C495BDE12DFB}' - } - NoRemove CLSID - { - ForceRemove {AB085C43-C619-48C8-B68C-C495BDE12DFB} = s 'nsXPCDispTestArrays Class' - { - ProgID = s 'XPCIDispatchTest.nsXPCDispTestArrays.1' - VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestArrays' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'both' - } - } - } -} diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.cpp b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.cpp deleted file mode 100644 index 64be08a269c..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.cpp +++ /dev/null @@ -1,699 +0,0 @@ -// nsXPCDispTestMethods.cpp : Implementation of CIDispatchTestApp and DLL registration. - -#include "stdafx.h" -#include "XPCIDispatchTest.h" -#include "nsXPCDispTestMethods.h" -#include "XPCDispUtilities.h" -#include "nsXPCDispSimple.h" - -///////////////////////////////////////////////////////////////////////////// -// - -STDMETHODIMP nsXPCDispTestMethods::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_nsIXPCDispTestMethods, - }; - - for (int i=0;i(CLSID_nsXPCDispTestNoIDispatch, IID_IUnknown, result); -} -STDMETHODIMP nsXPCDispTestMethods::ReturnI1(unsigned char * result) -{ - if (result == NULL) - return E_POINTER; - - *result = 120; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::ReturnUI2(USHORT * result) -{ - if (result == NULL) - return E_POINTER; - *result = 9999; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::ReturnUI4(ULONG * result) -{ - if (result == NULL) - return E_POINTER; - *result = 3000000000; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::ReturnInt(INT * result) -{ - if (result == NULL) - return E_POINTER; - *result = -999999; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::ReturnUInt(UINT * result) -{ - if (result == NULL) - return E_POINTER; - - *result = 3000000000; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::TakesBSTR(BSTR result) -{ - CComBSTR str(result); - static CComBSTR test(L"TakesBSTR"); - return str == test ? S_OK: E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TakesI4(INT result) -{ - return result == 999999 ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TakesUI1(BYTE result) -{ - return result == 42 ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TakesI2(SHORT result) -{ - return result == 32000 ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TakesR4(FLOAT result) -{ - // Hopefully we won't run into any precision/rounding issues - return result == 99999.99f ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TakesR8(DOUBLE result) -{ - // Hopefully we won't run into any precision/rounding issues - return result == 999999999.99 ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TakesBool(VARIANT_BOOL result) -{ - return result ? S_OK : E_FAIL; -} - -inline -HRESULT GetProperty(IDispatch *pDisp, const CComBSTR & name, CComVariant& output) -{ - DISPID dispid = GetIDsOfNames(pDisp, name); - DISPPARAMS dispParams; - dispParams.cArgs = 0; - dispParams.cNamedArgs = 0; - dispParams.rgdispidNamedArgs = 0; - dispParams.rgvarg = 0; - return pDisp->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,DISPATCH_PROPERTYGET, &dispParams, &output, 0, 0); -} - -inline -HRESULT PutProperty(IDispatch *pDisp, const CComBSTR & name, const CComVariant& input) -{ - DISPPARAMS dispParams; - DISPID did = DISPID_PROPERTYPUT; - dispParams.cArgs = 1; - CComVariant var(input); - dispParams.rgvarg = &var; - dispParams.cNamedArgs = 1; - dispParams.rgdispidNamedArgs = &did; - CComVariant result; - DISPID dispID = GetIDsOfNames(pDisp, name); - return pDisp->Invoke(dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT, - DISPATCH_PROPERTYPUT, &dispParams, &result, - 0, 0); -} - -HRESULT VerifynsXPCDispSimple(IDispatch * result) -{ - CComVariant property; - HRESULT hResult = GetProperty(result, L"Number", property); - CComVariant test((long)5); - if (FAILED(hResult)) - return hResult; - if (property != test) - return E_FAIL; - return PutProperty(result, L"Number", 76); -} - -STDMETHODIMP nsXPCDispTestMethods::TakesIDispatch(IDispatch * result) -{ - return VerifynsXPCDispSimple(result); -} -STDMETHODIMP nsXPCDispTestMethods::TakesError(SCODE result) -{ - return result == E_FAIL ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TakesDate(DATE result) -{ - CComBSTR dateStr(L"5/2/02"); - DATE myDate; - HRESULT hResult = VarDateFromStr(dateStr, LOCALE_SYSTEM_DEFAULT, - LOCALE_NOUSEROVERRIDE, &myDate); - if (SUCCEEDED(hResult)) - return myDate == result ? S_OK : E_FAIL; - else - return hResult; -} -STDMETHODIMP nsXPCDispTestMethods::TakesIUnknown(IUnknown * result) -{ - CComPtr ptr(result); - ULONG before = result->AddRef(); - ULONG after = result->Release(); - CComQIPtr noIDispatch(ptr); - return before - 1 == after ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TakesI1(unsigned char result) -{ - return result == 42 ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TakesUI2(USHORT result) -{ - return result == 50000 ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TakesUI4(ULONG result) -{ - return result == 0xF0000000 ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TakesInt(INT result) -{ - return result == -10000000 ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TakesUInt(UINT result) -{ - return result == 0xE0000000 ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::OutputsBSTR(BSTR * result) -{ - if (result == NULL) - return E_POINTER; - - CComBSTR x("Boo"); - *result = x.Detach(); - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::OutputsI4(LONG * result) -{ - if (result == NULL) - return E_POINTER; - *result = 99999; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::OutputsUI1(BYTE * result) -{ - if (result == NULL) - return E_POINTER; - *result = 99; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::OutputsI2(SHORT * result) -{ - if (result == NULL) - return E_POINTER; - *result = 9999; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::OutputsR4(FLOAT * result) -{ - if (result == NULL) - return E_POINTER; - *result = 999999.1f; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::OutputsR8(DOUBLE * result) -{ - if (result == NULL) - return E_POINTER; - *result = 99999999999.99; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::OutputsBool(VARIANT_BOOL * result) -{ - if (result == NULL) - return E_POINTER; - *result = VARIANT_TRUE; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::OutputsIDispatch(IDispatch * * result) -{ - if (result == NULL) - return E_POINTER; - return nsXPCDispSimple::CreateInstance(result); -} -STDMETHODIMP nsXPCDispTestMethods::OutputsError(SCODE * result) -{ - if (result == NULL) - return E_POINTER; - *result = E_FAIL; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::OutputsDate(DATE * result) -{ - if (result == NULL) - return E_POINTER; - CComBSTR dateStr(L"5/2/02"); - return VarDateFromStr(dateStr, LOCALE_SYSTEM_DEFAULT, - LOCALE_NOUSEROVERRIDE, result); -} -STDMETHODIMP nsXPCDispTestMethods::OutputsIUnknown(IUnknown * * result) -{ - if (result == NULL) - return E_POINTER; - - return XPCCreateInstance(CLSID_nsXPCDispTestNoIDispatch, IID_IUnknown, result); -} -STDMETHODIMP nsXPCDispTestMethods::OutputsI1(unsigned char * result) -{ - if (result == NULL) - return E_POINTER; - - *result = L'x'; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::OutputsUI2(USHORT * result) -{ - if (result == NULL) - return E_POINTER; - *result = 9999; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::OutputsUI4(ULONG * result) -{ - if (result == NULL) - return E_POINTER; - *result = 3000000000; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::InOutsBSTR(BSTR * result) -{ - if (result == NULL) - return E_POINTER; - CComBSTR str(*result); - str += L"Appended"; - SysFreeString(*result); - *result = str.Detach(); - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::InOutsI4(LONG * result) -{ - if (result == NULL) - return E_POINTER; - *result -= 4000000; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::InOutsUI1(BYTE * result) -{ - if (result == NULL) - return E_POINTER; - *result -= 42; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::InOutsI2(SHORT * result) -{ - if (result == NULL) - return E_POINTER; - *result += 10000; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::InOutsR4(FLOAT * result) -{ - if (result == NULL) - return E_POINTER; - *result += 5.05f; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::InOutsR8(DOUBLE * result) -{ - if (result == NULL) - return E_POINTER; - *result += 50000000.00000005; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::InOutsBool(VARIANT_BOOL * result) -{ - if (result == NULL) - return E_POINTER; - *result = !*result; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::InOutsIDispatch(IDispatch * * result) -{ - if (result == NULL) - return E_POINTER; - CComPtr ptr; - ptr.CoCreateInstance(CLSID_nsXPCDispSimple); - CComPtr incoming(*result); - CComVariant value; - HRESULT hResult = GetProperty(incoming, L"Number", value); - if (FAILED(hResult)) - return hResult; - if (value.lVal != 10) - return E_FAIL; - hResult = ptr->put_Number(value.lVal + 5); - if (FAILED(hResult)) - return hResult; - - *result = ptr.Detach(); - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::InOutsError(SCODE * result) -{ - if (result == NULL) - return E_POINTER; - *result += 1; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::InOutsDate(DATE * result) -{ - if (result == NULL) - return E_POINTER; - ULONG days; - HRESULT hResult = VarUI4FromDate(*result, &days); - if (FAILED(hResult)) - return hResult; - - return VarDateFromUI4(days + 1, result); -} -STDMETHODIMP nsXPCDispTestMethods::InOutsIUnknown(IUnknown * * result) -{ - if (result == NULL) - return E_POINTER; - - CComPtr ptr(*result); - ULONG before = (*result)->AddRef(); - ULONG after = (*result)->Release(); - if (before - 1 != after) - return E_FAIL; - return nsXPCDispSimple::CreateInstance(result); -} -STDMETHODIMP nsXPCDispTestMethods::InOutsI1(unsigned char * result) -{ - if (result == NULL) - return E_POINTER; - ++*result; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::InOutsUI2(USHORT * result) -{ - if (result == NULL) - return E_POINTER; - *result += 42; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::InOutsUI4(ULONG * result) -{ - if (result == NULL) - return E_POINTER; - *result -= 42; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::OneParameterWithReturn(LONG input, - LONG * result) -{ - if (result == NULL) - return E_POINTER; - *result = input + 42; - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::StringInputAndReturn(BSTR str, - BSTR * result) -{ - if (result == NULL) - return E_POINTER; - CComBSTR input(str); - input += L"Appended"; - *result = input.Detach(); - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::IDispatchInputAndReturn(IDispatch * input, IDispatch * * result) -{ - if (result == NULL) - return E_POINTER; - HRESULT hResult = VerifynsXPCDispSimple(input); - - hResult = XPCCreateInstance(CLSID_nsXPCDispSimple, IID_IDispatch, result); - if (FAILED(hResult)) - return hResult; - CComVariant variant; - hResult = GetProperty(input, L"Number", variant); - if (FAILED(hResult)) - return hResult; - return PutProperty(*result, L"Number", variant.lVal + 5); -} -STDMETHODIMP nsXPCDispTestMethods::TwoParameters(LONG one, LONG two) -{ - return one + 1 == two ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TwelveInParameters(LONG one, LONG two, - LONG three, LONG four, - LONG five, LONG six, - LONG seven, LONG eight, - LONG nine, LONG ten, - LONG eleven, LONG twelve) -{ - return one + two + three + four + five + six + seven + eight + nine + - ten + eleven + twelve == 78 ? S_OK : E_FAIL; -} -STDMETHODIMP nsXPCDispTestMethods::TwelveOutParameters(LONG * one, LONG * two, - LONG * three, - LONG * four, - LONG * five, LONG * six, - LONG * seven, - LONG * eight, - LONG * nine, LONG * ten, - LONG * eleven, - LONG * twelve) -{ - if (one == 0 || two == 0 || three == 0 || four == 0 || - five == 0 || six == 0 || seven == 0 || eight == 0 || - nine == 0 || ten == 0 || eleven == 0 || twelve == 0) - return E_POINTER; - - *one = 1; - *two = 2; - *three = 3; - *four = 4; - *five = 5; - *six = 6; - *seven = 7; - *eight = 8; - *nine = 9; - *ten = 10; - *eleven = 11; - *twelve = 12; - return S_OK; -} - -inline -boolean Equals(BSTR left, const char * str) -{ - return CComBSTR(left) == str; -} -#define TESTPARAM(val) Equals(val, #val) - -STDMETHODIMP nsXPCDispTestMethods::TwelveStrings(BSTR one, BSTR two, BSTR three, BSTR four, BSTR five, BSTR six, BSTR seven, BSTR eight, BSTR nine, BSTR ten, BSTR eleven, BSTR twelve) -{ - return TESTPARAM(one) && TESTPARAM(two) && TESTPARAM(three) && - TESTPARAM(four) && TESTPARAM(five) && TESTPARAM(six) && - TESTPARAM(seven) && TESTPARAM(eight) && TESTPARAM(nine) && - TESTPARAM(ten) && TESTPARAM(eleven) && TESTPARAM(twelve) ? - S_OK : E_FAIL; -} - -#define ASSIGNPARAM(val) \ - if (val == 0) \ - return E_POINTER; \ - *val = CComBSTR(#val).Detach() -STDMETHODIMP nsXPCDispTestMethods::TwelveOutStrings(BSTR * one, BSTR * two, BSTR * three, BSTR * four, BSTR * five, BSTR * six, BSTR * seven, BSTR * eight, BSTR * nine, BSTR * ten, BSTR * eleven, BSTR * twelve) -{ - ASSIGNPARAM(one); - ASSIGNPARAM(two); - ASSIGNPARAM(three); - ASSIGNPARAM(four); - ASSIGNPARAM(five); - ASSIGNPARAM(six); - ASSIGNPARAM(seven); - ASSIGNPARAM(eight); - ASSIGNPARAM(nine); - ASSIGNPARAM(ten); - ASSIGNPARAM(eleven); - ASSIGNPARAM(twelve); - return S_OK; -} -#define VERIFYSIMPLE(param) \ - hResult = VerifynsXPCDispSimple(param); \ - if (FAILED(hResult)) \ - return hResult -STDMETHODIMP nsXPCDispTestMethods::TwelveIDispatch(IDispatch * one, - IDispatch * two, - IDispatch * three, - IDispatch * four, - IDispatch * five, - IDispatch * six, - IDispatch * seven, - IDispatch * eight, - IDispatch * nine, - IDispatch * ten, - IDispatch * eleven, - IDispatch * twelve) -{ - HRESULT hResult; - VERIFYSIMPLE(one); - VERIFYSIMPLE(two); - VERIFYSIMPLE(three); - VERIFYSIMPLE(four); - VERIFYSIMPLE(five); - VERIFYSIMPLE(six); - VERIFYSIMPLE(seven); - VERIFYSIMPLE(eight); - VERIFYSIMPLE(nine); - VERIFYSIMPLE(ten); - VERIFYSIMPLE(eleven); - VERIFYSIMPLE(twelve); - return S_OK; -} - -#define ASSIGNSIMPLE(param) \ - if (param == 0) \ - return E_POINTER; \ - hResult = nsXPCDispSimple::CreateInstance(param); \ - if (FAILED(hResult)) \ - return hResult; \ - -STDMETHODIMP nsXPCDispTestMethods::TwelveOutIDispatch(IDispatch * * one, - IDispatch * * two, - IDispatch * * three, - IDispatch * * four, - IDispatch * * five, - IDispatch * * six, - IDispatch * * seven, - IDispatch * * eight, - IDispatch * * nine, - IDispatch * * ten, - IDispatch * * eleven, - IDispatch * * twelve){ - HRESULT hResult; - ASSIGNSIMPLE(one); - ASSIGNSIMPLE(two); - ASSIGNSIMPLE(three); - ASSIGNSIMPLE(four); - ASSIGNSIMPLE(five); - ASSIGNSIMPLE(six); - ASSIGNSIMPLE(seven); - ASSIGNSIMPLE(eight); - ASSIGNSIMPLE(nine); - ASSIGNSIMPLE(ten); - ASSIGNSIMPLE(eleven); - ASSIGNSIMPLE(twelve); - return S_OK; -} -STDMETHODIMP nsXPCDispTestMethods::CreateError() -{ - CComBSTR someText(L"CreateError Test"); - ICreateErrorInfo * pCreateError; - IErrorInfo * pError; - HRESULT result = CreateErrorInfo(&pCreateError); - if (FAILED(result)) - return E_NOTIMPL; - result = pCreateError->QueryInterface(&pError); - if (FAILED(result)) - return E_NOTIMPL; - result = pCreateError->SetDescription(someText); - if (FAILED(result)) - return E_NOTIMPL; - result = pCreateError->SetGUID(IID_nsIXPCDispTestMethods); - if (FAILED(result)) - return E_NOTIMPL; - CComBSTR source(L"XPCIDispatchTest.nsXPCDispTestMethods.1"); - result = pCreateError->SetSource(source); - if (FAILED(result)) - return E_NOTIMPL; - result = SetErrorInfo(0, pError); - if (FAILED(result)) - return E_NOTIMPL; - pError->Release(); - pCreateError->Release(); - return E_FAIL; -} diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.h b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.h deleted file mode 100644 index fda7b6ae281..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.h +++ /dev/null @@ -1,138 +0,0 @@ -// nsXPCDispTestMethods.h: Definition of the nsXPCDispTestMethods class -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_NSXPCDISPTESTMETHODS_H__A516B1D7_1971_419C_AE35_EDFAC27D1227__INCLUDED_) -#define AFX_NSXPCDISPTESTMETHODS_H__A516B1D7_1971_419C_AE35_EDFAC27D1227__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" // main symbols -#include "XPCIDispatchTest.h" - -///////////////////////////////////////////////////////////////////////////// -// nsXPCDispTestMethods - -class nsXPCDispTestMethods : - public ISupportErrorInfo, - public CComObjectRoot, - public CComCoClass, - public IDispatchImpl -{ -public: - nsXPCDispTestMethods() {} -BEGIN_CATEGORY_MAP(nsXPCDispTestMethods) - IMPLEMENTED_CATEGORY(CATID_SafeForScripting) -END_CATEGORY_MAP() -BEGIN_COM_MAP(nsXPCDispTestMethods) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY(nsIXPCDispTestMethods) -END_COM_MAP() -DECLARE_NOT_AGGREGATABLE(nsXPCDispTestMethods) - -DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestMethods) -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// nsIXPCDispTestMethods -public: -// nsIXPCDispTestMethod - STDMETHOD(NoParameters)(); - STDMETHOD(ReturnBSTR)(BSTR * result); - STDMETHOD(ReturnI4)(INT * result); - STDMETHOD(ReturnUI1)(BYTE * result); - STDMETHOD(ReturnI2)(SHORT * result); - STDMETHOD(ReturnR4)(FLOAT * result); - STDMETHOD(ReturnR8)(DOUBLE * result); - STDMETHOD(ReturnBool)(VARIANT_BOOL * result); - STDMETHOD(ReturnIDispatch)(IDispatch * * result); - STDMETHOD(ReturnError)(SCODE * result); - STDMETHOD(ReturnDate)(DATE * result); - STDMETHOD(ReturnIUnknown)(IUnknown * * result); - STDMETHOD(ReturnI1)(unsigned char * result); - STDMETHOD(ReturnUI2)(USHORT * result); - STDMETHOD(ReturnUI4)(ULONG * result); - STDMETHOD(ReturnInt)(INT * result); - STDMETHOD(ReturnUInt)(UINT * result); - STDMETHOD(TakesBSTR)(BSTR result); - STDMETHOD(TakesI4)(INT result); - STDMETHOD(TakesUI1)(BYTE result); - STDMETHOD(TakesI2)(SHORT result); - STDMETHOD(TakesR4)(FLOAT result); - STDMETHOD(TakesR8)(DOUBLE result); - STDMETHOD(TakesBool)(VARIANT_BOOL result); - STDMETHOD(TakesIDispatch)(IDispatch * result); - STDMETHOD(TakesError)(SCODE result); - STDMETHOD(TakesDate)(DATE result); - STDMETHOD(TakesIUnknown)(IUnknown * result); - STDMETHOD(TakesI1)(unsigned char result); - STDMETHOD(TakesUI2)(USHORT result); - STDMETHOD(TakesUI4)(ULONG result); - STDMETHOD(TakesInt)(INT result); - STDMETHOD(TakesUInt)(UINT result); - STDMETHOD(OutputsBSTR)(BSTR * result); - STDMETHOD(OutputsI4)(LONG * result); - STDMETHOD(OutputsUI1)(BYTE * result); - STDMETHOD(OutputsI2)(SHORT * result); - STDMETHOD(OutputsR4)(FLOAT * result); - STDMETHOD(OutputsR8)(DOUBLE * result); - STDMETHOD(OutputsBool)(VARIANT_BOOL * result); - STDMETHOD(OutputsIDispatch)(IDispatch * * result); - STDMETHOD(OutputsError)(SCODE * result); - STDMETHOD(OutputsDate)(DATE * result); - STDMETHOD(OutputsIUnknown)(IUnknown * * result); - STDMETHOD(OutputsI1)(unsigned char * result); - STDMETHOD(OutputsUI2)(USHORT * result); - STDMETHOD(OutputsUI4)(ULONG * result); - STDMETHOD(InOutsBSTR)(BSTR * result); - STDMETHOD(InOutsI4)(LONG * result); - STDMETHOD(InOutsUI1)(BYTE * result); - STDMETHOD(InOutsI2)(SHORT * result); - STDMETHOD(InOutsR4)(FLOAT * result); - STDMETHOD(InOutsR8)(DOUBLE * result); - STDMETHOD(InOutsBool)(VARIANT_BOOL * result); - STDMETHOD(InOutsIDispatch)(IDispatch * * result); - STDMETHOD(InOutsError)(SCODE * result); - STDMETHOD(InOutsDate)(DATE * result); - STDMETHOD(InOutsIUnknown)(IUnknown * * result); - STDMETHOD(InOutsI1)(unsigned char * result); - STDMETHOD(InOutsUI2)(USHORT * result); - STDMETHOD(InOutsUI4)(ULONG * result); - STDMETHOD(OneParameterWithReturn)(LONG input, LONG * result); - STDMETHOD(StringInputAndReturn)(BSTR str, BSTR * result); - STDMETHOD(IDispatchInputAndReturn)(IDispatch * input, IDispatch** result); - STDMETHOD(TwoParameters)(LONG one, LONG two); - STDMETHOD(TwelveInParameters)(LONG one, LONG two, LONG three, LONG four, - LONG five, LONG six, LONG seven, LONG eight, - LONG nine, LONG ten, LONG eleven, - LONG twelve); - STDMETHOD(TwelveOutParameters)(LONG * one, LONG * two, LONG * three, - LONG * four, LONG * five, LONG * six, - LONG * seven, LONG * eight, LONG * nine, - LONG * ten, LONG * eleven, LONG * twelve); - STDMETHOD(TwelveStrings)(BSTR one, BSTR two, BSTR three, BSTR four, - BSTR five, BSTR six, BSTR seven, BSTR eight, - BSTR nine, BSTR ten, BSTR eleven, BSTR twelve); - STDMETHOD(TwelveOutStrings)(BSTR * one, BSTR * two, BSTR * three, - BSTR * four, BSTR * five, BSTR * six, - BSTR * seven, BSTR * eight, BSTR * nine, - BSTR * ten, BSTR * eleven, BSTR * twelve); - STDMETHOD(TwelveIDispatch)(IDispatch * one, IDispatch * two, - IDispatch * three, IDispatch * four, - IDispatch * five, IDispatch * six, - IDispatch * seven, IDispatch * eight, - IDispatch * nine, IDispatch * ten, - IDispatch * eleven, IDispatch * twelve); - STDMETHOD(TwelveOutIDispatch)(IDispatch * * one, IDispatch * * two, - IDispatch * * three, IDispatch * * four, - IDispatch * * five, IDispatch * * six, - IDispatch * * seven, IDispatch * * eight, - IDispatch * * nine, IDispatch * * ten, - IDispatch * * eleven, IDispatch * * twelve); - STDMETHOD(CreateError)(); -}; - -#endif // !defined(AFX_NSXPCDISPTESTMETHODS_H__A516B1D7_1971_419C_AE35_EDFAC27D1227__INCLUDED_) diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.rgs b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.rgs deleted file mode 100644 index 29f5d3d8a85..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestMethods.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - XPCIDispatchTest.nsXPCDispTestMethods.1 = s 'nsXPCDispTestMethods Class' - { - CLSID = s '{745D1149-9F46-418C-B176-71EAA98974BA}' - } - XPCIDispatchTest.nsXPCDispTestMethods = s 'nsXPCDispTestMethods Class' - { - CLSID = s '{745D1149-9F46-418C-B176-71EAA98974BA}' - } - NoRemove CLSID - { - ForceRemove {745D1149-9F46-418C-B176-71EAA98974BA} = s 'nsXPCDispTestMethods Class' - { - ProgID = s 'XPCIDispatchTest.nsXPCDispTestMethods.1' - VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestMethods' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'both' - } - } - } -} diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestNoIDispatch.cpp b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestNoIDispatch.cpp deleted file mode 100644 index 7e305317d21..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestNoIDispatch.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// nsXPCDispTestNoIDispatch.cpp : Implementation of CXPCIDispatchTestApp and DLL registration. - -#include "stdafx.h" -#include "XPCIDispatchTest.h" -#include "nsXPCDispTestNoIDispatch.h" - -///////////////////////////////////////////////////////////////////////////// -// - -STDMETHODIMP nsXPCDispTestNoIDispatch::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_nsIXPCDispTestNoIDispatch, - }; - - for (int i=0;i 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// nsXPCDispTestNoIDispatch - -class nsXPCDispTestNoIDispatch : - public nsIXPCDispTestNoIDispatch, - public ISupportErrorInfo, - public CComObjectRoot, - public CComCoClass -{ -public: - nsXPCDispTestNoIDispatch() {} -BEGIN_COM_MAP(nsXPCDispTestNoIDispatch) - COM_INTERFACE_ENTRY(nsIXPCDispTestNoIDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() -//DECLARE_NOT_AGGREGATABLE(nsXPCDispTestNoIDispatch) -// Remove the comment from the line above if you don't want your object to -// support aggregation. - -DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestNoIDispatch) -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// nsIXPCDispTestNoIDispatch -public: -}; - -#endif // !defined(AFX_NSXPCDISPTESTNOIDISPATCH_H__E4B74F67_BA6B_4654_8674_E60E487129F7__INCLUDED_) diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestNoIDispatch.rgs b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestNoIDispatch.rgs deleted file mode 100644 index cc93a0d7941..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestNoIDispatch.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - XPCIDispatchTest.nsXPCDispTestNoIDispatch.1 = s 'nsXPCDispTestNoIDispatch Class' - { - CLSID = s '{7414404F-A4CC-4E3C-9B32-BB20CB22F541}' - } - XPCIDispatchTest.nsXPCDispTestNoIDispatch = s 'nsXPCDispTestNoIDispatch Class' - { - CLSID = s '{7414404F-A4CC-4E3C-9B32-BB20CB22F541}' - } - NoRemove CLSID - { - ForceRemove {7414404F-A4CC-4E3C-9B32-BB20CB22F541} = s 'nsXPCDispTestNoIDispatch Class' - { - ProgID = s 'XPCIDispatchTest.nsXPCDispTestNoIDispatch.1' - VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestNoIDispatch' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'both' - } - } - } -} diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.cpp b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.cpp deleted file mode 100644 index e74ea9f3d48..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.cpp +++ /dev/null @@ -1,256 +0,0 @@ -// nsXPCDispTestProperties.cpp : Implementation of CXPCIDispatchTestApp and DLL registration. - -#include "stdafx.h" -#include "XPCIDispatchTest.h" -#include "nsXPCDispTestProperties.h" - -const long PARAMETERIZED_PROPERTY_COUNT = 5; -///////////////////////////////////////////////////////////////////////////// -// - -STDMETHODIMP nsXPCDispTestProperties::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_nsIXPCDispTestProperties, - }; - - for (int i=0;i= PARAMETERIZED_PROPERTY_COUNT) - return E_FAIL; - - *pVal = mParameterizedProperty[aIndex]; - - return S_OK; -} - -STDMETHODIMP nsXPCDispTestProperties::put_ParameterizedProperty(long aIndex, long newVal) -{ - if (aIndex < 0 || aIndex >= PARAMETERIZED_PROPERTY_COUNT) - return E_FAIL; - - mParameterizedProperty[aIndex] = newVal; - - return S_OK; -} - -STDMETHODIMP nsXPCDispTestProperties::get_ParameterizedPropertyCount(long *pVal) -{ - *pVal = PARAMETERIZED_PROPERTY_COUNT; - - return S_OK; -} diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.h b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.h deleted file mode 100644 index 8dac4e86b0d..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.h +++ /dev/null @@ -1,88 +0,0 @@ -// nsXPCDispTestProperties.h: Definition of the nsXPCDispTestProperties class -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_NSXPCDISPTESTPROPERTIES_H__9E10C7AC_36AF_4A3A_91C7_2CFB9EB166A5__INCLUDED_) -#define AFX_NSXPCDISPTESTPROPERTIES_H__9E10C7AC_36AF_4A3A_91C7_2CFB9EB166A5__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// nsXPCDispTestProperties - -class nsXPCDispTestProperties : - public IDispatchImpl, - public ISupportErrorInfo, - public CComObjectRoot, - public CComCoClass -{ -public: - nsXPCDispTestProperties(); - virtual ~nsXPCDispTestProperties(); -BEGIN_CATEGORY_MAP(nsXPCDispTestProperties) - IMPLEMENTED_CATEGORY(CATID_SafeForScripting) -END_CATEGORY_MAP() -BEGIN_COM_MAP(nsXPCDispTestProperties) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(nsIXPCDispTestProperties) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() -DECLARE_NOT_AGGREGATABLE(nsXPCDispTestProperties) - -DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestProperties) -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// nsIXPCDispTestProperties -public: - STDMETHOD(get_ParameterizedPropertyCount)(/*[out, retval]*/ long *pVal); - STDMETHOD(get_ParameterizedProperty)(/*[in]*/long aIndex, /*[out, retval]*/ long *pVal); - STDMETHOD(put_ParameterizedProperty)(/*[in]*/long aIndex, /*[in]*/ long newVal); - STDMETHOD(get_Char)(/*[out, retval]*/ unsigned char *pVal); - STDMETHOD(put_Char)(/*[in]*/ unsigned char newVal); - STDMETHOD(get_COMPtr)(/*[out, retval]*/ IUnknown* *pVal); - STDMETHOD(put_COMPtr)(/*[in]*/ IUnknown* newVal); - STDMETHOD(get_Variant)(/*[out, retval]*/ VARIANT *pVal); - STDMETHOD(put_Variant)(/*[in]*/ VARIANT newVal); - STDMETHOD(get_Boolean)(/*[out, retval]*/ BOOL *pVal); - STDMETHOD(put_Boolean)(/*[in]*/ BOOL newVal); - STDMETHOD(get_SCode)(/*[out, retval]*/ SCODE *pVal); - STDMETHOD(put_SCode)(/*[in]*/ SCODE newVal); - STDMETHOD(get_DispatchPtr)(/*[out, retval]*/ IDispatch* *pVal); - STDMETHOD(put_DispatchPtr)(/*[in]*/ IDispatch* newVal); - STDMETHOD(get_String)(/*[out, retval]*/ BSTR *pVal); - STDMETHOD(put_String)(/*[in]*/ BSTR newVal); - STDMETHOD(get_Date)(/*[out, retval]*/ DATE *pVal); - STDMETHOD(put_Date)(/*[in]*/ DATE newVal); - STDMETHOD(get_Currency)(/*[out, retval]*/ CURRENCY *pVal); - STDMETHOD(put_Currency)(/*[in]*/ CURRENCY newVal); - STDMETHOD(get_Double)(/*[out, retval]*/ double *pVal); - STDMETHOD(put_Double)(/*[in]*/ double newVal); - STDMETHOD(get_Float)(/*[out, retval]*/ float *pVal); - STDMETHOD(put_Float)(/*[in]*/ float newVal); - STDMETHOD(get_Long)(/*[out, retval]*/ long *pVal); - STDMETHOD(put_Long)(/*[in]*/ long newVal); - STDMETHOD(get_Short)(/*[out, retval]*/ short *pVal); - STDMETHOD(put_Short)(/*[in]*/ short newVal); -private: - unsigned char mChar; - CComPtr mIUnknown; - CComVariant mVariant; - BOOL mBOOL; - SCODE mSCode; - CComPtr mIDispatch; - CComBSTR mBSTR; - DATE mDATE; - CURRENCY mCURRENCY; - double mDouble; - float mFloat; - long mLong; - short mShort; - long * mParameterizedProperty; -}; - -#endif // !defined(AFX_NSXPCDISPTESTPROPERTIES_H__9E10C7AC_36AF_4A3A_91C7_2CFB9EB166A5__INCLUDED_) diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.rgs b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.rgs deleted file mode 100644 index 160d3104fdf..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - XPCIDispatchTest.nsXPCDispTestProperties.1 = s 'nsXPCDispTestProperties Class' - { - CLSID = s '{D8B4265B-1768-4CA9-A285-7CCAEEB51C74}' - } - XPCIDispatchTest.nsXPCDispTestProperties = s 'nsXPCDispTestProperties Class' - { - CLSID = s '{D8B4265B-1768-4CA9-A285-7CCAEEB51C74}' - } - NoRemove CLSID - { - ForceRemove {D8B4265B-1768-4CA9-A285-7CCAEEB51C74} = s 'nsXPCDispTestProperties Class' - { - ProgID = s 'XPCIDispatchTest.nsXPCDispTestProperties.1' - VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestProperties' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'both' - } - } - } -} diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOff.cpp b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOff.cpp deleted file mode 100644 index 6539898affe..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOff.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// nsXPCDispTestScriptOff.cpp : Implementation of CXPCIDispatchTestApp and DLL registration. - -#include "stdafx.h" -#include "XPCIDispatchTest.h" -#include "nsXPCDispTestScriptOff.h" - -///////////////////////////////////////////////////////////////////////////// -// - -STDMETHODIMP nsXPCDispTestScriptOff::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_nsIXPCDispTestScriptOff, - }; - - for (int i=0;i 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" // main symbols -#include - -///////////////////////////////////////////////////////////////////////////// -// nsXPCDispTestScriptOff - -class nsXPCDispTestScriptOff : - public IDispatchImpl, - public ISupportErrorInfo, - public CComObjectRoot, - public CComCoClass, - public IObjectSafetyImpl -{ -public: - nsXPCDispTestScriptOff() {} -BEGIN_COM_MAP(nsXPCDispTestScriptOff) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(nsIXPCDispTestScriptOff) - COM_INTERFACE_ENTRY(IObjectSafety) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() -DECLARE_NOT_AGGREGATABLE(nsXPCDispTestScriptOff) - -DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestScriptOff) -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// nsIXPCDispTestScriptOff -public: -}; - -#endif // !defined(AFX_NSXPCDISPTESTSCRIPTOFF_H__EEC88DE0_F502_4893_9918_4E435DBC9815__INCLUDED_) diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOff.rgs b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOff.rgs deleted file mode 100644 index 8bb3e54df12..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOff.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - XPCIDispatchTest.nsXPCDispTestScriptOff.1 = s 'nsXPCDispTestScriptOff Class' - { - CLSID = s '{959CD122-9826-4757-BA09-DE327D55F9E7}' - } - XPCIDispatchTest.nsXPCDispTestScriptOff = s 'nsXPCDispTestScriptOff Class' - { - CLSID = s '{959CD122-9826-4757-BA09-DE327D55F9E7}' - } - NoRemove CLSID - { - ForceRemove {959CD122-9826-4757-BA09-DE327D55F9E7} = s 'nsXPCDispTestScriptOff Class' - { - ProgID = s 'XPCIDispatchTest.nsXPCDispTestScriptOff.1' - VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestScriptOff' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'both' - } - } - } -} diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOn.cpp b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOn.cpp deleted file mode 100644 index 067ba5269e9..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOn.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// nsXPCDispTestScriptOn.cpp : Implementation of CXPCIDispatchTestApp and DLL registration. - -#include "stdafx.h" -#include "XPCIDispatchTest.h" -#include "nsXPCDispTestScriptOn.h" - -///////////////////////////////////////////////////////////////////////////// -// - -STDMETHODIMP nsXPCDispTestScriptOn::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_nsIXPCDispTestScriptOn, - }; - - for (int i=0;i 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" // main symbols -#include - -///////////////////////////////////////////////////////////////////////////// -// nsXPCDispTestScriptOn - -class nsXPCDispTestScriptOn : - public IDispatchImpl, - public ISupportErrorInfo, - public CComObjectRoot, - public CComCoClass, - public IObjectSafetyImpl -{ -public: - nsXPCDispTestScriptOn(); -BEGIN_COM_MAP(nsXPCDispTestScriptOn) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(nsIXPCDispTestScriptOn) - COM_INTERFACE_ENTRY(IObjectSafety) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() -DECLARE_NOT_AGGREGATABLE(nsXPCDispTestScriptOn) - -DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestScriptOn) -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// nsIXPCDispTestScriptOn -public: -}; - -#endif // !defined(AFX_NSXPCDISPTESTSCRIPTON_H__C037D462_C403_48FF_A02F_6C36544F0833__INCLUDED_) diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOn.rgs b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOn.rgs deleted file mode 100644 index bec6373c74f..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestScriptOn.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - XPCIDispatchTest.nsXPCDispTestScriptOn.1 = s 'nsXPCDispTestScriptOn Class' - { - CLSID = s '{2A06373F-3E61-4882-A3D7-A104F70B09ED}' - } - XPCIDispatchTest.nsXPCDispTestScriptOn = s 'nsXPCDispTestScriptOn Class' - { - CLSID = s '{2A06373F-3E61-4882-A3D7-A104F70B09ED}' - } - NoRemove CLSID - { - ForceRemove {2A06373F-3E61-4882-A3D7-A104F70B09ED} = s 'nsXPCDispTestScriptOn Class' - { - ProgID = s 'XPCIDispatchTest.nsXPCDispTestScriptOn.1' - VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestScriptOn' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'both' - } - } - } -} diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.cpp b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.cpp deleted file mode 100644 index 5d037ca89ae..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.cpp +++ /dev/null @@ -1,177 +0,0 @@ -// nsXPCDispTestWrappedJS.cpp : Implementation of CXPCIDispatchTestApp and DLL registration. - -#include "stdafx.h" -#include "XPCIDispatchTest.h" -#include "nsXPCDispTestWrappedJS.h" -#include -#include - -///////////////////////////////////////////////////////////////////////////// -// - -STDMETHODIMP nsXPCDispTestWrappedJS::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_nsIXPCDispTestWrappedJS, - }; - - for (int i=0;i(left) == static_cast(right); \ -} - -CompareFunction(long); -CompareFunction(float); -CompareFunction(double); -CompareFunction(_bstr_t); - -DISPID GetIDsOfNames(IDispatch * pIDispatch , char const * i_Method) -{ - DISPID dispid; - CComBSTR method(i_Method); - OLECHAR * pMethod = method; - HRESULT hresult = pIDispatch->GetIDsOfNames( - IID_NULL, - &pMethod, - 1, - LOCALE_SYSTEM_DEFAULT, - &dispid); - if (!SUCCEEDED(hresult)) - { - dispid = 0; - } - return dispid; -} - -namespace -{ - -inline -_bstr_t ConvertVariantFromBSTR(_variant_t & variant) -{ - VARIANT temp = variant; - if (SUCCEEDED(VariantChangeType(&temp, &temp, 0, VT_BSTR))) - { - variant.Attach(temp); - return static_cast<_bstr_t>(variant); - } - return "**Type Conversion failed"; -} - -std::string DispInvoke(IDispatch * obj, const TestData & testData) -{ - // Perform a put on the property - ITypeInfo * pTypeInfo; - obj->GetTypeInfo(0, LOCALE_SYSTEM_DEFAULT, &pTypeInfo); - DISPID dispID = ::GetIDsOfNames(obj, testData.mName); - DISPPARAMS dispParams; - dispParams.cArgs = 1; - dispParams.rgvarg = const_cast(&reinterpret_cast(testData.mValue)); - dispParams.cNamedArgs = 1; - DISPID propPut = DISPID_PROPERTYPUT; - dispParams.rgdispidNamedArgs = &propPut; - _variant_t result1; - HRESULT hResult = obj->Invoke(dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, &dispParams, &result1, 0, 0); - if (FAILED(hResult)) - { - std::ostringstream msg; - msg << "IDispatch::Invoke on " << testData.mName << " failed to set property with result " << hResult; - return msg.str(); - } - dispParams.cArgs = 1; - dispParams.rgvarg = const_cast(&reinterpret_cast(testData.mValue)); - dispParams.cNamedArgs = 0; - dispParams.rgdispidNamedArgs = 0; - _variant_t result2; - hResult = obj->Invoke(dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, &dispParams, &result2, 0, 0); - if (FAILED(hResult)) - { - std::ostringstream msg; - msg << "IDispatch::Invoke on " << testData.mName << " failed to retrieve property with result " << hResult; - return msg.str(); - } - if (!testData.mCompFunc(result2,testData.mValue)) - { - std::ostringstream msg; - VARIANT temp = testData.mValue; - char const * const desired = SUCCEEDED(VariantChangeType(&temp, &temp, 0, VT_BSTR)) ? 0 : "**Conversion Failed"; - char const * const actual = SUCCEEDED(VariantChangeType(&result2, &result2, 0, VT_BSTR)) ? 0 : "**Conversion Failed"; - - msg << testData.mName << " [" - << (desired ? desired : static_cast(static_cast<_bstr_t>(testData.mValue))) << "] [" - << (actual ? actual : static_cast(static_cast<_bstr_t>(result2))) << "]"; - return msg.str(); - } - return std::string(); -} - -} - -STDMETHODIMP nsXPCDispTestWrappedJS::TestParamTypes(IDispatch *obj, BSTR *errMsg) -{ - CComPtr ptr; - CComBSTR progID("XPCIDispatchTest.nsXPCDispSimple.1"); - ptr.CoCreateInstance(progID); - _variant_t dispatchPtr; - dispatchPtr = static_cast(ptr); - CURRENCY currency; - currency.int64 = 55555; - _variant_t date(3000.0, VT_DATE); - _variant_t nullVariant; - nullVariant.ChangeType(VT_NULL); - const TestData tests[] = - { - TestData("Boolean", _variant_t(true), CompareVariant), - TestData("Short", _variant_t(short(4200)), reinterpret_cast(CompareVariantlong)), - TestData("Long", _variant_t(long(-42000000)), CompareVariantlong), - TestData("Float", _variant_t(float(4.5)), CompareVariantfloat), - TestData("Double", _variant_t(-11111.11), CompareVariant), -// TestData("Currency", _variant_t(currency), CompareVariantdouble), - TestData("Date", date, CompareVariant_bstr_t), - TestData("String", _variant_t("A String"), CompareVariant), - TestData("DispatchPtr", dispatchPtr, CompareVariant), -// TestData("SCode", _variant_t(long(5), VT_ERROR), CompareVariant_bstr_t), - TestData("Variant", nullVariant, CompareVariant), - TestData("Char", _variant_t(BYTE('x')), CompareVariant_bstr_t) - }; - std::string errors; - for (size_t index = 0; index < sizeof(tests) / sizeof(TestData); ++index) - { - std::string msg = DispInvoke(obj, tests[index]); - if (!msg.empty()) - { - errors += msg; - errors += "\r\n"; - } - } - CComBSTR errorMsg(errors.c_str()); - *errMsg = errorMsg.Detach(); - return S_OK; -} diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.h b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.h deleted file mode 100644 index ae398d18b4c..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.h +++ /dev/null @@ -1,50 +0,0 @@ -// nsXPCDispTestWrappedJS.h: Definition of the nsXPCDispTestWrappedJS class -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_NSXPCDISPTESTWRAPPEDJS_H__DAAB3C99_1894_40C2_B12B_A360739F8977__INCLUDED_) -#define AFX_NSXPCDISPTESTWRAPPEDJS_H__DAAB3C99_1894_40C2_B12B_A360739F8977__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// nsXPCDispTestWrappedJS - -class nsXPCDispTestWrappedJS : - public IDispatchImpl, - public ISupportErrorInfo, - public CComObjectRoot, - public CComCoClass -{ -public: - nsXPCDispTestWrappedJS() {} -BEGIN_CATEGORY_MAP(nsXPCDispTestWrappedJS) - IMPLEMENTED_CATEGORY(CATID_SafeForScripting) -END_CATEGORY_MAP() -BEGIN_COM_MAP(nsXPCDispTestWrappedJS) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(nsIXPCDispTestWrappedJS) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() -DECLARE_NOT_AGGREGATABLE(nsXPCDispTestWrappedJS) - -DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestWrappedJS) -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// nsIXPCDispTestWrappedJS -public: - /** - * This tests interacting with JS Objects via IDispatch - * @param obj the object being tested - * @param errMsg string receiving any error message, blank if no error - */ - STDMETHOD(TestParamTypes)(/*[in]*/ IDispatch * obj, - /*[out]*/BSTR * errMsg); -}; - -#endif // !defined(AFX_NSXPCDISPTESTWRAPPEDJS_H__DAAB3C99_1894_40C2_B12B_A360739F8977__INCLUDED_) diff --git a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.rgs b/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.rgs deleted file mode 100644 index bb191daedc5..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestWrappedJS.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - XPCIDispatchTest.nsXPCDispTestWrappedJS.1 = s 'nsXPCDispTestWrappedJS Class' - { - CLSID = s '{EAEE6BB2-C005-4B91-BCA7-6613236F6F69}' - } - XPCIDispatchTest.nsXPCDispTestWrappedJS = s 'nsXPCDispTestWrappedJS Class' - { - CLSID = s '{EAEE6BB2-C005-4B91-BCA7-6613236F6F69}' - } - NoRemove CLSID - { - ForceRemove {EAEE6BB2-C005-4B91-BCA7-6613236F6F69} = s 'nsXPCDispTestWrappedJS Class' - { - ProgID = s 'XPCIDispatchTest.nsXPCDispTestWrappedJS.1' - VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestWrappedJS' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'both' - } - } - } -} diff --git a/js/src/xpconnect/tests/idispatch/COM/resource.h b/js/src/xpconnect/tests/idispatch/COM/resource.h deleted file mode 100644 index cf6bfc5274b..00000000000 --- a/js/src/xpconnect/tests/idispatch/COM/resource.h +++ /dev/null @@ -1,36 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by XPCIDispatchTest.rc -// -#define IDS_PROJNAME 100 -#define IDS_NSXPCDISPTTESTMETHODS_DESC 101 -#define IDR_nsXPCDisptTestMethods 102 -#define IDS_NSXPCDISPTESTMETHODS_DESC 103 -#define IDR_nsXPCDispTestMethods 104 -#define IDS_NSXPCDISPSIMPLE_DESC 105 -#define IDR_nsXPCDispSimple 106 -#define IDS_NSXPCDISPTESTNOIDISPATCH_DESC 107 -#define IDR_nsXPCDispTestNoIDispatch 108 -#define IDS_NSXPCDISPTESTNOSCRIPT_DESC 109 -#define IDR_nsXPCDispTestNoScript 110 -#define IDS_NSXPCDISPTESTPROPERTIES_DESC 111 -#define IDR_nsXPCDispTestProperties 112 -#define IDS_NSXPCDISPTESTARRAYS_DESC 113 -#define IDR_nsXPCDispTestArrays 114 -#define IDS_NSXPCDISPTESTSCRIPTON_DESC 115 -#define IDR_nsXPCDispTestScriptOn 116 -#define IDS_NSXPCDISPTESTSCRIPTOFF_DESC 117 -#define IDR_nsXPCDispTestScriptOff 118 -#define IDS_NSXPCDISPTESTWRAPPEDJS_DESC 119 -#define IDR_nsXPCDispTestWrappedJS 120 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 204 -#define _APS_NEXT_COMMAND_VALUE 32768 -#define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 121 -#endif -#endif diff --git a/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/Attributes/XPCIDispatchAttributeTests.js b/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/Attributes/XPCIDispatchAttributeTests.js deleted file mode 100644 index 66c1b30a20c..00000000000 --- a/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/Attributes/XPCIDispatchAttributeTests.js +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -/** - * \file XPCIDispatchAttributeTests.js - * Test IDispatch properties and also type conversion - */ - -try -{ - // Test object used to test IDispatch property. - testObject = { one : 1, two : 2, three : 'three' }; - test(); -} -catch (e) -{ - reportFailure("Unhandled exception encountered: " + e.toString()); -} - -/** - * Main function to perform test - */ -function test() -{ - printStatus("Read-Write Attributes"); - - /* - * These values come from xpctest_attributes.idl and xpctest_attributes.cpp - */ - - o = COMObject(CLSID_nsXPCDispTestProperties); - - // Check the class an interface to make sure they're ok - reportCompare( - "object", - typeof o, - "typeof COMObject(CLSID_nsXPCDispTestProperties)"); - // Make sure we can read the values - testProperty("o.Boolean", ["true", "1","testObject", "'T'", "'F'", "'true'","'false'"], false); - testProperty("o.Char", ["32"], true); - testProperty("o.COMPtr", ["0"], true); - testProperty("o.Currency", ["0", "0.5", "10000.00"], true); - testProperty("o.Date", ["'04/01/03'"], false); - testProperty("o.DispatchPtr", ["testObject"], false); - testProperty("o.Double", ["5.555555555555555555555", "5.555555555555555555555", "5", "-5"], true); - testProperty("o.Float", ["-5.55555555", "5.5555555", "5", "-5"], true); - testProperty("o.Long", ["-5", "1073741823", "-1073741824", "1073741824", "-1073741825", "5.5"], true); - testProperty("o.SCode", ["5"], true); - testProperty("o.Short", ["5", "-5", "32767", "-32768"], true); - testProperty("o.String", ["'A String'", "'c'", "5", "true"], false); - testProperty("o.Variant", ["'A Variant String'", "testObject", "10", "5.5"], false); - - // Parameterized property tests - for (index = 0; index < o.ParameterizedPropertyCount; ++index) - compareExpression( - "o.ParameterizedProperty(index)", - index + 1, - "Reading initial value from parameterized property " + index); - for (index = 0; index < o.ParameterizedPropertyCount; ++index) - compareExpression( - "o.ParameterizedProperty(index) = index + 5", - index + 5, - "Assigning parameterized property " + index); - - for (index = 0; index < o.ParameterizedPropertyCount; ++index) - compareExpression( - "o.ParameterizedProperty(index)", - index + 5, - "Reading new value from parameterized property " + index); -} - -/** - * Tests retrieving a value from a property and setting multiple values on - * the property - */ -function testProperty(propertyExpression, values, tryString) -{ - print(propertyExpression); - try - { - reportCompare( - eval(propertyExpression), - eval(propertyExpression), - propertyExpression); - } - catch (e) - { - reportFailure("Testing initial value of " + propertyExpression + " Exception: " + e.toString()); - } - for (i = 0; i < values.length; ++i) - { - var value = values[i]; - var expression = propertyExpression + "=" + value; - print(expression); - try - { - reportCompare( - eval(expression), - eval(value), - expression); - if (tryString) - { - expression = propertyExpression + "='" + value + "'"; - print(expression); - reportCompare( - eval(expression), - eval("'" + value + "'"), - expression); - } - } - catch (e) - { - reportFailure("Testing assignment: " + expression + " Exception: " + e.toString()); - } - } -} \ No newline at end of file diff --git a/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/General/XPCIDispatchInstantiations.js b/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/General/XPCIDispatchInstantiations.js deleted file mode 100644 index 68fbeba0dff..00000000000 --- a/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/General/XPCIDispatchInstantiations.js +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -/** - * Verify that we can access but not overwrite the values of read-only - * attributes. - */ - -test(); - -function testInstantiate(name, id, scriptable, methods) -{ - var IDISPATCH_TEXT = "[xpconnect wrapped IDispatch"; - var obj = COMObject(id); - var value = obj.toString().substr(0, IDISPATCH_TEXT.length); - reportCompare( - IDISPATCH_TEXT, - value, - "var obj = COMObject(" + id + ");"); - try - { - obj = COMObject(id); - } - catch (e) - { - if (scriptable) - { - reportFailure("COMObject('" + id + "') generated an exception"); - } - return; - } - value = obj.toString().substr(0, IDISPATCH_TEXT.length); - reportCompare( - scriptable ? IDISPATCH_TEXT : undefined, - scriptable ? value : obj, - "var obj = COMObject(" + id + ");"); -} - -function testEnumeration(compInfo) -{ - var obj = COMObject(compInfo.cid); - compareObject(obj, compInfo, "Enumeration Test"); -} - -function test() -{ - try - { - - printStatus("Instantiation Tests - " + objectsDesc.length + " objects to test"); - for (index = 0; index < objectsDesc.length; ++index) - { - compInfo = objectsDesc[index]; - printStatus("Testing " + compInfo.name); - testInstantiate(compInfo.name, compInfo.cid, compInfo.scriptable); - testInstantiate(compInfo.name, compInfo.progid, compInfo.scriptable); - } - // Test a nonexistent COM object - var obj; - try - { - obj = COMObject("dwbnonexistentobject"); - printFailure("var obj = COMObject('dwbnonexistentobject'); did not throw an exception"); - } - catch (e) - { - } - try - { - obj = COMObject("dwbnonexistentobject"); - printFailure("obj = COMObject('dwbnonexistentobject'); did not throw an exception"); - } - catch (e) - { - } - printStatus("Enumeration Tests - testing " + objectsDesc.length + " objects"); - for (var index = 0; index < objectsDesc.length; ++index) - { - printStatus("Enumerating " + objectsDesc[index].name); - testEnumeration(objectsDesc[index]); - } - - } - catch (e) - { - reportFailure("Unhandled exception occurred:" + e.toString()); - } -} diff --git a/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/Methods/XPCIDispatchMethodTests.js b/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/Methods/XPCIDispatchMethodTests.js deleted file mode 100644 index 179800cdf5a..00000000000 --- a/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/Methods/XPCIDispatchMethodTests.js +++ /dev/null @@ -1,376 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** 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 IDispatch implementation for XPConnect. - * - * The Initial Developer of the Original Code is - * David Bradley. - * Portions created by the Initial Developer are Copyright (C) 2002 - * 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 ***** */ - -/** - * Verify that we can access but not overwrite the values of read-only - * attributes. - */ - -test(); - -function TestOutMethod(obj, method, value) -{ - printDebug("TestOutMethod - " + method); - var x = new Object(); - try - { - obj[method](x); - reportCompare(value, x.value, "Testing output parameter: " + method); - } - catch (e) - { - reportFailure("Testing output parameter failed: " + method + ": " + e.toString()); - } -} - -function TestReturnMethod(obj, method, value) -{ - printDebug("TestReturnMethod - " + method); - try - { - reportCompare(value, obj[method](), "Testing output parameter: " + method); - } - catch (e) - { - reportFailure("Testing return value failed: " + method + ": " + e.toString()); - } -} - -function TestInputMethod(obj, method, value) -{ - printDebug("TestInputMethod - " + method); - try - { - obj[method.toLowerCase()](value); - } - catch (e) - { - reportFailure("Testing input parameter failed: " + method + ": " + e.toString()); - } -} - -function TestInOutMethod(obj, method, inValue, outValue) -{ - printDebug("TestInOutMethod - " + method); - try - { - var param = { value : inValue }; - obj[method](param); - reportCompare(outValue, param.value, "Testing in/out parameter: " + method); - } - catch (e) - { - reportFailure("Testing in/out parameter failed: " + method + ": " + e.toString()); - } -} - -function test() -{ - printStatus("Testing methods"); - var obj = COMObject(CLSID_nsXPCDispTestMethods); - try - { - obj.NoParameters(); - } - catch (e) - { - reportFailure("NoParameters failed: " + e.toString()); - } - printStatus("Test method - Return values"); - TestReturnMethod(obj, "ReturnBSTR", "Boo"); - TestReturnMethod(obj, "ReturnI4",99999); - TestReturnMethod(obj, "ReturnUI1", 99); - TestReturnMethod(obj, "ReturnI2",9999); - TestReturnMethod(obj, "ReturnR4",99999.1); - TestReturnMethod(obj, "ReturnR8", 99999999999.99); - TestReturnMethod(obj, "ReturnBool", true); - - printStatus("TestReturnMethod - ReturnIDispatch"); - compareObject(obj.ReturnIDispatch(), nsXPCDispSimpleDesc, "Test method - Return IDispatch"); - var E_FAIL= -2147467259; - TestReturnMethod(obj, "ReturnError", E_FAIL); - TestReturnMethod(obj, "ReturnDate", "5/2/2002"); - // TestReturnMethod(obj, ReturnIUnknown(IUnknown * * result) - TestReturnMethod(obj, "ReturnI1", 120); - TestReturnMethod(obj, "ReturnUI2", 9999); - TestReturnMethod(obj, "ReturnUI4", 3000000000); - TestReturnMethod(obj, "ReturnInt", -999999); - TestReturnMethod(obj, "ReturnUInt", 3000000000); - - printStatus("Test method - Input params"); - TestInputMethod(obj, "TakesBSTR", "TakesBSTR"); - TestInputMethod(obj, "TakesI4", 999999); - TestInputMethod(obj, "TakesUI1", 42); - TestInputMethod(obj, "TakesI2", 32000); - TestInputMethod(obj, "TakesR4", 99999.99); - TestInputMethod(obj, "TakesR8", 999999999.99); - TestInputMethod(obj, "TakesBool", true); - var x = { Number : 5, ClassName : "nsXPCDispSimple" }; - TestInputMethod(obj, "TakesIDispatch", x); - // This would always fail, type mismatch (no way to indicate this is going - // to an error, and there's no automatic conversion from integers to error - // codes - // TestInputMethod(obj, "TakesError", E_FAIL); - TestInputMethod(obj, "TakesDate", "5/2/2002"); - // TestInputMethod(obj, TakesIUnknown, ); - TestInputMethod(obj, "TakesI1", 42); - TestInputMethod(obj, "TakesUI2", 50000); - TestInputMethod(obj, "TakesUI4", 4026531840); - TestInputMethod(obj, "TakesInt", -10000000); - TestInputMethod(obj, "TakesUInt", 3758096384); - - printStatus("Test method - Output params"); - TestOutMethod(obj, "OutputsBSTR", "Boo"); - TestOutMethod(obj, "OutputsI4",99999); - TestOutMethod(obj, "OutputsUI1", 99); - TestOutMethod(obj, "OutputsI2",9999); - TestOutMethod(obj, "OutputsR4",999999.1); - TestOutMethod(obj, "OutputsR8", 99999999999.99); - TestOutMethod(obj, "OutputsBool", true); - - var outParam = new Object(); - obj.OutputsIDispatch(outParam); - compareObject(outParam.value, nsXPCDispSimpleDesc, "Test method - Output params"); - TestOutMethod(obj, "OutputsError", E_FAIL); - TestOutMethod(obj, "OutputsDate", "5/2/2002"); - // TestOutMethod(obj, OutputsIUnknown(IUnknown * * result) - TestOutMethod(obj, "OutputsI1", 120); - TestOutMethod(obj, "OutputsUI2", 9999); - TestOutMethod(obj, "OutputsUI4", 3000000000); - - printStatus("Test method - In/out params"); - TestInOutMethod(obj, "InOutsBSTR", "String", "StringAppended"); - TestInOutMethod(obj, "InOutsI4", 2000000, -2000000); - TestInOutMethod(obj, "InOutsUI1", 50, 8); - TestInOutMethod(obj, "InOutsI2", -1000, 9000); - TestInOutMethod(obj, "InOutsR4", -2.05, 3.0); - TestInOutMethod(obj, "InOutsR8", -5.5, 49999994.50000005); - TestInOutMethod(obj, "InOutsBool", true, false); - TestInOutMethod(obj, "InOutsBool", false, true); - var inoutParam = { value : {ClassName : "InOutTest", Number : 10 } }; - try - { - obj.InOutsIDispatch(inoutParam); - if (inoutParam.value.Number != 15) - reportFailure("Testing in/out parameter failed: IDispatch"); - } - catch (e) - { - reportFailure("Testing in/out parameter failed: IDispatch - " + e.toString()); - } - // See the TakesError case - //TestInOutMethod(obj, "InOutsError", E_FAIL, E_FAIL + 1); - TestInOutMethod(obj, "InOutsDate", "5/23/2001", "5/24/2001"); - //TestInOutMethod(obj, InOutsIUnknown(IUnknown * * result) - TestInOutMethod(obj, "InOutsI1", -42, -41); - TestInOutMethod(obj, "InOutsUI2", 43, 85); - TestInOutMethod(obj, "InOutsUI4", 88, 46); - - try - { - reportCompare(obj.OneParameterWithReturn(-20), 22, "Testing OneParameterWithReturn"); - } - catch (e) - { - reportFailure("Testing OneParameterWithReturn: " + e.toString()); - } - - try - { - reportCompare(obj.StringInputAndReturn("A String "), "A String Appended", "Testing StringInputAndReturn"); - } - catch (e) - { - reportFailure("Testing StringInputAndReturn: " + e.toString()); - } - try - { - var inoutIDispatch = { className : "inouttest", Number : 5 }; - var result = obj.IDispatchInputAndReturn(inoutIDispatch); - reportCompare(81, result.Number, "IDispatchInputAndReturn"); - } - catch (e) - { - reportFailure("Testing IDispatchInputAndReturn: " + e.toString()); - } - try - { - obj.TwoParameters(1, 2); - } - catch (e) - { - reportFailure("Testing TwoParameters: " + e.toString()); - } - - try - { - obj.TwelveInParameters(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); - } - catch (e) - { - reportFailure("Testing TwelveInParameters: " + e.toString()); - } - - try - { - var out1 = new Object(); - var out2 = new Object(); - var out3 = new Object(); - var out4 = new Object(); - var out5 = new Object(); - var out6 = new Object(); - var out7 = new Object(); - var out8 = new Object(); - var out9 = new Object(); - var out10 = new Object(); - var out11 = new Object(); - var out12 = new Object(); - obj.TwelveOutParameters(out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12); - reportCompare(78, out1.value + out2.value + out3.value + out4.value + out5.value + out6.value + out7.value + out8.value + out9.value + out10.value + out11.value + out12.value, "Testing TwelveOutParameters"); - } - catch (e) - { - reportFailure("Testing TwelveOutParameters: " + e.toString()); - } - - try - { - obj.TwelveStrings("one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve"); - } - catch (e) - { - reportFailure("Testing TwelveStrings: " + e.toString()); - } - - try - { - var out1 = new Object(); - var out2 = new Object(); - var out3 = new Object(); - var out4 = new Object(); - var out5 = new Object(); - var out6 = new Object(); - var out7 = new Object(); - var out8 = new Object(); - var out9 = new Object(); - var out10 = new Object(); - var out11 = new Object(); - var out12 = new Object(); - obj.TwelveOutStrings(out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12); - reportCompare(true, out1.value == "one" && out2.value == "two" && - out3.value == "three" && out4.value == "four" && - out5.value == "five" && out6.value == "six" && - out7.value == "seven" && out8.value == "eight" && - out9.value == "nine" && out10.value == "ten" && - out11.value == "eleven" && out12.value == "twelve", - "Testing TwelveOutString"); - } - catch (e) - { - reportFailure("Testing TwelveOutParameters: " + e.toString()); - } - try - { - var out1 = { className : "out1", Number : 5 }; - var out2 = { className : "out2", Number : 5 }; - var out3 = { className : "out3", Number : 5 }; - var out4 = { className : "out4", Number : 5 }; - var out5 = { className : "out5", Number : 5 }; - var out6 = { className : "out6", Number : 5 }; - var out7 = { className : "out7", Number : 5 }; - var out8 = { className : "out8", Number : 5 }; - var out9 = { className : "out9", Number : 5 }; - var out10 = { className : "out10", Number : 5 }; - var out11 = { className : "out11", Number : 5 }; - var out12 = { className : "out12", Number : 5 }; - obj.TwelveIDispatch(out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12); - } - catch (e) - { - reportFailure("Testing TwelveIDispatch: " + e.toString()); - } - try - { - var out1 = new Object(); - var out2 = new Object(); - var out3 = new Object(); - var out4 = new Object(); - var out5 = new Object(); - var out6 = new Object(); - var out7 = new Object(); - var out8 = new Object(); - var out9 = new Object(); - var out10 = new Object(); - var out11 = new Object(); - var out12 = new Object(); - obj.TwelveOutIDispatch(out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12); - print("out1.value" + out1.value.Number); - reportCompare(true, out1.value.Number == 5 && out2.value.Number == 5 && - out3.value.Number == 5 && out4.value.Number == 5 && - out5.value.Number == 5 && out6.value.Number == 5 && - out7.value.Number == 5 && out8.value.Number == 5 && - out9.value.Number == 5 && out10.value.Number == 5 && - out11.value.Number == 5 && out12.value.Number == 5, - "Testing TwelveOutIDispatch"); - compareObject(out1.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out1"); - compareObject(out2.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out2"); - compareObject(out3.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out3"); - compareObject(out4.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out4"); - compareObject(out5.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out5"); - compareObject(out6.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out6"); - compareObject(out7.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out7"); - compareObject(out8.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out8"); - compareObject(out9.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out9"); - compareObject(out10.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out10"); - compareObject(out11.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out11"); - compareObject(out12.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out12"); - } - catch (e) - { - reportFailure("Testing TwelveOutIDispatch: " + e.toString()); - } - - try - { - obj.CreateError(); - reportFailure("Testing CreateError: Didn't generate a catchable exception"); - } - catch (e) - { - reportCompare(true, e.toString().search("CreateError Test") != -1, "Testing CreateError"); - } -} diff --git a/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/shell.js b/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/shell.js deleted file mode 100644 index b0e6a0b538a..00000000000 --- a/js/src/xpconnect/tests/idispatch/Tests/WrappedCOM/shell.js +++ /dev/null @@ -1,377 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * ***** 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 Communicator client code, released - * March 31, 1998. - * - * 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): - * Rob Ginda rginda@netscape.com - * - * 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 ***** */ - -FAILED = "FAILED!: "; -STATUS = "STATUS: "; -BUGNUMBER = "BUGNUMBER: "; -DEBUGLINE = "DEBUG: "; - -DEBUG = false; -VERBOSE = false; - -var CLSID_nsXPCDispSimple = "{9F39237C-D179-4260-8EF3-4B6D4D7D5570}"; -var ProgID_nsXPCDispSimple = "XPCIDispatchTest.nsXPCDispSimple.1"; -var nsXPCDispSimpleDesc = -{ - name : "nsXPCDispSimple", - cid : CLSID_nsXPCDispSimple, - progid : ProgID_nsXPCDispSimple, - scriptable : true, - methods : - [ - "ClassName", - "Number" - ] -}; - -var CLSID_nsXPCDispTestMethods = "{745D1149-9F46-418C-B176-71EAA98974BA}"; -var ProgID_nsXPCDispTestMethods = "XPCIDispatchTest.nsXPCDispTestMethods.1"; -var nsXPCDispTestMethodsDesc = -{ - name : "nsXPCDispTestMethods", - cid : CLSID_nsXPCDispTestMethods, - progid : ProgID_nsXPCDispTestMethods, - scriptable : true, - methods : - [ - "NoParameters", "ReturnBSTR", "ReturnI4", - "ReturnUI1", "ReturnI2", "ReturnR4", "ReturnR8", "ReturnBool", - "ReturnIDispatch", "ReturnError", "ReturnDate", - "ReturnIUnknown", "ReturnI1", "ReturnUI2", "ReturnUI4", - "ReturnInt", "ReturnUInt", "TakesBSTR", "TakesI4", "TakesUI1", - "TakesI2", "TakesR4", "TakesR8", "TakesBool", - "TakesIDispatch", "TakesError", "TakesDate", "TakesIUnknown", - "TakesI1", "TakesUI2", "TakesUI4", "TakesInt", "TakesUInt", - "OutputsBSTR", "OutputsI4", "OutputsUI1", "OutputsI2", - "OutputsR4", "OutputsR8", "OutputsBool", "OutputsIDispatch", - "OutputsError", "OutputsDate", "OutputsIUnknown", "OutputsI1", - "OutputsUI2", "OutputsUI4", "InOutsBSTR", "InOutsI4", - "InOutsUI1", "InOutsI2", "InOutsR4", "InOutsR8", "InOutsBool", - "InOutsIDispatch", "InOutsError", "InOutsDate", - "InOutsIUnknown", "InOutsI1", "InOutsUI2", "InOutsUI4", - "InOutsInt", "InOutsUInt", "OneParameterWithReturn", - "StringInputAndReturn", "IDispatchInputAndReturn", - "TwoParameters", "TwelveInParameters", "TwelveOutParameters", - "TwelveStrings", "TwelveOutStrings", "TwelveIDispatch", - "TwelveOutIDispatch", "CreateError" - ] -}; - -var CLSID_nsXPCDispTestArrays = "{AB085C43-C619-48C8-B68C-C495BDE12DFB}"; -var ProgID_nsXPCDispTestArrays = "XPCIDispatchTest.nsXPCDispTestArrays.1"; -var nsXPCDispTestArraysDesc = -{ - name : "nsXPCDispTestArrays", - cid : CLSID_nsXPCDispTestArrays, - progid : ProgID_nsXPCDispTestArrays, - scriptable : true, - methods : - [ - "ReturnSafeArray", "ReturnSafeArrayBSTR", "ReturnSafeArrayIDispatch", - "TakesSafeArray", "TakesSafeArrayBSTR", "TakesSafeArrayIDispatch", - "InOutSafeArray", "InOutSafeArrayBSTR", "InOutSafeArrayIDispatch" - ] -}; - - -var CLSID_nsXPCDispTestNoIDispatch = "{7414404F-A4CC-4E3C-9B32-BB20CB22F541}"; -var ProgID_nsXPCDispTestNoIDispatch = "XPCIDispatchTest.nsXPCDispTestNoIDispatch.1"; - -var CLSID_nsXPCDispTestNoScript = "{F8D54F00-4FC4-4731-B467-10F1CB8DB0AD}"; -var ProgID_nsXPCDispTestNoScript = "XPCIDispatchTest.nsXPCDispTestNoScript.1"; - -var CLSID_nsXPCDispTestProperties = "{D8B4265B-1768-4CA9-A285-7CCAEEB51C74}"; -var ProgID_nsXPCDispTestProperties = "XPCIDispatchTest.nsXPCDispTestProperties.1"; -var nsXPCDispTestPropertiesDesc = -{ - name : "nsXPCDispTestProperties", - cid : CLSID_nsXPCDispTestProperties, - progid : ProgID_nsXPCDispTestProperties, - scriptable : true, - methods : - [ - "Short", "Long", "Float", "Double", "Currency", - "Date", "String", "DispatchPtr", "SCode", "Boolean", "Variant", - "COMPtr", "Char" - ] -}; - -var CLSID_nsXPCDispTestScriptOn = "{2A06373F-3E61-4882-A3D7-A104F70B09ED}"; -var ProgID_nsXPCDispTestScriptOn = "XPCIDispatchTest.nsXPCDispTestScriptOn.1"; -var nsXPCDispTestScriptOnDesc = -{ - name : "nsXPCDispTestScriptOn", - cid : CLSID_nsXPCDispTestScriptOn, - progid : ProgID_nsXPCDispTestScriptOn, - scriptable : true, - methods : [ ] -}; - -var CLSID_nsXPCDispTestScriptOff = "{959CD122-9826-4757-BA09-DE327D55F9E7}"; -var ProgID_nsXPCDispTestScriptOff = "XPCIDispatchTest.nsXPCDispTestScriptOff.1"; -var nsXPCDispTestScriptOffDesc = -{ - name : "nsXPCDispTestScriptOff", - cid : CLSID_nsXPCDispTestScriptOff, - progid : ProgID_nsXPCDispTestScriptOff, - scriptable : false, - methods : [ ] -}; - -var CLSID_nsXPCDispTestWrappedJS = "{EAEE6BB2-C005-4B91-BCA7-6613236F6F69}"; -var ProgID_nsXPCDispTestWrappedJS = "XPCIDispatchTest.nsXPCDispTestWrappedJS.1"; -var nsXPCDispTestWrappedJSDesc = -{ - name : "nsXPCDispTestWrappedJS", - cid : CLSID_nsXPCDispTestWrappedJS, - progid : ProgID_nsXPCDispTestWrappedJS, - scriptable : true, - methods : - [ - "TestParamTypes" - ] -}; - -// create list of COM components -var objectsDesc = -[ - nsXPCDispSimpleDesc, - nsXPCDispTestMethodsDesc, - nsXPCDispTestArraysDesc, - nsXPCDispTestPropertiesDesc, - nsXPCDispTestScriptOnDesc, - nsXPCDispTestScriptOffDesc, - nsXPCDispTestWrappedJSDesc -]; - -function findProp(prop, array, marked) -{ - len = array.length; - for (index = 0; index < len; ++index) - { - if (prop == array[index]) - { - marked[index] = true; - return true; - } - } - return false; -} - -function compareObject(obj, objDesc, testName) -{ - if (obj == undefined) - { - reportFailure("compareObject passed an invalid object"); - return; - } - var marked = new Array(); - for (prop in obj) - { - printDebug("Found " + prop); - reportCompare( - true, - findProp(prop, objDesc.methods, marked), - testName + ": " + prop + " exists on " + objDesc.name + ", but was not expected"); - } - len = objDesc.methods.length; - for (var index = 0; index < len; ++index) - { - reportCompare( - true, - marked[index], - testName + ": " + objDesc.methods[index] + " does not exist on " + objDesc.name); - } -} - -function compareExpression(expression, expectedResult, testName) -{ - if (VERBOSE && (typeof testName != "undefined")) - printStatus(testName + " - evaluating:" + expression); - - try - { - reportCompare( - expectedResult, - eval(expression), - testName); - } - catch (e) - { - reportFailure(expression + " generated the following exception:" + e.toString()); - } -} - -var callStack = new Array(); - -/* - * Report a failure in the 'accepted' manner - */ -function reportFailure (msg) -{ - var lines = msg.split ("\n"); - var l; - var funcName = currentFunc(); - var prefix = (funcName) ? "[reported from " + funcName + "] ": ""; - - for (var i=0; i&1" : ""; - -# command line option defaults -my $opt_suite_path; -my $opt_trace = 0; -my $opt_classpath = ""; -my $opt_rhino_opt = 0; -my $opt_rhino_ms = 0; -my @opt_engine_list; -my $opt_engine_type = ""; -my $opt_engine_params = ""; -my $opt_user_output_file = 0; -my $opt_output_file = ""; -my @opt_test_list_files; -my @opt_neg_list_files; -my $opt_shell_path = ""; -my $opt_java_path = ""; -my $opt_bug_url = "http://bugzilla.mozilla.org/show_bug.cgi?id="; -my $opt_console_failures = 0; -my $opt_lxr_url = "http://lxr.mozilla.org/mozilla/source/js/tests/"; -my $opt_exit_munge = ($os_type ne "MAC") ? 1 : 0; - -# command line option definition -my $options = "b=s bugurl>b c=s classpath>c e=s engine>e f=s file>f " . - "h help>h i j=s javapath>j k confail>k l=s list>l L=s neglist>L " . - "o=s opt>o p=s testpath>p s=s shellpath>s t trace>t u=s lxrurl>u " . - "x noexitmunge>x"; - -if ($os_type eq "MAC") { - $opt_suite_path = `directory`; - $opt_suite_path =~ s/[\n\r]//g; - $opt_suite_path .= ":"; -} else { - $opt_suite_path = "./"; -} - -&parse_args; - -my $user_exit = 0; -my ($engine_command, $html, $failures_reported, $tests_completed, - $exec_time_string); -my @failed_tests; -my @test_list = &get_test_list; - -if ($#test_list == -1) { - die ("Nothing to test.\n"); -} - -if ($unixish) { - # on unix, ^C pauses the tests, and gives the user a chance to quit but - # report on what has been done, to just quit, or to continue (the - # interrupted test will still be skipped.) - # windows doesn't handle the int handler they way we want it to, - # so don't even pretend to let the user continue. - $SIG{INT} = 'int_handler'; -} - -&main; - -#End. - -sub main { - my $start_time; - - while ($opt_engine_type = pop (@opt_engine_list)) { - dd ("Testing engine '$opt_engine_type'"); - - $engine_command = &get_engine_command; - $html = ""; - @failed_tests = (); - $failures_reported = 0; - $tests_completed = 0; - $start_time = time; - - - &execute_tests (@test_list); - - my $exec_time = (time - $start_time); - my $exec_hours = int($exec_time / 60 / 60); - $exec_time -= $exec_hours * 60 * 60; - my $exec_mins = int($exec_time / 60); - $exec_time -= $exec_mins * 60; - my $exec_secs = ($exec_time % 60); - - if ($exec_hours > 0) { - $exec_time_string = "$exec_hours hours, $exec_mins minutes, " . - "$exec_secs seconds"; - } elsif ($exec_mins > 0) { - $exec_time_string = "$exec_mins minutes, $exec_secs seconds"; - } else { - $exec_time_string = "$exec_secs seconds"; - } - - if (!$opt_user_output_file) { - $opt_output_file = &get_tempfile_name; - } - - &write_results; - - } -} - -sub execute_tests { - my (@test_list) = @_; - my ($test, $shell_command, $line, @output, $path); - my $file_param = " -f "; - my ($last_suite, $last_test_dir); - - &status ("Executing " . ($#test_list + 1) . " test(s)."); - - foreach $test (@test_list) { - my ($suite, $test_dir, $test_file) = split($path_sep, $test); - # *-n.js is a negative test, expect exit code 3 (runtime error) - my $expected_exit = ($test =~ /\-n\.js$/) ? 3 : 0; - my ($got_exit, $exit_signal); - my $failure_lines; - my $bug_number; - my $status_lines; - - # user selected [Q]uit from ^C handler. - if ($user_exit) { - return; - } - - # Append the shell.js files to the shell_command if they're there. - # (only check for their existence if the suite or test_dir has changed - # since the last time we looked.) - if ($last_suite ne $suite || $last_test_dir ne $test_dir) { - $shell_command = &xp_path($engine_command); - - $path = &xp_path($opt_suite_path . $suite . "/shell.js"); - if (-f $path) { - $shell_command .= $file_param . $path; - } - - $path = &xp_path($opt_suite_path . $suite . "/" . - $test_dir . "/shell.js"); - if (-f $path) { - $shell_command .= $file_param . $path; - } - - $last_suite = $suite; - $last_test_dir = $test_dir; - } - - $path = &xp_path($opt_suite_path . $test); - &dd ("executing: " . $shell_command . $file_param . $path); - - open (OUTPUT, $shell_command . $file_param . $path . - $redirect_command . " |"); - @output = ; - close (OUTPUT); - - @output = grep (!/js\>/, @output); - - if ($opt_exit_munge == 1) { - # signal information in the lower 8 bits, exit code above that - $got_exit = ($? >> 8); - $exit_signal = ($? & 255); - } else { - # user says not to munge the exit code - $got_exit = $?; - $exit_signal = 0; - } - - $failure_lines = ""; - $bug_number = ""; - $status_lines = ""; - - foreach $line (@output) { - - # watch for testcase to proclaim what exit code it expects to - # produce (0 by default) - if ($line =~ /expect(ed)?\s*exit\s*code\s*\:?\s*(\d+)/i) { - $expected_exit = $2; - &dd ("Test case expects exit code $expected_exit"); - } - - # watch for failures - if ($line =~ /failed!/i) { - $failure_lines .= $line; - } - - # and watch for bugnumbers - # XXX This only allows 1 bugnumber per testfile, should be - # XXX modified to allow for multiple. - if ($line =~ /bugnumber\s*\:?\s*(.*)/i) { - $1 =~ /(\n+)/; - $bug_number = $1; - } - - # and watch for status - if ($line =~ /status/i) { - $status_lines .= $line; - } - - } - - if (!@output) { - @output = ("Testcase produced no output!"); - } - - if ($got_exit != $expected_exit) { - # full testcase output dumped on mismatched exit codes, - &report_failure ($test, "Expected exit code " . - "$expected_exit, got $got_exit\n" . - "Testcase terminated with signal $exit_signal\n" . - "Complete testcase output was:\n" . - join ("\n",@output), $bug_number); - } elsif ($failure_lines) { - # only offending lines if exit codes matched - &report_failure ($test, "$status_lines\n". - "Failure messages were:\n$failure_lines", - $bug_number); - } - - &dd ("exit code $got_exit, exit signal $exit_signal."); - - $tests_completed++; - } -} - -sub write_results { - my ($list_name, $neglist_name); - my $completion_date = localtime; - my $failure_pct = int(($failures_reported / $tests_completed) * 10000) / - 100; - &dd ("Writing output to $opt_output_file."); - - if ($#opt_test_list_files == -1) { - $list_name = "All tests"; - } elsif ($#opt_test_list_files < 10) { - $list_name = join (", ", @opt_test_list_files); - } else { - $list_name = "($#opt_test_list_files test files specified)"; - } - - if ($#opt_neg_list_files == -1) { - $neglist_name = "(none)"; - } elsif ($#opt_test_list_files < 10) { - $neglist_name = join (", ", @opt_neg_list_files); - } else { - $neglist_name = "($#opt_neg_list_files skip files specified)"; - } - - open (OUTPUT, "> $opt_output_file") || - die ("Could not create output file $opt_output_file"); - - print OUTPUT - ("\n" . - "Test results, $opt_engine_type\n" . - "\n" . - "\n" . - "\n" . - "

Test results, $opt_engine_type


\n" . - "

\n" . - "Test List: $list_name
\n" . - "Skip List: $neglist_name
\n" . - ($#test_list + 1) . " test(s) selected, $tests_completed test(s) " . - "completed, $failures_reported failures reported " . - "($failure_pct% failed)
\n" . - "Engine command line: $engine_command
\n" . - "OS type: $os_type
\n"); - - if ($opt_engine_type =~ /^rhino/) { - open (JAVAOUTPUT, $opt_java_path . "java -fullversion " . - $redirect_command . " |"); - print OUTPUT ; - print OUTPUT "
"; - close (JAVAOUTPUT); - } - - print OUTPUT - ("Testcase execution time: $exec_time_string.
\n" . - "Tests completed on $completion_date.

\n"); - - if ($failures_reported > 0) { - print OUTPUT - ("[ Failure Details | " . - "Retest List | " . - "Test Selection Page ]
\n" . - "


\n" . - "\n" . - "

Failure Details


\n
" . - $html . - "
\n[ Top of Page | " . - "Top of Failures ]
\n" . - "
\n" . - "\n" . - "

Retest List


\n" . - "
\n" .
-           "# Retest List, $opt_engine_type, " .
-           "generated $completion_date.\n" .
-           "# Original test base was: $list_name.\n" .
-           "# $tests_completed of " . ($#test_list + 1) .
-           " test(s) were completed, " .
-           "$failures_reported failures reported.\n" .
-           join ("\n", @failed_tests) .
-           "
\n" . - "[ Top of Page | " . - "Top of Retest List ]
\n"); - } else { - print OUTPUT - ("

Whoop-de-doo, nothing failed!

\n"); - } - - print OUTPUT ""; - - close (OUTPUT); - - &status ("Wrote results to '$opt_output_file'."); - - if ($opt_console_failures) { - &status ("$failures_reported test(s) failed"); - } - -} - -sub parse_args { - my ($option, $value, $lastopt); - - &dd ("checking command line options."); - - Getopt::Mixed::init ($options); - $Getopt::Mixed::order = $Getopt::Mixed::RETURN_IN_ORDER; - - while (($option, $value) = nextOption()) { - - if ($option eq "b") { - &dd ("opt: setting bugurl to '$value'."); - $opt_bug_url = $value; - - } elsif ($option eq "c") { - &dd ("opt: setting classpath to '$value'."); - $opt_classpath = $value; - - } elsif (($option eq "e") || (($option eq "") && ($lastopt eq "e"))) { - &dd ("opt: adding engine $value."); - push (@opt_engine_list, $value); - - } elsif ($option eq "f") { - if (!$value) { - die ("Output file cannot be null.\n"); - } - &dd ("opt: setting output file to '$value'."); - $opt_user_output_file = 1; - $opt_output_file = $value; - - } elsif ($option eq "h") { - &usage; - - } elsif ($option eq "j") { - if (!($value =~ /[\/\\]$/)) { - $value .= "/"; - } - &dd ("opt: setting java path to '$value'."); - $opt_java_path = $value; - - } elsif ($option eq "k") { - &dd ("opt: displaying failures on console."); - $opt_console_failures=1; - - } elsif ($option eq "l" || (($option eq "") && ($lastopt eq "l"))) { - $option = "l"; - &dd ("opt: adding test list '$value'."); - push (@opt_test_list_files, $value); - - } elsif ($option eq "L" || (($option eq "") && ($lastopt eq "L"))) { - $option = "L"; - &dd ("opt: adding negative list '$value'."); - push (@opt_neg_list_files, $value); - - } elsif ($option eq "o") { - $opt_engine_params = $value; - &dd ("opt: setting engine params to '$opt_engine_params'."); - - } elsif ($option eq "p") { - $opt_suite_path = $value; - - if ($os_type eq "MAC") { - if (!($opt_suite_path =~ /\:$/)) { - $opt_suite_path .= ":"; - } - } else { - if (!($opt_suite_path =~ /[\/\\]$/)) { - $opt_suite_path .= "/"; - } - } - - &dd ("opt: setting suite path to '$opt_suite_path'."); - - } elsif ($option eq "s") { - $opt_shell_path = $value; - &dd ("opt: setting shell path to '$opt_shell_path'."); - - } elsif ($option eq "t") { - &dd ("opt: tracing output. (console failures at no extra charge.)"); - $opt_console_failures = 1; - $opt_trace = 1; - - } elsif ($option eq "u") { - &dd ("opt: setting lxr url to '$value'."); - $opt_lxr_url = $value; - - } elsif ($option eq "x") { - &dd ("opt: turning off exit munging."); - $opt_exit_munge = 0; - - } else { - &usage; - } - - $lastopt = $option; - - } - - Getopt::Mixed::cleanup(); - - if ($#opt_engine_list == -1) { - die "You must select a shell to test in.\n"; - } - -} - -# -# print the arguments that this script expects -# -sub usage { - print STDERR - ("\nusage: $0 [] \n" . - "(-b|--bugurl) Bugzilla URL.\n" . - " (default is $opt_bug_url)\n" . - "(-c|--classpath) Classpath (Rhino only.)\n" . - "(-e|--engine) ... Specify the type of engine(s) to test.\n" . - " is one or more of\n" . - " (smopt|smdebug|xpcshell|" . - "rhino|rhinoi|rhinoms|rhinomsi|rhino9|rhinoms9).\n" . - "(-f|--file) Redirect output to file named .\n" . - " (default is " . - "results--.html)\n" . - "(-h|--help) Print this message.\n" . - "(-j|--javapath) Location of java executable.\n" . - "(-k|--confail) Log failures to console (also.)\n" . - "(-l|--list) ... List of tests to execute.\n" . - "(-L|--neglist) ... List of tests to skip.\n" . - "(-o|--opt) Options to pass to the JavaScript engine.\n" . - " (Make sure to quote them!)\n" . - "(-p|--testpath) Root of the test suite. (default is ./)\n" . - "(-s|--shellpath) Location of JavaScript shell.\n" . - "(-t|--trace) Trace script execution.\n" . - "(-u|--lxrurl) Complete URL to tests subdirectory on lxr.\n" . - " (default is $opt_lxr_url)\n" . - "(-x|--noexitmunge) Don't do exit code munging (try this if it\n" . - " seems like your exit codes are turning up\n" . - " as exit signals.)\n"); - exit (1); - -} - -# -# get the shell command used to start the (either) engine -# -sub get_engine_command { - - my $retval; - - if ($opt_engine_type eq "rhino") { - &dd ("getting rhino engine command."); - $opt_rhino_opt = 0; - $opt_rhino_ms = 0; - $retval = &get_rhino_engine_command; - } elsif ($opt_engine_type eq "rhinoi") { - &dd ("getting rhinoi engine command."); - $opt_rhino_opt = -1; - $opt_rhino_ms = 0; - $retval = &get_rhino_engine_command; - } elsif ($opt_engine_type eq "rhino9") { - &dd ("getting rhino engine command."); - $opt_rhino_opt = 9; - $opt_rhino_ms = 0; - $retval = &get_rhino_engine_command; - } elsif ($opt_engine_type eq "rhinoms") { - &dd ("getting rhinoms engine command."); - $opt_rhino_opt = 0; - $opt_rhino_ms = 1; - $retval = &get_rhino_engine_command; - } elsif ($opt_engine_type eq "rhinomsi") { - &dd ("getting rhinomsi engine command."); - $opt_rhino_opt = -1; - $opt_rhino_ms = 1; - $retval = &get_rhino_engine_command; - } elsif ($opt_engine_type eq "rhinoms9") { - &dd ("getting rhinomsi engine command."); - $opt_rhino_opt = 9; - $opt_rhino_ms = 1; - $retval = &get_rhino_engine_command; - } elsif ($opt_engine_type eq "xpcshell") { - &dd ("getting xpcshell engine command."); - $retval = &get_xpc_engine_command; - } elsif ($opt_engine_type =~ /^sm(opt|debug)$/) { - &dd ("getting spidermonkey engine command."); - $retval = &get_sm_engine_command; - } elsif ($opt_engine_type =~ /^ep(opt|debug)$/) { - &dd ("getting epimetheus engine command."); - $retval = &get_ep_engine_command; - } else { - die ("Unknown engine type selected, '$opt_engine_type'.\n"); - } - - $retval .= " $opt_engine_params"; - - &dd ("got '$retval'"); - - return $retval; - -} - -# -# get the shell command used to run rhino -# -sub get_rhino_engine_command { - my $retval = $opt_java_path . ($opt_rhino_ms ? "jview " : "java "); - - if ($opt_shell_path) { - $opt_classpath = ($opt_classpath) ? - $opt_classpath . ":" . $opt_shell_path : - $opt_shell_path; - } - - if ($opt_classpath) { - $retval .= ($opt_rhino_ms ? "/cp:p" : "-classpath") . " $opt_classpath "; - } - - $retval .= "org.mozilla.javascript.tools.shell.Main"; - - if ($opt_rhino_opt) { - $retval .= " -opt $opt_rhino_opt"; - } - - return $retval; - -} - -# -# get the shell command used to run xpcshell -# -sub get_xpc_engine_command { - my $retval; - my $m5_home = @ENV{"MOZILLA_FIVE_HOME"} || - die ("You must set MOZILLA_FIVE_HOME to use the xpcshell" , - (!$unixish) ? "." : ", also " . - "setting LD_LIBRARY_PATH to the same directory may get rid of " . - "any 'library not found' errors.\n"); - - if (($unixish) && (!@ENV{"LD_LIBRARY_PATH"})) { - print STDERR "-#- WARNING: LD_LIBRARY_PATH is not set, xpcshell may " . - "not be able to find the required components.\n"; - } - - if (!($m5_home =~ /[\/\\]$/)) { - $m5_home .= "/"; - } - - $retval = $m5_home . "xpcshell"; - - if ($os_type eq "WIN") { - $retval .= ".exe"; - } - - $retval = &xp_path($retval); - - if (($os_type ne "MAC") && !(-x $retval)) { - # mac doesn't seem to deal with -x correctly - die ($retval . " is not a valid executable on this system.\n"); - } - - return $retval; - -} - -# -# get the shell command used to run spidermonkey -# -sub get_sm_engine_command { - my $retval; - - # Look for Makefile.ref style make first. - # (On Windows, spidermonkey can be made by two makefiles, each putting the - # executable in a diferent directory, under a different name.) - - if ($opt_shell_path) { - # if the user provided a path to the shell, return that. - $retval = $opt_shell_path; - - } else { - - if ($os_type eq "MAC") { - $retval = $opt_suite_path . ":src:macbuild:JS"; - } else { - $retval = $opt_suite_path . "../src/"; - opendir (SRC_DIR_FILES, $retval); - my @src_dir_files = readdir(SRC_DIR_FILES); - closedir (SRC_DIR_FILES); - - my ($dir, $object_dir); - my $pattern = ($opt_engine_type eq "smdebug") ? - 'DBG.OBJ' : 'OPT.OBJ'; - - # scan for the first directory matching - # the pattern expected to hold this type (debug or opt) of engine - foreach $dir (@src_dir_files) { - if ($dir =~ $pattern) { - $object_dir = $dir; - last; - } - } - - if (!$object_dir && $os_type ne "WIN") { - die ("Could not locate an object directory in $retval " . - "matching the pattern *$pattern. Have you built the " . - "engine?\n"); - } - - if (!(-x $retval . $object_dir . "/js.exe") && ($os_type eq "WIN")) { - # On windows, you can build with js.mak as well as Makefile.ref - # (Can you say WTF boys and girls? I knew you could.) - # So, if the exe the would have been built by Makefile.ref isn't - # here, check for the js.mak version before dying. - if ($opt_shell_path) { - $retval = $opt_shell_path; - if (!($retval =~ /[\/\\]$/)) { - $retval .= "/"; - } - } else { - if ($opt_engine_type eq "smopt") { - $retval = "../src/Release/"; - } else { - $retval = "../src/Debug/"; - } - } - - $retval .= "jsshell.exe"; - - } else { - $retval .= $object_dir . "/js"; - if ($os_type eq "WIN") { - $retval .= ".exe"; - } - } - } # mac/ not mac - - $retval = &xp_path($retval); - - } # (user provided a path) - - - if (($os_type ne "MAC") && !(-x $retval)) { - # mac doesn't seem to deal with -x correctly - die ($retval . " is not a valid executable on this system.\n"); - } - - return $retval; - -} - -# -# get the shell command used to run epimetheus -# -sub get_ep_engine_command { - my $retval; - - if ($opt_shell_path) { - # if the user provided a path to the shell, return that - - $retval = $opt_shell_path; - - } else { - my $dir; - my $os; - my $debug; - my $opt; - my $exe; - - $dir = $opt_suite_path . "../../js2/src/"; - - if ($os_type eq "MAC") { - # - # On the Mac, the debug and opt builds lie in the same directory - - # - $os = "macbuild:"; - $debug = ""; - $opt = ""; - $exe = "JS2"; - } elsif ($os_type eq "WIN") { - $os = "winbuild/Epimetheus/"; - $debug = "Debug/"; - $opt = "Release/"; - $exe = "Epimetheus.exe"; - } else { - $os = ""; - $debug = ""; - $opt = ""; # <<<----- XXX THIS IS NOT RIGHT! CHANGE IT! - $exe = "epimetheus"; - } - - - if ($opt_engine_type eq "epdebug") { - $retval = $dir . $os . $debug . $exe; - } else { - $retval = $dir . $os . $opt . $exe; - } - - $retval = &xp_path($retval); - - }# (user provided a path) - - - if (($os_type ne "MAC") && !(-x $retval)) { - # mac doesn't seem to deal with -x correctly - die ($retval . " is not a valid executable on this system.\n"); - } - - return $retval; -} - -sub get_os_type { - - if ("\n" eq "\015") { - return "MAC"; - } - - my $uname = `uname -a`; - - if ($uname =~ /WIN/) { - $uname = "WIN"; - } else { - chop $uname; - } - - &dd ("get_os_type returning '$uname'."); - return $uname; - -} - -sub get_test_list { - my @test_list; - my @neg_list; - - if ($#opt_test_list_files > -1) { - my $list_file; - - &dd ("getting test list from user specified source."); - - foreach $list_file (@opt_test_list_files) { - push (@test_list, &expand_user_test_list($list_file)); - } - } else { - &dd ("no list file, groveling in '$opt_suite_path'."); - - @test_list = &get_default_test_list($opt_suite_path); - } - - if ($#opt_neg_list_files > -1) { - my $list_file; - my $orig_size = $#test_list + 1; - my $actually_skipped; - - &dd ("getting negative list from user specified source."); - - foreach $list_file (@opt_neg_list_files) { - push (@neg_list, &expand_user_test_list($list_file)); - } - - @test_list = &subtract_arrays (\@test_list, \@neg_list); - - $actually_skipped = $orig_size - ($#test_list + 1); - - &dd ($actually_skipped . " of " . $orig_size . - " tests will be skipped."); - &dd ((($#neg_list + 1) - $actually_skipped) . " skip tests were " . - "not actually part of the test list."); - - } - - - # Don't run any shell.js files as tests; they are only utility files - @test_list = grep (!/shell\.js$/, @test_list); - - return @test_list; - -} - -# -# reads $list_file, storing non-comment lines into an array. -# lines in the form suite_dir/[*] or suite_dir/test_dir/[*] are expanded -# to include all test files under the specified directory -# -sub expand_user_test_list { - my ($list_file) = @_; - my @retval = (); - - # - # Trim off the leading path separator that begins relative paths on the Mac. - # Each path will get concatenated with $opt_suite_path, which ends in one. - # - # Also note: - # - # We will call expand_test_list_entry(), which does pattern-matching on $list_file. - # This will make the pattern-matching the same as it would be on Linux/Windows - - # - if ($os_type eq "MAC") { - $list_file =~ s/^$path_sep//; - } - - if ($list_file =~ /\.js$/ || -d $opt_suite_path . $list_file) { - - push (@retval, &expand_test_list_entry($list_file)); - - } else { - - open (TESTLIST, $list_file) || - die("Error opening test list file '$list_file': $!\n"); - - while () { - s/\r*\n*$//; - if (!(/\s*\#/)) { - # It's not a comment, so process it - push (@retval, &expand_test_list_entry($_)); - } - } - - close (TESTLIST); - - } - - return @retval; - -} - - -# -# Currently expect all paths to be RELATIVE to the top-level tests directory. -# One day, this should be improved to allow absolute paths as well - -# -sub expand_test_list_entry { - my ($entry) = @_; - my @retval; - - if ($entry =~ /\.js$/) { - # it's a regular entry, add it to the list - if (-f $opt_suite_path . $entry) { - push (@retval, $entry); - } else { - status ("testcase '$entry' not found."); - } - } elsif ($entry =~ /(.*$path_sep[^\*][^$path_sep]*)$path_sep?\*?$/) { - # Entry is in the form suite_dir/test_dir[/*] - # so iterate all tests under it - my $suite_and_test_dir = $1; - my @test_files = &get_js_files ($opt_suite_path . - $suite_and_test_dir); - my $i; - - foreach $i (0 .. $#test_files) { - $test_files[$i] = $suite_and_test_dir . $path_sep . - $test_files[$i]; - } - - splice (@retval, $#retval + 1, 0, @test_files); - - } elsif ($entry =~ /([^\*][^$path_sep]*)$path_sep?\*?$/) { - # Entry is in the form suite_dir[/*] - # so iterate all test dirs and tests under it - my $suite = $1; - my @test_dirs = &get_subdirs ($opt_suite_path . $suite); - my $test_dir; - - foreach $test_dir (@test_dirs) { - my @test_files = &get_js_files ($opt_suite_path . $suite . - $path_sep . $test_dir); - my $i; - - foreach $i (0 .. $#test_files) { - $test_files[$i] = $suite . $path_sep . $test_dir . $path_sep . - $test_files[$i]; - } - - splice (@retval, $#retval + 1, 0, @test_files); - } - - } else { - die ("Don't know what to do with list entry '$entry'.\n"); - } - - return @retval; - -} - -# -# Grovels through $suite_path, searching for *all* test files. Used when the -# user doesn't supply a test list. -# -sub get_default_test_list { - my ($suite_path) = @_; - my @suite_list = &get_subdirs($suite_path); - my $suite; - my @retval; - - foreach $suite (@suite_list) { - my @test_dir_list = get_subdirs ($suite_path . $suite); - my $test_dir; - - foreach $test_dir (@test_dir_list) { - my @test_list = get_js_files ($suite_path . $suite . $path_sep . - $test_dir); - my $test; - - foreach $test (@test_list) { - $retval[$#retval + 1] = $suite . $path_sep . $test_dir . - $path_sep . $test; - } - } - } - - return @retval; - -} - -# -# generate an output file name based on the date -# -sub get_tempfile_name { - my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = - &get_padded_time (localtime); - my $rv; - - if ($os_type ne "MAC") { - $rv = "results-" . $year . "-" . $mon . "-" . $mday . "-" . $hour . - $min . $sec . "-" . $opt_engine_type; - } else { - $rv = "res-" . $year . $mon . $mday . $hour . $min . $sec . "-" . - $opt_engine_type - } - - return $rv . ".html"; -} - -sub get_padded_time { - my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = @_; - - $mon++; - $mon = &zero_pad($mon); - $year += 1900; - $mday= &zero_pad($mday); - $sec = &zero_pad($sec); - $min = &zero_pad($min); - $hour = &zero_pad($hour); - - return ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst); - -} - -sub zero_pad { - my ($string) = @_; - - $string = ($string < 10) ? "0" . $string : $string; - return $string; -} - -sub subtract_arrays { - my ($whole_ref, $part_ref) = @_; - my @whole = @$whole_ref; - my @part = @$part_ref; - my $line; - - foreach $line (@part) { - @whole = grep (!/$line/, @whole); - } - - return @whole; - -} - -# -# Convert unix path to mac style. -# -sub unix_to_mac { - my ($path) = @_; - my @path_elements = split ("/", $path); - my $rv = ""; - my $i; - - foreach $i (0 .. $#path_elements) { - if ($path_elements[$i] eq ".") { - if (!($rv =~ /\:$/)) { - $rv .= ":"; - } - } elsif ($path_elements[$i] eq "..") { - if (!($rv =~ /\:$/)) { - $rv .= "::"; - } else { - $rv .= ":"; - } - } elsif ($path_elements[$i] ne "") { - $rv .= $path_elements[$i] . ":"; - } - - } - - $rv =~ s/\:$//; - - return $rv; -} - -# -# Convert unix path to win style. -# -sub unix_to_win { - my ($path) = @_; - - if ($path_sep ne $win_sep) { - $path =~ s/$path_sep/$win_sep/g; - } - - return $path; -} - -# -# Windows shells require "/" or "\" as path separator. -# Find out the one used in the current Windows shell. -# -sub get_win_sep { - my $path = $ENV{"PATH"} || $ENV{"Path"} || $ENV{"path"}; - $path =~ /\\|\//; - return $&; -} - -# -# Convert unix path to correct style based on platform. -# -sub xp_path { - my ($path) = @_; - - if ($os_type eq "MAC") { - return &unix_to_mac($path); - } elsif($os_type eq "WIN") { - return &unix_to_win($path); - } else { - return $path; - } -} - -# -# given a directory, return an array of all subdirectories -# -sub get_subdirs { - my ($dir) = @_; - my @subdirs; - - if ($os_type ne "MAC") { - if (!($dir =~ /\/$/)) { - $dir = $dir . "/"; - } - } else { - if (!($dir =~ /\:$/)) { - $dir = $dir . ":"; - } - } - opendir (DIR, $dir) || die ("couldn't open directory $dir: $!"); - my @testdir_contents = readdir(DIR); - closedir(DIR); - - foreach (@testdir_contents) { - if ((-d ($dir . $_)) && ($_ ne 'CVS') && ($_ ne '.') && ($_ ne '..')) { - @subdirs[$#subdirs + 1] = $_; - } - } - - return @subdirs; -} - -# -# given a directory, return an array of all the js files that are in it. -# -sub get_js_files { - my ($test_subdir) = @_; - my (@js_file_array, @subdir_files); - - opendir (TEST_SUBDIR, $test_subdir) || die ("couldn't open directory " . - "$test_subdir: $!"); - @subdir_files = readdir(TEST_SUBDIR); - closedir( TEST_SUBDIR ); - - foreach (@subdir_files) { - if ($_ =~ /\.js$/) { - $js_file_array[$#js_file_array+1] = $_; - } - } - - return @js_file_array; -} - -sub report_failure { - my ($test, $message, $bug_number) = @_; - my $bug_line = ""; - - $failures_reported++; - - $message =~ s/\n+/\n/g; - $test =~ s/\:/\//g; - - if ($opt_console_failures) { - if($bug_number) { - print STDERR ("*-* Testcase $test failed:\nBug Number $bug_number". - "\n$message\n"); - } else { - print STDERR ("*-* Testcase $test failed:\n$message\n"); - } - } - - $message =~ s/\n/
\n/g; - $html .= ""; - - if ($bug_number) { - $bug_line = "". - "Bug Number $bug_number"; - } - - if ($opt_lxr_url) { - $test =~ /\/?([^\/]+\/[^\/]+\/[^\/]+)$/; - $test = $1; - $html .= "
". - "Testcase $1 " . - "failed $bug_line
\n"; - } else { - $html .= "
". - "Testcase $test failed $bug_line
\n"; - } - - $html .= " [ "; - if ($failures_reported > 1) { - $html .= "" . - "Previous Failure | "; - } - - $html .= "" . - "Next Failure | " . - "Top of Page ]
\n" . - "$message
\n"; - - @failed_tests[$#failed_tests + 1] = $test; - -} - -sub dd { - - if ($opt_trace) { - print ("-*- ", @_ , "\n"); - } - -} - -sub status { - - print ("-#- ", @_ , "\n"); - -} - -sub int_handler { - my $resp; - - do { - print ("\n*** User Break: Just [Q]uit, Quit and [R]eport, [C]ontinue ?"); - $resp = ; - } until ($resp =~ /[QqRrCc]/); - - if ($resp =~ /[Qq]/) { - print ("User Exit. No results were generated.\n"); - exit; - } elsif ($resp =~ /[Rr]/) { - $user_exit = 1; - } - -} diff --git a/js/src/xpconnect/tests/mochitest/Makefile.in b/js/src/xpconnect/tests/mochitest/Makefile.in index d3ede465a78..3002f519895 100644 --- a/js/src/xpconnect/tests/mochitest/Makefile.in +++ b/js/src/xpconnect/tests/mochitest/Makefile.in @@ -89,6 +89,7 @@ _TEST_FILES = bug500931_helper.html \ test2_bug629331.html \ test_bug618017.html \ test_bug636097.html \ + test_bug661980.html \ test_bug650273.html \ file_bug650273.html \ file_bug658560.html \ diff --git a/js/src/xpconnect/tests/mochitest/test_bug661980.html b/js/src/xpconnect/tests/mochitest/test_bug661980.html new file mode 100644 index 00000000000..f258cc9ddc1 --- /dev/null +++ b/js/src/xpconnect/tests/mochitest/test_bug661980.html @@ -0,0 +1,62 @@ + + + + + Test for Bug 661980 + + + + + +Mozilla Bug 661980 +

+ +
+
+
+ + diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 8d9d2addab3..94d3b66170f 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -134,9 +134,11 @@ public: ContainerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager, nsIFrame* aContainerFrame, - ContainerLayer* aContainerLayer) : + ContainerLayer* aContainerLayer, + const FrameLayerBuilder::ContainerParameters& aParameters) : mBuilder(aBuilder), mManager(aManager), mContainerFrame(aContainerFrame), mContainerLayer(aContainerLayer), + mParameters(aParameters), mNextFreeRecycledThebesLayer(0), mNextFreeRecycledColorLayer(0), mNextFreeRecycledImageLayer(0), mInvalidateAllThebesContent(PR_FALSE) { @@ -202,7 +204,7 @@ protected: * @param aSolidColor if non-null, the visible area of the item is * a constant color given by *aSolidColor */ - void Accumulate(nsDisplayListBuilder* aBuilder, + void Accumulate(ContainerState* aState, nsDisplayItem* aItem, const nsIntRect& aVisibleRect, const nsIntRect& aDrawRect, @@ -288,6 +290,7 @@ protected: */ FrameLayerBuilder::Clip mImageClip; }; + friend class ThebesLayerData; /** * Grab the next recyclable ThebesLayer, or create one if there are no @@ -362,6 +365,7 @@ protected: LayerManager* mManager; nsIFrame* mContainerFrame; ContainerLayer* mContainerLayer; + FrameLayerBuilder::ContainerParameters mParameters; /** * The region of ThebesLayers that should be invalidated every time * we recycle one. @@ -389,13 +393,30 @@ class ThebesDisplayItemLayerUserData : public LayerUserData { public: ThebesDisplayItemLayerUserData() : - mForcedBackgroundColor(NS_RGBA(0,0,0,0)) {} + mForcedBackgroundColor(NS_RGBA(0,0,0,0)), + mXScale(1.f), mYScale(1.f), + mActiveScrolledRootPosition(0, 0) {} /** * A color that should be painted over the bounds of the layer's visible * region before any other content is painted. */ nscolor mForcedBackgroundColor; + /** + * The resolution scale used. + */ + float mXScale, mYScale; + /** + * We try to make 0,0 of the ThebesLayer be the top-left of the + * border-box of the "active scrolled root" frame (i.e. the nearest ancestor + * frame for the display items that is being actively scrolled). But + * we force the ThebesLayer transform to be an integer translation, and we may + * have a resolution scale, so we have to snap the ThebesLayer transform, so + * 0,0 may not be exactly the top-left of the active scrolled root. Here we + * store the coordinates in ThebesLayer space of the top-left of the + * active scrolled root. + */ + gfxPoint mActiveScrolledRootPosition; }; /** @@ -792,6 +813,7 @@ ContainerState::CreateOrRecycleThebesLayer(nsIFrame* aActiveScrolledRoot) { // We need a new thebes layer nsRefPtr layer; + ThebesDisplayItemLayerUserData* data; if (mNextFreeRecycledThebesLayer < mRecycledThebesLayers.Length()) { // Recycle a layer layer = mRecycledThebesLayers[mNextFreeRecycledThebesLayer]; @@ -800,6 +822,10 @@ ContainerState::CreateOrRecycleThebesLayer(nsIFrame* aActiveScrolledRoot) // reapply any necessary clipping. layer->SetClipRect(nsnull); + data = static_cast + (layer->GetUserData(&gThebesDisplayItemLayerUserData)); + NS_ASSERTION(data, "Recycled ThebesLayers must have user data"); + // This gets called on recycled ThebesLayers that are going to be in the // final layer tree, so it's a convenient time to invalidate the // content that changed where we don't know what ThebesLayer it belonged @@ -808,7 +834,9 @@ ContainerState::CreateOrRecycleThebesLayer(nsIFrame* aActiveScrolledRoot) // transform. See nsGfxScrollFrame::InvalidateInternal, where // we ensure that mInvalidThebesContent is updated according to the // scroll position as of the most recent paint. - if (mInvalidateAllThebesContent) { + if (mInvalidateAllThebesContent || + data->mXScale != mParameters.mXScale || + data->mYScale != mParameters.mYScale) { nsIntRect invalidate = layer->GetValidRegion().GetBounds(); layer->InvalidateRegion(invalidate); } else { @@ -824,21 +852,43 @@ ContainerState::CreateOrRecycleThebesLayer(nsIFrame* aActiveScrolledRoot) if (!layer) return nsnull; // Mark this layer as being used for Thebes-painting display items - layer->SetUserData(&gThebesDisplayItemLayerUserData, - new ThebesDisplayItemLayerUserData()); + data = new ThebesDisplayItemLayerUserData(); + layer->SetUserData(&gThebesDisplayItemLayerUserData, data); } + data->mXScale = mParameters.mXScale; + data->mYScale = mParameters.mYScale; + // If we're in a transformed subtree, but no ancestor transform is actively + // changing, we'll use the residual translation when drawing into the + // ThebesLayer to ensure that snapping exactly matches the ideal transform. + layer->SetAllowResidualTranslation( + mParameters.mInTransformedSubtree && !mParameters.mInActiveTransformedSubtree); mBuilder->LayerBuilder()->SaveLastPaintOffset(layer); // Set up transform so that 0,0 in the Thebes layer corresponds to the // (pixel-snapped) top-left of the aActiveScrolledRoot. nsPoint offset = mBuilder->ToReferenceFrame(aActiveScrolledRoot); - nsIntPoint pixOffset = offset.ToNearestPixels( - aActiveScrolledRoot->PresContext()->AppUnitsPerDevPixel()); + nscoord appUnitsPerDevPixel = aActiveScrolledRoot->PresContext()->AppUnitsPerDevPixel(); + gfxPoint scaledOffset( + NSAppUnitsToDoublePixels(offset.x, appUnitsPerDevPixel)*mParameters.mXScale, + NSAppUnitsToDoublePixels(offset.y, appUnitsPerDevPixel)*mParameters.mYScale); + nsIntPoint pixOffset(NSToIntRoundUp(scaledOffset.x), NSToIntRoundUp(scaledOffset.y)); gfxMatrix matrix; matrix.Translate(gfxPoint(pixOffset.x, pixOffset.y)); layer->SetTransform(gfx3DMatrix::From2D(matrix)); + // Calculate exact position of the top-left of the active scrolled root. + // This might not be 0,0 due to the snapping in ScaleToNearestPixels. + gfxPoint activeScrolledRootTopLeft = scaledOffset - matrix.GetTranslation(); + // If it has changed, then we need to invalidate the entire layer since the + // pixels in the layer buffer have the content at a (subpixel) offset + // from what we need. + if (activeScrolledRootTopLeft != data->mActiveScrolledRootPosition) { + data->mActiveScrolledRootPosition = activeScrolledRootTopLeft; + nsIntRect invalidate = layer->GetValidRegion().GetBounds(); + layer->InvalidateRegion(invalidate); + } + return layer.forget(); } @@ -914,13 +964,14 @@ ContainerState::FindOpaqueBackgroundColorFor(PRInt32 aThebesLayerIndex) // The layer doesn't intersect our target, ignore it and move on continue; } - + // The candidate intersects our target. If any layer has a solid-color // area behind our target, this must be it. Scan its display items. nsPresContext* presContext = mContainerFrame->PresContext(); nscoord appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel(); nsRect rect = target->mVisibleRegion.GetBounds().ToAppUnits(appUnitsPerDevPixel); + rect.ScaleInverseRoundOut(mParameters.mXScale, mParameters.mYScale); return mBuilder->LayerBuilder()-> FindOpaqueColorCovering(mBuilder, candidate->mLayer, rect); } @@ -960,9 +1011,9 @@ ContainerState::PopThebesLayerData() if (data->mImageClip.mHaveClipRect) { nsPresContext* presContext = mContainerFrame->PresContext(); nscoord appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel(); - nsIntRect clip = data->mImageClip.mClipRect.ToNearestPixels(appUnitsPerDevPixel); - imageLayer->IntersectClipRect( - data->mImageClip.mClipRect.ToNearestPixels(appUnitsPerDevPixel)); + nsIntRect clip = data->mImageClip.mClipRect.ScaleToNearestPixels( + mParameters.mXScale, mParameters.mYScale, appUnitsPerDevPixel); + imageLayer->IntersectClipRect(clip); } layer = imageLayer; } else { @@ -1101,20 +1152,22 @@ WindowHasTransparency(nsDisplayListBuilder* aBuilder) } void -ContainerState::ThebesLayerData::Accumulate(nsDisplayListBuilder* aBuilder, +ContainerState::ThebesLayerData::Accumulate(ContainerState* aState, nsDisplayItem* aItem, const nsIntRect& aVisibleRect, const nsIntRect& aDrawRect, const FrameLayerBuilder::Clip& aClip) { nscolor uniformColor; - PRBool isUniform = aItem->IsUniform(aBuilder, &uniformColor); + PRBool isUniform = aItem->IsUniform(aState->mBuilder, &uniformColor); // Some display items have to exist (so they can set forceTransparentSurface // below) but don't draw anything. They'll return true for isUniform but // a color with opacity 0. if (!isUniform || NS_GET_A(uniformColor) > 0) { if (isUniform && - aItem->GetBounds(aBuilder).ToInsidePixels(AppUnitsPerDevPixel(aItem)).Contains(aVisibleRect)) { + aItem->GetBounds(aState->mBuilder).ScaleToInsidePixels( + aState->mParameters.mXScale, aState->mParameters.mYScale, + AppUnitsPerDevPixel(aItem)).Contains(aVisibleRect)) { if (mVisibleRegion.IsEmpty()) { // This color is all we have mSolidColor = uniformColor; @@ -1147,7 +1200,7 @@ ContainerState::ThebesLayerData::Accumulate(nsDisplayListBuilder* aBuilder, } PRBool forceTransparentSurface = PR_FALSE; - nsRegion opaque = aItem->GetOpaqueRegion(aBuilder, &forceTransparentSurface); + nsRegion opaque = aItem->GetOpaqueRegion(aState->mBuilder, &forceTransparentSurface); if (!opaque.IsEmpty()) { nsRegionRectIterator iter(opaque); nscoord appUnitsPerDevPixel = AppUnitsPerDevPixel(aItem); @@ -1157,25 +1210,28 @@ ContainerState::ThebesLayerData::Accumulate(nsDisplayListBuilder* aBuilder, // is a large opaque background at the bottom of z-order (e.g., // a canvas background), so we need to make sure that the first rect // we see doesn't get discarded. - nsIntRect rect = aClip.ApproximateIntersect(*r).ToInsidePixels(appUnitsPerDevPixel); + nsIntRect rect = aClip.ApproximateIntersect(*r).ScaleToInsidePixels( + aState->mParameters.mXScale, aState->mParameters.mYScale, + appUnitsPerDevPixel); nsIntRegion tmp; tmp.Or(mOpaqueRegion, rect); // Opaque display items in chrome documents whose window is partially // transparent are always added to the opaque region. This helps ensure // that we get as much subpixel-AA as possible in the chrome. if (tmp.GetNumRects() <= 4 || - (WindowHasTransparency(aBuilder) && + (WindowHasTransparency(aState->mBuilder) && aItem->GetUnderlyingFrame()->PresContext()->IsChrome())) { mOpaqueRegion = tmp; } } } - nsRect componentAlpha = aItem->GetComponentAlphaBounds(aBuilder); + nsRect componentAlpha = aItem->GetComponentAlphaBounds(aState->mBuilder); componentAlpha.IntersectRect(componentAlpha, aItem->GetVisibleRect()); if (!componentAlpha.IsEmpty()) { nscoord appUnitsPerDevPixel = AppUnitsPerDevPixel(aItem); - if (!mOpaqueRegion.Contains(componentAlpha.ToOutsidePixels(appUnitsPerDevPixel))) { - if (SuppressComponentAlpha(aBuilder, aItem, componentAlpha)) { + if (!mOpaqueRegion.Contains(componentAlpha.ScaleToOutsidePixels( + aState->mParameters.mXScale, aState->mParameters.mYScale, appUnitsPerDevPixel))) { + if (SuppressComponentAlpha(aState->mBuilder, aItem, componentAlpha)) { aItem->DisableComponentAlpha(); } else { mNeedComponentAlpha = PR_TRUE; @@ -1244,7 +1300,7 @@ ContainerState::FindThebesLayerFor(nsDisplayItem* aItem, layer = thebesLayerData->mLayer; } - thebesLayerData->Accumulate(mBuilder, aItem, aVisibleRect, aDrawRect, aClip); + thebesLayerData->Accumulate(this, aItem, aVisibleRect, aDrawRect, aClip); return layer.forget(); } @@ -1257,7 +1313,8 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder, // using a temporary BasicLayerManager. nsRefPtr tempManager = new BasicLayerManager(); tempManager->BeginTransactionWithTarget(aContext); - nsRefPtr layer = aItem->BuildLayer(aBuilder, tempManager); + nsRefPtr layer = + aItem->BuildLayer(aBuilder, tempManager, FrameLayerBuilder::ContainerParameters()); if (!layer) { tempManager->EndTransaction(nsnull, nsnull); return; @@ -1308,13 +1365,15 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList, "items in a container layer should all have the same app units per dev pixel"); nsIntRect itemVisibleRect = - item->GetVisibleRect().ToOutsidePixels(appUnitsPerDevPixel); + item->GetVisibleRect().ScaleToOutsidePixels( + mParameters.mXScale, mParameters.mYScale, appUnitsPerDevPixel); nsRect itemContent = item->GetBounds(mBuilder); if (aClip.mHaveClipRect) { itemContent.IntersectRect(aClip.mClipRect, itemContent); } mBounds.UnionRect(mBounds, itemContent); - nsIntRect itemDrawRect = itemContent.ToOutsidePixels(appUnitsPerDevPixel); + nsIntRect itemDrawRect = itemContent.ScaleToOutsidePixels( + mParameters.mXScale, mParameters.mYScale, appUnitsPerDevPixel); LayerState layerState = item->GetLayerState(mBuilder, mManager); nsIFrame* activeScrolledRoot = @@ -1346,12 +1405,21 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList, aClip.RemoveRoundedCorners(); // Just use its layer. - nsRefPtr ownLayer = item->BuildLayer(mBuilder, mManager); + nsRefPtr ownLayer = item->BuildLayer(mBuilder, mManager, mParameters); if (!ownLayer) { InvalidateForLayerChange(item, ownLayer); continue; } + // If it's not a ContainerLayer, we need to apply the scale transform + // ourselves. + if (!ownLayer->AsContainerLayer()) { + // The layer's current transform is applied first, then the result is scaled. + gfx3DMatrix transform = ownLayer->GetTransform()* + gfx3DMatrix::Scale(mParameters.mXScale, mParameters.mYScale, 1.0f); + ownLayer->SetTransform(transform); + } + ownLayer->SetIsFixedPosition(!nsLayoutUtils::ScrolledByViewportScrolling( activeScrolledRoot, mBuilder)); @@ -1362,7 +1430,8 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList, // It has its own layer. Update that layer's clip and visible rects. if (aClip.mHaveClipRect) { ownLayer->IntersectClipRect( - aClip.mClipRect.ToNearestPixels(appUnitsPerDevPixel)); + aClip.mClipRect.ScaleToNearestPixels( + mParameters.mXScale, mParameters.mYScale, appUnitsPerDevPixel)); } ThebesLayerData* data = GetTopThebesLayerData(); if (data) { @@ -1422,17 +1491,25 @@ ContainerState::InvalidateForLayerChange(nsDisplayItem* aItem, Layer* aNewLayer) // in the container via regular frame invalidation. nsRect bounds = aItem->GetBounds(mBuilder); PRInt32 appUnitsPerDevPixel = AppUnitsPerDevPixel(aItem); - nsIntRect r = bounds.ToOutsidePixels(appUnitsPerDevPixel); ThebesLayer* t = oldLayer->AsThebesLayer(); if (t) { - InvalidatePostTransformRegion(t, r, + ThebesDisplayItemLayerUserData* data = + static_cast(t->GetUserData(&gThebesDisplayItemLayerUserData)); + // Note that whenever the layer's scale changes, we invalidate the whole thing, + // so it doesn't matter whether we are using the old scale at last paint + // or a new scale here + InvalidatePostTransformRegion(t, + bounds.ScaleToOutsidePixels(data->mXScale, data->mYScale, appUnitsPerDevPixel), mBuilder->LayerBuilder()->GetLastPaintOffset(t)); } if (aNewLayer) { ThebesLayer* newLayer = aNewLayer->AsThebesLayer(); if (newLayer) { - InvalidatePostTransformRegion(newLayer, r, + ThebesDisplayItemLayerUserData* data = + static_cast(newLayer->GetUserData(&gThebesDisplayItemLayerUserData)); + InvalidatePostTransformRegion(newLayer, + bounds.ScaleToOutsidePixels(data->mXScale, data->mYScale, appUnitsPerDevPixel), GetTranslationForThebesLayer(newLayer)); } } @@ -1596,12 +1673,75 @@ ContainerState::Finish(PRUint32* aTextContentFlags) *aTextContentFlags = textContentFlags; } +static FrameLayerBuilder::ContainerParameters +ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder, + nsIFrame* aContainerFrame, + const gfx3DMatrix* aTransform, + const FrameLayerBuilder::ContainerParameters& aIncomingScale, + ContainerLayer* aLayer) +{ + gfx3DMatrix transform = + gfx3DMatrix::Scale(aIncomingScale.mXScale, aIncomingScale.mYScale, 1.0); + if (aTransform) { + // aTransform is applied first, then the scale is applied to the result + transform = (*aTransform)*transform; + } + + gfxMatrix transform2d; + gfxSize scale; + // Only fiddle with scale factors for the retaining layer manager, since + // it only matters for retained layers + if (aLayerBuilder->GetRetainingLayerManager() == aLayer->Manager() && + transform.Is2D(&transform2d)) { + //Scale factors are normalized to a power of 2 to reduce the number of resolution changes + scale = transform2d.ScaleFactors(PR_TRUE); + // For frames with a changing transform that's not just a translation, + // round scale factors up to nearest power-of-2 boundary so that we don't + // keep having to redraw the content as it scales up and down. Rounding up to nearest + // power-of-2 boundary ensures we never scale up, only down --- avoiding + // jaggies. It also ensures we never scale down by more than a factor of 2, + // avoiding bad downscaling quality. + gfxMatrix frameTransform; + if (aContainerFrame->AreLayersMarkedActive(nsChangeHint_UpdateTransformLayer) && + aTransform && + (!aTransform->Is2D(&frameTransform) || frameTransform.HasNonTranslationOrFlip())) { + scale.width = gfxUtils::ClampToScaleFactor(scale.width); + scale.height = gfxUtils::ClampToScaleFactor(scale.height); + } else { + // XXX Do we need to move nearly-integer values to integers here? + } + // If the scale factors are too small, just use 1.0. The content is being + // scaled out of sight anyway. + if (fabs(scale.width) < 1e-8 || fabs(scale.height) < 1e-8) { + scale.width = scale.height = 1.0; + } + } else { + scale = gfxSize(1.0, 1.0); + } + + // Apply the inverse of our resolution-scale before the rest of our transform + transform = gfx3DMatrix::Scale(1.0/scale.width, 1.0/scale.height, 1.0)*transform; + aLayer->SetTransform(transform); + + FrameLayerBuilder::ContainerParameters + result(scale.width, scale.height, aIncomingScale); + if (aTransform) { + result.mInTransformedSubtree = true; + if (aContainerFrame->AreLayersMarkedActive(nsChangeHint_UpdateTransformLayer)) { + result.mInActiveTransformedSubtree = true; + } + } + return result; +} + already_AddRefed FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder, LayerManager* aManager, nsIFrame* aContainerFrame, nsDisplayItem* aContainerItem, - const nsDisplayList& aChildren) + const nsDisplayList& aChildren, + const ContainerParameters& aParameters, + const gfx3DMatrix* aTransform) { FrameProperties props = aContainerFrame->Properties(); PRUint32 containerDisplayItemKey = @@ -1646,7 +1786,11 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder, return containerLayer.forget(); } - ContainerState state(aBuilder, aManager, aContainerFrame, containerLayer); + ContainerParameters scaleParameters = + ChooseScaleAndSetTransform(this, aContainerFrame, aTransform, aParameters, + containerLayer); + ContainerState state(aBuilder, aManager, aContainerFrame, containerLayer, + scaleParameters); nscoord appUnitsPerDevPixel = aContainerFrame->PresContext()->AppUnitsPerDevPixel(); if (aManager == mRetainingManager) { @@ -1666,7 +1810,8 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder, nsPoint offset = offsetAtLastPaint ? *offsetAtLastPaint : currentOffset; invalidThebesContent->MoveBy(offset); state.SetInvalidThebesContent(invalidThebesContent-> - ToOutsidePixels(appUnitsPerDevPixel)); + ScaleToOutsidePixels(scaleParameters.mXScale, scaleParameters.mYScale, + appUnitsPerDevPixel)); // We have to preserve the current contents of invalidThebesContent // because there might be multiple container layers for the same // frame and we need to invalidate the ThebesLayer children of all @@ -1691,14 +1836,18 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder, nsRect bounds = state.GetChildrenBounds(); NS_ASSERTION(bounds.IsEqualInterior(aChildren.GetBounds(aBuilder)), "Wrong bounds"); - nsIntRect pixBounds = bounds.ToOutsidePixels(appUnitsPerDevPixel); + nsIntRect pixBounds = + bounds.ScaleToOutsidePixels(scaleParameters.mXScale, scaleParameters.mYScale, + appUnitsPerDevPixel); containerLayer->SetVisibleRegion(pixBounds); // Make sure that rounding the visible region out didn't add any area // we won't paint - if (aChildren.IsOpaque() && !aChildren.NeedsTransparentSurface() && - bounds.Contains(pixBounds.ToAppUnits(appUnitsPerDevPixel))) { - // Clear CONTENT_COMPONENT_ALPHA - flags = Layer::CONTENT_OPAQUE; + if (aChildren.IsOpaque() && !aChildren.NeedsTransparentSurface()) { + bounds.ScaleRoundIn(scaleParameters.mXScale, scaleParameters.mYScale); + if (bounds.Contains(pixBounds.ToAppUnits(appUnitsPerDevPixel))) { + // Clear CONTENT_COMPONENT_ALPHA + flags = Layer::CONTENT_OPAQUE; + } } containerLayer->SetContentFlags(flags); @@ -1822,6 +1971,34 @@ FrameLayerBuilder::GetDedicatedLayer(nsIFrame* aFrame, PRUint32 aDisplayItemKey) return nsnull; } +/* + * A note on residual transforms: + * + * In a transformed subtree we sometimes apply the ThebesLayer's + * "residual transform" when drawing content into the ThebesLayer. + * This is a translation by components in the range [-0.5,0.5) provided + * by the layer system; applying the residual transform followed by the + * transforms used by layer compositing ensures that the subpixel alignment + * of the content of the ThebesLayer exactly matches what it would be if + * we used cairo/Thebes to draw directly to the screen without going through + * retained layer buffers. + * + * The visible and valid regions of the ThebesLayer are computed without + * knowing the residual transform (because we don't know what the residual + * transform is going to be until we've built the layer tree!). So we have to + * consider whether content painted in the range [x, xmost) might be painted + * outside the visible region we computed for that content. The visible region + * would be [floor(x), ceil(xmost)). The content would be rendered at + * [x + r, xmost + r), where -0.5 <= r < 0.5. So some half-rendered pixels could + * indeed fall outside the computed visible region, which is not a big deal; + * similar issues already arise when we snap cliprects to nearest pixels. + * Note that if the rendering of the content is snapped to nearest pixels --- + * which it often is --- then the content is actually rendered at + * [snap(x + r), snap(xmost + r)). It turns out that floor(x) <= snap(x + r) + * and ceil(xmost) >= snap(xmost + r), so the rendering of snapped content + * always falls within the visible region we computed. + */ + /* static */ void FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer, gfxContext* aContext, @@ -1864,15 +2041,22 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer, // ThebesLayer gfxContextMatrixAutoSaveRestore saveMatrix(aContext); nsIntPoint offset = GetTranslationForThebesLayer(aLayer); - aContext->Translate(-gfxPoint(offset.x, offset.y)); + // Apply the residual transform if it has been enabled, to ensure that + // snapping when we draw into aContext exactly matches the ideal transform. + // See above for why this is OK. + aContext->Translate(aLayer->GetResidualTranslation() - gfxPoint(offset.x, offset.y)); + aContext->Scale(userData->mXScale, userData->mYScale); nsPresContext* presContext = containerLayerFrame->PresContext(); PRInt32 appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel(); - nsRect r = (aRegionToInvalidate.GetBounds() + offset). - ToAppUnits(appUnitsPerDevPixel); - containerLayerFrame->InvalidateWithFlags(r, - nsIFrame::INVALIDATE_NO_THEBES_LAYERS | - nsIFrame::INVALIDATE_EXCLUDE_CURRENT_PAINT); + if (!aRegionToInvalidate.IsEmpty()) { + nsRect r = (aRegionToInvalidate.GetBounds() + offset). + ToAppUnits(appUnitsPerDevPixel); + r.ScaleInverseRoundOut(userData->mXScale, userData->mYScale); + containerLayerFrame->InvalidateWithFlags(r, + nsIFrame::INVALIDATE_NO_THEBES_LAYERS | + nsIFrame::INVALIDATE_EXCLUDE_CURRENT_PAINT); + } PRUint32 i; // Update visible regions. We need perform visibility analysis again @@ -1883,6 +2067,7 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer, nsRegion visible = aRegionToDraw.ToAppUnits(appUnitsPerDevPixel); visible.MoveBy(NSIntPixelsToAppUnits(offset.x, appUnitsPerDevPixel), NSIntPixelsToAppUnits(offset.y, appUnitsPerDevPixel)); + visible.ScaleInverseRoundOut(userData->mXScale, userData->mYScale); for (i = items.Length(); i > 0; --i) { ClippedDisplayItem* cdi = &items[i - 1]; @@ -1989,7 +2174,7 @@ void FrameLayerBuilder::DumpRetainedLayerTree() { if (mRetainingManager) { - mRetainingManager->Dump(stderr); + mRetainingManager->Dump(stdout); } } #endif diff --git a/layout/base/FrameLayerBuilder.h b/layout/base/FrameLayerBuilder.h index 2339854a8c9..2bcaa773c46 100644 --- a/layout/base/FrameLayerBuilder.h +++ b/layout/base/FrameLayerBuilder.h @@ -93,6 +93,15 @@ enum LayerState { * corresponds to the (pixel-snapped) top-left of the aActiveScrolledRoot. * It sets up ContainerLayers so that 0,0 in the container layer * corresponds to the snapped top-left of the display list reference frame. + * + * When we construct a container layer, we know the transform that will be + * applied to the layer. If the transform scales the content, we can get + * better results when intermediate buffers are used by pushing some scale + * from the container's transform down to the children. For ThebesLayer + * children, the scaling can be achieved by changing the size of the layer + * and drawing into it with increased or decreased resolution. By convention, + * integer types (nsIntPoint/nsIntSize/nsIntRect/nsIntRegion) are all in layer + * coordinates, post-scaling, whereas appunit types are all pre-scaling. */ class FrameLayerBuilder { public: @@ -132,6 +141,22 @@ public: */ void DidEndTransaction(LayerManager* aManager); + struct ContainerParameters { + ContainerParameters() : + mXScale(1), mYScale(1), + mInTransformedSubtree(false), mInActiveTransformedSubtree(false) {} + ContainerParameters(float aXScale, float aYScale) : + mXScale(aXScale), mYScale(aYScale), + mInTransformedSubtree(false), mInActiveTransformedSubtree(false) {} + ContainerParameters(float aXScale, float aYScale, + const ContainerParameters& aParent) : + mXScale(aXScale), mYScale(aYScale), + mInTransformedSubtree(aParent.mInTransformedSubtree), + mInActiveTransformedSubtree(aParent.mInActiveTransformedSubtree) {} + float mXScale, mYScale; + bool mInTransformedSubtree; + bool mInActiveTransformedSubtree; + }; /** * Build a container layer for a display item that contains a child * list, either reusing an existing one or creating a new one. It @@ -146,13 +171,17 @@ public: * Returns a layer with clip rect cleared; it is the * caller's responsibility to add any clip rect. The visible region * is set based on what's in the layer. + * The container layer is transformed by aTransform (if non-null), and + * the result is transformed by the scale factors in aContainerParameters. */ already_AddRefed BuildContainerLayerFor(nsDisplayListBuilder* aBuilder, LayerManager* aManager, nsIFrame* aContainerFrame, nsDisplayItem* aContainerItem, - const nsDisplayList& aChildren); + const nsDisplayList& aChildren, + const ContainerParameters& aContainerParameters, + const gfx3DMatrix* aTransform); /** * Get a retained layer for a display item that needs to create its own diff --git a/layout/base/Makefile.in b/layout/base/Makefile.in index 935006100c8..6fb3d12e419 100644 --- a/layout/base/Makefile.in +++ b/layout/base/Makefile.in @@ -165,6 +165,7 @@ LOCAL_INCLUDES += \ -I$(srcdir)/../../dom/base \ -I$(srcdir)/../../content/html/content/src \ -I$(srcdir)/../../content/svg/content/src \ + -I$(topsrcdir)/xpcom/ds \ -I$(srcdir)/../svg/base/src \ -I$(srcdir)/../mathml \ $(NULL) diff --git a/layout/base/crashtests/480686-1.html b/layout/base/crashtests/480686-1.html new file mode 100644 index 00000000000..8a4ba72d66e --- /dev/null +++ b/layout/base/crashtests/480686-1.html @@ -0,0 +1,13 @@ + + + + + + +
Q
+ + diff --git a/layout/base/crashtests/665837.html b/layout/base/crashtests/665837.html new file mode 100644 index 00000000000..df58b28026a --- /dev/null +++ b/layout/base/crashtests/665837.html @@ -0,0 +1,13 @@ + + +A B +C diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index b8b4a888988..75d1883b173 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -258,9 +258,12 @@ load 471594-1.xhtml load 479114-1.html load 477333-1.xhtml load 477731-1.html +# 479360-1.xhtml will assert 6 times due to bug 439258 and then make the test +# after the test after it also assert 6 times. asserts(6) load 479360-1.xhtml # Bug 439258 -load 481806-1.html -asserts(6) load 483604-1.xhtml # Bug 439258 +load 480686-1.html +asserts(6) load 481806-1.html # Bug 439258 +load 483604-1.xhtml load 485501-1.html load 487544-1.html load 488390-1.xhtml @@ -336,3 +339,4 @@ load 653133-1.html load 663295.html load 663662-1.html load 663662-2.html +load 665837.html diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp index cc7355a6605..a1a325f06af 100644 --- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -796,8 +796,7 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame, /* * If there is a newline in the frame, break the frame after the - * newline, do bidi resolution and repeat until the end of the - * element. + * newline, do bidi resolution and repeat until the last sibling */ ++endLine; @@ -805,17 +804,18 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame, * If the frame ends before the new line, save the text and move * into the next continuation */ + mBuffer.Append(Substring(text, start, + PR_MIN(end, endLine) - start)); while (end < endLine && nextSibling) { - mBuffer.Append(Substring(text, start, end - start)); - AdvanceAndAppendFrame(&frame, aLineIter, &nextSibling); NS_ASSERTION(frame, "Premature end of continuation chain"); frame->GetOffsets(start, end); + mBuffer.Append(Substring(text, start, + PR_MIN(end, endLine) - start)); } - mBuffer.Append(Substring(text, start, endLine - start)); PRBool createdContinuation = PR_FALSE; - if (PRUint32(endLine) < text.Length()) { + if (end >= endLine && PRUint32(endLine) < text.Length()) { /* * Timing is everything here: if the frame already has a bidi * continuation, we need to make the continuation fluid *before* diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 70a7e5976c8..c91c49b81e1 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -1600,8 +1600,6 @@ nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState, nsCounterUseNode* node = new nsCounterUseNode(counters, aContentIndex, type == eStyleContentType_Counters); - if (!node) - return nsnull; nsGenConInitializer* initializer = new nsGenConInitializer(node, counterList, @@ -1621,8 +1619,6 @@ nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState, { nsQuoteNode* node = new nsQuoteNode(type, aContentIndex); - if (!node) - return nsnull; nsGenConInitializer* initializer = new nsGenConInitializer(node, &mQuoteList, @@ -5072,9 +5068,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState PRBool resolveStyle; nsAutoPtr newPendingBinding(new PendingBinding()); - if (!newPendingBinding) { - return; - } + nsresult rv = xblService->LoadBindings(aContent, display->mBinding->GetURI(), display->mBinding->mOriginPrincipal, PR_FALSE, @@ -7689,13 +7683,13 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame, } } if (aChange & nsChangeHint_UpdateOpacityLayer) { - aFrame->MarkLayersActive(); + aFrame->MarkLayersActive(nsChangeHint_UpdateOpacityLayer); aFrame->InvalidateLayer(aFrame->GetVisualOverflowRectRelativeToSelf(), nsDisplayItem::TYPE_OPACITY); } if (aChange & nsChangeHint_UpdateTransformLayer) { - aFrame->MarkLayersActive(); + aFrame->MarkLayersActive(nsChangeHint_UpdateTransformLayer); // Invalidate the old transformed area. The new transformed area // will be invalidated by nsFrame::FinishAndStoreOverflowArea. aFrame->InvalidateTransformLayer(); @@ -9405,10 +9399,6 @@ nsCSSFrameConstructor::CreateNeededTablePseudos(nsFrameConstructorState& aState, wrapperStyle.forget(), PR_TRUE); - if (!newItem) { - return NS_ERROR_OUT_OF_MEMORY; - } - // Here we're cheating a tad... technically, table-internal items should be // inline if aParentFrame is inline, but they'll get wrapped in an // inline-table in the end, so it'll all work out. In any case, arguably diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index c16c7e86de5..7a66e40e6b4 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -856,14 +856,9 @@ private: new FrameConstructionItem(aFCData, aContent, aTag, aNameSpaceID, aPendingBinding, aStyleContext, aSuppressWhiteSpaceOptimizations); - if (item) { - PR_APPEND_LINK(item, &mItems); - ++mItemCount; - ++mDesiredParentCounts[item->DesiredParentType()]; - } else { - // Clean up the style context - nsRefPtr sc(aStyleContext); - } + PR_APPEND_LINK(item, &mItems); + ++mItemCount; + ++mDesiredParentCounts[item->DesiredParentType()]; return item; } diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 5f076c7aaa8..87ad6ceda7e 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -344,11 +344,15 @@ protected: } PRBool AreOnSameLine(nsIFrame* aFrame1, nsIFrame* aFrame2) { - // Assumes that aFrame1 and aFrame2 are both decsendants of mBlockFrame. PRBool isValid1, isValid2; nsBlockInFlowLineIterator it1(mBlockFrame, aFrame1, &isValid1); nsBlockInFlowLineIterator it2(mBlockFrame, aFrame2, &isValid2); - return isValid1 && isValid2 && it1.GetLine() == it2.GetLine(); + return isValid1 && isValid2 && + // Make sure aFrame1 and aFrame2 are in the same continuation of + // mBlockFrame. + it1.GetContainer() == it2.GetContainer() && + // And on the same line in it + it1.GetLine() == it2.GetLine(); } }; @@ -1125,8 +1129,8 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext, skipGfxRect = nsLayoutUtils::RectToGfxRect(paddingRect, twipsPerPixel); } else if (hasBorderRadius) { skipGfxRect.Deflate(gfxMargin( - 0, PR_MAX(borderRadii[C_TL].height, borderRadii[C_TR].height), - 0, PR_MAX(borderRadii[C_BL].height, borderRadii[C_BR].height))); + 0, NS_MAX(borderRadii[C_TL].height, borderRadii[C_TR].height), + 0, NS_MAX(borderRadii[C_BL].height, borderRadii[C_BR].height))); } for (PRUint32 i = shadows->Length(); i > 0; --i) { @@ -1362,8 +1366,8 @@ nsCSSRendering::PaintBoxShadowInner(nsPresContext* aPresContext, gfxRect skipGfxRect = nsLayoutUtils::RectToGfxRect(skipRect, twipsPerPixel); if (hasBorderRadius) { skipGfxRect.Deflate( - gfxMargin(0, PR_MAX(clipRectRadii[C_TL].height, clipRectRadii[C_TR].height), - 0, PR_MAX(clipRectRadii[C_BL].height, clipRectRadii[C_BR].height))); + gfxMargin(0, NS_MAX(clipRectRadii[C_TL].height, clipRectRadii[C_TR].height), + 0, NS_MAX(clipRectRadii[C_BL].height, clipRectRadii[C_BR].height))); } // When there's a blur radius, gfxAlphaBoxBlur leaves the skiprect area @@ -2121,7 +2125,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext, } gradientPattern = new gfxPattern(lineStart.x, lineStart.y, innerRadius, lineStart.x, lineStart.y, outerRadius); - if (gradientPattern && radiusX != radiusY) { + if (radiusX != radiusY) { // Stretch the circles into ellipses vertically by setting a transform // in the pattern. // Recall that this is the transform from user space to pattern space. @@ -2134,7 +2138,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext, gradientPattern->SetMatrix(matrix); } } - if (!gradientPattern || gradientPattern->CairoStatus()) + if (gradientPattern->CairoStatus()) return; // Now set normalized color stops in pattern. diff --git a/layout/base/nsCSSRenderingBorders.cpp b/layout/base/nsCSSRenderingBorders.cpp index f7771e1293f..b633bad00eb 100644 --- a/layout/base/nsCSSRenderingBorders.cpp +++ b/layout/base/nsCSSRenderingBorders.cpp @@ -197,6 +197,7 @@ nsCSSBorderRenderer::nsCSSBorderRenderer(PRInt32 aAppUnitsPerPixel, mOneUnitBorder = CheckFourFloatsEqual(mBorderWidths, 1.0); mNoBorderRadius = AllCornersZeroSize(mBorderRadii); + mAvoidStroke = PR_FALSE; } /* static */ void @@ -560,7 +561,8 @@ nsCSSBorderRenderer::FillSolidBorder(const gfxRect& aOuterRect, // common border styles, such as inset and outset, that are // top-left/bottom-right split. if (aSides == SIDE_BITS_ALL && - CheckFourFloatsEqual(aBorderSizes, aBorderSizes[0])) + CheckFourFloatsEqual(aBorderSizes, aBorderSizes[0]) && + !mAvoidStroke) { gfxRect r(aOuterRect); r.Deflate(aBorderSizes[0] / 2.0); @@ -635,7 +637,7 @@ nsCSSBorderRenderer::FillSolidBorder(const gfxRect& aOuterRect, for (PRUint32 i = 0; i < 4; i++) { if (aSides & (1 << i)) { mContext->NewPath(); - mContext->Rectangle(r[i]); + mContext->Rectangle(r[i], PR_TRUE); mContext->Fill(); } } @@ -1379,22 +1381,29 @@ nsCSSBorderRenderer::DrawBorders() return; } - // round mOuterRect and mInnerRect; they're already an integer - // number of pixels apart and should stay that way after - // rounding. - mOuterRect.Round(); - mInnerRect.Round(); - gfxMatrix mat = mContext->CurrentMatrix(); // Clamp the CTM to be pixel-aligned; we do this only // for translation-only matrices now, but we could do it // if the matrix has just a scale as well. We should not // do it if there's a rotation. - if (!mat.HasNonTranslation()) { + if (mat.HasNonTranslation()) { + if (!mat.HasNonAxisAlignedTransform()) { + // Scale + transform. Avoid stroke fast-paths so that we have a chance + // of snapping to pixel boundaries. + mAvoidStroke = PR_TRUE; + } + } else { mat.x0 = floor(mat.x0 + 0.5); mat.y0 = floor(mat.y0 + 0.5); mContext->SetMatrix(mat); + + // round mOuterRect and mInnerRect; they're already an integer + // number of pixels apart and should stay that way after + // rounding. We don't do this if there's a scale in the current transform + // since this loses information that might be relevant when we're scaling. + mOuterRect.Round(); + mInnerRect.Round(); } PRBool allBordersSameWidth = AllBordersSameWidth(); @@ -1415,7 +1424,8 @@ nsCSSBorderRenderer::DrawBorders() mCompositeColors[0] == NULL && allBordersSameWidth && mBorderStyles[0] == NS_STYLE_BORDER_STYLE_SOLID && - mNoBorderRadius) + mNoBorderRadius && + !mAvoidStroke) { // Very simple case. SetupStrokeStyle(NS_SIDE_TOP); @@ -1432,7 +1442,8 @@ nsCSSBorderRenderer::DrawBorders() allBordersSameWidth && mBorderStyles[0] == NS_STYLE_BORDER_STYLE_DOTTED && mBorderWidths[0] < 3 && - mNoBorderRadius) + mNoBorderRadius && + !mAvoidStroke) { // Very simple case. We draw this rectangular dotted borner without // antialiasing. The dots should be pixel aligned. @@ -1453,7 +1464,8 @@ nsCSSBorderRenderer::DrawBorders() if (allBordersSame && allBordersSameWidth && mCompositeColors[0] == NULL && - mBorderStyles[0] == NS_STYLE_BORDER_STYLE_SOLID) + mBorderStyles[0] == NS_STYLE_BORDER_STYLE_SOLID && + !mAvoidStroke) { NS_FOR_CSS_CORNERS(i) { if (mBorderRadii[i].width <= mBorderWidths[0]) { @@ -1495,13 +1507,15 @@ nsCSSBorderRenderer::DrawBorders() allBordersSameWidth && mCompositeColors[0] == NULL && mBorderWidths[0] == 1 && - mNoBorderRadius) + mNoBorderRadius && + !mAvoidStroke) { DrawSingleWidthSolidBorder(); return; } - if (allBordersSolid && !hasCompositeColors) + if (allBordersSolid && !hasCompositeColors && + !mAvoidStroke) { DrawNoCompositeColorSolidBorder(); return; @@ -1509,7 +1523,8 @@ nsCSSBorderRenderer::DrawBorders() if (allBordersSolid && allBordersSameWidth && - mNoBorderRadius) + mNoBorderRadius && + !mAvoidStroke) { // Easy enough to deal with. DrawRectangularCompositeColors(); diff --git a/layout/base/nsCSSRenderingBorders.h b/layout/base/nsCSSRenderingBorders.h index 96f0099c9aa..7001b562e4c 100644 --- a/layout/base/nsCSSRenderingBorders.h +++ b/layout/base/nsCSSRenderingBorders.h @@ -137,6 +137,7 @@ struct nsCSSBorderRenderer { // calculated values PRPackedBool mOneUnitBorder; PRPackedBool mNoBorderRadius; + PRPackedBool mAvoidStroke; // For all the sides in the bitmask, would they be rendered // in an identical color and style? diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index b73ac3f9a77..fc8f9111e1c 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -632,10 +632,30 @@ nsresult nsCaret::PrimeTimer() return NS_OK; } +void nsCaret::InvalidateTextOverflowBlock() +{ + // If the nearest block has a potential 'text-overflow' marker then + // invalidate it. + if (mLastContent) { + nsIFrame* caretFrame = mLastContent->GetPrimaryFrame(); + if (caretFrame) { + nsIFrame* block = nsLayoutUtils::GetAsBlock(caretFrame) ? caretFrame : + nsLayoutUtils::FindNearestBlockAncestor(caretFrame); + if (block) { + const nsStyleTextReset* style = block->GetStyleTextReset(); + if (style->mTextOverflow.mType != NS_STYLE_TEXT_OVERFLOW_CLIP) { + block->InvalidateOverflowRect(); + } + } + } + } +} //----------------------------------------------------------------------------- void nsCaret::StartBlinking() { + InvalidateTextOverflowBlock(); + if (mReadOnly) { // Make sure the one draw command we use for a readonly caret isn't // done until the selection is set @@ -659,6 +679,8 @@ void nsCaret::StartBlinking() //----------------------------------------------------------------------------- void nsCaret::StopBlinking() { + InvalidateTextOverflowBlock(); + if (mDrawn) // erase the caret if necessary DrawCaret(PR_TRUE); diff --git a/layout/base/nsCaret.h b/layout/base/nsCaret.h index c50e1d4660f..b0a7ba08cbc 100644 --- a/layout/base/nsCaret.h +++ b/layout/base/nsCaret.h @@ -204,6 +204,10 @@ protected: void StartBlinking(); void StopBlinking(); + + // If the nearest block has a potential 'text-overflow' marker then + // invalidate it. + void InvalidateTextOverflowBlock(); PRBool DrawAtPositionWithHint(nsIDOMNode* aNode, PRInt32 aOffset, diff --git a/layout/base/nsCounterManager.cpp b/layout/base/nsCounterManager.cpp index 340075be111..9233376e57a 100644 --- a/layout/base/nsCounterManager.cpp +++ b/layout/base/nsCounterManager.cpp @@ -244,8 +244,6 @@ nsCounterManager::AddResetOrIncrement(nsIFrame *aFrame, PRInt32 aIndex, { nsCounterChangeNode *node = new nsCounterChangeNode(aFrame, aType, aCounterData->mValue, aIndex); - if (!node) - return PR_FALSE; nsCounterList *counterList = CounterListFor(aCounterData->mCounter); if (!counterList) { @@ -277,8 +275,6 @@ nsCounterManager::CounterListFor(const nsSubstring& aCounterName) nsCounterList *counterList; if (!mNames.Get(aCounterName, &counterList)) { counterList = new nsCounterList(); - if (!counterList) - return nsnull; if (!mNames.Put(aCounterName, counterList)) { delete counterList; return nsnull; diff --git a/layout/base/nsDisplayItemTypes.h b/layout/base/nsDisplayItemTypes.h index 512d6e075a5..033ca0fa58a 100644 --- a/layout/base/nsDisplayItemTypes.h +++ b/layout/base/nsDisplayItemTypes.h @@ -66,6 +66,7 @@ enum Type { TYPE_COMBOBOX_FOCUS, TYPE_EVENT_RECEIVER, TYPE_FIELDSET_BORDER_BACKGROUND, + TYPE_FORCEPAINTONSCROLL, TYPE_FRAMESET_BORDER, TYPE_FRAMESET_BLANK, TYPE_HEADER_FOOTER, @@ -95,6 +96,7 @@ enum Type { TYPE_TABLE_BORDER_BACKGROUND, TYPE_TEXT, TYPE_TEXT_DECORATION, + TYPE_TEXT_OVERFLOW, TYPE_TEXT_SHADOW, TYPE_TRANSFORM, TYPE_VIDEO, diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index b9e79e2ed67..81e312727bf 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -200,21 +200,26 @@ static void UnmarkFrameForDisplay(nsIFrame* aFrame) { static void RecordFrameMetrics(nsIFrame* aForFrame, nsIFrame* aScrollFrame, ContainerLayer* aRoot, - nsRect aVisibleRect, - nsRect aViewport, + const nsRect& aVisibleRect, + const nsRect& aViewport, nsRect* aDisplayPort, - ViewID aScrollId) { + ViewID aScrollId, + const nsDisplayItem::ContainerParameters& aContainerParameters) { nsPresContext* presContext = aForFrame->PresContext(); + PRInt32 auPerDevPixel = presContext->AppUnitsPerDevPixel(); - nsIntRect visible = aVisibleRect.ToNearestPixels(presContext->AppUnitsPerDevPixel()); + nsIntRect visible = aVisibleRect.ScaleToNearestPixels( + aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel); aRoot->SetVisibleRegion(nsIntRegion(visible)); FrameMetrics metrics; - PRInt32 auPerDevPixel = presContext->AppUnitsPerDevPixel(); - metrics.mViewport = aViewport.ToNearestPixels(auPerDevPixel); + metrics.mViewport = aViewport.ScaleToNearestPixels( + aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel); + if (aDisplayPort) { - metrics.mDisplayPort = aDisplayPort->ToNearestPixels(auPerDevPixel); + metrics.mDisplayPort = aDisplayPort->ScaleToNearestPixels( + aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel); } nsIScrollableFrame* scrollableFrame = nsnull; @@ -225,16 +230,15 @@ static void RecordFrameMetrics(nsIFrame* aForFrame, nsSize contentSize = scrollableFrame->GetScrollRange().Size() + scrollableFrame->GetScrollPortRect().Size(); - metrics.mContentSize = nsIntSize(NSAppUnitsToIntPixels(contentSize.width, auPerDevPixel), - NSAppUnitsToIntPixels(contentSize.height, auPerDevPixel)); - - metrics.mViewportScrollOffset = - scrollableFrame->GetScrollPosition().ToNearestPixels(auPerDevPixel); + metrics.mContentSize = contentSize.ScaleToNearestPixels( + aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel); + metrics.mViewportScrollOffset = scrollableFrame->GetScrollPosition().ScaleToNearestPixels( + aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel); } else { nsSize contentSize = aForFrame->GetSize(); - metrics.mContentSize = nsIntSize(NSAppUnitsToIntPixels(contentSize.width, auPerDevPixel), - NSAppUnitsToIntPixels(contentSize.height, auPerDevPixel)); + metrics.mContentSize = contentSize.ScaleToNearestPixels( + aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel); } metrics.mScrollId = aScrollId; @@ -570,8 +574,6 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder, return; } layerManager = new BasicLayerManager(); - if (!layerManager) - return; } if (aFlags & PAINT_FLUSH_LAYERS) { @@ -589,14 +591,22 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder, aBuilder->LayerBuilder()->DidBeginRetainedLayerTransaction(layerManager); } - nsRefPtr root = aBuilder->LayerBuilder()-> - BuildContainerLayerFor(aBuilder, layerManager, aForFrame, nsnull, *this); - if (!root) - return; - nsPresContext* presContext = aForFrame->PresContext(); nsIPresShell* presShell = presContext->GetPresShell(); + nsDisplayItem::ContainerParameters containerParameters + (presShell->GetXResolution(), presShell->GetYResolution()); + nsRefPtr root = aBuilder->LayerBuilder()-> + BuildContainerLayerFor(aBuilder, layerManager, aForFrame, nsnull, *this, + containerParameters, nsnull); + if (!root) + return; + // Root is being scaled up by the X/Y resolution. Scale it back down. + gfx3DMatrix rootTransform = root->GetTransform()* + gfx3DMatrix::Scale(1.0f/containerParameters.mXScale, + 1.0f/containerParameters.mYScale, 1.0f); + root->SetTransform(rootTransform); + ViewID id = presContext->IsRootContentDocument() ? FrameMetrics::ROOT_SCROLL_ID : FrameMetrics::NULL_SCROLL_ID; @@ -611,17 +621,8 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder, } RecordFrameMetrics(aForFrame, rootScrollFrame, root, mVisibleRect, mVisibleRect, - (usingDisplayport ? &displayport : nsnull), id); - - // If the layer manager supports resolution scaling, set that up - if (LayerManager::LAYERS_BASIC == layerManager->GetBackendType()) { - BasicLayerManager* basicManager = - static_cast(layerManager.get()); - // This is free if both resolutions are 1.0, or neither resolution - // has changed since the last transaction - basicManager->SetResolution(presShell->GetXResolution(), - presShell->GetYResolution()); - } + (usingDisplayport ? &displayport : nsnull), id, + containerParameters); layerManager->SetRoot(root); aBuilder->LayerBuilder()->WillEndTransaction(layerManager); @@ -1701,9 +1702,11 @@ nsRegion nsDisplayOpacity::GetOpaqueRegion(nsDisplayListBuilder* aBuilder, // nsDisplayOpacity uses layers for rendering already_AddRefed nsDisplayOpacity::BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager) { + LayerManager* aManager, + const ContainerParameters& aContainerParameters) { nsRefPtr layer = aBuilder->LayerBuilder()-> - BuildContainerLayerFor(aBuilder, aManager, mFrame, this, mList); + BuildContainerLayerFor(aBuilder, aManager, mFrame, this, mList, + aContainerParameters, nsnull); if (!layer) return nsnull; @@ -1714,7 +1717,7 @@ nsDisplayOpacity::BuildLayer(nsDisplayListBuilder* aBuilder, nsDisplayItem::LayerState nsDisplayOpacity::GetLayerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager) { - if (mFrame->AreLayersMarkedActive()) + if (mFrame->AreLayersMarkedActive(nsChangeHint_UpdateOpacityLayer)) return LAYER_ACTIVE; nsIFrame* activeScrolledRoot = nsLayoutUtils::GetActiveScrolledRootFor(mFrame, nsnull); @@ -1768,9 +1771,11 @@ nsDisplayOwnLayer::~nsDisplayOwnLayer() { // nsDisplayOpacity uses layers for rendering already_AddRefed nsDisplayOwnLayer::BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager) { + LayerManager* aManager, + const ContainerParameters& aContainerParameters) { nsRefPtr layer = aBuilder->LayerBuilder()-> - BuildContainerLayerFor(aBuilder, aManager, mFrame, this, mList); + BuildContainerLayerFor(aBuilder, aManager, mFrame, this, mList, + aContainerParameters, nsnull); return layer.forget(); } @@ -1833,9 +1838,11 @@ nsDisplayScrollLayer::~nsDisplayScrollLayer() already_AddRefed nsDisplayScrollLayer::BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager) { + LayerManager* aManager, + const ContainerParameters& aContainerParameters) { nsRefPtr layer = aBuilder->LayerBuilder()-> - BuildContainerLayerFor(aBuilder, aManager, mFrame, this, mList); + BuildContainerLayerFor(aBuilder, aManager, mFrame, this, mList, + aContainerParameters, nsnull); // Get the already set unique ID for scrolling this content remotely. // Or, if not set, generate a new ID. @@ -1852,7 +1859,8 @@ nsDisplayScrollLayer::BuildLayer(nsDisplayListBuilder* aBuilder, usingDisplayport = nsLayoutUtils::GetDisplayPort(content, &displayport); } RecordFrameMetrics(mScrolledFrame, mScrollFrame, layer, mVisibleRect, viewport, - (usingDisplayport ? &displayport : nsnull), scrollId); + (usingDisplayport ? &displayport : nsnull), scrollId, + aContainerParameters); return layer.forget(); } @@ -2375,7 +2383,8 @@ nsDisplayTransform::GetResultingTransformMatrix(const nsIFrame* aFrame, } already_AddRefed nsDisplayTransform::BuildLayer(nsDisplayListBuilder *aBuilder, - LayerManager *aManager) + LayerManager *aManager, + const ContainerParameters& aContainerParameters) { gfxMatrix newTransformMatrix = GetResultingTransformMatrix(mFrame, ToReferenceFrame(), @@ -2384,19 +2393,16 @@ already_AddRefed nsDisplayTransform::BuildLayer(nsDisplayListBuilder *aBu if (newTransformMatrix.IsSingular()) return nsnull; - nsRefPtr layer = aBuilder->LayerBuilder()-> - BuildContainerLayerFor(aBuilder, aManager, mFrame, this, *mStoredList.GetList()); - if (!layer) - return nsnull; - - layer->SetTransform(gfx3DMatrix::From2D(newTransformMatrix)); - return layer.forget(); + gfx3DMatrix matrix = gfx3DMatrix::From2D(newTransformMatrix); + return aBuilder->LayerBuilder()-> + BuildContainerLayerFor(aBuilder, aManager, mFrame, this, *mStoredList.GetList(), + aContainerParameters, &matrix); } nsDisplayItem::LayerState nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager) { - if (mFrame->AreLayersMarkedActive()) + if (mFrame->AreLayersMarkedActive(nsChangeHint_UpdateTransformLayer)) return LAYER_ACTIVE; nsIFrame* activeScrolledRoot = nsLayoutUtils::GetActiveScrolledRootFor(mFrame, nsnull); @@ -2737,3 +2743,20 @@ PRBool nsDisplaySVGEffects::TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayIt other->mBounds + other->mEffectsFrame->GetOffsetTo(mEffectsFrame)); return PR_TRUE; } + +nsDisplayForcePaintOnScroll::nsDisplayForcePaintOnScroll( + nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) + : nsDisplayItem(aBuilder, aFrame) { + MOZ_COUNT_CTOR(nsDisplayForcePaintOnScroll); +} + +#ifdef NS_BUILD_REFCNT_LOGGING +nsDisplayForcePaintOnScroll::~nsDisplayForcePaintOnScroll() { + MOZ_COUNT_DTOR(nsDisplayForcePaintOnScroll); +} +#endif + +PRBool nsDisplayForcePaintOnScroll::IsVaryingRelativeToMovingFrame( + nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) { + return PR_TRUE; +} diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 790c6f35109..3bf936d3017 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -187,7 +187,7 @@ public: * @return the root of the display list's frame (sub)tree, whose origin * establishes the coordinate system for the display list */ - nsIFrame* ReferenceFrame() { return mReferenceFrame; } + nsIFrame* ReferenceFrame() const { return mReferenceFrame; } /** * @return a point pt such that adding pt to a coordinate relative to aFrame * makes it relative to ReferenceFrame(), i.e., returns @@ -195,7 +195,7 @@ public: * the appunits of aFrame. It may be optimized to be faster than * aFrame->GetOffsetToCrossDoc(ReferenceFrame()) (but currently isn't). */ - nsPoint ToReferenceFrame(const nsIFrame* aFrame) { + nsPoint ToReferenceFrame(const nsIFrame* aFrame) const { return aFrame->GetOffsetToCrossDoc(ReferenceFrame()); } /** @@ -636,7 +636,7 @@ public: * that wrap item lists, this could return nsnull because there is no single * underlying frame; for leaf items it will never return nsnull. */ - inline nsIFrame* GetUnderlyingFrame() { return mFrame; } + inline nsIFrame* GetUnderlyingFrame() const { return mFrame; } /** * The default bounds is the frame border rect. * @return a rectangle relative to aBuilder->ReferenceFrame() that @@ -721,9 +721,15 @@ public: * * The caller (nsDisplayList) is responsible for setting the visible * region of the layer. + * + * @param aContainerParameters should be passed to + * FrameLayerBuilder::BuildContainerLayerFor if a ContainerLayer is + * constructed. */ + typedef mozilla::FrameLayerBuilder::ContainerParameters ContainerParameters; virtual already_AddRefed BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager) + LayerManager* aManager, + const ContainerParameters& aContainerParameters) { return nsnull; } /** @@ -807,7 +813,7 @@ public: /** * Returns the result of aBuilder->ToReferenceFrame(GetUnderlyingFrame()) */ - const nsPoint& ToReferenceFrame() { + const nsPoint& ToReferenceFrame() const { NS_ASSERTION(mFrame, "No frame?"); return mToReferenceFrame; } @@ -1753,7 +1759,8 @@ public: virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder, PRBool* aForceTransparentSurface = nsnull); virtual already_AddRefed BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager); + LayerManager* aManager, + const ContainerParameters& aContainerParameters); virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager); virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, @@ -1776,7 +1783,8 @@ public: #endif virtual already_AddRefed BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager); + LayerManager* aManager, + const ContainerParameters& aContainerParameters); virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager) { @@ -1837,7 +1845,8 @@ public: #endif virtual already_AddRefed BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager); + LayerManager* aManager, + const ContainerParameters& aContainerParameters); virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, nsRegion* aVisibleRegion, @@ -2098,7 +2107,8 @@ public: virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager); virtual already_AddRefed BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager); + LayerManager* aManager, + const ContainerParameters& aContainerParameters); virtual PRBool ComputeVisibility(nsDisplayListBuilder *aBuilder, nsRegion *aVisibleRegion, const nsRect& aAllowVisibleRegionExpansion); @@ -2177,4 +2187,69 @@ private: nsDisplayWrapList mStoredList; }; +/** + * This class adds basic support for limiting the rendering to the part inside + * the specified edges. It's a base class for the display item classes that + * does the actual work. The two members, mLeftEdge and mRightEdge, are + * relative to the edges of the frame's scrollable overflow rectangle and is + * the amount to suppress on each side. + * + * Setting none, both or only one edge is allowed. + * The values must be non-negative. + * The default value for both edges is zero, which means everything is painted. + */ +class nsCharClipDisplayItem : public nsDisplayItem { +public: + nsCharClipDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) + : nsDisplayItem(aBuilder, aFrame), mLeftEdge(0), mRightEdge(0) {} + + struct ClipEdges { + ClipEdges(const nsDisplayItem& aItem, + nscoord aLeftEdge, nscoord aRightEdge) { + nsRect r = aItem.GetUnderlyingFrame()->GetScrollableOverflowRect() + + aItem.ToReferenceFrame(); + mX = aLeftEdge > 0 ? r.x + aLeftEdge : nscoord_MIN; + mXMost = aRightEdge > 0 ? NS_MAX(r.XMost() - aRightEdge, mX) : nscoord_MAX; + } + void Intersect(nscoord* aX, nscoord* aWidth) const { + nscoord xmost1 = *aX + *aWidth; + *aX = NS_MAX(*aX, mX); + *aWidth = NS_MAX(NS_MIN(xmost1, mXMost) - *aX, 0); + } + nscoord mX; + nscoord mXMost; + }; + + ClipEdges Edges() const { return ClipEdges(*this, mLeftEdge, mRightEdge); } + + static nsCharClipDisplayItem* CheckCast(nsDisplayItem* aItem) { + nsDisplayItem::Type t = aItem->GetType(); + return (t == nsDisplayItem::TYPE_TEXT || + t == nsDisplayItem::TYPE_TEXT_DECORATION || + t == nsDisplayItem::TYPE_TEXT_SHADOW) + ? static_cast(aItem) : nsnull; + } + + nscoord mLeftEdge; // length from the left side + nscoord mRightEdge; // length from the right side +}; + + +/** + * This is a dummy item that reports true for IsVaryingRelativeToMovingFrame. + * It forces the bounds of its frame to be repainted every time it is scrolled. + * It is transparent to events and does not paint anything. + */ +class nsDisplayForcePaintOnScroll : public nsDisplayItem +{ +public: + nsDisplayForcePaintOnScroll(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame); +#ifdef NS_BUILD_REFCNT_LOGGING + virtual ~nsDisplayForcePaintOnScroll(); +#endif + NS_DISPLAY_DECL_NAME("ForcePaintOnScroll", TYPE_FORCEPAINTONSCROLL) + virtual PRBool IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilder, + nsIFrame* aFrame); +}; + #endif /*NSDISPLAYLIST_H_*/ diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index ecd4fc7db4d..376baac8d56 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -115,6 +115,7 @@ #include "nsIClipboardHelper.h" #include "nsPIDOMWindow.h" +#include "nsDOMNavigationTiming.h" #include "nsPIWindowRoot.h" #include "nsJSEnvironment.h" #include "nsFocusManager.h" @@ -326,6 +327,11 @@ public: */ virtual nsIView* FindContainerView(); + /** + * Set collector for navigation timing data (load, unload events). + */ + virtual void SetNavigationTiming(nsDOMNavigationTiming* timing); + // nsIContentViewerEdit NS_DECL_NSICONTENTVIEWEREDIT @@ -539,9 +545,6 @@ nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult) { *aResult = new DocumentViewerImpl(); - if (!*aResult) { - return NS_ERROR_OUT_OF_MEMORY; - } NS_ADDREF(*aResult); @@ -794,7 +797,6 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow) if (!mSelectionListener) { nsDocViewerSelectionListener *selectionListener = new nsDocViewerSelectionListener(); - NS_ENSURE_TRUE(selectionListener, NS_ERROR_OUT_OF_MEMORY); selectionListener->Init(this); @@ -819,7 +821,6 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow) // now register ourselves as a focus listener, so that we get called // when the focus changes in the window nsDocViewerFocusListener *focusListener = new nsDocViewerFocusListener(); - NS_ENSURE_TRUE(focusListener, NS_ERROR_OUT_OF_MEMORY); focusListener->Init(this); @@ -990,6 +991,14 @@ DocumentViewerImpl::InitInternal(nsIWidget* aParentWidget, return rv; } +void DocumentViewerImpl::SetNavigationTiming(nsDOMNavigationTiming* timing) +{ + NS_ASSERTION(mDocument, "Must have a document to set navigation timing."); + if (mDocument) { + mDocument->SetNavigationTiming(timing); + } +} + // // LoadComplete(aStatus) // @@ -1051,8 +1060,15 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus) docShell->GetRestoringDocument(&restoring); if (!restoring) { + nsRefPtr timing(mDocument->GetNavigationTiming()); + if (timing) { + timing->NotifyLoadEventStart(); + } nsEventDispatcher::Dispatch(window, mPresContext, &event, nsnull, &status); + if (timing) { + timing->NotifyLoadEventEnd(); + } #ifdef MOZ_TIMELINE // if navigator.xul's load is complete, the main nav window is visible // mark that point. @@ -2159,9 +2175,6 @@ DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument, // this should eventually get expanded to allow for creating // different sets for different media nsStyleSet *styleSet = new nsStyleSet(); - if (!styleSet) { - return NS_ERROR_OUT_OF_MEMORY; - } styleSet->BeginUpdate(); @@ -3389,37 +3402,20 @@ DocumentViewerImpl::GetPopupLinkNode(nsIDOMNode** aNode) // find out if we have a link in our ancestry while (node) { - // are we an anchor? - nsCOMPtr anchor(do_QueryInterface(node)); - nsCOMPtr area; - nsCOMPtr link; - nsAutoString xlinkType; - if (!anchor) { - // area? - area = do_QueryInterface(node); - if (!area) { - // link? - link = do_QueryInterface(node); - if (!link) { - // XLink? - nsCOMPtr element(do_QueryInterface(node)); - if (element) { - element->GetAttributeNS(NS_LITERAL_STRING("http://www.w3.org/1999/xlink"),NS_LITERAL_STRING("type"),xlinkType); - } - } + nsCOMPtr content(do_QueryInterface(node)); + if (content) { + nsCOMPtr hrefURI = content->GetHrefURI(); + if (hrefURI) { + *aNode = node; + NS_IF_ADDREF(*aNode); // addref + return NS_OK; } } - if (anchor || area || link || xlinkType.EqualsLiteral("simple")) { - *aNode = node; - NS_IF_ADDREF(*aNode); // addref - return NS_OK; - } - else { - // if not, get our parent and keep trying... - nsCOMPtr parentNode; - node->GetParentNode(getter_AddRefs(parentNode)); - node = parentNode; - } + + // get our parent and keep trying... + nsCOMPtr parentNode; + node->GetParentNode(getter_AddRefs(parentNode)); + node = parentNode; } // if we have no node, fail @@ -3680,7 +3676,6 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings, if (!mPrintEngine) { mPrintEngine = new nsPrintEngine(); - NS_ENSURE_TRUE(mPrintEngine, NS_ERROR_OUT_OF_MEMORY); rv = mPrintEngine->Initialize(this, mContainer, mDocument, float(mDeviceContext->AppUnitsPerCSSInch()) / @@ -3747,7 +3742,6 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, nsPrintEventDispatcher beforeAndAfterPrint(doc); if (!mPrintEngine) { mPrintEngine = new nsPrintEngine(); - NS_ENSURE_TRUE(mPrintEngine, NS_ERROR_OUT_OF_MEMORY); rv = mPrintEngine->Initialize(this, mContainer, doc, float(mDeviceContext->AppUnitsPerCSSInch()) / diff --git a/layout/base/nsFrameManager.cpp b/layout/base/nsFrameManager.cpp index 7859cbc1468..58593686bed 100644 --- a/layout/base/nsFrameManager.cpp +++ b/layout/base/nsFrameManager.cpp @@ -380,14 +380,12 @@ nsFrameManager::SetUndisplayedContent(nsIContent* aContent, if (! mUndisplayedMap) { mUndisplayedMap = new UndisplayedMap; } - if (mUndisplayedMap) { - nsIContent* parent = aContent->GetParent(); - NS_ASSERTION(parent || (mPresShell && mPresShell->GetDocument() && - mPresShell->GetDocument()->GetRootElement() == aContent), - "undisplayed content must have a parent, unless it's the root " - "element"); - mUndisplayedMap->AddNodeFor(parent, aContent, aStyleContext); - } + nsIContent* parent = aContent->GetParent(); + NS_ASSERTION(parent || (mPresShell && mPresShell->GetDocument() && + mPresShell->GetDocument()->GetRootElement() == aContent), + "undisplayed content must have a parent, unless it's the root " + "element"); + mUndisplayedMap->AddNodeFor(parent, aContent, aStyleContext); } void @@ -1900,9 +1898,6 @@ nsFrameManagerBase::UndisplayedMap::AddNodeFor(nsIContent* aParentContent, nsStyleContext* aStyle) { UndisplayedNode* node = new UndisplayedNode(aChild, aStyle); - if (! node) { - return NS_ERROR_OUT_OF_MEMORY; - } AppendNodeFor(node, aParentContent); return NS_OK; diff --git a/layout/base/nsFrameTraversal.cpp b/layout/base/nsFrameTraversal.cpp index 7b18636e76f..76c3793feae 100644 --- a/layout/base/nsFrameTraversal.cpp +++ b/layout/base/nsFrameTraversal.cpp @@ -151,8 +151,6 @@ nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult) *aResult = nsnull; nsCOMPtr t(new nsFrameTraversal()); - if (!t) - return NS_ERROR_OUT_OF_MEMORY; *aResult = t; NS_ADDREF(*aResult); @@ -179,10 +177,7 @@ NS_NewFrameTraversal(nsIFrameEnumerator **aEnumerator, trav = new nsFrameIterator(aPresContext, aStart, aType, aLockInScrollView, aFollowOOFs); } - if (!trav) - return NS_ERROR_OUT_OF_MEMORY; - *aEnumerator = trav; - NS_ADDREF(trav); + trav.forget(aEnumerator); return NS_OK; } diff --git a/layout/base/nsIDocumentViewer.h b/layout/base/nsIDocumentViewer.h index 4ad5c4a6e8c..bce52189523 100644 --- a/layout/base/nsIDocumentViewer.h +++ b/layout/base/nsIDocumentViewer.h @@ -48,6 +48,8 @@ class nsIPresShell; class nsIStyleSheet; class nsIView; +class nsDOMNavigationTiming; + #define NS_IDOCUMENT_VIEWER_IID \ { 0x5a5c9a1d, 0x49c4, 0x4f3f, \ { 0x80, 0xcd, 0x12, 0x09, 0x5b, 0x1e, 0x1f, 0x61 } } @@ -69,6 +71,8 @@ public: PRBool aForceReuseInnerWindow) = 0; virtual nsIView* FindContainerView() = 0; + + virtual void SetNavigationTiming(nsDOMNavigationTiming* timing) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentViewer, NS_IDOCUMENT_VIEWER_IID) diff --git a/layout/base/nsLayoutDebugger.cpp b/layout/base/nsLayoutDebugger.cpp index efce9b2c3b4..9b160cd38a6 100644 --- a/layout/base/nsLayoutDebugger.cpp +++ b/layout/base/nsLayoutDebugger.cpp @@ -84,9 +84,6 @@ NS_NewLayoutDebugger(nsILayoutDebugger** aResult) return NS_ERROR_NULL_POINTER; } nsLayoutDebugger* it = new nsLayoutDebugger(); - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } return it->QueryInterface(NS_GET_IID(nsILayoutDebugger), (void**)aResult); } @@ -213,7 +210,7 @@ void nsFrame::PrintDisplayList(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList) { - PrintDisplayListTo(aBuilder, aList, 0, stderr); + PrintDisplayListTo(aBuilder, aList, 0, stdout); } #endif diff --git a/layout/base/nsLayoutHistoryState.cpp b/layout/base/nsLayoutHistoryState.cpp index 5c5a28710d6..894c3c6fcdf 100644 --- a/layout/base/nsLayoutHistoryState.cpp +++ b/layout/base/nsLayoutHistoryState.cpp @@ -77,8 +77,6 @@ NS_NewLayoutHistoryState(nsILayoutHistoryState** aState) *aState = nsnull; state = new nsLayoutHistoryState(); - if (!state) - return NS_ERROR_OUT_OF_MEMORY; NS_ADDREF(state); nsresult rv = state->Init(); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 94c7f9ad162..283033ced56 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -22,7 +22,7 @@ * * Contributor(s): * L. David Baron , Mozilla Corporation - * Mats Palmgren + * Mats Palmgren * * 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"), @@ -50,6 +50,7 @@ #include "nsIAtom.h" #include "nsCSSPseudoElements.h" #include "nsCSSAnonBoxes.h" +#include "nsCSSColorUtils.h" #include "nsIView.h" #include "nsPlaceholderFrame.h" #include "nsIScrollableFrame.h" @@ -1292,7 +1293,7 @@ nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect, #ifdef DEBUG if (gDumpEventList) { - fprintf(stderr, "Event handling --- (%d,%d):\n", aRect.x, aRect.y); + fprintf(stdout, "Event handling --- (%d,%d):\n", aRect.x, aRect.y); nsFrame::PrintDisplayList(&builder, list); } #endif @@ -1601,7 +1602,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram #ifdef DEBUG if (gDumpPaintList) { - fprintf(stderr, "Painting --- before optimization (dirty %d,%d,%d,%d):\n", + fprintf(stdout, "Painting --- before optimization (dirty %d,%d,%d,%d):\n", dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); nsFrame::PrintDisplayList(&builder, list); } @@ -1653,10 +1654,10 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram #ifdef DEBUG if (gDumpPaintList) { - fprintf(stderr, "Painting --- after optimization:\n"); + fprintf(stdout, "Painting --- after optimization:\n"); nsFrame::PrintDisplayList(&builder, list); - fprintf(stderr, "Painting --- retained layer tree:\n"); + fprintf(stdout, "Painting --- retained layer tree:\n"); builder.LayerBuilder()->DumpRetainedLayerTree(); } #endif @@ -1810,10 +1811,6 @@ nsLayoutUtils::RectListBuilder::RectListBuilder(nsClientRectList* aList) void nsLayoutUtils::RectListBuilder::AddRect(const nsRect& aRect) { nsRefPtr rect = new nsClientRect(); - if (!rect) { - mRV = NS_ERROR_OUT_OF_MEMORY; - return; - } rect->SetLayoutRect(aRect); mRectList->Append(rect); @@ -2790,6 +2787,49 @@ nsLayoutUtils::PrefWidthFromInline(nsIFrame* aFrame, return data.prevLines; } +static nscolor +DarkenColor(nscolor aColor) +{ + PRUint16 hue, sat, value; + PRUint8 alpha; + + // convert the RBG to HSV so we can get the lightness (which is the v) + NS_RGB2HSV(aColor, hue, sat, value, alpha); + + // The goal here is to send white to black while letting colored + // stuff stay colored... So we adopt the following approach. + // Something with sat = 0 should end up with value = 0. Something + // with a high sat can end up with a high value and it's ok.... At + // the same time, we don't want to make things lighter. Do + // something simple, since it seems to work. + if (value > sat) { + value = sat; + // convert this color back into the RGB color space. + NS_HSV2RGB(aColor, hue, sat, value, alpha); + } + return aColor; +} + +// Check whether we should darken text colors. We need to do this if +// background images and colors are being suppressed, because that means +// light text will not be visible against the (presumed light-colored) background. +static PRBool +ShouldDarkenColors(nsPresContext* aPresContext) +{ + return !aPresContext->GetBackgroundColorDraw() && + !aPresContext->GetBackgroundImageDraw(); +} + +nscolor +nsLayoutUtils::GetTextColor(nsIFrame* aFrame) +{ + nscolor color = aFrame->GetVisitedDependentColor(eCSSProperty_color); + if (ShouldDarkenColors(aFrame->PresContext())) { + color = DarkenColor(color); + } + return color; +} + void nsLayoutUtils::DrawString(const nsIFrame* aFrame, nsRenderingContext* aContext, @@ -3832,12 +3872,8 @@ nsLayoutUtils::SurfaceFromElement(nsIDOMElement *aElement, if (wantImageSurface && surf->GetType() != gfxASurface::SurfaceTypeImage) { nsRefPtr imgSurf = new gfxImageSurface(size, gfxASurface::ImageFormatARGB32); - if (!imgSurf) - return result; nsRefPtr ctx = new gfxContext(imgSurf); - if (!ctx) - return result; ctx->SetOperator(gfxContext::OPERATOR_SOURCE); ctx->DrawSurface(surf, size); surf = imgSurf; diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 5e90c7bfadb..a1ddeab0a3c 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -22,7 +22,7 @@ * Contributor(s): * Boris Zbarsky (original author) * L. David Baron , Mozilla Corporation - * Mats Palmgren + * Mats Palmgren * * 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"), @@ -931,6 +931,9 @@ public: static nscoord MinWidthFromInline(nsIFrame* aFrame, nsRenderingContext* aRenderingContext); + // Get a suitable foreground color for painting text for the frame. + static nscolor GetTextColor(nsIFrame* aFrame); + static void DrawString(const nsIFrame* aFrame, nsRenderingContext* aContext, const PRUnichar* aString, diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 4247971b6f4..1b5b6e79163 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -86,7 +86,7 @@ #include "gfxPlatform.h" #include "nsCSSRules.h" #include "nsFontFaceLoader.h" -#include "nsIEventListenerManager.h" +#include "nsEventListenerManager.h" #include "nsStyleStructInlines.h" #include "nsIAppShell.h" #include "prenv.h" @@ -94,9 +94,7 @@ #include "nsIDOMEventTarget.h" #include "nsObjectFrame.h" #include "nsTransitionManager.h" -#ifdef MOZ_CSS_ANIMATIONS #include "nsAnimationManager.h" -#endif #include "mozilla/dom/Element.h" #include "nsIFrameMessageManager.h" #include "FrameLayerBuilder.h" @@ -914,20 +912,11 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext) } mEventManager = new nsEventStateManager(); - if (!mEventManager) - return NS_ERROR_OUT_OF_MEMORY; - NS_ADDREF(mEventManager); mTransitionManager = new nsTransitionManager(this); - if (!mTransitionManager) - return NS_ERROR_OUT_OF_MEMORY; -#ifdef MOZ_CSS_ANIMATIONS mAnimationManager = new nsAnimationManager(this); - if (!mAnimationManager) - return NS_ERROR_OUT_OF_MEMORY; -#endif if (mDocument->GetDisplayDocument()) { NS_ASSERTION(mDocument->GetDisplayDocument()->GetShell() && @@ -963,8 +952,6 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext) if (!mRefreshDriver) { mRefreshDriver = new nsRefreshDriver(this); - if (!mRefreshDriver) - return NS_ERROR_OUT_OF_MEMORY; } } @@ -1093,12 +1080,10 @@ nsPresContext::SetShell(nsIPresShell* aShell) mTransitionManager->Disconnect(); mTransitionManager = nsnull; } -#ifdef MOZ_CSS_ANIMATIONS if (mAnimationManager) { mAnimationManager->Disconnect(); mAnimationManager = nsnull; } -#endif } } @@ -1656,9 +1641,7 @@ nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint) } RebuildUserFontSet(); -#ifdef MOZ_CSS_ANIMATIONS AnimationManager()->KeyframesListIsDirty(); -#endif mShell->FrameConstructor()->RebuildAllStyleData(aExtraHint); } @@ -1719,7 +1702,7 @@ nsPresContext::MediaFeatureValuesChanged(PRBool aCallerWillRebuildStyleData) if (!notifyList.IsEmpty()) { nsPIDOMWindow *win = mDocument->GetInnerWindow(); - nsCOMPtr et = do_QueryInterface(win); + nsCOMPtr et = do_QueryInterface(win); nsCxPusher pusher; for (PRUint32 i = 0, i_end = notifyList.Length(); i != i_end; ++i) { @@ -2074,11 +2057,11 @@ MayHavePaintEventListener(nsPIDOMWindow* aInnerWindow) if (aInnerWindow->HasPaintEventListeners()) return PR_TRUE; - nsPIDOMEventTarget* parentTarget = aInnerWindow->GetParentTarget(); + nsIDOMEventTarget* parentTarget = aInnerWindow->GetParentTarget(); if (!parentTarget) return PR_FALSE; - nsIEventListenerManager* manager = nsnull; + nsEventListenerManager* manager = nsnull; if ((manager = parentTarget->GetListenerManager(PR_FALSE)) && manager->MayHavePaintEventListener()) { return PR_TRUE; @@ -2104,7 +2087,7 @@ MayHavePaintEventListener(nsPIDOMWindow* aInnerWindow) return MayHavePaintEventListener(window); nsCOMPtr root = do_QueryInterface(parentTarget); - nsPIDOMEventTarget* tabChildGlobal; + nsIDOMEventTarget* tabChildGlobal; return root && (tabChildGlobal = root->GetParentTarget()) && (manager = tabChildGlobal->GetListenerManager(PR_FALSE)) && diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 579e1ec89e8..9e554dc5cdc 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -103,9 +103,7 @@ class nsUserFontSet; struct nsFontFaceRuleContainer; class nsObjectFrame; class nsTransitionManager; -#ifdef MOZ_CSS_ANIMATIONS class nsAnimationManager; -#endif class nsRefreshDriver; class imgIContainer; class nsIDOMMediaQueryList; @@ -243,9 +241,7 @@ public: { return GetPresShell()->FrameManager(); } nsTransitionManager* TransitionManager() { return mTransitionManager; } -#ifdef MOZ_CSS_ANIMATIONS nsAnimationManager* AnimationManager() { return mAnimationManager; } -#endif nsRefreshDriver* RefreshDriver() { return mRefreshDriver; } #endif @@ -1082,9 +1078,7 @@ protected: nsILookAndFeel* mLookAndFeel; // [STRONG] nsRefPtr mRefreshDriver; nsRefPtr mTransitionManager; -#ifdef MOZ_CSS_ANIMATIONS nsRefPtr mAnimationManager; -#endif nsIAtom* mMedium; // initialized by subclass ctors; // weak pointer to static atom diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 6d2fab0e421..f6fec5924de 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -56,6 +56,7 @@ /* a presentation of a document, part 2 */ +#include "nsAlgorithm.h" #include "nsIPresShell.h" #include "nsPresContext.h" #include "nsIContent.h" @@ -66,9 +67,7 @@ #include "nsStyleSet.h" #include "nsCSSStyleSheet.h" // XXX for UA sheet loading hack, can this go away please? #include "nsIDOMCSSStyleSheet.h" // for Pref-related rule management (bugs 22963,20760,31816) -#ifdef MOZ_CSS_ANIMATIONS #include "nsAnimationManager.h" -#endif #include "nsINameSpaceManager.h" // for Pref-related rule management (bugs 22963,20760,31816) #include "nsIServiceManager.h" #include "nsFrame.h" @@ -625,7 +624,7 @@ StackArena::Allocate(size_t aSize) // make sure we are aligned. Beard said 8 was safer then 4. // Round size to multiple of 8 - aSize = PR_ROUNDUP(aSize, 8); + aSize = NS_ROUNDUP(aSize, 8); // if the size makes the stack overflow. Grab another block for the stack if (mPos + aSize >= BLOCK_INCREMENT) @@ -1056,7 +1055,7 @@ protected: PRBool mCaretEnabled; #ifdef NS_DEBUG - nsresult CloneStyleSet(nsStyleSet* aSet, nsStyleSet** aResult); + nsStyleSet* CloneStyleSet(nsStyleSet* aSet); PRBool VerifyIncrementalReflow(); PRBool mInVerifyReflow; void ShowEventTargetDebug(); @@ -1245,10 +1244,8 @@ protected: aEvent->widget, aEvent->reason, aEvent->context); - if (mEvent) { - Init(aEvent); - static_cast(mEvent)->clickCount = aEvent->clickCount; - } + Init(aEvent); + static_cast(mEvent)->clickCount = aEvent->clickCount; } virtual ~nsDelayedMouseEvent() @@ -1265,14 +1262,12 @@ protected: mEvent = new nsKeyEvent(NS_IS_TRUSTED_EVENT(aEvent), aEvent->message, aEvent->widget); - if (mEvent) { - Init(aEvent); - static_cast(mEvent)->keyCode = aEvent->keyCode; - static_cast(mEvent)->charCode = aEvent->charCode; - static_cast(mEvent)->alternativeCharCodes = - aEvent->alternativeCharCodes; - static_cast(mEvent)->isChar = aEvent->isChar; - } + Init(aEvent); + static_cast(mEvent)->keyCode = aEvent->keyCode; + static_cast(mEvent)->charCode = aEvent->charCode; + static_cast(mEvent)->alternativeCharCodes = + aEvent->alternativeCharCodes; + static_cast(mEvent)->isChar = aEvent->isChar; } virtual ~nsDelayedKeyEvent() @@ -1665,8 +1660,6 @@ NS_NewPresShell(nsIPresShell** aInstancePtrResult) return NS_ERROR_NULL_POINTER; *aInstancePtrResult = new PresShell(); - if (!*aInstancePtrResult) - return NS_ERROR_OUT_OF_MEMORY; NS_ADDREF(*aInstancePtrResult); return NS_OK; @@ -1802,7 +1795,6 @@ PresShell::Init(nsIDocument* aDocument, // Create our frame constructor. mFrameConstructor = new nsCSSFrameConstructor(mDocument, this); - NS_ENSURE_TRUE(mFrameConstructor, NS_ERROR_OUT_OF_MEMORY); // The document viewer owns both view manager and pres shell. mViewManager->SetViewObserver(this); @@ -4367,66 +4359,26 @@ nsresult PresShell::GetLinkLocation(nsIDOMNode* aNode, nsAString& aLocationStrin #endif NS_ENSURE_ARG_POINTER(aNode); - nsresult rv; - nsAutoString anchorText; - static const char strippedChars[] = "\t\r\n"; - // are we an anchor? - nsCOMPtr anchor(do_QueryInterface(aNode)); - nsCOMPtr area; - nsCOMPtr link; - nsAutoString xlinkType; - if (anchor) { - rv = anchor->GetHref(anchorText); - NS_ENSURE_SUCCESS(rv, rv); - } else { - // area? - area = do_QueryInterface(aNode); - if (area) { - rv = area->GetHref(anchorText); + nsCOMPtr content(do_QueryInterface(aNode)); + if (content) { + nsCOMPtr hrefURI = content->GetHrefURI(); + if (hrefURI) { + nsCAutoString specUTF8; + nsresult rv = hrefURI->GetSpec(specUTF8); NS_ENSURE_SUCCESS(rv, rv); - } else { - // link? - link = do_QueryInterface(aNode); - if (link) { - rv = link->GetHref(anchorText); - NS_ENSURE_SUCCESS(rv, rv); - } else { - // Xlink? - nsCOMPtr element(do_QueryInterface(aNode)); - if (element) { - NS_NAMED_LITERAL_STRING(xlinkNS,"http://www.w3.org/1999/xlink"); - element->GetAttributeNS(xlinkNS,NS_LITERAL_STRING("type"),xlinkType); - if (xlinkType.EqualsLiteral("simple")) { - element->GetAttributeNS(xlinkNS,NS_LITERAL_STRING("href"),anchorText); - if (!anchorText.IsEmpty()) { - // Resolve the full URI using baseURI property - nsCOMPtr node = do_QueryInterface(aNode); - NS_ENSURE_TRUE(node, NS_ERROR_UNEXPECTED); - nsCOMPtr baseURI = node->GetBaseURI(); + nsAutoString anchorText; + CopyUTF8toUTF16(specUTF8, anchorText); - nsCAutoString spec; - rv = baseURI->Resolve(NS_ConvertUTF16toUTF8(anchorText),spec); - NS_ENSURE_SUCCESS(rv, rv); - - CopyUTF8toUTF16(spec, anchorText); - } - } - } - } + // Remove all the '\t', '\r' and '\n' from 'anchorText' + static const char strippedChars[] = "\t\r\n"; + anchorText.StripChars(strippedChars); + aLocationString = anchorText; + return NS_OK; } } - if (anchor || area || link || xlinkType.EqualsLiteral("simple")) { - //Remove all the '\t', '\r' and '\n' from 'anchorText' - anchorText.StripChars(strippedChars); - - aLocationString = anchorText; - - return NS_OK; - } - // if no link, fail. return NS_ERROR_FAILURE; } @@ -4812,13 +4764,11 @@ PresShell::FlushPendingNotifications(mozFlushType aType) mFrameConstructor->ProcessPendingRestyles(); } -#ifdef MOZ_CSS_ANIMATIONS // Dispatch any 'animationstart' events those (or earlier) restyles // queued up. if (!mIsDestroying) { mPresContext->AnimationManager()->DispatchEvents(); } -#endif // Process whatever XBL constructors those restyles queued up. This // ensures that onload doesn't fire too early and that we won't do extra @@ -5137,9 +5087,7 @@ nsIPresShell::ReconstructStyleDataInternal() if (mPresContext) { mPresContext->RebuildUserFontSet(); -#ifdef MOZ_CSS_ANIMATIONS mPresContext->AnimationManager()->KeyframesListIsDirty(); -#endif } Element* root = mDocument->GetRootElement(); @@ -5531,8 +5479,6 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange, return nsnull; info = new RangePaintInfo(range, ancestorFrame); - if (!info) - return nsnull; nsRect ancestorRect = ancestorFrame->GetVisualOverflowRect(); @@ -5634,7 +5580,7 @@ PresShell::PaintRangePaintInfo(nsTArray >* aItems, gfxImageSurface* surface = new gfxImageSurface(gfxIntSize(pixelArea.width, pixelArea.height), gfxImageSurface::ImageFormatARGB32); - if (!surface || surface->CairoStatus()) { + if (surface->CairoStatus()) { delete surface; return nsnull; } @@ -6610,7 +6556,7 @@ PresShell::HandleEvent(nsIView *aView, } else if (!mNoDelayedKeyEvents) { nsDelayedEvent* event = new nsDelayedKeyEvent(static_cast(aEvent)); - if (event && !mDelayedEvents.AppendElement(event)) { + if (!mDelayedEvents.AppendElement(event)) { delete event; } } @@ -8592,13 +8538,10 @@ FindTopFrame(nsIFrame* aRoot) #ifdef DEBUG -nsresult -PresShell::CloneStyleSet(nsStyleSet* aSet, nsStyleSet** aResult) +nsStyleSet* +PresShell::CloneStyleSet(nsStyleSet* aSet) { nsStyleSet *clone = new nsStyleSet(); - if (!clone) { - return NS_ERROR_OUT_OF_MEMORY; - } PRInt32 i, n = aSet->SheetCount(nsStyleSet::eOverrideSheet); for (i = 0; i < n; i++) { @@ -8630,8 +8573,7 @@ PresShell::CloneStyleSet(nsStyleSet* aSet, nsStyleSet** aResult) if (ss) clone->AppendStyleSheet(nsStyleSet::eAgentSheet, ss); } - *aResult = clone; - return NS_OK; + return clone; } #ifdef DEBUG_Eli @@ -8644,7 +8586,6 @@ DumpToPNG(nsIPresShell* shell, nsAString& name) { nsRefPtr imgSurface = new gfxImageSurface(gfxIntSize(width, height), gfxImageSurface::ImageFormatARGB32); - NS_ENSURE_TRUE(imgSurface, NS_ERROR_OUT_OF_MEMORY); nsRefPtr imgContext = new gfxContext(imgSurface); @@ -8655,7 +8596,6 @@ DumpToPNG(nsIPresShell* shell, nsAString& name) { NS_ENSURE_TRUE(surface, NS_ERROR_OUT_OF_MEMORY); nsRefPtr context = new gfxContext(surface); - NS_ENSURE_TRUE(context, NS_ERROR_OUT_OF_MEMORY); shell->RenderDocument(r, 0, NS_RGB(255, 255, 0), context); @@ -8743,9 +8683,7 @@ PresShell::VerifyIncrementalReflow() // Create a new presentation shell to view the document. Use the // exact same style information that this document has. - nsAutoPtr newSet; - rv = CloneStyleSet(mStyleSet, getter_Transfers(newSet)); - NS_ENSURE_SUCCESS(rv, PR_FALSE); + nsAutoPtr newSet(CloneStyleSet(mStyleSet)); nsCOMPtr sh; rv = mDocument->CreateShell(cx, vm, newSet, getter_AddRefs(sh)); NS_ENSURE_SUCCESS(rv, PR_FALSE); @@ -9030,7 +8968,6 @@ void ReflowCountMgr::Add(const char * aName, nsIFrame * aFrame) ReflowCounter * counter = (ReflowCounter *)PL_HashTableLookup(mCounts, aName); if (counter == nsnull) { counter = new ReflowCounter(this); - NS_ASSERTION(counter != nsnull, "null ptr"); char * name = NS_strdup(aName); NS_ASSERTION(name != nsnull, "null ptr"); PL_HashTableAdd(mCounts, name, counter); @@ -9046,7 +8983,6 @@ void ReflowCountMgr::Add(const char * aName, nsIFrame * aFrame) IndiReflowCounter * counter = (IndiReflowCounter *)PL_HashTableLookup(mIndiFrameCounts, key); if (counter == nsnull) { counter = new IndiReflowCounter(this); - NS_ASSERTION(counter != nsnull, "null ptr"); counter->mFrame = aFrame; counter->mName.AssignASCII(aName); PL_HashTableAdd(mIndiFrameCounts, key, counter); diff --git a/layout/base/nsStyleConsts.h b/layout/base/nsStyleConsts.h index 50fb327f62c..654163c724e 100644 --- a/layout/base/nsStyleConsts.h +++ b/layout/base/nsStyleConsts.h @@ -20,7 +20,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Mats Palmgren + * Mats Palmgren * Jonathon Jongsma , Collabora Ltd. * * Alternatively, the contents of this file may be used under the terms of @@ -247,7 +247,6 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_COLOR_MOZ_VISITEDHYPERLINKTEXT -5 #define NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT -6 -#ifdef MOZ_CSS_ANIMATIONS // See nsStyleDisplay #define NS_STYLE_ANIMATION_DIRECTION_NORMAL 0 #define NS_STYLE_ANIMATION_DIRECTION_ALTERNATE 1 @@ -264,7 +263,6 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { // See nsStyleDisplay #define NS_STYLE_ANIMATION_PLAY_STATE_RUNNING 0 #define NS_STYLE_ANIMATION_PLAY_STATE_PAUSED 1 -#endif // See nsStyleBackground #define NS_STYLE_BG_ATTACHMENT_SCROLL 0 @@ -662,6 +660,11 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_STYLE_TEXT_DECORATION_STYLE_WAVY 5 #define NS_STYLE_TEXT_DECORATION_STYLE_MAX NS_STYLE_TEXT_DECORATION_STYLE_WAVY +// See nsStyleTextOverflow +#define NS_STYLE_TEXT_OVERFLOW_CLIP 0 +#define NS_STYLE_TEXT_OVERFLOW_ELLIPSIS 1 +#define NS_STYLE_TEXT_OVERFLOW_STRING 2 + // See nsStyleText #define NS_STYLE_TEXT_TRANSFORM_NONE 0 #define NS_STYLE_TEXT_TRANSFORM_CAPITALIZE 1 diff --git a/layout/base/nsStyleSheetService.cpp b/layout/base/nsStyleSheetService.cpp index 0b62c8ec5e2..bc95d5a0707 100644 --- a/layout/base/nsStyleSheetService.cpp +++ b/layout/base/nsStyleSheetService.cpp @@ -169,7 +169,6 @@ nsStyleSheetService::LoadAndRegisterSheetInternal(nsIURI *aSheetURI, NS_ENSURE_ARG_POINTER(aSheetURI); nsRefPtr loader = new mozilla::css::Loader(); - NS_ENSURE_TRUE(loader, NS_ERROR_OUT_OF_MEMORY); nsRefPtr sheet; // Allow UA sheets, but not user sheets, to use unsafe rules diff --git a/layout/base/tests/Makefile.in b/layout/base/tests/Makefile.in index 8fffe90118a..9d5f27c69db 100644 --- a/layout/base/tests/Makefile.in +++ b/layout/base/tests/Makefile.in @@ -64,7 +64,6 @@ DEFINES += -D_IMPL_NS_LAYOUT _TEST_FILES = \ border_radius_hit_testing_iframe.html \ bug369950-subframe.xml \ - bug495648.rdf \ decoration_line_rendering.js \ test_after_paint_pref.html \ test_border_radius_hit_testing.html \ @@ -89,61 +88,6 @@ _TEST_FILES = \ test_bug435293-scale.html \ test_bug435293-interaction.html \ test_bug435293-skew.html \ - test_bug495648.xul \ - test_reftests_with_caret.html \ - bug106855-1.html \ - bug106855-2.html \ - bug106855-1-ref.html \ - bug240933-1.html \ - bug240933-2.html \ - bug240933-1-ref.html \ - bug389321-1.html \ - bug389321-1-ref.html \ - bug389321-2.html \ - bug389321-2-ref.html \ - bug389321-3.html \ - bug389321-3-ref.html \ - bug482484.html \ - bug482484-ref.html \ - bug512295-1.html \ - bug512295-1-ref.html \ - bug512295-2.html \ - bug512295-2-ref.html \ - bug585922.html \ - bug585922-ref.html \ - bug597519-1.html \ - bug597519-1-ref.html \ - bug602141-1.html \ - bug602141-1-ref.html \ - bug602141-2.html \ - bug602141-2-ref.html \ - bug602141-3.html \ - bug602141-3-ref.html \ - bug602141-4.html \ - bug602141-4-ref.html \ - bug612271-1.html \ - bug612271-2.html \ - bug612271-3.html \ - bug612271-ref.html \ - bug613433-1.html \ - bug613433-2.html \ - bug613433-3.html \ - bug613433-ref.html \ - bug613807-1.html \ - bug613807-1-ref.html \ - bug632215-1.html \ - bug632215-2.html \ - bug632215-ref.html \ - bug633044-1.html \ - bug633044-1-ref.html \ - bug634406-1.html \ - bug634406-1-ref.html \ - bug644428-1.html \ - bug644428-1-ref.html \ - bug646382-1.html \ - bug646382-1-ref.html \ - bug646382-2.html \ - bug646382-2-ref.html \ test_bug514127.html \ test_bug518777.html \ test_bug548545.xhtml \ diff --git a/layout/base/tests/chrome/Makefile.in b/layout/base/tests/chrome/Makefile.in index 9e131e96ed1..d7a6b650e2e 100644 --- a/layout/base/tests/chrome/Makefile.in +++ b/layout/base/tests/chrome/Makefile.in @@ -38,7 +38,7 @@ DEPTH = ../../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ -relativesrcdir = layout/base/test/chrome +relativesrcdir = layout/base/tests/chrome include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk @@ -48,6 +48,8 @@ _CHROME_FILES = \ test_bug396367-1.html \ test_bug396367-2.html \ test_bug420499.xul \ + test_bug495648.xul \ + bug495648.rdf \ test_bug504311.xul \ test_bug514660.xul \ test_bug533845.xul \ @@ -66,6 +68,60 @@ _CHROME_FILES = \ printpreview_bug396024_helper.xul \ test_printpreview_bug482976.xul \ printpreview_bug482976_helper.xul \ + test_reftests_with_caret.html \ + bug585922.html \ + bug585922-ref.html \ + bug613807-1.html \ + bug613807-1-ref.html \ + bug106855-1.html \ + bug106855-2.html \ + bug106855-1-ref.html \ + bug240933-1.html \ + bug240933-2.html \ + bug240933-1-ref.html \ + bug389321-1.html \ + bug389321-1-ref.html \ + bug389321-2.html \ + bug389321-2-ref.html \ + bug389321-3.html \ + bug389321-3-ref.html \ + bug482484.html \ + bug482484-ref.html \ + bug512295-1.html \ + bug512295-1-ref.html \ + bug512295-2.html \ + bug512295-2-ref.html \ + bug597519-1.html \ + bug597519-1-ref.html \ + bug602141-1.html \ + bug602141-1-ref.html \ + bug602141-2.html \ + bug602141-2-ref.html \ + bug602141-3.html \ + bug602141-3-ref.html \ + bug602141-4.html \ + bug602141-4-ref.html \ + bug612271-1.html \ + bug612271-2.html \ + bug612271-3.html \ + bug612271-ref.html \ + bug613433-1.html \ + bug613433-2.html \ + bug613433-3.html \ + bug613433-ref.html \ + bug632215-1.html \ + bug632215-2.html \ + bug632215-ref.html \ + bug633044-1.html \ + bug633044-1-ref.html \ + bug634406-1.html \ + bug634406-1-ref.html \ + bug644428-1.html \ + bug644428-1-ref.html \ + bug646382-1.html \ + bug646382-1-ref.html \ + bug646382-2.html \ + bug646382-2-ref.html \ $(NULL) libs:: $(_CHROME_FILES) diff --git a/layout/base/tests/bug106855-1-ref.html b/layout/base/tests/chrome/bug106855-1-ref.html similarity index 69% rename from layout/base/tests/bug106855-1-ref.html rename to layout/base/tests/chrome/bug106855-1-ref.html index fb5c87c6045..418d653574f 100644 --- a/layout/base/tests/bug106855-1-ref.html +++ b/layout/base/tests/chrome/bug106855-1-ref.html @@ -1,6 +1,6 @@ - - + + x
diff --git a/layout/base/tests/bug106855-1.html b/layout/base/tests/chrome/bug106855-1.html similarity index 67% rename from layout/base/tests/bug106855-1.html rename to layout/base/tests/chrome/bug106855-1.html index f71c02b7d3f..ed585533611 100644 --- a/layout/base/tests/bug106855-1.html +++ b/layout/base/tests/chrome/bug106855-1.html @@ -1,6 +1,6 @@ - - + + x
diff --git a/layout/base/tests/bug106855-2.html b/layout/base/tests/chrome/bug106855-2.html similarity index 69% rename from layout/base/tests/bug106855-2.html rename to layout/base/tests/chrome/bug106855-2.html index 946e4484b0c..0810521d4ff 100644 --- a/layout/base/tests/bug106855-2.html +++ b/layout/base/tests/chrome/bug106855-2.html @@ -1,6 +1,6 @@ - - + + x
diff --git a/layout/base/tests/bug240933-1-ref.html b/layout/base/tests/chrome/bug240933-1-ref.html similarity index 100% rename from layout/base/tests/bug240933-1-ref.html rename to layout/base/tests/chrome/bug240933-1-ref.html diff --git a/layout/base/tests/bug240933-1.html b/layout/base/tests/chrome/bug240933-1.html similarity index 52% rename from layout/base/tests/bug240933-1.html rename to layout/base/tests/chrome/bug240933-1.html index 6fefc5627d4..71168b70fe9 100644 --- a/layout/base/tests/bug240933-1.html +++ b/layout/base/tests/chrome/bug240933-1.html @@ -1,6 +1,6 @@ - - + + diff --git a/layout/base/tests/bug240933-2.html b/layout/base/tests/chrome/bug240933-2.html similarity index 60% rename from layout/base/tests/bug240933-2.html rename to layout/base/tests/chrome/bug240933-2.html index 6780792f78f..f441a7e7dfe 100644 --- a/layout/base/tests/bug240933-2.html +++ b/layout/base/tests/chrome/bug240933-2.html @@ -1,6 +1,6 @@ - - + + diff --git a/layout/base/tests/bug389321-1-ref.html b/layout/base/tests/chrome/bug389321-1-ref.html similarity index 65% rename from layout/base/tests/bug389321-1-ref.html rename to layout/base/tests/chrome/bug389321-1-ref.html index d4b75bd1e86..689c6d2ddda 100644 --- a/layout/base/tests/bug389321-1-ref.html +++ b/layout/base/tests/chrome/bug389321-1-ref.html @@ -1,6 +1,6 @@ - - + + diff --git a/layout/base/tests/bug389321-1.html b/layout/base/tests/chrome/bug389321-1.html similarity index 68% rename from layout/base/tests/bug389321-1.html rename to layout/base/tests/chrome/bug389321-1.html index 907262a1cc8..5685f976ade 100644 --- a/layout/base/tests/bug389321-1.html +++ b/layout/base/tests/chrome/bug389321-1.html @@ -1,6 +1,6 @@ - - + + diff --git a/layout/base/tests/bug389321-2-ref.html b/layout/base/tests/chrome/bug389321-2-ref.html similarity index 100% rename from layout/base/tests/bug389321-2-ref.html rename to layout/base/tests/chrome/bug389321-2-ref.html diff --git a/layout/base/tests/bug389321-2.html b/layout/base/tests/chrome/bug389321-2.html similarity index 100% rename from layout/base/tests/bug389321-2.html rename to layout/base/tests/chrome/bug389321-2.html diff --git a/layout/base/tests/bug389321-3-ref.html b/layout/base/tests/chrome/bug389321-3-ref.html similarity index 100% rename from layout/base/tests/bug389321-3-ref.html rename to layout/base/tests/chrome/bug389321-3-ref.html diff --git a/layout/base/tests/bug389321-3.html b/layout/base/tests/chrome/bug389321-3.html similarity index 100% rename from layout/base/tests/bug389321-3.html rename to layout/base/tests/chrome/bug389321-3.html diff --git a/layout/base/tests/bug482484-ref.html b/layout/base/tests/chrome/bug482484-ref.html similarity index 100% rename from layout/base/tests/bug482484-ref.html rename to layout/base/tests/chrome/bug482484-ref.html diff --git a/layout/base/tests/bug482484.html b/layout/base/tests/chrome/bug482484.html similarity index 72% rename from layout/base/tests/bug482484.html rename to layout/base/tests/chrome/bug482484.html index e4294133801..532e96769d8 100644 --- a/layout/base/tests/bug482484.html +++ b/layout/base/tests/chrome/bug482484.html @@ -1,6 +1,6 @@ - - + +

BC

diff --git a/layout/base/tests/bug495648.rdf b/layout/base/tests/chrome/bug495648.rdf similarity index 100% rename from layout/base/tests/bug495648.rdf rename to layout/base/tests/chrome/bug495648.rdf diff --git a/layout/base/tests/bug512295-1-ref.html b/layout/base/tests/chrome/bug512295-1-ref.html similarity index 71% rename from layout/base/tests/bug512295-1-ref.html rename to layout/base/tests/chrome/bug512295-1-ref.html index b149fb8510b..030f9a24b81 100644 --- a/layout/base/tests/bug512295-1-ref.html +++ b/layout/base/tests/chrome/bug512295-1-ref.html @@ -1,6 +1,6 @@ - - + +
diff --git a/layout/base/tests/bug512295-1.html b/layout/base/tests/chrome/bug512295-1.html similarity index 80% rename from layout/base/tests/bug512295-1.html rename to layout/base/tests/chrome/bug512295-1.html index 23fae91bfde..8a3d211f560 100644 --- a/layout/base/tests/bug512295-1.html +++ b/layout/base/tests/chrome/bug512295-1.html @@ -1,6 +1,6 @@ - - + +
diff --git a/layout/base/tests/bug512295-2-ref.html b/layout/base/tests/chrome/bug512295-2-ref.html similarity index 70% rename from layout/base/tests/bug512295-2-ref.html rename to layout/base/tests/chrome/bug512295-2-ref.html index f450adb4d9c..0b920691d2c 100644 --- a/layout/base/tests/bug512295-2-ref.html +++ b/layout/base/tests/chrome/bug512295-2-ref.html @@ -1,6 +1,6 @@ - - + + x diff --git a/layout/base/tests/bug512295-2.html b/layout/base/tests/chrome/bug512295-2.html similarity index 78% rename from layout/base/tests/bug512295-2.html rename to layout/base/tests/chrome/bug512295-2.html index 11ad82ed59c..5055df7225d 100644 --- a/layout/base/tests/bug512295-2.html +++ b/layout/base/tests/chrome/bug512295-2.html @@ -1,6 +1,6 @@ - - + + x diff --git a/layout/base/tests/bug585922-ref.html b/layout/base/tests/chrome/bug585922-ref.html similarity index 76% rename from layout/base/tests/bug585922-ref.html rename to layout/base/tests/chrome/bug585922-ref.html index d301f6b7d58..5628c786862 100644 --- a/layout/base/tests/bug585922-ref.html +++ b/layout/base/tests/chrome/bug585922-ref.html @@ -1,15 +1,12 @@ - + + - + + diff --git a/layout/base/tests/bug602141-1-ref.html b/layout/base/tests/chrome/bug602141-1-ref.html similarity index 100% rename from layout/base/tests/bug602141-1-ref.html rename to layout/base/tests/chrome/bug602141-1-ref.html diff --git a/layout/base/tests/bug602141-1.html b/layout/base/tests/chrome/bug602141-1.html similarity index 73% rename from layout/base/tests/bug602141-1.html rename to layout/base/tests/chrome/bug602141-1.html index 8eef1288e21..f48c54ed4c8 100644 --- a/layout/base/tests/bug602141-1.html +++ b/layout/base/tests/chrome/bug602141-1.html @@ -1,6 +1,6 @@ - - + + navigable__navigable|unnavigable
diff --git a/layout/base/tests/bug602141-2-ref.html b/layout/base/tests/chrome/bug602141-2-ref.html similarity index 100% rename from layout/base/tests/bug602141-2-ref.html rename to layout/base/tests/chrome/bug602141-2-ref.html diff --git a/layout/base/tests/bug602141-2.html b/layout/base/tests/chrome/bug602141-2.html similarity index 74% rename from layout/base/tests/bug602141-2.html rename to layout/base/tests/chrome/bug602141-2.html index 736ba92bd7b..5d5c00412bb 100644 --- a/layout/base/tests/bug602141-2.html +++ b/layout/base/tests/chrome/bug602141-2.html @@ -1,6 +1,6 @@ - - + + navigable__|
diff --git a/layout/base/tests/bug602141-3-ref.html b/layout/base/tests/chrome/bug602141-3-ref.html similarity index 100% rename from layout/base/tests/bug602141-3-ref.html rename to layout/base/tests/chrome/bug602141-3-ref.html diff --git a/layout/base/tests/bug602141-3.html b/layout/base/tests/chrome/bug602141-3.html similarity index 72% rename from layout/base/tests/bug602141-3.html rename to layout/base/tests/chrome/bug602141-3.html index 803c8e891ac..97cb300e72f 100644 --- a/layout/base/tests/bug602141-3.html +++ b/layout/base/tests/chrome/bug602141-3.html @@ -1,6 +1,6 @@ - - + + noteditablenavigable|unnavigable
diff --git a/layout/base/tests/bug602141-4-ref.html b/layout/base/tests/chrome/bug602141-4-ref.html similarity index 100% rename from layout/base/tests/bug602141-4-ref.html rename to layout/base/tests/chrome/bug602141-4-ref.html diff --git a/layout/base/tests/bug602141-4.html b/layout/base/tests/chrome/bug602141-4.html similarity index 72% rename from layout/base/tests/bug602141-4.html rename to layout/base/tests/chrome/bug602141-4.html index 61e5228c667..95184b44cc8 100644 --- a/layout/base/tests/bug602141-4.html +++ b/layout/base/tests/chrome/bug602141-4.html @@ -1,6 +1,6 @@ - - + + not editablenavigable|unnavigable diff --git a/layout/base/tests/bug612271-1.html b/layout/base/tests/chrome/bug612271-1.html similarity index 69% rename from layout/base/tests/bug612271-1.html rename to layout/base/tests/chrome/bug612271-1.html index 669c5a5e249..6bdce8af451 100644 --- a/layout/base/tests/bug612271-1.html +++ b/layout/base/tests/chrome/bug612271-1.html @@ -1,6 +1,6 @@ - - + + @@ -11,7 +11,6 @@ var area = document.getElementById('t'); area.focus(); - netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); const nsIDOMWindowUtils = Components.interfaces.nsIDOMWindowUtils; // start composition diff --git a/layout/base/tests/bug632215-1.html b/layout/base/tests/chrome/bug632215-1.html similarity index 78% rename from layout/base/tests/bug632215-1.html rename to layout/base/tests/chrome/bug632215-1.html index d658b801516..566bd000a61 100644 --- a/layout/base/tests/bug632215-1.html +++ b/layout/base/tests/chrome/bug632215-1.html @@ -1,8 +1,8 @@ - - + + diff --git a/layout/base/tests/bug632215-2.html b/layout/base/tests/chrome/bug632215-2.html similarity index 78% rename from layout/base/tests/bug632215-2.html rename to layout/base/tests/chrome/bug632215-2.html index d31942055f8..1823fbefbfa 100644 --- a/layout/base/tests/bug632215-2.html +++ b/layout/base/tests/chrome/bug632215-2.html @@ -1,8 +1,8 @@ - - + + diff --git a/layout/base/tests/bug632215-ref.html b/layout/base/tests/chrome/bug632215-ref.html similarity index 100% rename from layout/base/tests/bug632215-ref.html rename to layout/base/tests/chrome/bug632215-ref.html diff --git a/layout/base/tests/bug633044-1-ref.html b/layout/base/tests/chrome/bug633044-1-ref.html similarity index 100% rename from layout/base/tests/bug633044-1-ref.html rename to layout/base/tests/chrome/bug633044-1-ref.html diff --git a/layout/base/tests/bug633044-1.html b/layout/base/tests/chrome/bug633044-1.html similarity index 75% rename from layout/base/tests/bug633044-1.html rename to layout/base/tests/chrome/bug633044-1.html index f3d70a146f1..878a0b2fe48 100644 --- a/layout/base/tests/bug633044-1.html +++ b/layout/base/tests/chrome/bug633044-1.html @@ -1,7 +1,7 @@ - - + + - + + diff --git a/layout/base/tests/bug644428-1-ref.html b/layout/base/tests/chrome/bug644428-1-ref.html similarity index 61% rename from layout/base/tests/bug644428-1-ref.html rename to layout/base/tests/chrome/bug644428-1-ref.html index 633f6ec0a5c..f963a0e8855 100644 --- a/layout/base/tests/bug644428-1-ref.html +++ b/layout/base/tests/chrome/bug644428-1-ref.html @@ -1,8 +1,8 @@ - - + +
a
diff --git a/layout/base/tests/bug644428-1.html b/layout/base/tests/chrome/bug644428-1.html similarity index 68% rename from layout/base/tests/bug644428-1.html rename to layout/base/tests/chrome/bug644428-1.html index 2f32b5f5637..cb5d75c8980 100644 --- a/layout/base/tests/bug644428-1.html +++ b/layout/base/tests/chrome/bug644428-1.html @@ -1,8 +1,8 @@ - - + +
abc
diff --git a/layout/base/tests/bug646382-1-ref.html b/layout/base/tests/chrome/bug646382-1-ref.html similarity index 100% rename from layout/base/tests/bug646382-1-ref.html rename to layout/base/tests/chrome/bug646382-1-ref.html diff --git a/layout/base/tests/bug646382-1.html b/layout/base/tests/chrome/bug646382-1.html similarity index 71% rename from layout/base/tests/bug646382-1.html rename to layout/base/tests/chrome/bug646382-1.html index 967f2ea074c..be7bf203b4b 100644 --- a/layout/base/tests/bug646382-1.html +++ b/layout/base/tests/chrome/bug646382-1.html @@ -1,8 +1,8 @@ - - + + diff --git a/layout/base/tests/bug646382-2-ref.html b/layout/base/tests/chrome/bug646382-2-ref.html similarity index 100% rename from layout/base/tests/bug646382-2-ref.html rename to layout/base/tests/chrome/bug646382-2-ref.html diff --git a/layout/base/tests/bug646382-2.html b/layout/base/tests/chrome/bug646382-2.html similarity index 68% rename from layout/base/tests/bug646382-2.html rename to layout/base/tests/chrome/bug646382-2.html index 817ba51bc92..cc6a1402d29 100644 --- a/layout/base/tests/bug646382-2.html +++ b/layout/base/tests/chrome/bug646382-2.html @@ -1,7 +1,7 @@ - - + + diff --git a/layout/base/tests/chrome/test_bug370436.html b/layout/base/tests/chrome/test_bug370436.html index 3879cca92d8..c22835f0c11 100644 --- a/layout/base/tests/chrome/test_bug370436.html +++ b/layout/base/tests/chrome/test_bug370436.html @@ -27,8 +27,6 @@ function expandStringOffsetToWord(data, offset) function onContextMenu(e) { - netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); - var node = e.rangeParent; var offset = e.rangeOffset; diff --git a/layout/base/tests/chrome/test_bug396367-1.html b/layout/base/tests/chrome/test_bug396367-1.html index 40fc1111ffa..99e1914cf57 100644 --- a/layout/base/tests/chrome/test_bug396367-1.html +++ b/layout/base/tests/chrome/test_bug396367-1.html @@ -19,7 +19,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=396367 } function getdocviewer() { - //netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var navigator1 = top.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebNavigation); var docShell = navigator1.QueryInterface(Components.interfaces.nsIDocShell); var docviewer = docShell.contentViewer.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer); diff --git a/layout/base/tests/chrome/test_bug396367-2.html b/layout/base/tests/chrome/test_bug396367-2.html index 45d87a293a5..48ee294bcca 100644 --- a/layout/base/tests/chrome/test_bug396367-2.html +++ b/layout/base/tests/chrome/test_bug396367-2.html @@ -20,7 +20,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=396367 } function getdocviewer() { - //netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var navigator1 = top.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebNavigation); var docShell = navigator1.QueryInterface(Components.interfaces.nsIDocShell); var docviewer = docShell.contentViewer.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer); diff --git a/layout/base/tests/chrome/test_bug420499.xul b/layout/base/tests/chrome/test_bug420499.xul index b110b77f2dd..b0f1cbacbb7 100644 --- a/layout/base/tests/chrome/test_bug420499.xul +++ b/layout/base/tests/chrome/test_bug420499.xul @@ -68,7 +68,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=420499 } function isCaretVisible() { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); window.QueryInterface(Components.interfaces.nsIInterfaceRequestor); var docShell = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) diff --git a/layout/base/tests/test_bug495648.xul b/layout/base/tests/chrome/test_bug495648.xul similarity index 87% rename from layout/base/tests/test_bug495648.xul rename to layout/base/tests/chrome/test_bug495648.xul index 56f771efccd..787a23a50eb 100644 --- a/layout/base/tests/test_bug495648.xul +++ b/layout/base/tests/chrome/test_bug495648.xul @@ -1,13 +1,13 @@ - + - - - - - + + + + + + + +text-overflow:"" | | (Try "." or "" for example)
+ +LTR / LTR +
+CSS is awesome + + + + +
CSS is awesome
+
CSS is awesome
+CSS is awesome + +
CSS is awesomeCSS is awesome
+
CSS is awesomeCSS is awesome
+ + + +
  • CSS is awesome
+

+ +RTL / LTR +
+CSS is awesome + + + + +
CSS is awesome
+
CSS is awesome
+CSS is awesome + +
CSS is awesomeCSS is awesome
+
CSS is awesomeCSS is awesome
+ + + +
  • CSS is awesome
+

+ +LTR / RTL +
+CSS is awesome + + + + +
CSS is awesome
+
CSS is awesome
+CSS is awesome + +
CSS is awesomeCSS is awesome
+
CSS is awesomeCSS is awesome
+ + + +
  • CSS is awesome
+

+ +RTL / RTL +
+CSS is awesome + + + + +
CSS is awesome
+
CSS is awesome
+CSS is awesome + +
CSS is awesomeCSS is awesome
+
CSS is awesomeCSS is awesome
+ + + +
  • CSS is awesome
+

+ + + + diff --git a/layout/generic/crashtests/text-overflow-iframe.html b/layout/generic/crashtests/text-overflow-iframe.html new file mode 100644 index 00000000000..ba34dc2aabb --- /dev/null +++ b/layout/generic/crashtests/text-overflow-iframe.html @@ -0,0 +1,115 @@ + + + +text-overflow: Test 12 + + + +text-overflow:"" | | (Try "." or "" for example)
+ +LTR / LTR +
+CSS is awesome CSSoverflowing-inline-block is awesome
+CSS is awesome CSS is awesome
+C SS is awesome CSS is awesom e
+C­SS is awesome CSS is awesom­e
+

+ +RTL / LTR +
+CSS is awesome CSSoverflowing-inline-block is awesome
+CSS is awesome CSS is awesome
+C SS is awesome CSS is awesom e
+C­SS is awesome CSS is awesom­e
+

+ + +LTR / RTL +
+CSS is awesome CSSoverflowing-inline-block is awesome
+CSS is awesome CSS is awesome
+C SS is awesome CSS is awesom e
+C­SS is awesome CSS is awesom­e
+

+ +RTL / RTL +
+CSS is awesome CSSoverflowing-inline-block is awesome
+CSS is awesome CSS is awesome
+C SS is awesome CSS is awesom e
+C­SS is awesome CSS is awesom­e
+

+ + diff --git a/layout/generic/nsAutoCopyListener.h b/layout/generic/nsAutoCopyListener.h index 1e3399d3d14..babfa6db268 100644 --- a/layout/generic/nsAutoCopyListener.h +++ b/layout/generic/nsAutoCopyListener.h @@ -57,8 +57,6 @@ public: { if (!sInstance) { sInstance = new nsAutoCopyListener(); - if (!sInstance) - return nsnull; NS_ADDREF(sInstance); } diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 06aa3979789..69f4d0e0db7 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -89,6 +89,8 @@ #include "nsCSSRendering.h" #include "FrameLayerBuilder.h" #include "nsRenderingContext.h" +#include "TextOverflow.h" +#include "mozilla/Util.h" // for DebugOnly #ifdef IBMBIDI #include "nsBidiPresUtils.h" @@ -106,6 +108,7 @@ static const PRUnichar kSquareCharacter = 0x25aa; #define DISABLE_FLOAT_BREAKING_IN_COLUMNS using namespace mozilla; +using namespace mozilla::css; #ifdef DEBUG #include "nsPrintfCString.h" @@ -3984,7 +3987,7 @@ nsBlockFrame::SplitFloat(nsBlockReflowState& aState, if (nextInFlow) { nsContainerFrame *oldParent = static_cast(nextInFlow->GetParent()); - nsresult rv = oldParent->StealFrame(aState.mPresContext, nextInFlow); + DebugOnly rv = oldParent->StealFrame(aState.mPresContext, nextInFlow); NS_ASSERTION(NS_SUCCEEDED(rv), "StealFrame failed"); if (oldParent != this) { ReparentFrame(nextInFlow, oldParent, this); @@ -6071,15 +6074,17 @@ nsBlockFrame::IsVisibleInSelection(nsISelection* aSelection) } /* virtual */ void -nsBlockFrame::PaintTextDecorationLine(gfxContext* aCtx, - const nsPoint& aPt, - nsLineBox* aLine, - nscolor aColor, - PRUint8 aStyle, - gfxFloat aOffset, - gfxFloat aAscent, - gfxFloat aSize, - const PRUint8 aDecoration) +nsBlockFrame::PaintTextDecorationLine( + gfxContext* aCtx, + const nsPoint& aPt, + nsLineBox* aLine, + nscolor aColor, + PRUint8 aStyle, + gfxFloat aOffset, + gfxFloat aAscent, + gfxFloat aSize, + const nsCharClipDisplayItem::ClipEdges& aClipEdges, + const PRUint8 aDecoration) { NS_ASSERTION(!aLine->IsBlock(), "Why did we ask for decorations on a block?"); @@ -6087,10 +6092,12 @@ nsBlockFrame::PaintTextDecorationLine(gfxContext* aCtx, nscoord width = aLine->mBounds.width; AdjustForTextIndent(aLine, start, width); - + nscoord x = start + aPt.x; + aClipEdges.Intersect(&x, &width); + // Only paint if we have a positive width if (width > 0) { - gfxPoint pt(PresContext()->AppUnitsToGfxUnits(start + aPt.x), + gfxPoint pt(PresContext()->AppUnitsToGfxUnits(x), PresContext()->AppUnitsToGfxUnits(aLine->mBounds.y + aPt.y)); gfxSize size(PresContext()->AppUnitsToGfxUnits(width), aSize); nsCSSRendering::PaintDecorationLine( @@ -6150,7 +6157,7 @@ static nsresult DisplayLine(nsDisplayListBuilder* aBuilder, const nsRect& aLineArea, const nsRect& aDirtyRect, nsBlockFrame::line_iterator& aLine, PRInt32 aDepth, PRInt32& aDrawnLines, const nsDisplayListSet& aLists, - nsBlockFrame* aFrame) { + nsBlockFrame* aFrame, TextOverflow* aTextOverflow) { // If the line's combined area (which includes child frames that // stick outside of the line's bounding box or our bounding box) // intersects the dirty rect then paint the line. @@ -6168,24 +6175,27 @@ DisplayLine(nsDisplayListBuilder* aBuilder, const nsRect& aLineArea, // on all the frames on the line, but that might be expensive. So // we approximate it by checking it on aFrame; if it's true for any // frame in the line, it's also true for aFrame. - if (!intersect && !aBuilder->ShouldDescendIntoFrame(aFrame)) + PRBool lineInline = aLine->IsInline(); + PRBool lineMayHaveTextOverflow = aTextOverflow && lineInline; + if (!intersect && !aBuilder->ShouldDescendIntoFrame(aFrame) && + !lineMayHaveTextOverflow) return NS_OK; + nsDisplayListCollection collection; nsresult rv; nsDisplayList aboveTextDecorations; - PRBool lineInline = aLine->IsInline(); if (lineInline) { // Display the text-decoration for the hypothetical anonymous inline box // that wraps these inlines - rv = aFrame->DisplayTextDecorations(aBuilder, aLists.Content(), + rv = aFrame->DisplayTextDecorations(aBuilder, collection.Content(), &aboveTextDecorations, aLine); NS_ENSURE_SUCCESS(rv, rv); } // Block-level child backgrounds go on the blockBorderBackgrounds list ... // Inline-level child backgrounds go on the regular child content list. - nsDisplayListSet childLists(aLists, - lineInline ? aLists.Content() : aLists.BlockBorderBackgrounds()); + nsDisplayListSet childLists(collection, + lineInline ? collection.Content() : collection.BlockBorderBackgrounds()); nsIFrame* kid = aLine->mFirstChild; PRInt32 n = aLine->GetChildCount(); while (--n >= 0) { @@ -6195,7 +6205,13 @@ DisplayLine(nsDisplayListBuilder* aBuilder, const nsRect& aLineArea, kid = kid->GetNextSibling(); } - aLists.Content()->AppendToTop(&aboveTextDecorations); + collection.Content()->AppendToTop(&aboveTextDecorations); + + if (lineMayHaveTextOverflow) { + aTextOverflow->ProcessLine(collection, aLine.get()); + } + + collection.MoveTo(aLists); return NS_OK; } @@ -6237,6 +6253,10 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, aBuilder->MarkFramesForDisplayList(this, mFloats, aDirtyRect); + // Prepare for text-overflow processing. + nsAutoPtr textOverflow( + TextOverflow::WillProcessLines(aBuilder, aLists, this)); + // Don't use the line cursor if we might have a descendant placeholder ... // it might skip lines that contain placeholders but don't themselves // intersect with the dirty area. @@ -6261,7 +6281,7 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, break; } rv = DisplayLine(aBuilder, lineArea, aDirtyRect, line, depth, drawnLines, - aLists, this); + aLists, this, textOverflow); if (NS_FAILED(rv)) break; } @@ -6276,7 +6296,7 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, ++line) { nsRect lineArea = line->GetVisualOverflowArea(); rv = DisplayLine(aBuilder, lineArea, aDirtyRect, line, depth, drawnLines, - aLists, this); + aLists, this, textOverflow); if (NS_FAILED(rv)) break; if (!lineArea.IsEmpty()) { @@ -6295,6 +6315,11 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, } } + // Finalize text-overflow processing. + if (textOverflow) { + textOverflow->DidProcessLines(); + } + if (NS_SUCCEEDED(rv) && (nsnull != mBullet) && HaveOutsideBullet()) { // Display outside bullets manually rv = BuildDisplayListForChild(aBuilder, mBullet, aDirtyRect, aLists); diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index 20d8184b400..ec1293b1503 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -372,6 +372,7 @@ protected: gfxFloat aOffset, gfxFloat aAscent, gfxFloat aSize, + const nsCharClipDisplayItem::ClipEdges& aClipEdges, const PRUint8 aDecoration); virtual void AdjustForTextIndent(const nsLineBox* aLine, diff --git a/layout/generic/nsBlockReflowContext.cpp b/layout/generic/nsBlockReflowContext.cpp index c2b0a957c9c..227ca7b4e42 100644 --- a/layout/generic/nsBlockReflowContext.cpp +++ b/layout/generic/nsBlockReflowContext.cpp @@ -173,8 +173,6 @@ nsBlockReflowContext::ComputeCollapsedTopMargin(const nsHTMLReflowState& aRS, nsSize availSpace(aRS.ComputedWidth(), aRS.ComputedHeight()); outerReflowState = new nsHTMLReflowState(prescontext, aRS, frame, availSpace); - if (!outerReflowState) - goto done; } { nsSize availSpace(outerReflowState->ComputedWidth(), diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index adc6f7c0e71..48b819851b1 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -55,6 +55,7 @@ #include "nsINameSpaceManager.h" +#include "mozilla/Util.h" // for DebugOnly #ifdef DEBUG #include "nsBlockDebugFlags.h" @@ -881,8 +882,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat) mFloatManager->AddFloat(aFloat, region); NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "bad float placement"); // store region - rv = nsFloatManager::StoreRegionFor(aFloat, region); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "float region storage failed"); + nsFloatManager::StoreRegionFor(aFloat, region); // If the float's dimensions have changed, note the damage in the // float manager. @@ -941,7 +941,7 @@ nsBlockReflowState::PushFloatPastBreak(nsIFrame *aFloat) // Put the float on the pushed floats list, even though it // isn't actually a continuation. - nsresult rv = mBlock->StealFrame(mPresContext, aFloat); + DebugOnly rv = mBlock->StealFrame(mPresContext, aFloat); NS_ASSERTION(NS_SUCCEEDED(rv), "StealFrame should succeed"); AppendPushedFloat(aFloat); diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 8e45b5a7718..651059390c6 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -1375,21 +1375,14 @@ nsContainerFrame::DeleteNextInFlowChild(nsPresContext* aPresContext, /** * Set the frames on the overflow list */ -nsresult +void nsContainerFrame::SetOverflowFrames(nsPresContext* aPresContext, const nsFrameList& aOverflowFrames) { NS_PRECONDITION(aOverflowFrames.NotEmpty(), "Shouldn't be called"); nsFrameList* newList = new nsFrameList(aOverflowFrames); - if (!newList) { - // XXXbz should really destroy the frames here, but callers are holding - // pointers to them.... We should switch all callers to framelists, then - // audit and do that. - return NS_ERROR_OUT_OF_MEMORY; - } aPresContext->PropertyTable()->Set(this, OverflowProperty(), newList); - return NS_OK; } nsFrameList* diff --git a/layout/generic/nsContainerFrame.h b/layout/generic/nsContainerFrame.h index 91f5f265430..a6922f7bbf3 100644 --- a/layout/generic/nsContainerFrame.h +++ b/layout/generic/nsContainerFrame.h @@ -402,8 +402,8 @@ protected: /** * Set the overflow list. aOverflowFrames must not be an empty list. */ - nsresult SetOverflowFrames(nsPresContext* aPresContext, - const nsFrameList& aOverflowFrames); + void SetOverflowFrames(nsPresContext* aPresContext, + const nsFrameList& aOverflowFrames); /** * Destroy the overflow list and any frames that are on it. diff --git a/layout/generic/nsFloatManager.cpp b/layout/generic/nsFloatManager.cpp index 78288a89601..2b83106b1a3 100644 --- a/layout/generic/nsFloatManager.cpp +++ b/layout/generic/nsFloatManager.cpp @@ -338,11 +338,10 @@ nsFloatManager::GetRegionFor(nsIFrame* aFloat) return region; } -nsresult +void nsFloatManager::StoreRegionFor(nsIFrame* aFloat, nsRect& aRegion) { - nsresult rv = NS_OK; nsRect rect = aFloat->GetRect(); FrameProperties props = aFloat->Properties(); if (aRegion.IsEqualEdges(rect)) { @@ -357,7 +356,6 @@ nsFloatManager::StoreRegionFor(nsIFrame* aFloat, } *storedMargin = aRegion - rect; } - return rv; } nsresult diff --git a/layout/generic/nsFloatManager.h b/layout/generic/nsFloatManager.h index 343b3ce4522..c74e5579057 100644 --- a/layout/generic/nsFloatManager.h +++ b/layout/generic/nsFloatManager.h @@ -100,8 +100,7 @@ public: * as a delta against the mRect, so repositioning the frame will * also reposition the float region. */ - static nsresult StoreRegionFor(nsIFrame* aFloat, - nsRect& aRegion); + static void StoreRegionFor(nsIFrame* aFloat, nsRect& aRegion); // Structure that stores the current state of a frame manager for // Save/Restore purposes. diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 8c25be7517a..68f51e82500 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -118,6 +118,7 @@ #include "nsExpirationTracker.h" #include "nsSVGIntegrationUtils.h" #include "nsSVGEffects.h" +#include "nsChangeHint.h" #include "gfxContext.h" #include "CSSCalc.h" @@ -1889,7 +1890,7 @@ nsFrame::FireDOMEvent(const nsAString& aDOMEventName, nsIContent *aContent) if (target) { nsRefPtr event = new nsPLDOMEvent(target, aDOMEventName, PR_TRUE, PR_FALSE); - if (!event || NS_FAILED(event->PostDOMEvent())) + if (NS_FAILED(event->PostDOMEvent())) NS_WARNING("Failed to dispatch nsPLDOMEvent"); } } @@ -2191,7 +2192,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext, else frameselection = shell->ConstFrameSelection(); - if (frameselection->GetDisplaySelection() == nsISelectionController::SELECTION_OFF) + if (!frameselection || frameselection->GetDisplaySelection() == nsISelectionController::SELECTION_OFF) return NS_OK;//nothing to do we cannot affect selection from here nsMouseEvent *me = (nsMouseEvent *)aEvent; @@ -4099,12 +4100,17 @@ nsIFrame::InvalidateTransformLayer() class LayerActivity { public: - LayerActivity(nsIFrame* aFrame) : mFrame(aFrame) {} + LayerActivity(nsIFrame* aFrame) : mFrame(aFrame), mChangeHint(nsChangeHint(0)) {} ~LayerActivity(); nsExpirationState* GetExpirationState() { return &mState; } nsIFrame* mFrame; nsExpirationState mState; + // mChangeHint can be some combination of nsChangeHint_UpdateOpacityLayer and + // nsChangeHint_UpdateTransformLayer (or neither) + // The presence of those bits indicates whether opacity or transform + // changes have been detected. + nsChangeHint mChangeHint; }; class LayerActivityTracker : public nsExpirationTracker { @@ -4149,7 +4155,7 @@ LayerActivityTracker::NotifyExpired(LayerActivity* aObject) } void -nsIFrame::MarkLayersActive() +nsIFrame::MarkLayersActive(nsChangeHint aChangeHint) { FrameProperties properties = Properties(); LayerActivity* layerActivity = @@ -4164,6 +4170,7 @@ nsIFrame::MarkLayersActive() gLayerActivityTracker->AddObject(layerActivity); properties.Set(LayerActivityProperty(), layerActivity); } + NS_UpdateHint(layerActivity->mChangeHint, aChangeHint); } PRBool @@ -4172,6 +4179,14 @@ nsIFrame::AreLayersMarkedActive() return Properties().Get(LayerActivityProperty()) != nsnull; } +PRBool +nsIFrame::AreLayersMarkedActive(nsChangeHint aChangeHint) +{ + LayerActivity* layerActivity = + static_cast(Properties().Get(LayerActivityProperty())); + return layerActivity && (layerActivity->mChangeHint & aChangeHint); +} + /* static */ void nsFrame::ShutdownLayerActivityTimer() { diff --git a/layout/generic/nsFrameList.cpp b/layout/generic/nsFrameList.cpp index 04ae0b6aca7..9b9d4f53123 100644 --- a/layout/generic/nsFrameList.cpp +++ b/layout/generic/nsFrameList.cpp @@ -50,16 +50,12 @@ const nsFrameList* nsFrameList::sEmptyList; /* static */ -nsresult +void nsFrameList::Init() { NS_PRECONDITION(!sEmptyList, "Shouldn't be allocated"); sEmptyList = new nsFrameList(); - if (!sEmptyList) - return NS_ERROR_OUT_OF_MEMORY; - - return NS_OK; } void diff --git a/layout/generic/nsFrameList.h b/layout/generic/nsFrameList.h index 7cb750dd97c..9981b94aa83 100644 --- a/layout/generic/nsFrameList.h +++ b/layout/generic/nsFrameList.h @@ -274,7 +274,7 @@ public: void List(FILE* out) const; #endif - static nsresult Init(); + static void Init(); static void Shutdown() { delete sEmptyList; } static const nsFrameList& EmptyList() { return *sEmptyList; } diff --git a/layout/generic/nsFrameUtil.cpp b/layout/generic/nsFrameUtil.cpp index afcd2592629..8ed96d7f639 100644 --- a/layout/generic/nsFrameUtil.cpp +++ b/layout/generic/nsFrameUtil.cpp @@ -220,9 +220,6 @@ nsFrameUtil::Node* nsFrameUtil::Node::Read(FILE* aFile, Tag* tag) { Node* node = new Node; - if (!node) { - /* crash() */ - } node->type = Copy(tag->GetAttr("type")); if (!node->type) { /* crash() */ @@ -508,7 +505,6 @@ nsFrameUtil::Tag::ToString(nsString& aResult) //---------------------------------------------------------------------- -nsresult NS_NewFrameUtil(nsIFrameUtil** aResult); nsresult NS_NewFrameUtil(nsIFrameUtil** aResult) { @@ -516,13 +512,11 @@ NS_NewFrameUtil(nsIFrameUtil** aResult) if (nsnull == aResult) { return NS_ERROR_NULL_POINTER; } - *aResult = nsnull; nsFrameUtil* it = new nsFrameUtil(); - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - return it->QueryInterface(NS_GET_IID(nsIFrameUtil), (void**) aResult); + + NS_ADDREF(*aResult = it); + return NS_OK; } nsFrameUtil::nsFrameUtil() diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 26b0ed61e3d..b8051e49c5b 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1561,15 +1561,11 @@ nsGfxScrollFrameInner::ScrollTo(nsPoint aScrollPosition, } } else { mAsyncScroll = new AsyncScroll; - if (mAsyncScroll) { - mAsyncScroll->mScrollTimer = do_CreateInstance("@mozilla.org/timer;1"); - if (!mAsyncScroll->mScrollTimer) { - delete mAsyncScroll; - mAsyncScroll = nsnull; - } - } - if (!mAsyncScroll) { - // some allocation failed. Scroll the normal way. + mAsyncScroll->mScrollTimer = do_CreateInstance("@mozilla.org/timer;1"); + if (!mAsyncScroll->mScrollTimer) { + delete mAsyncScroll; + mAsyncScroll = nsnull; + // allocation failed. Scroll the normal way. ScrollToImpl(mDestination); return; } @@ -1634,9 +1630,6 @@ CanScrollWithBlitting(nsIFrame* aFrame) { for (nsIFrame* f = aFrame; f; f = nsLayoutUtils::GetCrossDocParentFrame(f)) { - if (f->GetStyleDisplay()->HasTransform()) { - return PR_FALSE; - } if (nsSVGIntegrationUtils::UsingEffectsForFrame(f) || f->IsFrameOfType(nsIFrame::eSVG)) { return PR_FALSE; @@ -2202,8 +2195,8 @@ nsGfxScrollFrameInner::ScrollBy(nsIntPoint aDelta, nsPoint clampAmount = mDestination - newPos; float appUnitsPerDevPixel = mOuter->PresContext()->AppUnitsPerDevPixel(); *aOverflow = nsIntPoint( - NSAppUnitsToIntPixels(PR_ABS(clampAmount.x), appUnitsPerDevPixel), - NSAppUnitsToIntPixels(PR_ABS(clampAmount.y), appUnitsPerDevPixel)); + NSAppUnitsToIntPixels(NS_ABS(clampAmount.x), appUnitsPerDevPixel), + NSAppUnitsToIntPixels(NS_ABS(clampAmount.y), appUnitsPerDevPixel)); } } @@ -3622,10 +3615,7 @@ nsGfxScrollFrameInner::SaveState(nsIStatefulFrame::SpecialStateID aStateID) } nsPresState* state = new nsPresState(); - if (!state) { - return nsnull; - } - + state->SetScrollState(scrollPos); return state; diff --git a/layout/generic/nsHTMLCanvasFrame.cpp b/layout/generic/nsHTMLCanvasFrame.cpp index 4420a61ee64..0c53129ee03 100644 --- a/layout/generic/nsHTMLCanvasFrame.cpp +++ b/layout/generic/nsHTMLCanvasFrame.cpp @@ -97,7 +97,8 @@ public: } virtual already_AddRefed BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager) + LayerManager* aManager, + const ContainerParameters& aContainerParameters) { return static_cast(mFrame)-> BuildLayer(aBuilder, aManager, this); @@ -132,7 +133,7 @@ nsHTMLCanvasFrame::Init(nsIContent* aContent, // We can fill in the canvas before the canvas frame is created, in // which case we never get around to marking the layer active. Therefore, // we mark it active here when we create the frame. - MarkLayersActive(); + MarkLayersActive(nsChangeHint(0)); return rv; } diff --git a/layout/generic/nsHTMLContainerFrame.cpp b/layout/generic/nsHTMLContainerFrame.cpp index a39e0673cd4..3231716e8bb 100644 --- a/layout/generic/nsHTMLContainerFrame.cpp +++ b/layout/generic/nsHTMLContainerFrame.cpp @@ -68,12 +68,12 @@ #include "nsDisplayList.h" #include "nsCSSRendering.h" -class nsDisplayTextDecoration : public nsDisplayItem { +class nsDisplayTextDecoration : public nsCharClipDisplayItem { public: nsDisplayTextDecoration(nsDisplayListBuilder* aBuilder, nsHTMLContainerFrame* aFrame, PRUint8 aDecoration, nscolor aColor, PRUint8 aStyle, nsLineBox* aLine) - : nsDisplayItem(aBuilder, aFrame), mLine(aLine), mColor(aColor), + : nsCharClipDisplayItem(aBuilder, aFrame), mLine(aLine), mColor(aColor), mDecoration(aDecoration), mStyle(aStyle) { MOZ_COUNT_CTOR(nsDisplayTextDecoration); } @@ -134,15 +134,15 @@ nsDisplayTextDecoration::Paint(nsDisplayListBuilder* aBuilder, gfxFloat underlineOffset = fontGroup->GetUnderlineOffset(); f->PaintTextDecorationLine(aCtx->ThebesContext(), pt, mLine, mColor, mStyle, underlineOffset, ascent, - metrics.underlineSize, mDecoration); + metrics.underlineSize, Edges(), mDecoration); } else if (mDecoration == NS_STYLE_TEXT_DECORATION_LINE_OVERLINE) { f->PaintTextDecorationLine(aCtx->ThebesContext(), pt, mLine, mColor, mStyle, metrics.maxAscent, ascent, - metrics.underlineSize, mDecoration); + metrics.underlineSize, Edges(), mDecoration); } else { f->PaintTextDecorationLine(aCtx->ThebesContext(), pt, mLine, mColor, - mStyle, metrics.strikeoutOffset, - ascent, metrics.strikeoutSize, mDecoration); + mStyle, metrics.strikeoutOffset, ascent, + metrics.strikeoutSize, Edges(), mDecoration); } } @@ -152,14 +152,14 @@ nsDisplayTextDecoration::GetBounds(nsDisplayListBuilder* aBuilder) return mFrame->GetVisualOverflowRect() + ToReferenceFrame(); } -class nsDisplayTextShadow : public nsDisplayItem { +class nsDisplayTextShadow : public nsCharClipDisplayItem { public: nsDisplayTextShadow(nsDisplayListBuilder* aBuilder, nsHTMLContainerFrame* aFrame, const PRUint8 aDecoration, PRUint8 aUnderlineStyle, PRUint8 aOverlineStyle, PRUint8 aStrikeThroughStyle, nsLineBox* aLine) - : nsDisplayItem(aBuilder, aFrame), mLine(aLine), + : nsCharClipDisplayItem(aBuilder, aFrame), mLine(aLine), mDecorationFlags(aDecoration), mUnderlineStyle(aUnderlineStyle), mOverlineStyle(aOverlineStyle), mStrikeThroughStyle(aStrikeThroughStyle) { MOZ_COUNT_CTOR(nsDisplayTextShadow); @@ -300,22 +300,23 @@ nsDisplayTextShadow::Paint(nsDisplayListBuilder* aBuilder, continue; } + const nsCharClipDisplayItem::ClipEdges clipEdges = this->Edges(); if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE) { f->PaintTextDecorationLine(shadowCtx, pt, mLine, shadowColor, mUnderlineStyle, underlineOffset, ascent, - metrics.underlineSize, + metrics.underlineSize, clipEdges, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE); } if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_OVERLINE) { f->PaintTextDecorationLine(shadowCtx, pt, mLine, shadowColor, mOverlineStyle, metrics.maxAscent, ascent, - metrics.underlineSize, + metrics.underlineSize, clipEdges, NS_STYLE_TEXT_DECORATION_LINE_OVERLINE); } if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH) { f->PaintTextDecorationLine(shadowCtx, pt, mLine, shadowColor, mStrikeThroughStyle, metrics.strikeoutOffset, - ascent, metrics.strikeoutSize, + ascent, metrics.strikeoutSize, clipEdges, NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH); } @@ -440,6 +441,7 @@ nsHTMLContainerFrame::PaintTextDecorationLine( gfxFloat aOffset, gfxFloat aAscent, gfxFloat aSize, + const nsCharClipDisplayItem::ClipEdges& aClipEdges, const PRUint8 aDecoration) { NS_ASSERTION(!aLine, "Should not have passed a linebox to a non-block frame"); @@ -450,8 +452,10 @@ nsHTMLContainerFrame::PaintTextDecorationLine( bp.Side(side) = 0; } } + nscoord x = aPt.x + bp.left; nscoord innerWidth = mRect.width - bp.left - bp.right; - gfxPoint pt(PresContext()->AppUnitsToGfxUnits(bp.left + aPt.x), + aClipEdges.Intersect(&x, &innerWidth); + gfxPoint pt(PresContext()->AppUnitsToGfxUnits(x), PresContext()->AppUnitsToGfxUnits(bp.top + aPt.y)); gfxSize size(PresContext()->AppUnitsToGfxUnits(innerWidth), aSize); nsCSSRendering::PaintDecorationLine(aCtx, aColor, pt, size, aAscent, aOffset, diff --git a/layout/generic/nsHTMLContainerFrame.h b/layout/generic/nsHTMLContainerFrame.h index 73a6b4378ef..e6dea54a03e 100644 --- a/layout/generic/nsHTMLContainerFrame.h +++ b/layout/generic/nsHTMLContainerFrame.h @@ -41,6 +41,7 @@ #define nsHTMLContainerFrame_h___ #include "nsContainerFrame.h" +#include "nsDisplayList.h" #include "gfxPoint.h" class nsString; @@ -172,20 +173,23 @@ protected: * i.e. negative offsets draws *below* * the baseline. * @param aSize the thickness of the line + * @param aClipEdges clip edges from the display item * @param aDecoration which line will be painted i.e., * NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE or * NS_STYLE_TEXT_DECORATION_LINE_OVERLINE or * NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH. */ - virtual void PaintTextDecorationLine(gfxContext* aCtx, - const nsPoint& aPt, - nsLineBox* aLine, - nscolor aColor, - PRUint8 aStyle, - gfxFloat aOffset, - gfxFloat aAscent, - gfxFloat aSize, - const PRUint8 aDecoration); + virtual void PaintTextDecorationLine( + gfxContext* aCtx, + const nsPoint& aPt, + nsLineBox* aLine, + nscolor aColor, + PRUint8 aStyle, + gfxFloat aOffset, + gfxFloat aAscent, + gfxFloat aSize, + const nsCharClipDisplayItem::ClipEdges& aClipEdges, + const PRUint8 aDecoration); virtual void AdjustForTextIndent(const nsLineBox* aLine, nscoord& start, diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 9c1db63de91..b15c1ec8938 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -1997,14 +1997,25 @@ public: * after a short period. This call does no immediate invalidation, * but when the mark times out, we'll invalidate the frame's overflow * area. + * @param aChangeHint nsChangeHint_UpdateTransformLayer or + * nsChangeHint_UpdateOpacityLayer or 0, depending on whether the change + * triggering the activity is a changing transform, changing opacity, or + * something else. */ - void MarkLayersActive(); - + void MarkLayersActive(nsChangeHint aHint); /** * Return true if this frame is marked as needing active layers. */ PRBool AreLayersMarkedActive(); - + /** + * Return true if this frame is marked as needing active layers. + * @param aChangeHint nsChangeHint_UpdateTransformLayer or + * nsChangeHint_UpdateOpacityLayer. We return true only if + * a change in the transform or opacity has been recorded while layers have + * been marked active for this frame. + */ + PRBool AreLayersMarkedActive(nsChangeHint aChangeHint); + /** * @param aFlags see InvalidateInternal below */ diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 4f16814699c..2711cc671c9 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -101,6 +101,7 @@ #include "ImageLayers.h" #include "mozilla/Preferences.h" +#include "mozilla/Util.h" // for DebugOnly using namespace mozilla; @@ -248,7 +249,6 @@ nsImageFrame::Init(nsIContent* aContent, NS_ENSURE_SUCCESS(rv, rv); mListener = new nsImageListener(this); - if (!mListener) return NS_ERROR_OUT_OF_MEMORY; nsCOMPtr imageLoader = do_QueryInterface(aContent); NS_ENSURE_TRUE(imageLoader, NS_ERROR_UNEXPECTED); @@ -773,7 +773,7 @@ nsImageFrame::GetMinWidth(nsRenderingContext *aRenderingContext) { // XXX The caller doesn't account for constraints of the height, // min-height, and max-height properties. - nscoord result; + DebugOnly result; DISPLAY_MIN_WIDTH(this, result); nsPresContext *presContext = PresContext(); EnsureIntrinsicSizeAndRatio(presContext); @@ -786,7 +786,7 @@ nsImageFrame::GetPrefWidth(nsRenderingContext *aRenderingContext) { // XXX The caller doesn't account for constraints of the height, // min-height, and max-height properties. - nscoord result; + DebugOnly result; DISPLAY_PREF_WIDTH(this, result); nsPresContext *presContext = PresContext(); EnsureIntrinsicSizeAndRatio(presContext); @@ -1857,8 +1857,6 @@ nsresult nsImageFrame::LoadIcons(nsPresContext *aPresContext) NS_NAMED_LITERAL_STRING(brokenSrc,"resource://gre-resources/broken-image.png"); gIconLoad = new IconLoad(); - if (!gIconLoad) - return NS_ERROR_OUT_OF_MEMORY; NS_ADDREF(gIconLoad); nsresult rv; diff --git a/layout/generic/nsLineBox.cpp b/layout/generic/nsLineBox.cpp index b58acc581ec..ef6b92d4c1d 100644 --- a/layout/generic/nsLineBox.cpp +++ b/layout/generic/nsLineBox.cpp @@ -408,10 +408,8 @@ nsLineBox::SetCarriedOutBottomMargin(nsCollapsingMargin aValue) if (!mBlockData) { mBlockData = new ExtraBlockData(mBounds); } - if (mBlockData) { - changed = aValue != mBlockData->mCarriedOutBottomMargin; - mBlockData->mCarriedOutBottomMargin = aValue; - } + changed = aValue != mBlockData->mCarriedOutBottomMargin; + mBlockData->mCarriedOutBottomMargin = aValue; } else if (mBlockData) { changed = aValue != mBlockData->mCarriedOutBottomMargin; @@ -469,9 +467,7 @@ nsLineBox::AppendFloats(nsFloatCacheFreeList& aFreeList) if (!mInlineData) { mInlineData = new ExtraInlineData(mBounds); } - if (mInlineData) { - mInlineData->mFloats.Append(aFreeList); - } + mInlineData->mFloats.Append(aFreeList); } } } diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 9293331c306..cf51939700f 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -956,7 +956,8 @@ public: NS_DISPLAY_DECL_NAME("PluginReadback", TYPE_PLUGIN_READBACK) virtual already_AddRefed BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager) + LayerManager* aManager, + const ContainerParameters& aContainerParameters) { return static_cast(mFrame)->BuildLayer(aBuilder, aManager, this); } @@ -1383,7 +1384,7 @@ nsObjectFrame::PrintPlugin(nsRenderingContext& aRenderingContext, window.window = &gWorld; npprint.print.embedPrint.platformPrint = gWorld; npprint.print.embedPrint.window = window; - nsresult rv = pi->Print(&npprint); + pi->Print(&npprint); ::CGContextTranslateCTM(cgContext, 0.0f, float(window.height)); ::CGContextScaleCTM(cgContext, 1.0f, -1.0f); @@ -2101,9 +2102,6 @@ nsObjectFrame::PrepareInstanceOwner() ("Created new instance owner %p for frame %p\n", mInstanceOwner.get(), this)); - if (!mInstanceOwner) - return NS_ERROR_OUT_OF_MEMORY; - // Note, |this| may very well be gone after this call. return mInstanceOwner->Init(PresContext(), this, GetContent()); } diff --git a/layout/generic/nsObjectFrame.h b/layout/generic/nsObjectFrame.h index 5415f34f2c7..f1b55af5e7b 100644 --- a/layout/generic/nsObjectFrame.h +++ b/layout/generic/nsObjectFrame.h @@ -348,7 +348,8 @@ public: nsTArray* aConfigurations); virtual already_AddRefed BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager) + LayerManager* aManager, + const ContainerParameters& aContainerParameters) { return static_cast(mFrame)->BuildLayer(aBuilder, aManager, diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 7bf82fb0508..8a9ab458b1f 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -509,8 +509,6 @@ NS_IMPL_ISUPPORTS1(nsAutoScrollTimer, nsITimerCallback) nsresult NS_NewDomSelection(nsISelection **aDomSelection) { nsTypedSelection *rlist = new nsTypedSelection; - if (!rlist) - return NS_ERROR_OUT_OF_MEMORY; *aDomSelection = (nsISelection *)rlist; NS_ADDREF(rlist); return NS_OK; @@ -711,8 +709,6 @@ nsFrameSelection::nsFrameSelection() PRInt32 i; for (i = 0;iSetType(GetSelectionTypeFromIndex(i)); } mBatching = 0; @@ -1829,9 +1825,6 @@ nsFrameSelection::TakeFocus(nsIContent *aNewFocus, mDomSelections[index]->RemoveCollapsedRanges(); nsCOMPtr newRange = new nsRange(); - if (!newRange) { - return NS_ERROR_OUT_OF_MEMORY; - } newRange->SetStart(aNewFocus, aContentOffset); newRange->SetEnd(aNewFocus, aContentOffset); @@ -3262,7 +3255,6 @@ nsFrameSelection::CreateAndAddRange(nsINode *aParentNode, PRInt32 aOffset) if (!aParentNode) return NS_ERROR_NULL_POINTER; nsCOMPtr range = new nsRange(); - if (!range) return NS_ERROR_OUT_OF_MEMORY; // Set range around child at given offset nsresult result = range->SetStart(aParentNode, aOffset); @@ -3694,9 +3686,7 @@ nsTypedSelection::SubtractRange(RangeData* aRange, nsIRange* aSubtract, // We need to add a new RangeData to the output, running from // the end of aSubtract to the end of range nsIRange* postOverlap = new nsRange(); - if (!postOverlap) - return NS_ERROR_OUT_OF_MEMORY; - + rv = postOverlap->SetStart(aSubtract->GetEndParent(), aSubtract->EndOffset()); NS_ENSURE_SUCCESS(rv, rv); @@ -3714,8 +3704,6 @@ nsTypedSelection::SubtractRange(RangeData* aRange, nsIRange* aSubtract, // We need to add a new RangeData to the output, running from // the start of the range to the start of aSubtract nsIRange* preOverlap = new nsRange(); - if (!preOverlap) - return NS_ERROR_OUT_OF_MEMORY; nsresult rv = preOverlap->SetStart(range->GetStartParent(), range->StartOffset()); @@ -4521,8 +4509,6 @@ nsTypedSelection::LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, continue; // the ranges do not overlap the input range SelectionDetails* details = new SelectionDetails; - if (!details) - return NS_ERROR_OUT_OF_MEMORY; details->mNext = *aReturnDetails; details->mStart = start; @@ -4675,9 +4661,6 @@ nsTypedSelection::StartAutoScrollTimer(nsIFrame *aFrame, { mAutoScrollTimer = new nsAutoScrollTimer(); - if (!mAutoScrollTimer) - return NS_ERROR_OUT_OF_MEMORY; - result = mAutoScrollTimer->Init(mFrameSelection, this); if (NS_FAILED(result)) @@ -4742,11 +4725,8 @@ nsTypedSelection::DoAutoScroll(nsIFrame *aFrame, nsPoint& aPoint) NS_IMETHODIMP nsTypedSelection::GetEnumerator(nsIEnumerator **aIterator) { - nsresult status = NS_ERROR_OUT_OF_MEMORY; - nsSelectionIterator *iterator = new nsSelectionIterator(this); - if (iterator && NS_FAILED(status = CallQueryInterface(iterator, aIterator)) ) - delete iterator; - return status; + NS_ADDREF(*aIterator = new nsSelectionIterator(this)); + return NS_OK; } @@ -4944,10 +4924,6 @@ nsTypedSelection::Collapse(nsINode* aParentNode, PRInt32 aOffset) mFrameSelection->ClearTableCellSelection(); nsCOMPtr range = new nsRange(); - if (!range) { - NS_ASSERTION(PR_FALSE,"Couldn't make a range - nsFrameSelection::Collapse"); - return NS_ERROR_UNEXPECTED; - } result = range->SetEnd(aParentNode, aOffset); if (NS_FAILED(result)) return result; diff --git a/layout/generic/nsTextFrame.h b/layout/generic/nsTextFrame.h index 6907328cb72..7e70555fd21 100644 --- a/layout/generic/nsTextFrame.h +++ b/layout/generic/nsTextFrame.h @@ -56,6 +56,7 @@ #include "gfxFont.h" #include "gfxSkipChars.h" #include "gfxContext.h" +#include "nsDisplayList.h" class nsTextPaintStyle; class PropertyProvider; @@ -272,16 +273,41 @@ public: gfxFloat GetSnappedBaselineY(gfxContext* aContext, gfxFloat aY); + /** + * Calculate the horizontal bounds of the grapheme clusters that fit entirely + * inside the given left/right edges (which are positive lengths from the + * respective frame edge). If an input value is zero it is ignored and the + * result for that edge is zero. All out parameter values are undefined when + * the method returns false. + * @return true if at least one whole grapheme cluster fit between the edges + */ + bool MeasureCharClippedText(gfxContext* aCtx, + nscoord aLeftEdge, nscoord aRightEdge, + nscoord* aSnappedLeftEdge, + nscoord* aSnappedRightEdge); + /** + * Same as above; this method also the returns the corresponding text run + * offset and number of characters that fit. All out parameter values are + * undefined when the method returns false. + * @return true if at least one whole grapheme cluster fit between the edges + */ + bool MeasureCharClippedText(gfxContext* aCtx, + PropertyProvider& aProvider, + nscoord aLeftEdge, nscoord aRightEdge, + PRUint32* aStartOffset, PRUint32* aMaxLength, + nscoord* aSnappedLeftEdge, + nscoord* aSnappedRightEdge); // primary frame paint method called from nsDisplayText // The private DrawText() is what applies the text to a graphics context void PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt, - const nsRect& aDirtyRect); + const nsRect& aDirtyRect, const nsCharClipDisplayItem& aItem); // helper: paint quirks-mode CSS text decorations void PaintTextDecorations(gfxContext* aCtx, const gfxRect& aDirtyRect, const gfxPoint& aFramePt, const gfxPoint& aTextBaselinePt, nsTextPaintStyle& aTextStyle, PropertyProvider& aProvider, + const nsCharClipDisplayItem::ClipEdges& aClipEdges, const nscolor* aOverrideColor = nsnull); // helper: paint text frame when we're impacted by at least one selection. // Return PR_FALSE if the text was not painted and we should continue with @@ -291,7 +317,8 @@ public: const gfxPoint& aTextBaselinePt, const gfxRect& aDirtyRect, PropertyProvider& aProvider, - nsTextPaintStyle& aTextPaintStyle); + nsTextPaintStyle& aTextPaintStyle, + const nsCharClipDisplayItem::ClipEdges& aClipEdges); // helper: paint text with foreground and background colors determined // by selection(s). Also computes a mask of all selection types applying to // our text, returned in aAllTypes. @@ -428,7 +455,9 @@ protected: const gfxPoint& aFramePt, const gfxPoint& aTextBaselinePt, gfxContext* aCtx, - const nscolor& aForegroundColor); + const nscolor& aForegroundColor, + const nsCharClipDisplayItem::ClipEdges& aClipEdges, + nscoord aLeftSideOffset); struct TextDecorations { PRUint8 mDecorations; diff --git a/layout/generic/nsTextFrameTextRunCache.h b/layout/generic/nsTextFrameTextRunCache.h index 7cafbc70e28..62774bdb8b5 100644 --- a/layout/generic/nsTextFrameTextRunCache.h +++ b/layout/generic/nsTextFrameTextRunCache.h @@ -46,7 +46,7 @@ */ class nsTextFrameTextRunCache { public: - static nsresult Init(); + static void Init(); static void Shutdown(); }; diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index d860104b43c..d0faed6784f 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -113,7 +113,9 @@ #include "gfxContext.h" #include "gfxTextRunWordCache.h" #include "gfxImageSurface.h" + #include "mozilla/dom/Element.h" +#include "mozilla/Util.h" // for DebugOnly #ifdef NS_DEBUG #undef NOISY_BLINK @@ -461,7 +463,7 @@ UnhookTextRunFromFrames(gfxTextRun* aTextRun, nsTextFrame* aStartContinuation) if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) { nsIFrame* userDataFrame = static_cast(aTextRun->GetUserData()); - PRBool found = + DebugOnly found = ClearAllTextRunReferences(static_cast(userDataFrame), aTextRun, aStartContinuation); NS_ASSERTION(!aStartContinuation || found, @@ -590,10 +592,9 @@ MakeTextRun(const PRUint8 *aText, PRUint32 aLength, return textRun.forget(); } -nsresult +void nsTextFrameTextRunCache::Init() { gTextRuns = new FrameTextRunCache(); - return gTextRuns ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } void @@ -2800,7 +2801,7 @@ PropertyProvider::CalcTabWidths(PRUint32 aStart, PRUint32 aLength) PRUint32 startOffset = mStart.GetSkippedOffset(); PRUint32 tabsEnd = mTabWidths ? - mTabWidths->mLimit : PR_MAX(mTabWidthsAnalyzedLimit, startOffset); + mTabWidths->mLimit : NS_MAX(mTabWidthsAnalyzedLimit, startOffset); if (tabsEnd < aStart + aLength) { NS_ASSERTION(mReflowing, @@ -2845,7 +2846,7 @@ PropertyProvider::CalcTabWidths(PRUint32 aStart, PRUint32 aLength) if (!mTabWidths) { // Delete any stale property that may be left on the frame mFrame->Properties().Delete(TabWidthProperty()); - mTabWidthsAnalyzedLimit = PR_MAX(mTabWidthsAnalyzedLimit, + mTabWidthsAnalyzedLimit = NS_MAX(mTabWidthsAnalyzedLimit, aStart + aLength); } } @@ -3035,8 +3036,8 @@ public: NS_DECL_NSITIMERCALLBACK - static nsresult AddBlinkFrame(nsPresContext* aPresContext, nsIFrame* aFrame); - static nsresult RemoveBlinkFrame(nsIFrame* aFrame); + static void AddBlinkFrame(nsPresContext* aPresContext, nsIFrame* aFrame); + static void RemoveBlinkFrame(nsIFrame* aFrame); static PRBool GetBlinkIsOff() { return sState == 3; } @@ -3160,33 +3161,28 @@ NS_IMETHODIMP nsBlinkTimer::Notify(nsITimer *timer) // static -nsresult nsBlinkTimer::AddBlinkFrame(nsPresContext* aPresContext, nsIFrame* aFrame) +void nsBlinkTimer::AddBlinkFrame(nsPresContext* aPresContext, nsIFrame* aFrame) { if (!sTextBlinker) { sTextBlinker = new nsBlinkTimer; - if (!sTextBlinker) return NS_ERROR_OUT_OF_MEMORY; } - + NS_ADDREF(sTextBlinker); sTextBlinker->AddFrame(aPresContext, aFrame); - return NS_OK; } // static -nsresult nsBlinkTimer::RemoveBlinkFrame(nsIFrame* aFrame) +void nsBlinkTimer::RemoveBlinkFrame(nsIFrame* aFrame) { NS_ASSERTION(sTextBlinker, "Should have blink timer here"); - + nsBlinkTimer* blinkTimer = sTextBlinker; // copy so we can call NS_RELEASE on it - if (!blinkTimer) return NS_OK; - + blinkTimer->RemoveFrame(aFrame); NS_RELEASE(blinkTimer); - - return NS_OK; } //---------------------------------------------------------------------- @@ -3206,39 +3202,6 @@ EnsureDifferentColors(nscolor colorA, nscolor colorB) //----------------------------------------------------------------------------- -static nscolor -DarkenColor(nscolor aColor) -{ - PRUint16 hue, sat, value; - PRUint8 alpha; - - // convert the RBG to HSV so we can get the lightness (which is the v) - NS_RGB2HSV(aColor, hue, sat, value, alpha); - - // The goal here is to send white to black while letting colored - // stuff stay colored... So we adopt the following approach. - // Something with sat = 0 should end up with value = 0. Something - // with a high sat can end up with a high value and it's ok.... At - // the same time, we don't want to make things lighter. Do - // something simple, since it seems to work. - if (value > sat) { - value = sat; - // convert this color back into the RGB color space. - NS_HSV2RGB(aColor, hue, sat, value, alpha); - } - return aColor; -} - -// Check whether we should darken text colors. We need to do this if -// background images and colors are being suppressed, because that means -// light text will not be visible against the (presumed light-colored) background. -static PRBool -ShouldDarkenColors(nsPresContext* aPresContext) -{ - return !aPresContext->GetBackgroundColorDraw() && - !aPresContext->GetBackgroundImageDraw(); -} - nsTextPaintStyle::nsTextPaintStyle(nsTextFrame* aFrame) : mFrame(aFrame), mPresContext(aFrame->PresContext()), @@ -3277,11 +3240,7 @@ nsTextPaintStyle::EnsureSufficientContrast(nscolor *aForeColor, nscolor *aBackCo nscolor nsTextPaintStyle::GetTextColor() { - nscolor color = mFrame->GetVisitedDependentColor(eCSSProperty_color); - if (ShouldDarkenColors(mPresContext)) { - color = DarkenColor(color); - } - return color; + return nsLayoutUtils::GetTextColor(mFrame); } PRBool @@ -4167,10 +4126,10 @@ nsTextFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) ClearTextRun(nsnull); } -class nsDisplayText : public nsDisplayItem { +class nsDisplayText : public nsCharClipDisplayItem { public: nsDisplayText(nsDisplayListBuilder* aBuilder, nsTextFrame* aFrame) : - nsDisplayItem(aBuilder, aFrame), + nsCharClipDisplayItem(aBuilder, aFrame), mDisableSubpixelAA(PR_FALSE) { MOZ_COUNT_CTOR(nsDisplayText); } @@ -4216,7 +4175,9 @@ nsDisplayText::Paint(nsDisplayListBuilder* aBuilder, gfxContextAutoDisableSubpixelAntialiasing disable(aCtx->ThebesContext(), mDisableSubpixelAA); - f->PaintText(aCtx, ToReferenceFrame(), extraVisible); + NS_ASSERTION(mLeftEdge >= 0, "illegal left edge"); + NS_ASSERTION(mRightEdge >= 0, "illegal right edge"); + f->PaintText(aCtx, ToReferenceFrame(), extraVisible, *this); } NS_IMETHODIMP @@ -4432,12 +4393,14 @@ nsTextFrame::UnionTextDecorationOverflow(nsPresContext* aPresContext, } void -nsTextFrame::PaintTextDecorations(gfxContext* aCtx, const gfxRect& aDirtyRect, - const gfxPoint& aFramePt, - const gfxPoint& aTextBaselinePt, - nsTextPaintStyle& aTextPaintStyle, - PropertyProvider& aProvider, - const nscolor* aOverrideColor) +nsTextFrame::PaintTextDecorations( + gfxContext* aCtx, const gfxRect& aDirtyRect, + const gfxPoint& aFramePt, + const gfxPoint& aTextBaselinePt, + nsTextPaintStyle& aTextPaintStyle, + PropertyProvider& aProvider, + const nsCharClipDisplayItem::ClipEdges& aClipEdges, + const nscolor* aOverrideColor) { TextDecorations decorations = GetTextDecorations(aTextPaintStyle.PresContext()); @@ -4455,8 +4418,11 @@ nsTextFrame::PaintTextDecorations(gfxContext* aCtx, const gfxRect& aDirtyRect, gfxFloat app = aTextPaintStyle.PresContext()->AppUnitsPerDevPixel(); // XXX aFramePt is in AppUnits, shouldn't it be nsFloatPoint? - gfxPoint pt(aFramePt.x / app, (aTextBaselinePt.y - mAscent) / app); - gfxSize size(GetRect().width / app, 0); + nscoord x = aFramePt.x; + nscoord width = GetRect().width; + aClipEdges.Intersect(&x, &width); + gfxPoint pt(x / app, (aTextBaselinePt.y - mAscent) / app); + gfxSize size(width / app, 0); gfxFloat ascent = gfxFloat(mAscent) / app; nscolor lineColor; @@ -4809,7 +4775,9 @@ nsTextFrame::PaintOneShadow(PRUint32 aOffset, PRUint32 aLength, nsCSSShadowItem* aShadowDetails, PropertyProvider* aProvider, const nsRect& aDirtyRect, const gfxPoint& aFramePt, const gfxPoint& aTextBaselinePt, - gfxContext* aCtx, const nscolor& aForegroundColor) + gfxContext* aCtx, const nscolor& aForegroundColor, + const nsCharClipDisplayItem::ClipEdges& aClipEdges, + nscoord aLeftSideOffset) { gfxPoint shadowOffset(aShadowDetails->mXOffset, aShadowDetails->mYOffset); nscoord blurRadius = NS_MAX(aShadowDetails->mRadius, 0); @@ -4825,7 +4793,7 @@ nsTextFrame::PaintOneShadow(PRUint32 aOffset, PRUint32 aLength, // The origin of mBoundingBox is the text baseline left, so we must translate it by // that much in order to make the origin the top-left corner of the text bounding box. gfxRect shadowGfxRect = shadowMetrics.mBoundingBox + - gfxPoint(aFramePt.x, aTextBaselinePt.y) + shadowOffset; + gfxPoint(aFramePt.x + aLeftSideOffset, aTextBaselinePt.y) + shadowOffset; nsRect shadowRect(shadowGfxRect.X(), shadowGfxRect.Y(), shadowGfxRect.Width(), shadowGfxRect.Height()); @@ -4862,7 +4830,7 @@ nsTextFrame::PaintOneShadow(PRUint32 aOffset, PRUint32 aLength, nsTextPaintStyle textPaintStyle(this); PaintTextDecorations(shadowContext, dirtyGfxRect, aFramePt + shadowOffset, aTextBaselinePt + shadowOffset, - textPaintStyle, *aProvider, &shadowColor); + textPaintStyle, *aProvider, aClipEdges, &shadowColor); contextBoxBlur.DoPaint(); aCtx->Restore(); @@ -5027,7 +4995,7 @@ nsTextFrame::PaintTextSelectionDecorations(gfxContext* aCtx, if (type == aSelectionType) { pt.x = (aFramePt.x + xOffset - (mTextRun->IsRightToLeft() ? advance : 0)) / app; - gfxFloat width = PR_ABS(advance) / app; + gfxFloat width = NS_ABS(advance) / app; DrawSelectionDecorations(aCtx, aSelectionType, this, aTextPaintStyle, selectedStyle, pt, width, mAscent / app, decorationMetrics); @@ -5040,7 +5008,8 @@ PRBool nsTextFrame::PaintTextWithSelection(gfxContext* aCtx, const gfxPoint& aFramePt, const gfxPoint& aTextBaselinePt, const gfxRect& aDirtyRect, - PropertyProvider& aProvider, nsTextPaintStyle& aTextPaintStyle) + PropertyProvider& aProvider, nsTextPaintStyle& aTextPaintStyle, + const nsCharClipDisplayItem::ClipEdges& aClipEdges) { SelectionDetails* details = GetSelectionDetails(); if (!details) @@ -5050,7 +5019,7 @@ nsTextFrame::PaintTextWithSelection(gfxContext* aCtx, PaintTextWithSelectionColors(aCtx, aFramePt, aTextBaselinePt, aDirtyRect, aProvider, aTextPaintStyle, details, &allTypes); PaintTextDecorations(aCtx, aDirtyRect, aFramePt, aTextBaselinePt, - aTextPaintStyle, aProvider); + aTextPaintStyle, aProvider, aClipEdges); PRInt32 i; // Iterate through just the selection types that paint decorations and // paint decorations for any that actually occur in this frame. Paint @@ -5129,14 +5098,120 @@ nsTextFrame::GetSnappedBaselineY(gfxContext* aContext, gfxFloat aY) gfxFloat appUnitsPerDevUnit = mTextRun->GetAppUnitsPerDevUnit(); gfxFloat baseline = aY + mAscent; gfxRect putativeRect(0, baseline/appUnitsPerDevUnit, 1, 1); - if (!aContext->UserToDevicePixelSnapped(putativeRect)) + if (!aContext->UserToDevicePixelSnapped(putativeRect, PR_TRUE)) return baseline; return aContext->DeviceToUser(putativeRect.TopLeft()).y*appUnitsPerDevUnit; } +bool +nsTextFrame::MeasureCharClippedText(gfxContext* aCtx, + nscoord aLeftEdge, nscoord aRightEdge, + nscoord* aSnappedLeftEdge, + nscoord* aSnappedRightEdge) +{ + // Don't pass in aRenderingContext here, because we need a *reference* + // context and aRenderingContext might have some transform in it + // XXX get the block and line passed to us somehow! This is slow! + gfxSkipCharsIterator iter = EnsureTextRun(); + if (!mTextRun) + return false; + + PropertyProvider provider(this, iter); + // Trim trailing whitespace + provider.InitializeForDisplay(PR_TRUE); + + PRUint32 startOffset = provider.GetStart().GetSkippedOffset(); + PRUint32 maxLength = ComputeTransformedLength(provider); + return MeasureCharClippedText(aCtx, provider, aLeftEdge, aRightEdge, + &startOffset, &maxLength, + aSnappedLeftEdge, aSnappedRightEdge); +} + +static PRUint32 GetClusterLength(gfxTextRun* aTextRun, + PRUint32 aStartOffset, + PRUint32 aMaxLength, + bool aIsRTL) +{ + PRUint32 clusterLength = aIsRTL ? 0 : 1; + while (clusterLength < aMaxLength) { + if (aTextRun->IsClusterStart(aStartOffset + clusterLength)) { + if (aIsRTL) { + ++clusterLength; + } + break; + } + ++clusterLength; + } + return clusterLength; +} + +bool +nsTextFrame::MeasureCharClippedText(gfxContext* aCtx, + PropertyProvider& aProvider, + nscoord aLeftEdge, nscoord aRightEdge, + PRUint32* aStartOffset, + PRUint32* aMaxLength, + nscoord* aSnappedLeftEdge, + nscoord* aSnappedRightEdge) +{ + *aSnappedLeftEdge = 0; + *aSnappedRightEdge = 0; + if (aLeftEdge <= 0 && aRightEdge <= 0) { + return true; + } + + PRUint32 offset = *aStartOffset; + PRUint32 maxLength = *aMaxLength; + const nscoord frameWidth = GetSize().width; + const PRBool rtl = mTextRun->IsRightToLeft(); + gfxFloat advanceWidth = 0; + const nscoord startEdge = rtl ? aRightEdge : aLeftEdge; + if (startEdge > 0) { + const gfxFloat maxAdvance = gfxFloat(startEdge); + while (maxLength > 0) { + PRUint32 clusterLength = + GetClusterLength(mTextRun, offset, maxLength, rtl); + advanceWidth += + mTextRun->GetAdvanceWidth(offset, clusterLength, &aProvider); + maxLength -= clusterLength; + offset += clusterLength; + if (advanceWidth >= maxAdvance) { + break; + } + } + nscoord* snappedStartEdge = rtl ? aSnappedRightEdge : aSnappedLeftEdge; + *snappedStartEdge = NSToCoordFloor(advanceWidth); + *aStartOffset = offset; + } + + const nscoord endEdge = rtl ? aLeftEdge : aRightEdge; + if (endEdge > 0) { + const gfxFloat maxAdvance = gfxFloat(frameWidth - endEdge); + while (maxLength > 0) { + PRUint32 clusterLength = + GetClusterLength(mTextRun, offset, maxLength, rtl); + gfxFloat nextAdvance = advanceWidth + + mTextRun->GetAdvanceWidth(offset, clusterLength, &aProvider); + if (nextAdvance > maxAdvance) { + break; + } + // This cluster fits, include it. + advanceWidth = nextAdvance; + maxLength -= clusterLength; + offset += clusterLength; + } + maxLength = offset - *aStartOffset; + nscoord* snappedEndEdge = rtl ? aSnappedLeftEdge : aSnappedRightEdge; + *snappedEndEdge = NSToCoordFloor(gfxFloat(frameWidth) - advanceWidth); + } + *aMaxLength = maxLength; + return maxLength != 0; +} + void nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt, - const nsRect& aDirtyRect) + const nsRect& aDirtyRect, + const nsCharClipDisplayItem& aItem) { // Don't pass in aRenderingContext here, because we need a *reference* // context and aRenderingContext might have some transform in it @@ -5145,23 +5220,28 @@ nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt, if (!mTextRun) return; - nsTextPaintStyle textPaintStyle(this); PropertyProvider provider(this, iter); // Trim trailing whitespace provider.InitializeForDisplay(PR_TRUE); gfxContext* ctx = aRenderingContext->ThebesContext(); - + const PRBool rtl = mTextRun->IsRightToLeft(); + const nscoord frameWidth = GetSize().width; gfxPoint framePt(aPt.x, aPt.y); - gfxPoint textBaselinePt( - mTextRun->IsRightToLeft() ? gfxFloat(aPt.x + GetSize().width) : framePt.x, - GetSnappedBaselineY(ctx, aPt.y)); - - gfxRect dirtyRect(aDirtyRect.x, aDirtyRect.y, - aDirtyRect.width, aDirtyRect.height); - - gfxFloat advanceWidth; - gfxRGBA foregroundColor = gfxRGBA(textPaintStyle.GetTextColor()); + gfxPoint textBaselinePt(rtl ? gfxFloat(aPt.x + frameWidth) : framePt.x, + GetSnappedBaselineY(ctx, aPt.y)); + PRUint32 startOffset = provider.GetStart().GetSkippedOffset(); + PRUint32 maxLength = ComputeTransformedLength(provider); + nscoord snappedLeftEdge, snappedRightEdge; + if (!MeasureCharClippedText(ctx, provider, aItem.mLeftEdge, aItem.mRightEdge, + &startOffset, &maxLength, &snappedLeftEdge, &snappedRightEdge)) { + return; + } + textBaselinePt.x += rtl ? -snappedRightEdge : snappedLeftEdge; + nsCharClipDisplayItem::ClipEdges clipEdges(aItem, snappedLeftEdge, + snappedRightEdge); + nsTextPaintStyle textPaintStyle(this); + nscolor foregroundColor = textPaintStyle.GetTextColor(); // Paint the text shadow before doing any foreground stuff const nsStyleText* textStyle = GetStyleText(); @@ -5169,29 +5249,29 @@ nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt, // Text shadow happens with the last value being painted at the back, // ie. it is painted first. for (PRUint32 i = textStyle->mTextShadow->Length(); i > 0; --i) { - PaintOneShadow(provider.GetStart().GetSkippedOffset(), - ComputeTransformedLength(provider), + PaintOneShadow(startOffset, maxLength, textStyle->mTextShadow->ShadowAt(i - 1), &provider, aDirtyRect, framePt, textBaselinePt, ctx, - textPaintStyle.GetTextColor()); + foregroundColor, clipEdges, snappedLeftEdge); } } + gfxRect dirtyRect(aDirtyRect.x, aDirtyRect.y, + aDirtyRect.width, aDirtyRect.height); // Fork off to the (slower) paint-with-selection path if necessary. if (nsLayoutUtils::GetNonGeneratedAncestor(this)->GetStateBits() & NS_FRAME_SELECTED_CONTENT) { if (PaintTextWithSelection(ctx, framePt, textBaselinePt, - dirtyRect, provider, textPaintStyle)) + dirtyRect, provider, textPaintStyle, clipEdges)) return; } - ctx->SetColor(foregroundColor); + ctx->SetColor(gfxRGBA(foregroundColor)); - DrawText(ctx, textBaselinePt, provider.GetStart().GetSkippedOffset(), - ComputeTransformedLength(provider), &dirtyRect, - &provider, advanceWidth, - (GetStateBits() & TEXT_HYPHEN_BREAK) != 0); + gfxFloat advanceWidth; + DrawText(ctx, textBaselinePt, startOffset, maxLength, &dirtyRect, &provider, + advanceWidth, (GetStateBits() & TEXT_HYPHEN_BREAK) != 0); PaintTextDecorations(ctx, dirtyRect, framePt, textBaselinePt, - textPaintStyle, provider); + textPaintStyle, provider, clipEdges); } void @@ -6123,7 +6203,7 @@ nsTextFrame::AddInlineMinWidthForFlow(nsRenderingContext *aRenderingContext, (mTextRun->GetFlags() & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0)); if (hyphenating) { gfxSkipCharsIterator tmp(iter); - len = PR_MIN(GetContentOffset() + GetInFlowContentLength(), + len = NS_MIN(GetContentOffset() + GetInFlowContentLength(), tmp.ConvertSkippedToOriginal(flowEndInTextRun)) - iter.GetOriginalOffset(); } PropertyProvider provider(mTextRun, textStyle, frag, this, @@ -7060,12 +7140,10 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth, mContentOffset + contentLength <= contentNewLineOffset)) { if (!cachedNewlineOffset) { cachedNewlineOffset = new NewlineProperty; - if (cachedNewlineOffset) { - if (NS_FAILED(mContent->SetProperty(nsGkAtoms::newline, cachedNewlineOffset, - NewlineProperty::Destroy))) { - delete cachedNewlineOffset; - cachedNewlineOffset = nsnull; - } + if (NS_FAILED(mContent->SetProperty(nsGkAtoms::newline, cachedNewlineOffset, + NewlineProperty::Destroy))) { + delete cachedNewlineOffset; + cachedNewlineOffset = nsnull; } } if (cachedNewlineOffset) { diff --git a/layout/generic/nsVideoFrame.cpp b/layout/generic/nsVideoFrame.cpp index 437920d721c..2df59e59f00 100644 --- a/layout/generic/nsVideoFrame.cpp +++ b/layout/generic/nsVideoFrame.cpp @@ -403,7 +403,8 @@ public: } virtual already_AddRefed BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager) + LayerManager* aManager, + const ContainerParameters& aContainerParameters) { return static_cast(mFrame)->BuildLayer(aBuilder, aManager, this); } diff --git a/layout/generic/test/Makefile.in b/layout/generic/test/Makefile.in index ba253f4a6d7..d943e0b211f 100644 --- a/layout/generic/test/Makefile.in +++ b/layout/generic/test/Makefile.in @@ -47,94 +47,95 @@ include $(topsrcdir)/config/rules.mk # in the list below, we make sure that the tests that require focus # run before test_plugin_clipping, which can steal focus for its window. _TEST_FILES = \ - bug344830_testembed.svg \ - frame_selection_underline.xhtml \ - frame_selection_underline-ref.xhtml \ - frame_selection_underline.css \ - plugin_clipping_helper.xhtml \ - plugin_clipping_helper2.xhtml \ - plugin_clipping_helper_transformed.xhtml \ - plugin_clipping_helper_table.xhtml \ - plugin_clipping_lib.js \ - plugin_focus_helper.html \ - test_backspace_delete.xul \ - test_bug240933.html \ - test_bug263683.html \ - test_bug288789.html \ - test_bug290397.html \ - test_bug323656.html \ - test_bug344830.html \ - test_bug348681.html \ - test_bug382429.html \ - test_bug384527.html \ - test_bug385751.html \ - test_bug389630.html \ - test_bug391747.html \ - test_bug392746.html \ - test_bug392923.html \ - test_bug394173.html \ - test_bug394239.html \ - test_bug402380.html \ - test_bug404872.html \ - test_bug405178.html \ - test_bug416168.html \ - test_bug421436.html \ - $(warning test_bug421839-1.html disabled because it calls finish twice which can cause timeouts) \ - test_bug421839-2.html \ - bug421839-2-page.html \ - test_bug424627.html \ - test_bug438840.html \ - test_bug448860.html \ - test_bug460532.html \ - test_bug468167.html \ - test_bug469613.xul \ - test_bug469774.xul \ - test_bug470212.html \ - $(warning test_bug488417.html temporarily disabled - see bug 489560) \ - test_bug496275.html \ - test_bug503813.html \ - test_bug508115.xul \ - $(warning test_bug507902.html temporarily disabled - see bug 510001) \ - test_bug514732.html \ - test_bug527306.html \ - test_bug579767.html \ - test_bug597333.html \ - test_image_selection.html \ - test_invalidate_during_plugin_paint.html \ - test_movement_by_characters.html \ - test_movement_by_words.html \ - test_plugin_clipping.xhtml \ - test_plugin_clipping2.xhtml \ - test_plugin_clipping_transformed.xhtml \ - test_plugin_clipping_table.xhtml \ - test_plugin_focus.html \ - test_plugin_mouse_coords.html \ - test_plugin_position.xhtml \ - test_selection_expanding.html \ - selection_expanding_xbl.xml \ - test_selection_underline.html \ - file_BrokenImageReference.png \ - file_Dolske.png \ - file_IconTestServer.sjs \ - file_LoadingImageReference.png \ - file_bug514732_1.html \ - file_bug514732_helper.html \ - file_bug579767_1.html \ - file_bug579767_2.html \ - test_bug522632.html \ - test_bug589621.html \ - test_bug589623.html \ - test_bug632379.xul \ - test_bug633762.html \ - bug633762_iframe.html \ - $(srcdir)/../../reftests/backgrounds/blue-32x32.png \ - $(srcdir)/../../reftests/backgrounds/fuchsia-32x32.png \ - $(NULL) + bug344830_testembed.svg \ + frame_selection_underline.xhtml \ + frame_selection_underline-ref.xhtml \ + frame_selection_underline.css \ + plugin_clipping_helper.xhtml \ + plugin_clipping_helper2.xhtml \ + plugin_clipping_helper_transformed.xhtml \ + plugin_clipping_helper_table.xhtml \ + plugin_clipping_lib.js \ + plugin_focus_helper.html \ + test_bug240933.html \ + test_bug263683.html \ + test_bug288789.html \ + test_bug290397.html \ + test_bug323656.html \ + test_bug344830.html \ + test_bug348681.html \ + test_bug382429.html \ + test_bug384527.html \ + test_bug385751.html \ + test_bug389630.html \ + test_bug391747.html \ + test_bug392746.html \ + test_bug392923.html \ + test_bug394173.html \ + test_bug394239.html \ + test_bug402380.html \ + test_bug404872.html \ + test_bug405178.html \ + test_bug416168.html \ + test_bug421436.html \ + $(warning test_bug421839-1.html disabled because it calls finish twice which can cause timeouts) \ + test_bug421839-2.html \ + bug421839-2-page.html \ + test_bug424627.html \ + test_bug438840.html \ + test_bug448860.html \ + test_bug460532.html \ + test_bug468167.html \ + test_bug470212.html \ + $(warning test_bug488417.html temporarily disabled - see bug 489560) \ + test_bug496275.html \ + test_bug503813.html \ + $(warning test_bug507902.html temporarily disabled - see bug 510001) \ + test_bug514732.html \ + test_bug527306.html \ + test_bug579767.html \ + test_bug597333.html \ + test_bug666225.html \ + test_image_selection.html \ + test_invalidate_during_plugin_paint.html \ + test_movement_by_characters.html \ + test_movement_by_words.html \ + test_plugin_clipping.xhtml \ + test_plugin_clipping2.xhtml \ + test_plugin_clipping_transformed.xhtml \ + test_plugin_clipping_table.xhtml \ + test_plugin_focus.html \ + test_plugin_mouse_coords.html \ + test_plugin_position.xhtml \ + test_selection_expanding.html \ + selection_expanding_xbl.xml \ + test_selection_underline.html \ + file_BrokenImageReference.png \ + file_Dolske.png \ + file_IconTestServer.sjs \ + file_LoadingImageReference.png \ + file_bug514732_1.html \ + file_bug514732_helper.html \ + file_bug579767_1.html \ + file_bug579767_2.html \ + test_bug522632.html \ + test_bug589621.html \ + test_bug589623.html \ + test_bug633762.html \ + bug633762_iframe.html \ + $(srcdir)/../../reftests/backgrounds/blue-32x32.png \ + $(srcdir)/../../reftests/backgrounds/fuchsia-32x32.png \ + $(NULL) _CHROME_FILES = \ - test_bug514732-2.xul \ - file_bug514732_window.xul \ - $(NULL) + test_bug632379.xul \ + test_bug508115.xul \ + test_bug469613.xul \ + test_bug469774.xul \ + test_backspace_delete.xul \ + test_bug514732-2.xul \ + file_bug514732_window.xul \ + $(NULL) libs:: $(_TEST_FILES) $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir) diff --git a/layout/generic/test/plugin_focus_helper.html b/layout/generic/test/plugin_focus_helper.html index e5c26d0fe19..de14f98cbd8 100644 --- a/layout/generic/test/plugin_focus_helper.html +++ b/layout/generic/test/plugin_focus_helper.html @@ -2,7 +2,6 @@ Test that clicking on plugins transfers focus correctly - @@ -16,6 +15,7 @@ var SimpleTest = window.opener.SimpleTest; var is = window.opener.is; var ok = window.opener.ok; +var todo = window.opener.todo; netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); const Cc = Components.classes; diff --git a/layout/generic/test/test_backspace_delete.xul b/layout/generic/test/test_backspace_delete.xul index 8806b5d4325..8966dd5a71b 100644 --- a/layout/generic/test/test_backspace_delete.xul +++ b/layout/generic/test/test_backspace_delete.xul @@ -1,11 +1,11 @@ - + - - + + + @@ -34,7 +34,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=469774 // Like snapshotWindow, but with DRAWWINDOW_DRAW_CARET function snapShot() { - netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead'); var canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); canvas.setAttribute("width", 200); canvas.setAttribute("height", 50); diff --git a/layout/generic/test/test_bug508115.xul b/layout/generic/test/test_bug508115.xul index 310a390ff70..78792d6420c 100644 --- a/layout/generic/test/test_bug508115.xul +++ b/layout/generic/test/test_bug508115.xul @@ -1,6 +1,6 @@ - + @@ -10,9 +10,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=508115 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> Test for Bug 508115 - + diff --git a/layout/generic/test/test_bug666225.html b/layout/generic/test/test_bug666225.html new file mode 100644 index 00000000000..5410ee6c879 --- /dev/null +++ b/layout/generic/test/test_bug666225.html @@ -0,0 +1,43 @@ + + + + + Test for Bug 666225 + + + + + + +Mozilla Bug 666225 +

+ +
+
+
+ + diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index 24d8dc44fed..e106f9ef1d4 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -204,6 +204,7 @@ ComputeShadowTreeTransform(nsIFrame* aContainerFrame, nscoord auPerDevPixel = aContainerFrame->PresContext()->AppUnitsPerDevPixel(); nsIntPoint scrollOffset = aConfig.mScrollOffset.ToNearestPixels(auPerDevPixel); + // metricsScrollOffset is in layer coordinates. nsIntPoint metricsScrollOffset = aMetrics->mViewportScrollOffset; if (aRootFrameLoader->AsyncScrollEnabled() && !aMetrics->mDisplayPort.IsEmpty()) { @@ -225,7 +226,7 @@ ComputeShadowTreeTransform(nsIFrame* aContainerFrame, static void BuildListForLayer(Layer* aLayer, nsFrameLoader* aRootFrameLoader, - gfx3DMatrix aTransform, + const gfx3DMatrix& aTransform, nsDisplayListBuilder* aBuilder, nsDisplayList& aShadowTree, nsIFrame* aSubdocFrame) @@ -245,6 +246,8 @@ BuildListForLayer(Layer* aLayer, // Calculate transform for this layer. nsContentView* view = aRootFrameLoader->GetCurrentRemoteFrame()->GetContentView(scrollId); + // XXX why don't we include aLayer->GetTransform() in the inverse-scale here? + // This seems wrong, but it doesn't seem to cause bugs! gfx3DMatrix applyTransform = ComputeShadowTreeTransform( aSubdocFrame, aRootFrameLoader, metrics, view->GetViewConfig(), 1 / GetXScale(aTransform), 1 / GetYScale(aTransform)); @@ -252,14 +255,15 @@ BuildListForLayer(Layer* aLayer, // As mentioned above, bounds calculation also depends on the scale // of this layer. - Scale(aTransform, GetXScale(applyTransform), GetYScale(applyTransform)); + gfx3DMatrix tmpTransform = aTransform; + Scale(tmpTransform, GetXScale(applyTransform), GetYScale(applyTransform)); // Calculate rect for this layer based on aTransform. nsRect bounds; { nscoord auPerDevPixel = aSubdocFrame->PresContext()->AppUnitsPerDevPixel(); bounds = metrics->mViewport.ToAppUnits(auPerDevPixel); - ApplyTransform(bounds, aTransform, auPerDevPixel); + ApplyTransform(bounds, tmpTransform, auPerDevPixel); } @@ -281,7 +285,7 @@ BuildListForLayer(Layer* aLayer, static void TransformShadowTree(nsDisplayListBuilder* aBuilder, nsFrameLoader* aFrameLoader, nsIFrame* aFrame, Layer* aLayer, - ViewTransform& aTransform) + const ViewTransform& aTransform) { ShadowLayer* shadow = aLayer->AsShadowLayer(); shadow->SetShadowClipRect(aLayer->GetClipRect()); @@ -290,32 +294,38 @@ TransformShadowTree(nsDisplayListBuilder* aBuilder, nsFrameLoader* aFrameLoader, const FrameMetrics* metrics = GetFrameMetrics(aLayer); gfx3DMatrix shadowTransform; + ViewTransform layerTransform = aTransform; if (metrics && metrics->IsScrollable()) { const ViewID scrollId = metrics->mScrollId; const nsContentView* view = aFrameLoader->GetCurrentRemoteFrame()->GetContentView(scrollId); NS_ABORT_IF_FALSE(view, "Array of views should be consistent with layer tree"); + const gfx3DMatrix& currentTransform = aLayer->GetTransform(); ViewTransform viewTransform = ComputeShadowTreeTransform( aFrame, aFrameLoader, metrics, view->GetViewConfig(), - 1 / aTransform.mXScale, 1 / aTransform.mYScale + 1 / (GetXScale(currentTransform)*layerTransform.mXScale), + 1 / (GetYScale(currentTransform)*layerTransform.mYScale) ); + // Apply the layer's own transform *before* the view transform + shadowTransform = gfx3DMatrix(viewTransform) * currentTransform; + if (metrics->IsRootScrollable()) { - aTransform.mTranslation = viewTransform.mTranslation; - viewTransform.mTranslation += GetRootFrameOffset(aFrame, aBuilder); + layerTransform.mTranslation = viewTransform.mTranslation; + // Apply the root frame translation *before* we do the rest of the transforms. + nsIntPoint rootFrameOffset = GetRootFrameOffset(aFrame, aBuilder); + shadowTransform = shadowTransform * + gfx3DMatrix::Translation(float(rootFrameOffset.x), float(rootFrameOffset.y), 0.0); } - - shadowTransform = gfx3DMatrix(viewTransform) * aLayer->GetTransform(); - } else { shadowTransform = aLayer->GetTransform(); } if (aLayer->GetIsFixedPosition() && !aLayer->GetParent()->GetIsFixedPosition()) { - ReverseTranslate(shadowTransform, aTransform); + ReverseTranslate(shadowTransform, layerTransform); const nsIntRect* clipRect = shadow->GetShadowClipRect(); if (clipRect) { nsIntRect transformedClipRect(*clipRect); @@ -325,12 +335,12 @@ TransformShadowTree(nsDisplayListBuilder* aBuilder, nsFrameLoader* aFrameLoader, } shadow->SetShadowTransform(shadowTransform); - aTransform.mXScale *= GetXScale(shadowTransform); - aTransform.mYScale *= GetYScale(shadowTransform); + layerTransform.mXScale *= GetXScale(shadowTransform); + layerTransform.mYScale *= GetYScale(shadowTransform); for (Layer* child = aLayer->GetFirstChild(); child; child = child->GetNextSibling()) { - TransformShadowTree(aBuilder, aFrameLoader, aFrame, child, aTransform); + TransformShadowTree(aBuilder, aFrameLoader, aFrame, child, layerTransform); } } @@ -819,7 +829,8 @@ RenderFrameParent::BuildDisplayList(nsDisplayListBuilder* aBuilder, already_AddRefed nsDisplayRemote::BuildLayer(nsDisplayListBuilder* aBuilder, - LayerManager* aManager) + LayerManager* aManager, + const ContainerParameters& aContainerParameters) { PRInt32 appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); nsIntRect visibleRect = GetVisibleRect().ToNearestPixels(appUnitsPerDevPixel); diff --git a/layout/ipc/RenderFrameParent.h b/layout/ipc/RenderFrameParent.h index 5b1487ebdf4..7fe4ad86829 100644 --- a/layout/ipc/RenderFrameParent.h +++ b/layout/ipc/RenderFrameParent.h @@ -143,7 +143,8 @@ public: NS_OVERRIDE virtual already_AddRefed - BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager); + BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager, + const ContainerParameters& aContainerParameters); NS_DISPLAY_DECL_NAME("Remote", TYPE_REMOTE) diff --git a/layout/mathml/Makefile.in b/layout/mathml/Makefile.in index c981a5b9931..d300e27fe4a 100644 --- a/layout/mathml/Makefile.in +++ b/layout/mathml/Makefile.in @@ -102,6 +102,7 @@ font_properties = \ mathfontSTIXNonUnicode.properties \ mathfontSTIXSize1.properties \ mathfontSTIXSizeOneSym.properties \ + mathfontAsanaMath.properties \ mathfontStandardSymbolsL.properties \ $(NULL) diff --git a/layout/mathml/mathfont.properties b/layout/mathml/mathfont.properties index 3ade7a3e16b..1b43443535c 100644 --- a/layout/mathml/mathfont.properties +++ b/layout/mathml/mathfont.properties @@ -46,9 +46,9 @@ # each font. Do not include the Unicode table in this list. %ifdef XP_WIN -font.mathfont-glyph-tables = STIXNonUnicode, STIXSizeOneSym, STIXSize1, Standard Symbols L, Symbol +font.mathfont-glyph-tables = STIXNonUnicode, STIXSizeOneSym, STIXSize1, Asana Math, Standard Symbols L, Symbol %else -font.mathfont-glyph-tables = STIXNonUnicode, STIXSizeOneSym, STIXSize1, Standard Symbols L +font.mathfont-glyph-tables = STIXNonUnicode, STIXSizeOneSym, STIXSize1, Asana Math, Standard Symbols L %endif # The ordered list of fonts with which to attempt to stretch MathML diff --git a/layout/mathml/mathfontAsanaMath.properties b/layout/mathml/mathfontAsanaMath.properties new file mode 100644 index 00000000000..fb6bb51ebc4 --- /dev/null +++ b/layout/mathml/mathfontAsanaMath.properties @@ -0,0 +1,180 @@ +# ***** 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 MathML Project. +# +# The Initial Developer of the Original Code is +# The University of Queensland. +# Portions created by the Initial Developer are Copyright (C) 2001 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Roger B. Sidje +# Karl Tomlinson , Mozilla Corporation +# Frederic Wang +# +# 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 ***** + +# LOCALIZATION NOTE: FILE +# Do not translate anything in this file + +# This file contains the list of some stretchy MathML chars that +# can be rendered with Asana Math font. + +# [ T/L | M | B/R | G | size0 ... size{N-1} ] +# (*) not in the MathML operator dictionary + +\u0028 = \u239B\uFFFD\u239D\u239C\u0028\uDBFF\uDFF4\uDBFF\uDFF5\uDBFF\uDFF6 # ( +\u0029 = \u239E\uFFFD\u23A0\u239F\u0029\uDBFF\uDFF7\uDBFF\uDFF8\uDBFF\uDFF9 # ) +\u005B = \u23A1\uFFFD\u23A3\u23A2\u005B\uDBFF\uDFEE\uDBFF\uDFEF\uDBFF\uDFF0 # [ +\u005D = \u23A4\uFFFD\u23A6\u23A5\u005D\uDBFF\uDFF1\uDBFF\uDFF2\uDBFF\uDFF3 # ] +\u007B = \u23A7\u23A8\u23A9\u23AA\u007B\uDBFF\uDFFA\uDBFF\uDFFB\uDBFF\uDFFC # { +\u007C = \uFFFD\uFFFD\uFFFD\u007C\u007C\uDBFF\uDFD6\uDBFF\uDFD7\uDBFF\uDFD8\uDBFF\uDFD9 # | +\u007D = \u23AB\u23AC\u23AD\u23AA\u007D\uDBFF\uDFFD\uDBFF\uDFFE\uDBFF\uDFFF # } +\u2016 = \uFFFD\uFFFD\uFFFD\uDBFF\uDFD1\u2016\uDBFF\uDFCE\uDBFF\uDFCF\uDBFF\uDFD0\uDBFF\uDFD1 # DOUBLE VERTICAL LINE + +\u2044 = \uFFFD\uFFFD\uFFFD\uFFFD\u2044\uDBFF\uDFD2\uDBFF\uDFD3\uDBFF\uDFD4\uDBFF\uDFD5 # FRACTION SLASH +# \u2045 = \uDBFF\uDFB6\uDBFF\uDF53\uDBFF\uDFB7\uDBFF\uDFBA\u2045\uDBFF\uDFBB\uDBFF\uDFBC\uDBFF\uDFBD # LEFT SQUARE BRACKET WITH QUILL (*) +# \u2046 = \uDBFF\uDFB8\uDBFF\uDF54\uDBFF\uDFB9\uDBFF\uDF52\u2046\uDBFF\uDFBE\uDBFF\uDFBF\uDBFF\uDFC0 # RIGHT SQUARE BRACKET WITH QUILL (*) + +\u2191 = \u2191\uFFFD\uFFFD\uDBFF\uDEC6\u2191 # UPWARDS ARROW +\u2193 = \uFFFD\uFFFD\u2193\uDBFF\uDEC6\u2193 # DOWNWARDS ARROW +\u21D1 = \u21D1\uFFFD\uFFFD\uDBFF\uDEC7\u21D1 # UPWARDS DOUBLE ARROW +\u21D3 = \uFFFD\uFFFD\u21D3\uDBFF\uDEC7\u21D3 # DOWNWARDS DOUBLE ARROW + +\u220F = \uFFFD\uFFFD\uFFFD\uFFFD\u220F\uDBFF\uDF9F\uDBFF\uDFA0\uDBFF\uDFA1 # N-ARY PRODUCT +\u2210 = \uFFFD\uFFFD\uFFFD\uFFFD\u2210\uDBFF\uDFA2\uDBFF\uDFA3\uDBFF\uDFA4 # N-ARY COPRODUCT +\u2211 = \uFFFD\uFFFD\uFFFD\uFFFD\u2211\uDBFF\uDF9C\uDBFF\uDF9D\uDBFF\uDF9E # summation N-ARY SUMMATION +\u221A = \uDBFF\uDF6D\uFFFD\u23B7\u20D3\u221A\uDBFF\uDF6E\uDBFF\uDF6F\uDBFF\uDF70\uDBFF\uDF71 # SQUARE ROOT +\u2223 = \uFFFD\uFFFD\uFFFD\u2223\u2223 # DIVIDES +\u2225 = \uFFFD\uFFFD\uFFFD\u2225\u2225 # PARALLEL TO +\u222B = \u2320\uFFFD\u2321\u23AE\u222B\uDBFF\uDF99\uDBFF\uDF9A\uDBFF\uDF9B # INTEGRAL +\u222C = \uFFFD\uFFFD\uFFFD\uFFFD\u222C\uDBFF\uDF6A\uDBFF\uDF6B\uDBFF\uDF6C # DOUBLE INTEGRAL +\u222D = \uFFFD\uFFFD\uFFFD\uFFFD\u222D\uDBFF\uDF67\uDBFF\uDF68\uDBFF\uDF69 # TRIPLE INTEGRAL +\u222E = \uFFFD\uFFFD\uFFFD\uFFFD\u222E\uDBFF\uDF64\uDBFF\uDF65\uDBFF\uDF66 # CONTOUR INTEGRAL +\u222F = \uFFFD\uFFFD\uFFFD\uFFFD\u222F\uDBFF\uDF61\uDBFF\uDF62\uDBFF\uDF63 # SURFACE INTEGRAL +\u2230 = \uFFFD\uFFFD\uFFFD\uFFFD\u2230\uDBFF\uDF5E\uDBFF\uDF5F\uDBFF\uDF60 # VOLUME INTEGRAL +\u2231 = \uFFFD\uFFFD\uFFFD\uFFFD\u2231\uDBFF\uDF5B\uDBFF\uDF5C\uDBFF\uDF5D # CLOCKWISE INTEGRAL +\u2232 = \uFFFD\uFFFD\uFFFD\uFFFD\u2232\uDBFF\uDF58\uDBFF\uDF59\uDBFF\uDF5A # CLOCKWISE CONTOUR INTEGRAL +\u2233 = \uFFFD\uFFFD\uFFFD\uFFFD\u2233\uDBFF\uDF55\uDBFF\uDF56\uDBFF\uDF57 # ANTICLOCKWISE CONTOUR INTEGRAL + +\u22C0 = \uFFFD\uFFFD\uFFFD\uFFFD\u22C0\uDBFF\uDF92\uDBFF\uDF93 # N-ARY LOGICAL AND +\u22C1 = \uFFFD\uFFFD\uFFFD\uFFFD\u22C1\uDBFF\uDF94\uDBFF\uDF95 # N-ARY LOGICAL OR +\u22C2 = \uFFFD\uFFFD\uFFFD\uFFFD\u22C2\uDBFF\uDF8E\uDBFF\uDF8F # N-ARY INTERSECTION +\u22C3 = \uFFFD\uFFFD\uFFFD\uFFFD\u22C3\uDBFF\uDF8C\uDBFF\uDF8D # N-ARY UNION +\u2308 = \u23A1\uFFFD\uFFFD\u23A2\u2308\uDBFF\uDFE2\uDBFF\uDFE3\uDBFF\uDFE4 # LEFT CEILING +\u2309 = \u23A4\uFFFD\uFFFD\u23A5\u2309\uDBFF\uDFE5\uDBF\uDFE6\uDBFF\uDFE7 # RIGHT CEILING +\u230A = \uFFFD\uFFFD\u23A3\u23A2\u230A\uDBFF\uDFE8\uDBFF\uDFE9\uDBFF\uDFEA # LEFT FLOOR +\u230B = \uFFFD\uFFFD\u23A6\u23A5\u230B\u230B\uDBFF\uDFEB\uDBFF\uDFEC\uDBFF\uDFED # RIGHT FLOOR + +# \u27C5 = \uFFFD\uFFFD\uFFFD\uFFFD\u27C5\uDBFF\uDDF3\uDBFF\uDDF5\uDBFF\uDDF7\uDBFF\uDDF9\uDBFF\uDDFB # LEFT S-SHAPED BAG DELIMITER (*) +# \u27C6 = \uFFFD\uFFFD\uFFFD\uFFFD\uDBFF\uDDF4\uDBFF\uDDF6\uDBFF\uDDF8\uDBFF\uDDFA\uDBFF\uDDFC # RIGHT S-SHAPED BAG DELIMITER (*) +\u27E6 = \uFFFD\uFFFD\uFFFD\uFFFD\u27E6\uDBFF\uDFDA\uDBFF\uDFDB\uDBFF\uDFDC\uDBFF\uDFDD # MATHEMATICAL LEFT WHITE SQUARE BRACKET +\u27E7 = \uFFFD\uFFFD\uFFFD\uFFFD\u27E7\uDBFF\uDFDE\uDBFF\uDFDF\uDBFF\uDFE0\uDBFF\uDFE1 # MATHEMATICAL RIGHT WHITE SQUARE BRACKET +\u27E8 = \uFFFD\uFFFD\uFFFD\uFFFD\u27E8\uDBFF\uDF89\uDBFF\uDF8A\uDBFF\uD8B # MATHEMATICAL LEFT ANGLE BRACKET +\u27E9 = \uFFFD\uFFFD\uFFFD\uFFFD\u27E9\uDBFF\uDF7C\uDBFF\uDF7D\uDBFF\uDF7E # MATHEMATICAL RIGHT ANGLE BRACKET +\u27EA = \uFFFD\uFFFD\uFFFD\uFFFD\u27EA\uDBFF\uDF76\uDBFF\uDF77\uDBFF\uDF78 # MATHEMATICAL LEFT DOUBLE ANGLE BRACKET +\u27EB = \uFFFD\uFFFD\uFFFD\uFFFD\u27EB\uDBFF\uDF79\uDBFF\uDF7A\uDBFF\uDF7B # MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET + +\u29FC = \uFFFD\uFFFD\uFFFD\uFFFD\u29FC\uDBFF\uDEC8\uDBFF\uDEC9\uDBFF\uDECA # LEFT-POINTING CURVED ANGLE BRACKET +\u29FD = \uFFFD\uFFFD\uFFFD\uFFFD\u29FD\uDBFF\uDECB\uDBFF\uDECC\uDBFF\uDECD # RIGHT-POINTING CURVED ANGLE BRACKET + +\u2A00 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A00\uDBFF\uDF96\uDBFF\uDF97 # N-ARY CIRCLED DOT OPERATOR +\u2A01 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A01\uDBFF\uDF98\uDBFF\uDFA5 # N-ARY CIRCLED PLUS OPERATOR +\u2A02 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A02\uDBFF\uDF7F\uDBFF\uDF80 # N-ARY CIRCLED TIMES OPERATOR +\u2A03 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A03\uDBFF\uDF81\uDBFF\uDF82 # N-ARY UNION OPERATOR WITH DOT +\u2A04 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A04\uDBFF\uDF90\uDBFF\uDF91 # N-ARY UNION OPERATOR WITH PLUS +\u2A05 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A05\uDBFF\uDF83\uDBFF\uDF84 # N-ARY SQUARE INTERSECTION OPERATOR +\u2A06 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A06\uDBFF\uDF85\uDBFF\uDF86 # N-ARY SQUARE UNION OPERATOR +\u2A07 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A07\uDBFF\uDF72\uDBFF\uDF73 # TWO LOGICAL AND OPERATOR +\u2A08 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A08\uDBFF\uDF74\uDBFF\uDF75 # TWO LOGICAL OR OPERATOR +\u2A09 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A09\uDBFF\uDF87\uDBFF\uDF88 # N-ARY TIMES OPERATOR +\u2A0C = \uFFFD\uFFFD\uFFFD\uFFFD\u2A0C\uDBFF\uDF1F\uDBFF\uDF20\uDBFF\uDF21 # QUADRUPLE INTEGRAL OPERATOR +\u2A0D = \uFFFD\uFFFD\uFFFD\uFFFD\u2A0D\uDBFF\uDF22\uDBFF\uDF23\uDBFF\uDF24 # FINITE PART INTEGRAL +\u2A0E = \uFFFD\uFFFD\uFFFD\uFFFD\u2A0E\uDBFF\uDF25\uDBFF\uDF26\uDBFF\uDF27 # INTEGRAL WITH DOUBLE STROKE +\u2A0F = \uFFFD\uFFFD\uFFFD\uFFFD\u2A0F\uDBFF\uDF28\uDBFF\uDF29\uDBFF\uDF2A # INTEGRAL AVERAGE WITH SLASH +\u2A10 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A10\uDBFF\uDF2B\uDBFF\uDF2C\uDBFF\uDF2D # CIRCULATION FUNCTION +\u2A11 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A11\uDBFF\uDF2E\uDBFF\uDF2F\uDBFF\uDF30 # ANTICLOCKWISE INTEGRATION +\u2A12 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A12\uDBFF\uDF31\uDBFF\uDF32\uDBFF\uDF33 # LINE INTEGRATION WITH RECTANGULAR PATH AROUND POLE +\u2A13 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A13\uDBFF\uDF34\uDBFF\uDF35\uDBFF\uDF36 # LINE INTEGRATION WITH SEMICIRCULAR PATH AROUND POLE +\u2A14 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A14\uDBFF\uDF37\uDBFF\uDF38\uDBFF\uDF39 # LINE INTEGRATION NOT INCLUDING THE POLE +\u2A15 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A15\uDBFF\uDF3A\uDBFF\uDF3B\uDBFF\uDF3C # INTEGRAL AROUND A POINT OPERATOR +\u2A16 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A16\uDBFF\uDF3D\uDBFF\uDF3E\uDBFF\uDF3F # QUATERNION INTEGRAL OPERATOR +\u2A17 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A17\uDBFF\uDF40\uDBFF\uDF41\uDBFF\uDF42 # INTEGRAL WITH LEFTWARDS ARROW WITH HOOK +\u2A18 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A18\uDBFF\uDF43\uDBFF\uDF44\uDBFF\uDF45 # INTEGRAL WITH TIMES SIGN +\u2A19 = \uFFFD\uFFFD\uFFFD\uFFFD\u2A19\uDBFF\uDF46\uDBFF\uDF47\uDBFF\uDF48 # INTEGRAL WITH INTERSECTION +\u2A1A = \uFFFD\uFFFD\uFFFD\uFFFD\u2A1A\uDBFF\uDF49\uDBFF\uDF4A\uDBFF\uDF4B # INTEGRAL WITH UNION +\u2A1B = \uFFFD\uFFFD\uFFFD\uFFFD\u2A1B\uDBFF\uDF4C\uDBFF\uDF4D\uDBFF\uDF4E # INTEGRAL WITH OVERBAR +\u2A1C = \uFFFD\uFFFD\uFFFD\uFFFD\u2A1C\uDBFF\uDF4F\uDBFF\uDF50\uDBFF\uDF51 # INTEGRAL WITH UNDERBAR + +\u005E = \uFFFD\uFFFD\uFFFD\uFFFD\u005E\uDBFF\uDFA6\uDBFF\uDFA7\uDBFF\uDFA8 # CIRCUMFLEX ACCENT +\u0302 = \uFFFD\uFFFD\uFFFD\uFFFD\u005E\uDBFF\uDFA6\uDBFF\uDFA7\uDBFF\uDFA8 # COMBINING CIRCUMFLEX ACCENT +\u007E = \uFFFD\uFFFD\uFFFD\uFFFD\u007E\uDBFF\uDFAA\uDBFF\uDFAB\uDBFF\uDFAC\uDBFF\uDFAD # TILDE +\u02DC = \uFFFD\uFFFD\uFFFD\uFFFD\u007E\uDBFF\uDFAA\uDBFF\uDFAB\uDBFF\uDFAC\uDBFF\uDFAD # SMALL TILDE +# \u0303 = \uFFFD\uFFFD\uFFFD\uFFFD\u007E\uDBFF\uDFAA\uDBFF\uDFAB\uDBFF\uDFAC\uDBFF\uDFAD # COMBINING TILDE (*) +# \u0305 = \uFFFD\uFFFD\uFFFD\uDBFF\uDF1E\u0305 COMBINING OVERLINE (*) +# \u0306 = \uFFFD\uFFFD\uFFFD\uFFFD\u02D8\uDBFF\uDFB2\uDBFF\uDFB3\uDBFF\uDFB4\uDBFF\uDFB5 # COMBINING BREVE (*) +# \u02D8 = \uFFFD\uFFFD\uFFFD\uFFFD\u02D8\uDBFF\uDFB2\uDBFF\uDFB3\uDBFF\uDFB4\uDBFF\uDFB5 # BREVE (not stretchy) +\u02C7 = \uFFFD\uFFFD\uFFFD\uFFFD\u02C7\uDBFF\uDFAE\uDBFF\uDFAF\uDBFF\uDFB0\uDBFF\uDFB1 # CARON +# \u030C = \uFFFD\uFFFD\uFFFD\uFFFD\u02C7\uDBFF\uDFAE\uDBFF\uDFAF\uDBFF\uDFB0\uDBFF\uDFB1 # COMBINING CARON (*) +# \u0332 = \uFFFD\uFFFD\uFFFD\uDBFF\uDF1D\u0332\uDBFF\uDF1D\uDBFF\uDF18\uDBFF\uDF14 # COMBINING LOW LINE (*) +# \u0333 = \uFFFD\uFFFD\uFFFD\uDBFF\uDF1C\u0333\uDBFF\uDF1C\uDBFF\uDF17\uDBFF\uDF13 # COMBINING DOUBLE LOW LINE (*) +# \u033F = \uFFFD\uFFFD\uFFFD\uDBFF\uDF1B\u033F\uDBFF\uDF1B\uDBFF\uDF16\uDBFF\uDF12 # COMBINING DOUBLE OVERLINE (*) +# \u20D0 = \u20D0\uFFFD\uFFFD\uDBFF\uDF1A\u20D0 # COMBINING LEFT HARPOON ABOVE (*) +# \u20D1 = \uFFFD\uFFFD\u20D1\uDBFF\uDF1A\u20D1 # COMBINING RIGHT HARPOON ABOVE (*) +# \u20D6 = \u20D6\uFFFD\uFFFD\uDBFF\uDF1A\u20D6\uDBFF\uDE4A\uDBFF\uDE4B\uDBFF\uDE4C\uDBFF\uDE4D # COMBINING LEFT ARROW ABOVE (*) +# \u20D7 = \uFFFD\uFFFD\u20D7\uDBFF\uDF1A\u20D7\uDBFF\uDE4E\uDBFF\uDE4F\uDBFF\uDE50\uDBFF\uDE51 # COMBINING RIGHT ARROW ABOVE (*) +# \u20E1 = \u20D6\uFFFD\u20D7\uDBFF\uDF1A\u20E1 # COMBINING LEFT RIGHT ARROW ABOVE (*) +# \u20E9 = \uDBFF\uDEEC\uFFFD\uDBFF\uDEED\uDBFF\uDEEB\u20E9 # COMBINING WIDE BRIDGE ABOVE (*) + +\u2190 = \uDBFF\uDF11\uFFFD\uDBFF\uDF10\u23AF\u2190 # LEFTWARDS ARROW +\u2192 = \uDBFF\uDF0E\uFFFD\uDBFF\uDF0F\u23AF\u2192 # RIGHTWARDS ARROW +\u2194 = \uDBFF\uDF11\uFFFD\uDBFF\uDF0F\u23AF\u2194 # LEFT RIGHT ARROW +\u21A4 = \uDBFF\uDF11\uFFFD\uDBFF\uDF08\u23AF\u21A4 # LEFTWARDS ARROW FROM BAR +\u21A6 = \uDBFF\uDF07\uFFFD\uDBFF\uDF0F\u23AF\u21A6 # RIGHTWARDS ARROW FROM BAR +\u21A9 = \uDBFF\uDF11\uFFFD\uDBFF\uDF06\u23AF\u21A9 # LEFTWARDS ARROW WITH HOOK +\u21AA = \uDBFF\uDF05\uFFFD\uDBFF\uDF0F\u23AF\u21AA # RIGHTWARDS ARROW WITH HOOK + +\u21D0 = \uDBFF\uDF0D\uFFFD\uDBFF\uDF0C\uDBFF\uDF09\u21D0 # LEFTWARDS DOUBLE ARROW +\u21D2 = \uDBFF\uDF0A\uFFFD\uDBFF\uDF0B\uDBFF\uDF09\u21D2 # RIGHTWARDS DOUBLE ARROW +\u21D4 = \uDBFF\uDF0D\uFFFD\uDBFF\uDF0B\uDBFF\uDF09\u21D4 # LEFT RIGHT DOUBLE ARROW + +\u23B4 = \uDBFF\uDEEC\uFFFD\uDBFF\uDEED\uDBFF\uDEEB\u23B4\uDBFF\uDEFD\uDBFF\uDEFE\uDBFF\uDEFF # TOP SQUARE BRACKET +\u23B5 = \uDBFF\uDEEE\uFFFD\uDBFF\uDEEF\uDBFF\uDEEA\u23B5\uDBFF\uDF00\uDBFF\uDF01\uDBFF\uDF02 # BOTTOM SQUARE BRACKET + +\u23DC = \uDBFF\uDFC7\uFFFD\uDBFF\uDFC9\uDBFF\uDFCA\u23DC\uDBFF\uDEF7\uDBFF\uDEF8\uDBFF\uDEF9 # TOP PARENTHESIS +\uFE35 = \uDBFF\uDFC7\uFFFD\uDBFF\uDFC9\uDBFF\uDFCA\u23DC\uDBFF\uDEF7\uDBFF\uDEF8\uDBFF\uDEF9 # ⏜ (MathML 2.0) +\u23DD = \uDBFF\uDFCB\uFFFD\uDBFF\uDFCD\uDBFF\uDEF0\u23DD\uDBFF\uDEFA\uDBFF\uDEFB\uDBFF\uDEFC # BOTTOM PARENTHESIS +\uFE36 = \uDBFF\uDFCB\uFFFD\uDBFF\uDFCD\uDBFF\uDEF0\u23DD\uDBFF\uDEFA\uDBFF\uDEFB\uDBFF\uDEFC # ⏝ (MathML 2.0) + +\u23DE = \uDBFF\uDFC7\uDBFF\uDFC8\uDBFF\uDFC9\uDBFF\uDFCA\u23DE\uDBFF\uDFC1\uDBFF\uDFC2\uDBFF\uDFC3 # TOP CURLY BRACKET +\uFE37 = \uDBFF\uDFC7\uDBFF\uDFC8\uDBFF\uDFC9\uDBFF\uDFCA\u23DE\uDBFF\uDFC1\uDBFF\uDFC2\uDBFF\uDFC3 # ⏞ (MathML 2.0) +\u23DF = \uDBFF\uDFCB\uDBFF\uDFCC\uDBFF\uDFCD\uDBFF\uDEF0\u23DF\uDBFF\uDFC4\uDBFF\uDFC5\uDBFF\uDFC6 # BOTTOM CURLY BRACKET +\uFE38 = \uDBFF\uDFCB\uDBFF\uDFCC\uDBFF\uDFCD\uDBFF\uDEF0\u23DF\uDBFF\uDFC4\uDBFF\uDFC5\uDBFF\uDFC6 # ⏟ (MathML 2.0) +\u23E0 = \uFFFD\uFFFD\uFFFD\uFFFD\u23E0\uDBFF\uDEF1\uDBFF\uDEF2\uDBFF\uDEF3 # TOP TORTOISE SHELL BRACKET +\u23E1 = \uFFFD\uFFFD\uFFFD\uFFFD\u23E1\uDBFF\uDEF4\uDBFF\uDEF5\uDBFF\uDEF6 # BOTTOM TORTOISE SHELL BRACKET + +\u2906 = \uDBFF\uDF0D\uFFFD\uDBFF\uDF04\uDBFF\uDF09\u2906 # LEFTWARDS DOUBLE ARROW FROM BAR +\u2907 = \uDBFF\uDF03\uFFFD\uDBFF\uDF0B\uDBFF\uDF09\u2907 # RIGHTWARDS DOUBLE ARROW FROM BAR diff --git a/layout/mathml/mathfontSTIXSizeOneSym.properties b/layout/mathml/mathfontSTIXSizeOneSym.properties index 28aded92359..945eb9e8ce7 100644 --- a/layout/mathml/mathfontSTIXSizeOneSym.properties +++ b/layout/mathml/mathfontSTIXSizeOneSym.properties @@ -49,8 +49,7 @@ external.2 = STIXSizeTwoSym external.3 = STIXSizeThreeSym external.4 = STIXSizeFourSym external.5 = STIXSizeFiveSym -external.6 = STIXGeneral -external.7 = STIXIntegralsD +external.6 = STIXIntegralsD # [ T/L | M | B/R | G | size0 ... size{N-1} ] \u0028 = \u239B\uFFFD\u239D\u239C\uFFFD((@2(@3(@4 # ( @@ -84,33 +83,33 @@ external.7 = STIXIntegralsD \u221A = \uE001@1\uFFFD\u221A@4\uE000@1\uFFFD\u221A\u221A@2\u221A@3 # Sqrt, radic # Integrals -\u222B = \u2320\uFFFD\u2321\u23AE\uFFFD\u222B@6\u222B@7 -\u222C = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u222C@6\u222C@7 -\u222D = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u222D@6\u222D@7 -\u222E = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u222E@6\u222E@7 -\u222F = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u222F@6\u222F@7 -\u2230 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2230@6\u2230@7 -\u2231 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2231@6\u2231@7 -\u2232 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2232@6\u2232@7 -\u2233 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2233@6\u2233@7 -\u2A0B = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A0B@6\u2A0B@7 -\u2A0C = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A0C@6\u2A0C@7 -\u2A0D = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A0D@6\u2A0D@7 -\u2A0E = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A0E@6\u2A0E@7 -\u2A0F = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A0F@6\u2A0F@7 -\u2A10 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A10@6\u2A10@7 -\u2A11 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A11@6\u2A11@7 -\u2A12 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A12@6\u2A12@7 -\u2A13 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A13@6\u2A13@7 -\u2A14 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A14@6\u2A14@7 -\u2A15 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A15@6\u2A15@7 -\u2A16 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A16@6\u2A16@7 -\u2A17 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A17@6\u2A17@7 -\u2A18 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A18@6\u2A18@7 -\u2A19 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A19@6\u2A19@7 -\u2A1A = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A1A@6\u2A1A@7 -\u2A1B = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A1B@6\u2A1B@7 -\u2A1C = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A1C@6\u2A1C@7 +\u222B = \u2320\uFFFD\u2321\u23AE\uFFFD\u222B@6 +\u222C = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u222C@6 +\u222D = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u222D@6 +\u222E = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u222E@6 +\u222F = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u222F@6 +\u2230 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2230@6 +\u2231 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2231@6 +\u2232 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2232@6 +\u2233 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2233@6 +\u2A0B = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A0B@6 +\u2A0C = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A0C@6 +\u2A0D = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A0D@6 +\u2A0E = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A0E@6 +\u2A0F = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A0F@6 +\u2A10 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A10@6 +\u2A11 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A11@6 +\u2A12 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A12@6 +\u2A13 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A13@6 +\u2A14 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A14@6 +\u2A15 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A15@6 +\u2A16 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A16@6 +\u2A17 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A17@6 +\u2A18 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A18@6 +\u2A19 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A19@6 +\u2A1A = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A1A@6 +\u2A1B = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A1B@6 +\u2A1C = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2A1C@6 \u27E8 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u27E8\u27E8@2\u27E8@3\u27E8@4 # LeftAngleBracket \u27E9 = \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u27E9\u27E9@2\u27E9@3\u27E9@4 # RightAngleBracket diff --git a/layout/mathml/mathml.css b/layout/mathml/mathml.css index 0268ee895dc..37d6cbd946e 100644 --- a/layout/mathml/mathml.css +++ b/layout/mathml/mathml.css @@ -99,6 +99,13 @@ math[display="inline"] { font-weight: normal; } +/**************************************************************************/ +/* Links */ +/**************************************************************************/ +:-moz-any-link { + text-decoration: none !important; +} + /**************************************************************************/ /* attributes common to all tags */ /**************************************************************************/ diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp index 1bea7da80dd..88a1f5dc0dd 100644 --- a/layout/mathml/nsMathMLChar.cpp +++ b/layout/mathml/nsMathMLChar.cpp @@ -74,7 +74,7 @@ using namespace mozilla; // ----------------------------------------------------------------------------------- static const PRUnichar kSpaceCh = PRUnichar(' '); -static const nsGlyphCode kNullGlyph = {0, 0}; +static const nsGlyphCode kNullGlyph = {{0, 0}, 0}; typedef enum {eExtension_base, eExtension_variants, eExtension_parts} nsMathfontPrefExtension; @@ -248,8 +248,8 @@ private: // excludes the '@' symbol and explicitly inserts all optional '0' that indicates // the primary font identifier. Specifically therefore, the k-th glyph is // characterized by : - // 1) mGlyphCache[2*k] : its Unicode point (or glyph index -- depending on mType), - // 2) mGlyphCache[2*k+1] : the numeric identifier of the font where it comes from. + // 1) mGlyphCache[3*k],mGlyphCache[3*k+1] : its Unicode point (or glyph index -- depending on mType), + // 2) mGlyphCache[3*k+2] : the numeric identifier of the font where it comes from. // A font identifier of '0' means the default primary font associated to this // table. Other digits map to the "external" fonts that may have been specified // in the MathFont Property File. @@ -311,7 +311,7 @@ nsGlyphTable::ElementAt(nsPresContext* aPresContext, nsMathMLChar* aChar, PRUint // external font '1', the property line looks like \uNNNN = \uNNNN\uNNNN@1\uNNNN. // This is where mGlyphCache is pre-processed to explicitly store all glyph codes // as combined pairs of 'code@font', excluding the '@' separator. This means that - // mGlyphCache[2*k] will later be rendered with mFontName[mGlyphCache[2*k+1]] + // mGlyphCache[3*k],mGlyphCache[3*k+1] will later be rendered with mFontName[mGlyphCache[3*k+2]] // Note: font identifier is internally an ASCII digit to avoid the null char issue nsAutoString buffer; PRInt32 length = value.Length(); @@ -320,7 +320,7 @@ nsGlyphTable::ElementAt(nsPresContext* aPresContext, nsMathMLChar* aChar, PRUint while (i < length) { PRUnichar code = value[i]; ++i; - PRUnichar font = 0; + buffer.Append(code); // see if we are at the beginning of a child char if (code == kSpaceCh) { // reset the annotation indicator to be 0 for the next code point @@ -346,8 +346,18 @@ nsGlyphTable::ElementAt(nsPresContext* aPresContext, nsMathMLChar* aChar, PRUint ++i; } #endif + // Read the next word if we have a non-BMP character. + if (i < length && NS_IS_HIGH_SURROGATE(code)) { + code = value[i]; + ++i; + } else { + code = PRUnichar('\0'); + } + buffer.Append(code); + // See if an external font is needed for the code point. // Limit of 9 external fonts + PRUnichar font = 0; if (i+1 < length && value[i] == PRUnichar('@') && value[i+1] >= PRUnichar('0') && value[i+1] <= PRUnichar('9')) { ++i; @@ -362,7 +372,6 @@ nsGlyphTable::ElementAt(nsPresContext* aPresContext, nsMathMLChar* aChar, PRUint return kNullGlyph; } } - buffer.Append(code); buffer.Append(font); ++j; } @@ -390,14 +399,15 @@ nsGlyphTable::ElementAt(nsPresContext* aPresContext, nsMathMLChar* aChar, PRUint offset += 5; // skip the 4 partial glyphs + the whitespace separator child = child->mSibling; } - length = 2*(offset + 4); // stay confined in the 4 partial glyphs of this child + length = 3*(offset + 4); // stay confined in the 4 partial glyphs of this child } - PRUint32 index = 2*(offset + aPosition); // 2* is to account for the code@font pairs - if (index+1 >= length) return kNullGlyph; + PRUint32 index = 3*(offset + aPosition); // 3* is to account for the code@font pairs + if (index+2 >= length) return kNullGlyph; nsGlyphCode ch; - ch.code = mGlyphCache.CharAt(index); - ch.font = mGlyphCache.CharAt(index + 1); - return (ch.code == PRUnichar(0xFFFD)) ? kNullGlyph : ch; + ch.code[0] = mGlyphCache.CharAt(index); + ch.code[1] = mGlyphCache.CharAt(index + 1); + ch.font = mGlyphCache.CharAt(index + 2); + return ch.code[0] == PRUnichar(0xFFFD) ? kNullGlyph : ch; } PRBool @@ -409,9 +419,9 @@ nsGlyphTable::IsComposite(nsPresContext* aPresContext, nsMathMLChar* aChar) // shortcut to sync the cache with this char... mCharCache = 0; mGlyphCache.Truncate(); ElementAt(aPresContext, aChar, 0); // the cache remained empty if the char wasn't found in this table - if (8 >= mGlyphCache.Length()) return PR_FALSE; + if (4*3 >= mGlyphCache.Length()) return PR_FALSE; // the lists of glyphs of a composite char are space-separated - return (kSpaceCh == mGlyphCache.CharAt(8)); + return (kSpaceCh == mGlyphCache.CharAt(4*3)); } PRInt32 @@ -1124,11 +1134,8 @@ nsMathMLChar::StretchEnumContext::TryVariants(nsGlyphTable* aGlyphTable, : mBoundingMetrics.rightBearing - mBoundingMetrics.leftBearing; PRBool haveBetter = PR_FALSE; - // figure out the starting size : if this is a largeop, start at 2 else 1 - PRInt32 size = 1; // size=0 is the char at its normal size - if (largeop && aGlyphTable->BigOf(mPresContext, mChar, 2).Exists()) { - size = 2; - } + // start at size = 1 (size = 0 is the char at its normal size) + PRInt32 size = 1; #ifdef NOISY_SEARCH printf(" searching in %s ...\n", NS_LossyConvertUTF16toASCII(aFamily).get()); @@ -1140,11 +1147,13 @@ nsMathMLChar::StretchEnumContext::TryVariants(nsGlyphTable* aGlyphTable, SetFontFamily(mChar->mStyleContext->PresContext(), mRenderingContext, font, aGlyphTable, ch, aFamily); - NS_ASSERTION(maxWidth || ch.code != mChar->mGlyph.code || + NS_ASSERTION(maxWidth || ch.code[0] != mChar->mGlyph.code[0] || + ch.code[1] != mChar->mGlyph.code[1] || !font.name.Equals(mChar->mFamily), "glyph table incorrectly set -- duplicate found"); - nsBoundingMetrics bm = mRenderingContext.GetBoundingMetrics(&ch.code, 1); + nsBoundingMetrics bm = mRenderingContext.GetBoundingMetrics(ch.code, + ch.Length()); nscoord charSize = isVertical ? bm.ascent + bm.descent : bm.rightBearing - bm.leftBearing; @@ -1262,7 +1271,8 @@ nsMathMLChar::StretchEnumContext::TryParts(nsGlyphTable* aGlyphTable, else { SetFontFamily(mChar->mStyleContext->PresContext(), mRenderingContext, font, aGlyphTable, ch, aFamily); - nsBoundingMetrics bm = mRenderingContext.GetBoundingMetrics(&ch.code, 1); + nsBoundingMetrics bm = mRenderingContext.GetBoundingMetrics(ch.code, + ch.Length()); // TODO: For the generic Unicode table, ideally we should check that the // glyphs are actually found and that they each come from the same @@ -2066,7 +2076,8 @@ nsMathMLChar::PaintForeground(nsPresContext* aPresContext, if (mGlyph.Exists()) { //printf("Painting %04X with a glyph of appropriate size\n", mData[0]); //aRenderingContext.SetColor(NS_RGB(0,0,255)); - aRenderingContext.DrawString(&mGlyph.code, 1, 0, mUnscaledAscent); + aRenderingContext.DrawString(mGlyph.code, mGlyph.Length(), + 0, mUnscaledAscent); } else { // paint by parts //aRenderingContext.SetColor(NS_RGB(0,255,0)); @@ -2156,7 +2167,7 @@ nsMathMLChar::PaintVertically(nsPresContext* aPresContext, if (ch.Exists()) { SetFontFamily(aPresContext, aRenderingContext, aFont, aGlyphTable, ch, mFamily); - bmdata[i] = aRenderingContext.GetBoundingMetrics(&ch.code, 1); + bmdata[i] = aRenderingContext.GetBoundingMetrics(ch.code, ch.Length()); } chdata[i] = ch; ++i; @@ -2241,7 +2252,7 @@ nsMathMLChar::PaintVertically(nsPresContext* aPresContext, AutoPushClipRect clip(aRenderingContext, clipRect); SetFontFamily(aPresContext, aRenderingContext, aFont, aGlyphTable, ch, mFamily); - aRenderingContext.DrawString(&ch.code, 1, dx, dy); + aRenderingContext.DrawString(ch.code, ch.Length(), dx, dy); } } } @@ -2317,7 +2328,7 @@ nsMathMLChar::PaintVertically(nsPresContext* aPresContext, clipRect.height = NS_MIN(bm.ascent + bm.descent, fillEnd - dy); AutoPushClipRect clip(aRenderingContext, clipRect); dy += bm.ascent; - aRenderingContext.DrawString(&chGlue.code, 1, dx, dy); + aRenderingContext.DrawString(chGlue.code, chGlue.Length(), dx, dy); dy += bm.descent; } #ifdef SHOW_BORDERS @@ -2384,7 +2395,7 @@ nsMathMLChar::PaintHorizontally(nsPresContext* aPresContext, if (ch.Exists()) { SetFontFamily(aPresContext, aRenderingContext, aFont, aGlyphTable, ch, mFamily); - bmdata[i] = aRenderingContext.GetBoundingMetrics(&ch.code, 1); + bmdata[i] = aRenderingContext.GetBoundingMetrics(ch.code, ch.Length()); } chdata[i] = ch; ++i; @@ -2464,7 +2475,7 @@ nsMathMLChar::PaintHorizontally(nsPresContext* aPresContext, AutoPushClipRect clip(aRenderingContext, clipRect); SetFontFamily(aPresContext, aRenderingContext, aFont, aGlyphTable, ch, mFamily); - aRenderingContext.DrawString(&ch.code, 1, dx, dy); + aRenderingContext.DrawString(ch.code, ch.Length(), dx, dy); } } } @@ -2539,7 +2550,7 @@ nsMathMLChar::PaintHorizontally(nsPresContext* aPresContext, clipRect.width = NS_MIN(bm.rightBearing - bm.leftBearing, fillEnd - dx); AutoPushClipRect clip(aRenderingContext, clipRect); dx -= bm.leftBearing; - aRenderingContext.DrawString(&chGlue.code, 1, dx, dy); + aRenderingContext.DrawString(chGlue.code, chGlue.Length(), dx, dy); dx += bm.rightBearing; } #ifdef SHOW_BORDERS diff --git a/layout/mathml/nsMathMLChar.h b/layout/mathml/nsMathMLChar.h index 947978b774d..d5884a7d0fc 100644 --- a/layout/mathml/nsMathMLChar.h +++ b/layout/mathml/nsMathMLChar.h @@ -71,16 +71,18 @@ enum { // (depending on the type of nsGlyphTable where this comes from). The 'font' is a // numeric identifier given to the font to which the glyph belongs. struct nsGlyphCode { - PRUnichar code; + PRUnichar code[2]; PRInt32 font; + PRInt32 Length() { return (code[1] == PRUnichar('\0') ? 1 : 2); } PRBool Exists() const { - return (code != 0); + return (code[0] != 0); } PRBool operator==(const nsGlyphCode& other) const { - return other.code == code && other.font == font; + return (other.code[0] == code[0] && other.code[1] == code[1] && + other.font == font); } PRBool operator!=(const nsGlyphCode& other) const { diff --git a/layout/mathml/nsMathMLFrame.cpp b/layout/mathml/nsMathMLFrame.cpp index fcc5f2a68c4..3861a90381b 100644 --- a/layout/mathml/nsMathMLFrame.cpp +++ b/layout/mathml/nsMathMLFrame.cpp @@ -377,6 +377,34 @@ nsMathMLFrame::ParseNamedSpaceValue(nsIFrame* aMathMLmstyleFrame, i = 7; namedspaceAtom = nsGkAtoms::veryverythickmathspace_; } + else if (aString.EqualsLiteral("negativeveryverythinmathspace")) { + i = -1; + namedspaceAtom = nsGkAtoms::negativeveryverythinmathspace_; + } + else if (aString.EqualsLiteral("negativeverythinmathspace")) { + i = -2; + namedspaceAtom = nsGkAtoms::negativeverythinmathspace_; + } + else if (aString.EqualsLiteral("negativethinmathspace")) { + i = -3; + namedspaceAtom = nsGkAtoms::negativethinmathspace_; + } + else if (aString.EqualsLiteral("negativemediummathspace")) { + i = -4; + namedspaceAtom = nsGkAtoms::negativemediummathspace_; + } + else if (aString.EqualsLiteral("negativethickmathspace")) { + i = -5; + namedspaceAtom = nsGkAtoms::negativethickmathspace_; + } + else if (aString.EqualsLiteral("negativeverythickmathspace")) { + i = -6; + namedspaceAtom = nsGkAtoms::negativeverythickmathspace_; + } + else if (aString.EqualsLiteral("negativeveryverythickmathspace")) { + i = -7; + namedspaceAtom = nsGkAtoms::negativeveryverythickmathspace_; + } if (0 != i) { if (aMathMLmstyleFrame) { diff --git a/layout/mathml/nsMathMLmfracFrame.cpp b/layout/mathml/nsMathMLmfracFrame.cpp index 950866cc557..f161c05d782 100644 --- a/layout/mathml/nsMathMLmfracFrame.cpp +++ b/layout/mathml/nsMathMLmfracFrame.cpp @@ -24,6 +24,7 @@ * David J. Fiddes * Shyjan Mahamud * Frederic Wang + * Florian Scholz * * 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"), @@ -60,11 +61,8 @@ #define THIN_FRACTION_LINE 0.5f #define THIN_FRACTION_LINE_MINIMUM_PIXELS 1 // minimum of 1 pixel -#define MEDIUM_FRACTION_LINE 1.5f -#define MEDIUM_FRACTION_LINE_MINIMUM_PIXELS 2 // minimum of 2 pixels - #define THICK_FRACTION_LINE 2.0f -#define THICK_FRACTION_LINE_MINIMUM_PIXELS 4 // minimum of 4 pixels +#define THICK_FRACTION_LINE_MINIMUM_PIXELS 2 // minimum of 2 pixels nsIFrame* NS_NewMathMLmfracFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) @@ -135,18 +133,14 @@ nsMathMLmfracFrame::CalcLineThickness(nsPresContext* aPresContext, lineThickness = defaultThickness - onePixel; } else if (aThicknessAttribute.EqualsLiteral("medium")) { - lineThickness = NSToCoordRound(defaultThickness * MEDIUM_FRACTION_LINE); - minimumThickness = onePixel * MEDIUM_FRACTION_LINE_MINIMUM_PIXELS; - // should visually increase by at least one pixel - if (lineThickness < defaultThickness + onePixel) - lineThickness = defaultThickness + onePixel; + // medium is default } else if (aThicknessAttribute.EqualsLiteral("thick")) { lineThickness = NSToCoordCeil(defaultThickness * THICK_FRACTION_LINE); minimumThickness = onePixel * THICK_FRACTION_LINE_MINIMUM_PIXELS; - // should visually increase by at least two pixels - if (lineThickness < defaultThickness + 2*onePixel) - lineThickness = defaultThickness + 2*onePixel; + // should visually increase by at least one pixel + if (lineThickness < defaultThickness + onePixel) + lineThickness = defaultThickness + onePixel; } else { // see if it is a plain number, or a percentage, or a h/v-unit like 1ex, 2px, 1em nsCSSValue cssValue; diff --git a/layout/mathml/tests/maxwell.xml b/layout/mathml/tests/maxwell.xml index 89f9b8a0395..b38fe1ec614 100644 --- a/layout/mathml/tests/maxwell.xml +++ b/layout/mathml/tests/maxwell.xml @@ -60,13 +60,10 @@ × - - - B - - + + B - + - 1 @@ -75,13 +72,10 @@ - - - E - - + + E - + @@ -102,13 +96,10 @@ c - - - j - - + + j - + @@ -117,13 +108,10 @@ ċ - - - E - - + + E - + @@ -142,13 +130,10 @@ × - - - E - - + + E - + + 1 @@ -157,13 +142,10 @@ - - - B - - + + B - + @@ -176,13 +158,10 @@ = - - - 0 - - + + 0 - + @@ -190,13 +169,10 @@ ċ - - - B - - + + B - + @@ -218,24 +194,21 @@ - - - R - + + R μ ν - - + - 1 2 - + g @@ -243,38 +216,29 @@ ν - - - - R - + + R = 8 π - - G - + G - + c - 4 - + - - - T - + + T μ ν - - + diff --git a/layout/mathml/tests/mixing.xml b/layout/mathml/tests/mixing.xml index 404455828dd..3ffd669aa25 100644 --- a/layout/mathml/tests/mixing.xml +++ b/layout/mathml/tests/mixing.xml @@ -96,8 +96,8 @@ See the difference of rendering between
- jif - jif + jif + jif -- italic MathML <msup> and @@ -159,7 +159,7 @@ And there could be more... 72 - 2+... + 2+... diff --git a/layout/mathml/tests/various.xml b/layout/mathml/tests/various.xml index 7d924a1b40e..8201b2fdc10 100644 --- a/layout/mathml/tests/various.xml +++ b/layout/mathml/tests/various.xml @@ -118,7 +118,7 @@ Click the expression below to see several definitions of pi: π = - 3.14159265358... + 3.14159265358... @@ -170,7 +170,7 @@ Click the expression below to see several definitions of pi: - ... + ... @@ -216,7 +216,7 @@ Click the expression below to see several definitions of pi: 72 - 2+... + 2+... @@ -241,7 +241,7 @@ Click the expression below to see several definitions of pi: - A + A qp i @@ -251,7 +251,7 @@ Click the expression below to see several definitions of pi: - R + R i1 j230 j230y @@ -829,7 +829,7 @@ And this is from the "Thomson scattering theory" 3 - r + r @@ -837,7 +837,7 @@ And this is from the "Thomson scattering theory" | - e + e ^ @@ -851,7 +851,7 @@ And this is from the "Thomson scattering theory" . - e + e ^ @@ -871,9 +871,9 @@ And this is from the "Thomson scattering theory" ( - k + k . - v + v - ω ) @@ -884,7 +884,7 @@ And this is from the "Thomson scattering theory" 3 - v + v
@@ -923,7 +923,7 @@ And this is from the "Thomson scattering theory" 3 - r + r @@ -938,12 +938,12 @@ And this is from the "Thomson scattering theory" 1 - - s + s ^ . - ı + ı ^ ) @@ -1040,9 +1040,9 @@ And this is from the "Thomson scattering theory" ( - k + k . - v + v - ω ) @@ -1053,7 +1053,7 @@ And this is from the "Thomson scattering theory" 3 - v + v diff --git a/layout/reftests/bugs/624359-1-notref.html b/layout/reftests/bugs/624359-1-notref.html deleted file mode 100644 index e8479c563bc..00000000000 --- a/layout/reftests/bugs/624359-1-notref.html +++ /dev/null @@ -1,38 +0,0 @@ - - - -Bug 624359 - - - - -
Cluster in mozTextAlongPath:
- - - diff --git a/layout/reftests/bugs/624359-1.html b/layout/reftests/bugs/624359-1.html deleted file mode 100644 index 01d7ced3e7d..00000000000 --- a/layout/reftests/bugs/624359-1.html +++ /dev/null @@ -1,41 +0,0 @@ - - - -Bug 624359 - - - - -
Cluster in mozTextAlongPath:
- - - diff --git a/layout/reftests/bugs/633344-1-ref.html b/layout/reftests/bugs/633344-1-ref.html new file mode 100644 index 00000000000..39b43baee1d --- /dev/null +++ b/layout/reftests/bugs/633344-1-ref.html @@ -0,0 +1,34 @@ + + + + + + +
+ + + diff --git a/layout/reftests/bugs/633344-1.html b/layout/reftests/bugs/633344-1.html new file mode 100644 index 00000000000..b91fda3f2a5 --- /dev/null +++ b/layout/reftests/bugs/633344-1.html @@ -0,0 +1,37 @@ + + + + + + +
+ + + diff --git a/layout/reftests/bugs/637597-1-ref.html b/layout/reftests/bugs/637597-1-ref.html new file mode 100644 index 00000000000..c526f512a20 --- /dev/null +++ b/layout/reftests/bugs/637597-1-ref.html @@ -0,0 +1,37 @@ + + + + + + +
+
+
+
+ + diff --git a/layout/reftests/bugs/637597-1.html b/layout/reftests/bugs/637597-1.html new file mode 100644 index 00000000000..7b0b8eea7f1 --- /dev/null +++ b/layout/reftests/bugs/637597-1.html @@ -0,0 +1,49 @@ + + + + + + +
+
+
+
+ + + diff --git a/layout/reftests/bugs/637852-1-ref.html b/layout/reftests/bugs/637852-1-ref.html new file mode 100644 index 00000000000..9bcb50619fa --- /dev/null +++ b/layout/reftests/bugs/637852-1-ref.html @@ -0,0 +1,16 @@ + + + + + + +
Hello Kitty
+ + diff --git a/layout/reftests/bugs/637852-1.html b/layout/reftests/bugs/637852-1.html new file mode 100644 index 00000000000..2f2741b7a99 --- /dev/null +++ b/layout/reftests/bugs/637852-1.html @@ -0,0 +1,16 @@ + + + + + + +
Hello Kitty
+ + diff --git a/layout/reftests/bugs/637852-2-ref.html b/layout/reftests/bugs/637852-2-ref.html new file mode 100644 index 00000000000..c2d5672e22b --- /dev/null +++ b/layout/reftests/bugs/637852-2-ref.html @@ -0,0 +1,8 @@ + + + +
+
+ + + diff --git a/layout/reftests/bugs/637852-2.html b/layout/reftests/bugs/637852-2.html new file mode 100644 index 00000000000..296a8d3eccb --- /dev/null +++ b/layout/reftests/bugs/637852-2.html @@ -0,0 +1,14 @@ + + + +
+ + + + + diff --git a/layout/reftests/bugs/637852-3-ref.html b/layout/reftests/bugs/637852-3-ref.html new file mode 100644 index 00000000000..b3e82984adc --- /dev/null +++ b/layout/reftests/bugs/637852-3-ref.html @@ -0,0 +1,11 @@ + + + +
+
+
+
+
+ + + diff --git a/layout/reftests/bugs/637852-3.html b/layout/reftests/bugs/637852-3.html new file mode 100644 index 00000000000..a9f541fefa8 --- /dev/null +++ b/layout/reftests/bugs/637852-3.html @@ -0,0 +1,19 @@ + + + +
+ +
+
+
+ + + + diff --git a/layout/reftests/bugs/664127-1-ref.xul b/layout/reftests/bugs/664127-1-ref.xul new file mode 100644 index 00000000000..671ea703ec7 --- /dev/null +++ b/layout/reftests/bugs/664127-1-ref.xul @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/bugs/664127-1.css b/layout/reftests/bugs/664127-1.css new file mode 100644 index 00000000000..25dc4308593 --- /dev/null +++ b/layout/reftests/bugs/664127-1.css @@ -0,0 +1,11 @@ +/* This external stylesheet is needed to be able to use a cached image + (solidblue.png) through a relative path */ +tree { + height: 100px; -moz-appearance: none; border: none; +} +treecol, treecolpicker { + visibility: hidden; +} +treechildren::-moz-tree-image { + list-style-image: url('solidblue.png'); +} diff --git a/layout/reftests/bugs/664127-1.xul b/layout/reftests/bugs/664127-1.xul new file mode 100644 index 00000000000..8c97477b4c8 --- /dev/null +++ b/layout/reftests/bugs/664127-1.xul @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index d5e26282279..9b586c953fc 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1561,7 +1561,7 @@ asserts(0-1) == 582146-1.html about:blank == 584699-1.html 584699-1-ref.html == 585598-2.xhtml 585598-2-ref.xhtml == 586400-1.html 586400-1-ref.html -fails-if(Android) fails-if(cocoaWidget) == 586683-1.html 586683-1-ref.html +fails-if(Android) == 586683-1.html 586683-1-ref.html == 589615-1a.xhtml 589615-1-ref.html == 589615-1b.html 589615-1-ref.html == 589672-1.html 589672-1-ref.html @@ -1614,7 +1614,6 @@ fails-if(Android) HTTP(..) == 619511-1.html 619511-1-ref.html random-if(winWidget) == 621918-1.svg 621918-1-ref.svg # 1-pixel diacritic positioning discrepancy in rotated text (may depend on platform fonts) random-if(winWidget) HTTP(..) == 621918-2.svg 621918-2-ref.svg # same 1px issue as above, and HTTP(..) for filters.svg, used to mask antialiasing issues where glyphs touch == 622585-1.html 622585-1-ref.html -HTTP(..) != 624359-1.html 624359-1-notref.html # http(..) for @font-face, to ensure consistent behavior fails-if(Android) == 625409-1.html 625409-1-ref.html == 627393-1.html about:blank == 630835-1.html about:blank @@ -1622,6 +1621,7 @@ fails-if(Android) == 625409-1.html 625409-1-ref.html fails-if(Android) == 632423-1.html 632423-1-ref.html skip-if(Android) fails-if(winWidget) == 632781-verybig.html 632781-ref.html # large canvas elements are not drawn on Windows, see bug 633936 == 632781-normalsize.html 632781-ref.html +== 633344-1.html 633344-1-ref.html fails-if(Android) == 634232-1.html 634232-1-ref.html fails-if(Android) == 635302-1.html 635302-1-ref.html == 635373-1.html 635373-1-ref.html @@ -1629,6 +1629,10 @@ fails-if(Android) == 635302-1.html 635302-1-ref.html fails-if(http.platform=="X11"&&!layersGPUAccelerated) == 635373-3.html 635373-3-ref.html HTTP(..) == 635639-1.html 635639-1-ref.html HTTP(..) == 635639-2.html 635639-2-ref.html +== 637597-1.html 637597-1-ref.html +== 637852-1.html 637852-1-ref.html +== 637852-2.html 637852-2-ref.html +== 637852-3.html 637852-3-ref.html == 641770-1.html 641770-1-ref.html == 641856-1.html 641856-1-ref.html == 645491-1.html 645491-1-ref.html @@ -1641,4 +1645,5 @@ fails-if(layersGPUAccelerated&&cocoaWidget) == 654950-1.html 654950-1-ref.html # == 655549-1.html 655549-1-ref.html != 656875.html about:blank == 658952.html 658952-ref.html +== 664127-1.xul 664127-1-ref.xul == 660682-1.html 660682-1-ref.html diff --git a/layout/reftests/image-element/canvas-outside-document-invalidate-02.html b/layout/reftests/image-element/canvas-outside-document-invalidate-02.html index 0047ff810b0..a24e398a2bd 100644 --- a/layout/reftests/image-element/canvas-outside-document-invalidate-02.html +++ b/layout/reftests/image-element/canvas-outside-document-invalidate-02.html @@ -18,10 +18,11 @@ var ctx = canvas.getContext('2d'); ctx.fillStyle = "red"; ctx.fillRect(0, 0, 1, 1); window.addEventListener("MozReftestInvalidate", function () { - ctx.fillStyle = "white"; - ctx.mozTextStyle = "50px bold Arial"; + ctx.strokeStyle = "white"; + ctx.font = "50px bold Arial"; ctx.translate(-8, 18); - ctx.mozDrawText("•"); + ctx.lineWidth = 50; + ctx.strokeText("•", 0, 0); document.documentElement.className = ""; }, false); diff --git a/layout/reftests/image-element/reftest.list b/layout/reftests/image-element/reftest.list index c102c43c890..4bf5d142c90 100644 --- a/layout/reftests/image-element/reftest.list +++ b/layout/reftests/image-element/reftest.list @@ -5,7 +5,7 @@ fails-if(Android) == canvas-outside-document.html canvas-inside-document.html == mozsetimageelement-02.html about:blank == image-outside-document-invalidate.html about:blank == canvas-outside-document-invalidate-01.html about:blank -== canvas-outside-document-invalidate-02.html about:blank +fails-if(cocoaWidget) == canvas-outside-document-invalidate-02.html about:blank # See bug 666800 == element-paint-simple.html element-paint-simple-ref.html == element-paint-repeated.html element-paint-repeated-ref.html == element-paint-recursion.html element-paint-recursion-ref.html @@ -20,10 +20,10 @@ fails-if(Android) == element-paint-native-widget.html element-paint-native-widge == element-paint-subimage-sampling-restriction.html about:blank == element-paint-clippath.html element-paint-clippath-ref.html == element-paint-sharpness-01a.html element-paint-sharpness-01b.html -fails-if(Android) == element-paint-sharpness-01b.html element-paint-sharpness-01c.html +== element-paint-sharpness-01b.html element-paint-sharpness-01c.html == element-paint-sharpness-01c.html element-paint-sharpness-01d.html == element-paint-sharpness-02a.html element-paint-sharpness-02b.html -fails-if(Android) == element-paint-sharpness-02b.html element-paint-sharpness-02c.html +== element-paint-sharpness-02b.html element-paint-sharpness-02c.html == element-paint-paintserversize-rounding-01.html element-paint-paintserversize-rounding-01-ref.html == element-paint-paintserversize-rounding-02.html element-paint-paintserversize-rounding-02-ref.html == element-paint-multiple-backgrounds-01a.html element-paint-multiple-backgrounds-01-ref.html diff --git a/layout/reftests/image/reftest.list b/layout/reftests/image/reftest.list index 6d4578b0c71..f0aff076623 100644 --- a/layout/reftests/image/reftest.list +++ b/layout/reftests/image/reftest.list @@ -1,4 +1,4 @@ -fails-if(Android) == background-image-zoom-1.html background-image-zoom-1-ref.html +== background-image-zoom-1.html background-image-zoom-1-ref.html == background-image-zoom-2.html about:blank -fails-if(Android) == image-zoom-1.html image-zoom-1-ref.html +== image-zoom-1.html image-zoom-1-ref.html == invalid-url-image-1.html invalid-url-image-1-ref.html diff --git a/layout/reftests/mathml/link-1.xhtml b/layout/reftests/mathml/link-1.xhtml new file mode 100644 index 00000000000..13ab701890b --- /dev/null +++ b/layout/reftests/mathml/link-1.xhtml @@ -0,0 +1,12 @@ + + + + Test XLink + + + + MathML Link + + + diff --git a/layout/reftests/mathml/link-ref.xhtml b/layout/reftests/mathml/link-ref.xhtml new file mode 100644 index 00000000000..a5ac817f184 --- /dev/null +++ b/layout/reftests/mathml/link-ref.xhtml @@ -0,0 +1,11 @@ + + + + Test link + + + + MathML Link + + + diff --git a/layout/reftests/mathml/mathml-negativespace-ref.html b/layout/reftests/mathml/mathml-negativespace-ref.html new file mode 100644 index 00000000000..0ce9bf51dab --- /dev/null +++ b/layout/reftests/mathml/mathml-negativespace-ref.html @@ -0,0 +1,54 @@ + + + +

+ + + x y + + +

+

+ + + x y + + +

+

+ + + x y + + +

+

+ + + x y + + +

+

+ + + x y + + +

+

+ + + x y + + +

+

+ + + x y + + +

+ + diff --git a/layout/reftests/mathml/mathml-negativespace.html b/layout/reftests/mathml/mathml-negativespace.html new file mode 100644 index 00000000000..5d2724503a1 --- /dev/null +++ b/layout/reftests/mathml/mathml-negativespace.html @@ -0,0 +1,53 @@ + + + +

+ + + x y + + +

+

+ + + x y + + +

+ + + x y + + +

+

+ + + x y + + +

+

+ + + x y + + +

+

+ + + x y + + +

+

+ + + x y + + +

+ + diff --git a/layout/reftests/mathml/mfrac-linethickness-1-ref.xhtml b/layout/reftests/mathml/mfrac-linethickness-1-ref.xhtml new file mode 100644 index 00000000000..11ca24afaf2 --- /dev/null +++ b/layout/reftests/mathml/mfrac-linethickness-1-ref.xhtml @@ -0,0 +1,20 @@ + + + + + a + b + + = + + a + b + + = + + a + b + + + + diff --git a/layout/reftests/mathml/mfrac-linethickness-1.xhtml b/layout/reftests/mathml/mfrac-linethickness-1.xhtml new file mode 100644 index 00000000000..5262798587f --- /dev/null +++ b/layout/reftests/mathml/mfrac-linethickness-1.xhtml @@ -0,0 +1,20 @@ + + + + + a + b + + = + + a + b + + = + + a + b + + + + diff --git a/layout/reftests/mathml/reftest.list b/layout/reftests/mathml/reftest.list index 7fa14fd9dd9..5496de575fc 100644 --- a/layout/reftests/mathml/reftest.list +++ b/layout/reftests/mathml/reftest.list @@ -60,3 +60,6 @@ fails == mstyle-5.xhtml mstyle-5-ref.xhtml # See bug 569125#c29 != scale-stretchy-4.xhtml scale-stretchy-4-ref.xhtml != scale-stretchy-5.xhtml scale-stretchy-5-ref.xhtml == math-as-mstyle-1.xhtml math-as-mstyle-1-ref.xhtml +== mfrac-linethickness-1.xhtml mfrac-linethickness-1-ref.xhtml +== mathml-negativespace.html mathml-negativespace-ref.html +!= link-1.xhtml link-ref.xhtml diff --git a/layout/reftests/reftest.list b/layout/reftests/reftest.list index 3087378ad73..0741350f700 100644 --- a/layout/reftests/reftest.list +++ b/layout/reftests/reftest.list @@ -89,6 +89,9 @@ skip-if(Android) include css-invalid/reftest.list # css-submit-invalid include css-submit-invalid/reftest.list +# css text-overflow +include text-overflow/reftest.list + # css transitions include css-transitions/reftest.list diff --git a/layout/reftests/scrolling/reftest.list b/layout/reftests/scrolling/reftest.list index 720bfc151e5..a0564e56b51 100644 --- a/layout/reftests/scrolling/reftest.list +++ b/layout/reftests/scrolling/reftest.list @@ -7,5 +7,7 @@ HTTP == opacity-mixed-scrolling-1.html opacity-mixed-scrolling-1.html?ref random-if(cocoaWidget) HTTP == opacity-mixed-scrolling-2.html opacity-mixed-scrolling-2.html?ref # see bug 625357 HTTP == simple-1.html simple-1.html?ref HTTP == text-1.html text-1.html?ref +HTTP == transformed-1.html transformed-1.html?ref +HTTP == transformed-1.html?up transformed-1.html?ref == uncovering-1.html uncovering-1-ref.html == uncovering-2.html uncovering-2-ref.html diff --git a/layout/reftests/scrolling/scrolling.js b/layout/reftests/scrolling/scrolling.js index c01369abe51..e2346abe665 100644 --- a/layout/reftests/scrolling/scrolling.js +++ b/layout/reftests/scrolling/scrolling.js @@ -24,6 +24,13 @@ function doScroll(d) if (document.location.search == '?ref') { doScroll(20); +} else if (document.location.search == '?up') { + doScroll(40); + document.documentElement.setAttribute("class", "reftest-wait"); + window.addEventListener("MozReftestInvalidate", function() { + document.documentElement.removeAttribute("class"); + doScroll(20); + }, false); } else { doScroll(1); document.documentElement.setAttribute("class", "reftest-wait"); diff --git a/layout/reftests/scrolling/transformed-1.html b/layout/reftests/scrolling/transformed-1.html new file mode 100644 index 00000000000..cbc9b7ad4a2 --- /dev/null +++ b/layout/reftests/scrolling/transformed-1.html @@ -0,0 +1,25 @@ + + + +
+
+
Hello Kitty
+
Hello Kitty
+
Hello Kitty
+
Hello Kitty
+
Hello Kitty
+
Hello Kitty
+
Hello Kitty
+
Hello Kitty
+
Hello Kitty
+
Hello Kitty
+
Hello Kitty
+
Hello Kitty
+
Hello Kitty
+
+
+ + + + diff --git a/layout/reftests/svg/altGlyph-01-ref.svg b/layout/reftests/svg/altGlyph-01-ref.svg index 8c1ded9ce20..58a1f7cad70 100644 --- a/layout/reftests/svg/altGlyph-01-ref.svg +++ b/layout/reftests/svg/altGlyph-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/altGlyph-01.svg b/layout/reftests/svg/altGlyph-01.svg index 6e4a977ab81..a8fdbb3dd41 100644 --- a/layout/reftests/svg/altGlyph-01.svg +++ b/layout/reftests/svg/altGlyph-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/clip-01.svg b/layout/reftests/svg/clip-01.svg index 3d50c30efa5..e15923b4e64 100644 --- a/layout/reftests/svg/clip-01.svg +++ b/layout/reftests/svg/clip-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/clip-02-ref.svg b/layout/reftests/svg/clip-02-ref.svg index 3d2847778e9..8148dda729d 100644 --- a/layout/reftests/svg/clip-02-ref.svg +++ b/layout/reftests/svg/clip-02-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/clip-02a.svg b/layout/reftests/svg/clip-02a.svg index 4d82bb62831..233712bdd95 100644 --- a/layout/reftests/svg/clip-02a.svg +++ b/layout/reftests/svg/clip-02a.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/clip-02b.svg b/layout/reftests/svg/clip-02b.svg index ce156346688..dd77c9aed3c 100644 --- a/layout/reftests/svg/clip-02b.svg +++ b/layout/reftests/svg/clip-02b.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/clipPath-and-shape-rendering-01-ref.svg b/layout/reftests/svg/clipPath-and-shape-rendering-01-ref.svg index bc5619fafa7..93e57bb3859 100644 --- a/layout/reftests/svg/clipPath-and-shape-rendering-01-ref.svg +++ b/layout/reftests/svg/clipPath-and-shape-rendering-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/clipPath-and-shape-rendering-01.svg b/layout/reftests/svg/clipPath-and-shape-rendering-01.svg index 3ec7b371bb1..61ef52cce35 100644 --- a/layout/reftests/svg/clipPath-and-shape-rendering-01.svg +++ b/layout/reftests/svg/clipPath-and-shape-rendering-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/clipPath-basic-02.svg b/layout/reftests/svg/clipPath-basic-02.svg index 527363a0800..401251b4107 100644 --- a/layout/reftests/svg/clipPath-basic-02.svg +++ b/layout/reftests/svg/clipPath-basic-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/clipPath-basic-03.svg b/layout/reftests/svg/clipPath-basic-03.svg index d9e3e75cf32..ab5c9a265eb 100644 --- a/layout/reftests/svg/clipPath-basic-03.svg +++ b/layout/reftests/svg/clipPath-basic-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/clipPath-basic-04.svg b/layout/reftests/svg/clipPath-basic-04.svg index 1feea2db51f..5353a1081e7 100644 --- a/layout/reftests/svg/clipPath-basic-04.svg +++ b/layout/reftests/svg/clipPath-basic-04.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/clipPath-basic-05.svg b/layout/reftests/svg/clipPath-basic-05.svg index 8c1c5be1923..610bae8a665 100644 --- a/layout/reftests/svg/clipPath-basic-05.svg +++ b/layout/reftests/svg/clipPath-basic-05.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/conditions-01.svg b/layout/reftests/svg/conditions-01.svg index 397cc35248b..b00133774de 100644 --- a/layout/reftests/svg/conditions-01.svg +++ b/layout/reftests/svg/conditions-01.svg @@ -1,7 +1,7 @@ Testcase for conditions diff --git a/layout/reftests/svg/conditions-02.svg b/layout/reftests/svg/conditions-02.svg index b8b8e9fb46f..f5ba400829e 100644 --- a/layout/reftests/svg/conditions-02.svg +++ b/layout/reftests/svg/conditions-02.svg @@ -1,7 +1,7 @@ Test that paint servers inside a failing conditional attribute subtree work diff --git a/layout/reftests/svg/conditions-03.svg b/layout/reftests/svg/conditions-03.svg index cb16e9c043b..9abb90cf5a4 100644 --- a/layout/reftests/svg/conditions-03.svg +++ b/layout/reftests/svg/conditions-03.svg @@ -1,7 +1,7 @@ diff --git a/layout/reftests/svg/conditions-04.svg b/layout/reftests/svg/conditions-04.svg index d174518c69c..caf5d7001cc 100644 --- a/layout/reftests/svg/conditions-04.svg +++ b/layout/reftests/svg/conditions-04.svg @@ -1,7 +1,7 @@ diff --git a/layout/reftests/svg/conditions-05.svg b/layout/reftests/svg/conditions-05.svg index af4e0205398..19891d39993 100644 --- a/layout/reftests/svg/conditions-05.svg +++ b/layout/reftests/svg/conditions-05.svg @@ -1,7 +1,7 @@ Test that conditional processing attributes on outer 'svg' elements are honored diff --git a/layout/reftests/svg/currentColor-01.svg b/layout/reftests/svg/currentColor-01.svg index 90243f2442e..503f79ebfaf 100644 --- a/layout/reftests/svg/currentColor-01.svg +++ b/layout/reftests/svg/currentColor-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/currentColor-02.svg b/layout/reftests/svg/currentColor-02.svg index 22cc400a51b..23d387343b1 100644 --- a/layout/reftests/svg/currentColor-02.svg +++ b/layout/reftests/svg/currentColor-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/currentColor-03.svg b/layout/reftests/svg/currentColor-03.svg index ce251d2217c..ea3a93aee75 100644 --- a/layout/reftests/svg/currentColor-03.svg +++ b/layout/reftests/svg/currentColor-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/data-uri-with-filter-01.xhtml b/layout/reftests/svg/data-uri-with-filter-01.xhtml index b8f21bd3948..78ba90e1965 100644 --- a/layout/reftests/svg/data-uri-with-filter-01.xhtml +++ b/layout/reftests/svg/data-uri-with-filter-01.xhtml @@ -1,7 +1,7 @@ diff --git a/layout/reftests/svg/data-uri-with-gradient-01.xhtml b/layout/reftests/svg/data-uri-with-gradient-01.xhtml index 7da655ef1f9..490a73c38d3 100644 --- a/layout/reftests/svg/data-uri-with-gradient-01.xhtml +++ b/layout/reftests/svg/data-uri-with-gradient-01.xhtml @@ -1,7 +1,7 @@ diff --git a/layout/reftests/svg/data-uri-with-pattern-01.xhtml b/layout/reftests/svg/data-uri-with-pattern-01.xhtml index 1587482f580..2b608a7b044 100644 --- a/layout/reftests/svg/data-uri-with-pattern-01.xhtml +++ b/layout/reftests/svg/data-uri-with-pattern-01.xhtml @@ -1,7 +1,7 @@ diff --git a/layout/reftests/svg/dynamic-attr-change-1.svg b/layout/reftests/svg/dynamic-attr-change-1.svg index 68bbbd07e93..1e50563a7ce 100644 --- a/layout/reftests/svg/dynamic-attr-change-1.svg +++ b/layout/reftests/svg/dynamic-attr-change-1.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/dynamic-attr-removal-1.svg b/layout/reftests/svg/dynamic-attr-removal-1.svg index 99599165a9a..6cc20c53552 100644 --- a/layout/reftests/svg/dynamic-attr-removal-1.svg +++ b/layout/reftests/svg/dynamic-attr-removal-1.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/dynamic-attr-removal-2.svg b/layout/reftests/svg/dynamic-attr-removal-2.svg index c0b2e510047..46f0d38f8b0 100644 --- a/layout/reftests/svg/dynamic-attr-removal-2.svg +++ b/layout/reftests/svg/dynamic-attr-removal-2.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/dynamic-class-01.svg b/layout/reftests/svg/dynamic-class-01.svg index 92f33645d8f..9ef8fd1ca60 100644 --- a/layout/reftests/svg/dynamic-class-01.svg +++ b/layout/reftests/svg/dynamic-class-01.svg @@ -1,6 +1,6 @@ Testcase for dynamic conditions diff --git a/layout/reftests/svg/dynamic-conditions-02.svg b/layout/reftests/svg/dynamic-conditions-02.svg index 7fae74f3cd0..05c5b687a7e 100644 --- a/layout/reftests/svg/dynamic-conditions-02.svg +++ b/layout/reftests/svg/dynamic-conditions-02.svg @@ -1,7 +1,7 @@ Test that dynamically changed conditional processing attributes on outer 'svg' elements are honored diff --git a/layout/reftests/svg/dynamic-conditions-03.svg b/layout/reftests/svg/dynamic-conditions-03.svg index 36a27d24a01..e9e174ac992 100644 --- a/layout/reftests/svg/dynamic-conditions-03.svg +++ b/layout/reftests/svg/dynamic-conditions-03.svg @@ -1,7 +1,7 @@ Test that dynamically changed conditional processing attributes on outer 'svg' elements are honored diff --git a/layout/reftests/svg/dynamic-conditions-04.svg b/layout/reftests/svg/dynamic-conditions-04.svg index c2a5b1dbc89..4394b48c707 100644 --- a/layout/reftests/svg/dynamic-conditions-04.svg +++ b/layout/reftests/svg/dynamic-conditions-04.svg @@ -1,7 +1,7 @@ Test that dynamically changed conditional processing attributes on outer 'svg' elements are honored diff --git a/layout/reftests/svg/dynamic-conditions-05.svg b/layout/reftests/svg/dynamic-conditions-05.svg index f360b47480d..d22456ce662 100644 --- a/layout/reftests/svg/dynamic-conditions-05.svg +++ b/layout/reftests/svg/dynamic-conditions-05.svg @@ -1,7 +1,7 @@ Test that dynamically changed conditional processing attributes on outer 'svg' elements are honored diff --git a/layout/reftests/svg/dynamic-conditions-06.svg b/layout/reftests/svg/dynamic-conditions-06.svg index 408644ccbda..8504eb8d887 100644 --- a/layout/reftests/svg/dynamic-conditions-06.svg +++ b/layout/reftests/svg/dynamic-conditions-06.svg @@ -1,7 +1,7 @@ Test that changing conditional processing attributes dynamically on outer 'svg' elements while redraw is suspended is honored diff --git a/layout/reftests/svg/dynamic-conditions-07.svg b/layout/reftests/svg/dynamic-conditions-07.svg index bdbd606b81b..8132b7ddb73 100644 --- a/layout/reftests/svg/dynamic-conditions-07.svg +++ b/layout/reftests/svg/dynamic-conditions-07.svg @@ -1,7 +1,7 @@ Test that changing conditional processing attributes dynamically on outer 'svg' elements while redraw is suspended is honored diff --git a/layout/reftests/svg/dynamic-conditions-08.svg b/layout/reftests/svg/dynamic-conditions-08.svg index 8361113146f..7b82d35bfa4 100644 --- a/layout/reftests/svg/dynamic-conditions-08.svg +++ b/layout/reftests/svg/dynamic-conditions-08.svg @@ -1,7 +1,7 @@ Test that changing conditional processing attributes dynamically on outer 'svg' elements while redraw is suspended is honored diff --git a/layout/reftests/svg/dynamic-conditions-09.svg b/layout/reftests/svg/dynamic-conditions-09.svg index 92d2041a65f..fefc1b2a921 100644 --- a/layout/reftests/svg/dynamic-conditions-09.svg +++ b/layout/reftests/svg/dynamic-conditions-09.svg @@ -1,7 +1,7 @@ Test that changing conditional processing attributes dynamically on outer 'svg' elements while redraw is suspended is honored diff --git a/layout/reftests/svg/dynamic-conditions-10.svg b/layout/reftests/svg/dynamic-conditions-10.svg index b07035e0a59..2708d63e1ca 100644 --- a/layout/reftests/svg/dynamic-conditions-10.svg +++ b/layout/reftests/svg/dynamic-conditions-10.svg @@ -1,7 +1,7 @@ Test that changing conditional processing attributes dynamically while redraw is suspended is honored diff --git a/layout/reftests/svg/dynamic-conditions-11.svg b/layout/reftests/svg/dynamic-conditions-11.svg index 24c9bd9192c..2f908938a6c 100644 --- a/layout/reftests/svg/dynamic-conditions-11.svg +++ b/layout/reftests/svg/dynamic-conditions-11.svg @@ -1,7 +1,7 @@ Test that changing conditional processing attributes dynamically elements while redraw is suspended is honored diff --git a/layout/reftests/svg/dynamic-conditions-12.svg b/layout/reftests/svg/dynamic-conditions-12.svg index 9d05259c162..284f823044a 100644 --- a/layout/reftests/svg/dynamic-conditions-12.svg +++ b/layout/reftests/svg/dynamic-conditions-12.svg @@ -1,7 +1,7 @@ Test that changing conditional processing attributes dynamically elements while redraw is suspended is honored diff --git a/layout/reftests/svg/dynamic-conditions-13.svg b/layout/reftests/svg/dynamic-conditions-13.svg index a6c2bbba943..c484beafa8d 100644 --- a/layout/reftests/svg/dynamic-conditions-13.svg +++ b/layout/reftests/svg/dynamic-conditions-13.svg @@ -1,7 +1,7 @@ Test that changing conditional processing attributes dynamically elements while redraw is suspended is honored diff --git a/layout/reftests/svg/dynamic-feFlood-01.svg b/layout/reftests/svg/dynamic-feFlood-01.svg index 58ea1d5fa26..283c3550b41 100644 --- a/layout/reftests/svg/dynamic-feFlood-01.svg +++ b/layout/reftests/svg/dynamic-feFlood-01.svg @@ -1,7 +1,7 @@ Testcase for dynamic feFlood changes diff --git a/layout/reftests/svg/dynamic-feImage-01.svg b/layout/reftests/svg/dynamic-feImage-01.svg index 872a3d2fdb6..920927790bc 100644 --- a/layout/reftests/svg/dynamic-feImage-01.svg +++ b/layout/reftests/svg/dynamic-feImage-01.svg @@ -1,7 +1,7 @@ Testcase for dynamic feImage changes diff --git a/layout/reftests/svg/dynamic-filter-contents-01-ref.svg b/layout/reftests/svg/dynamic-filter-contents-01-ref.svg index 92114f75e61..a81725da4ef 100644 --- a/layout/reftests/svg/dynamic-filter-contents-01-ref.svg +++ b/layout/reftests/svg/dynamic-filter-contents-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/dynamic-filter-contents-01.svg b/layout/reftests/svg/dynamic-filter-contents-01.svg index 458e6cb4933..4a93d39e379 100644 --- a/layout/reftests/svg/dynamic-filter-contents-01.svg +++ b/layout/reftests/svg/dynamic-filter-contents-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/dynamic-rect-05.svg b/layout/reftests/svg/dynamic-rect-05.svg index 04799abad2f..c3b2f08a524 100644 --- a/layout/reftests/svg/dynamic-rect-05.svg +++ b/layout/reftests/svg/dynamic-rect-05.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/dynamic-small-object-scaled-up-01.svg b/layout/reftests/svg/dynamic-small-object-scaled-up-01.svg index fd9fe46ffaf..70060e4a699 100644 --- a/layout/reftests/svg/dynamic-small-object-scaled-up-01.svg +++ b/layout/reftests/svg/dynamic-small-object-scaled-up-01.svg @@ -1,6 +1,6 @@ Test invalidation of very small objects that have been scaled up diff --git a/layout/reftests/svg/dynamic-small-object-scaled-up-02.svg b/layout/reftests/svg/dynamic-small-object-scaled-up-02.svg index 543d90e8622..bf23045123c 100644 --- a/layout/reftests/svg/dynamic-small-object-scaled-up-02.svg +++ b/layout/reftests/svg/dynamic-small-object-scaled-up-02.svg @@ -1,6 +1,6 @@ Test invalidation of very small objects that have been scaled up diff --git a/layout/reftests/svg/dynamic-switch-01.svg b/layout/reftests/svg/dynamic-switch-01.svg index 62d68c58bb2..cb9fcc599bb 100644 --- a/layout/reftests/svg/dynamic-switch-01.svg +++ b/layout/reftests/svg/dynamic-switch-01.svg @@ -1,7 +1,7 @@ Testcase for dynamic switch changes diff --git a/layout/reftests/svg/dynamic-text-01-ref.svg b/layout/reftests/svg/dynamic-text-01-ref.svg index 1d0825f885a..6d1ab0307e9 100644 --- a/layout/reftests/svg/dynamic-text-01-ref.svg +++ b/layout/reftests/svg/dynamic-text-01-ref.svg @@ -1,7 +1,7 @@ Reference for dynamic text changes diff --git a/layout/reftests/svg/dynamic-text-01.svg b/layout/reftests/svg/dynamic-text-01.svg index 64a3223a0a8..5134aa24ac7 100644 --- a/layout/reftests/svg/dynamic-text-01.svg +++ b/layout/reftests/svg/dynamic-text-01.svg @@ -1,7 +1,7 @@ Testcase for dynamic text changes diff --git a/layout/reftests/svg/dynamic-text-02-ref.svg b/layout/reftests/svg/dynamic-text-02-ref.svg index 931a8fd176d..64cc1e37e05 100644 --- a/layout/reftests/svg/dynamic-text-02-ref.svg +++ b/layout/reftests/svg/dynamic-text-02-ref.svg @@ -1,7 +1,7 @@ Reference for dynamic text changes with filters diff --git a/layout/reftests/svg/dynamic-text-02.svg b/layout/reftests/svg/dynamic-text-02.svg index 55d3dcdc1cf..5df7e61c73e 100644 --- a/layout/reftests/svg/dynamic-text-02.svg +++ b/layout/reftests/svg/dynamic-text-02.svg @@ -1,7 +1,7 @@ Testcase for dynamic text changes with filters diff --git a/layout/reftests/svg/dynamic-text-03-ref.svg b/layout/reftests/svg/dynamic-text-03-ref.svg index 0214660129d..d50459fd0a9 100644 --- a/layout/reftests/svg/dynamic-text-03-ref.svg +++ b/layout/reftests/svg/dynamic-text-03-ref.svg @@ -1,7 +1,7 @@ Reference for dynamic text changes with filters diff --git a/layout/reftests/svg/dynamic-text-03.svg b/layout/reftests/svg/dynamic-text-03.svg index 889f88c812c..ecb0ba0f42c 100644 --- a/layout/reftests/svg/dynamic-text-03.svg +++ b/layout/reftests/svg/dynamic-text-03.svg @@ -1,7 +1,7 @@ Testcase for dynamic text changes diff --git a/layout/reftests/svg/dynamic-textPath-01-ref.svg b/layout/reftests/svg/dynamic-textPath-01-ref.svg index 25b9673b469..b26811006af 100644 --- a/layout/reftests/svg/dynamic-textPath-01-ref.svg +++ b/layout/reftests/svg/dynamic-textPath-01-ref.svg @@ -1,6 +1,6 @@ Referemce for dynamic changes to textPath diff --git a/layout/reftests/svg/dynamic-textPath-01.svg b/layout/reftests/svg/dynamic-textPath-01.svg index 973098c2476..377b21214bb 100644 --- a/layout/reftests/svg/dynamic-textPath-01.svg +++ b/layout/reftests/svg/dynamic-textPath-01.svg @@ -1,6 +1,6 @@ Testing that dynamic changes to the element for a given ID are reflected in textPath diff --git a/layout/reftests/svg/dynamic-use-01.svg b/layout/reftests/svg/dynamic-use-01.svg index ba922857a64..75de1e80727 100644 --- a/layout/reftests/svg/dynamic-use-01.svg +++ b/layout/reftests/svg/dynamic-use-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/dynamic-use-02.svg b/layout/reftests/svg/dynamic-use-02.svg index ab57f04afe3..7a63eb14eef 100644 --- a/layout/reftests/svg/dynamic-use-02.svg +++ b/layout/reftests/svg/dynamic-use-02.svg @@ -1,6 +1,6 @@ + + + + + + + diff --git a/layout/reftests/svg/dynamic-use-04.svg b/layout/reftests/svg/dynamic-use-04.svg new file mode 100644 index 00000000000..c791c9274de --- /dev/null +++ b/layout/reftests/svg/dynamic-use-04.svg @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/layout/reftests/svg/fallback-color-01a.svg b/layout/reftests/svg/fallback-color-01a.svg index 9dda1d84165..3fedc0aa828 100644 --- a/layout/reftests/svg/fallback-color-01a.svg +++ b/layout/reftests/svg/fallback-color-01a.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/fallback-color-01b.svg b/layout/reftests/svg/fallback-color-01b.svg index 8beaf133d6a..abc8206c68a 100644 --- a/layout/reftests/svg/fallback-color-01b.svg +++ b/layout/reftests/svg/fallback-color-01b.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/fallback-color-02-ref.svg b/layout/reftests/svg/fallback-color-02-ref.svg index 4f66f6f605b..5c316cd73d3 100644 --- a/layout/reftests/svg/fallback-color-02-ref.svg +++ b/layout/reftests/svg/fallback-color-02-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/fallback-color-02a.svg b/layout/reftests/svg/fallback-color-02a.svg index d500c2a3887..e97da0ca662 100644 --- a/layout/reftests/svg/fallback-color-02a.svg +++ b/layout/reftests/svg/fallback-color-02a.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/fallback-color-02b.svg b/layout/reftests/svg/fallback-color-02b.svg index a74e9755d01..b65e805a3a2 100644 --- a/layout/reftests/svg/fallback-color-02b.svg +++ b/layout/reftests/svg/fallback-color-02b.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/fallback-color-03.svg b/layout/reftests/svg/fallback-color-03.svg index 2f081886394..0beab9dc0a4 100644 --- a/layout/reftests/svg/fallback-color-03.svg +++ b/layout/reftests/svg/fallback-color-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filter-basic-01.svg b/layout/reftests/svg/filter-basic-01.svg index cd668001e12..f8815e8bb07 100644 --- a/layout/reftests/svg/filter-basic-01.svg +++ b/layout/reftests/svg/filter-basic-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filter-basic-02.svg b/layout/reftests/svg/filter-basic-02.svg index b75c1a29d7a..02e1d35967e 100644 --- a/layout/reftests/svg/filter-basic-02.svg +++ b/layout/reftests/svg/filter-basic-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filter-basic-03.svg b/layout/reftests/svg/filter-basic-03.svg index 486a4ffdeba..e2f1db1adf0 100644 --- a/layout/reftests/svg/filter-basic-03.svg +++ b/layout/reftests/svg/filter-basic-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filter-foreignObject-01.svg b/layout/reftests/svg/filter-foreignObject-01.svg index 6a547beff2e..0fc9708ee5e 100644 --- a/layout/reftests/svg/filter-foreignObject-01.svg +++ b/layout/reftests/svg/filter-foreignObject-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filter-translated-01-ref.svg b/layout/reftests/svg/filter-translated-01-ref.svg index a249ffc9c5e..3a777245729 100644 --- a/layout/reftests/svg/filter-translated-01-ref.svg +++ b/layout/reftests/svg/filter-translated-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filter-translated-01.svg b/layout/reftests/svg/filter-translated-01.svg index d90eee33f0c..aeb1747524e 100644 --- a/layout/reftests/svg/filter-translated-01.svg +++ b/layout/reftests/svg/filter-translated-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters-and-group-opacity-01.svg b/layout/reftests/svg/filters-and-group-opacity-01.svg index 473a3d4a0d6..0c597809af6 100644 --- a/layout/reftests/svg/filters-and-group-opacity-01.svg +++ b/layout/reftests/svg/filters-and-group-opacity-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/feComponentTransfer-03.svg b/layout/reftests/svg/filters/feComponentTransfer-03.svg index 048b299bc26..d4ee0198482 100644 --- a/layout/reftests/svg/filters/feComponentTransfer-03.svg +++ b/layout/reftests/svg/filters/feComponentTransfer-03.svg @@ -1,6 +1,6 @@ Testcase for feComponentTransfer with default arguments for gamma and linear diff --git a/layout/reftests/svg/filters/feConvolveMatrix-bias-01-ref.svg b/layout/reftests/svg/filters/feConvolveMatrix-bias-01-ref.svg index b70311e403b..5672e6df784 100644 --- a/layout/reftests/svg/filters/feConvolveMatrix-bias-01-ref.svg +++ b/layout/reftests/svg/filters/feConvolveMatrix-bias-01-ref.svg @@ -1,6 +1,6 @@ Reference for feConvolveMatrix with bias diff --git a/layout/reftests/svg/filters/feConvolveMatrix-bias-01.svg b/layout/reftests/svg/filters/feConvolveMatrix-bias-01.svg index 164b59f1e60..815dd486351 100644 --- a/layout/reftests/svg/filters/feConvolveMatrix-bias-01.svg +++ b/layout/reftests/svg/filters/feConvolveMatrix-bias-01.svg @@ -1,6 +1,6 @@ Testcase for feConvolveMatrix with bias diff --git a/layout/reftests/svg/filters/feDiffuseLighting-1-ref.svg b/layout/reftests/svg/filters/feDiffuseLighting-1-ref.svg index a50bc61e1d1..e6406e8556f 100644 --- a/layout/reftests/svg/filters/feDiffuseLighting-1-ref.svg +++ b/layout/reftests/svg/filters/feDiffuseLighting-1-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/feDiffuseLighting-1.svg b/layout/reftests/svg/filters/feDiffuseLighting-1.svg index a156e72620f..046c4ad750f 100644 --- a/layout/reftests/svg/filters/feDiffuseLighting-1.svg +++ b/layout/reftests/svg/filters/feDiffuseLighting-1.svg @@ -1,6 +1,6 @@ Testcase for feDisplacementMap processing in2 with premultiplied colour values diff --git a/layout/reftests/svg/filters/feDisplacementMap-colour-01-ref.svg b/layout/reftests/svg/filters/feDisplacementMap-colour-01-ref.svg index 51676660587..2edd897b728 100644 --- a/layout/reftests/svg/filters/feDisplacementMap-colour-01-ref.svg +++ b/layout/reftests/svg/filters/feDisplacementMap-colour-01-ref.svg @@ -1,6 +1,6 @@ Reference for feDisplacementMap processing in1 with linearRGB colours diff --git a/layout/reftests/svg/filters/feDisplacementMap-colour-01.svg b/layout/reftests/svg/filters/feDisplacementMap-colour-01.svg index 8f8fc4066bd..6c8b1cb34e9 100644 --- a/layout/reftests/svg/filters/feDisplacementMap-colour-01.svg +++ b/layout/reftests/svg/filters/feDisplacementMap-colour-01.svg @@ -1,6 +1,6 @@ Testcase for feDisplacementMap processing in1 with linearRGB colours diff --git a/layout/reftests/svg/filters/feDistantLight-filterRes-01-ref.svg b/layout/reftests/svg/filters/feDistantLight-filterRes-01-ref.svg index 79e193ddf1f..0329db9629d 100644 --- a/layout/reftests/svg/filters/feDistantLight-filterRes-01-ref.svg +++ b/layout/reftests/svg/filters/feDistantLight-filterRes-01-ref.svg @@ -1,6 +1,6 @@ Reference for feDistantLight with filterRes larger than filter region diff --git a/layout/reftests/svg/filters/feDistantLight-filterRes-01.svg b/layout/reftests/svg/filters/feDistantLight-filterRes-01.svg index 44d91caee3b..91aa0712dc0 100644 --- a/layout/reftests/svg/filters/feDistantLight-filterRes-01.svg +++ b/layout/reftests/svg/filters/feDistantLight-filterRes-01.svg @@ -1,6 +1,6 @@ Testcase for feDistantLight with filterRes larger than filter region diff --git a/layout/reftests/svg/filters/feMorphology-radius-negative-01.svg b/layout/reftests/svg/filters/feMorphology-radius-negative-01.svg index 1a876580cc9..3b9f9000f90 100644 --- a/layout/reftests/svg/filters/feMorphology-radius-negative-01.svg +++ b/layout/reftests/svg/filters/feMorphology-radius-negative-01.svg @@ -1,6 +1,6 @@ Test 'feMorphology' with a negative value for its 'radius' diff --git a/layout/reftests/svg/filters/feMorphology-radius-negative-02.svg b/layout/reftests/svg/filters/feMorphology-radius-negative-02.svg index 429ed3487b4..afbb9ab613a 100644 --- a/layout/reftests/svg/filters/feMorphology-radius-negative-02.svg +++ b/layout/reftests/svg/filters/feMorphology-radius-negative-02.svg @@ -1,6 +1,6 @@ Test 'feMorphology' with a negative value for its 'radius' diff --git a/layout/reftests/svg/filters/feMorphology-radius-zero-01.svg b/layout/reftests/svg/filters/feMorphology-radius-zero-01.svg index f0a0eb092c2..efaea3939db 100644 --- a/layout/reftests/svg/filters/feMorphology-radius-zero-01.svg +++ b/layout/reftests/svg/filters/feMorphology-radius-zero-01.svg @@ -1,6 +1,6 @@ Test 'feMorphology' with a zero value for its 'radius' diff --git a/layout/reftests/svg/filters/feMorphology-radius-zero-02.svg b/layout/reftests/svg/filters/feMorphology-radius-zero-02.svg index 224dab4d91b..07094ba5b68 100644 --- a/layout/reftests/svg/filters/feMorphology-radius-zero-02.svg +++ b/layout/reftests/svg/filters/feMorphology-radius-zero-02.svg @@ -1,6 +1,6 @@ Test 'feMorphology' with a zero value for its 'radius' diff --git a/layout/reftests/svg/filters/feSpecularLighting-1-ref.svg b/layout/reftests/svg/filters/feSpecularLighting-1-ref.svg index 9e82d10045c..c57f91f06d5 100644 --- a/layout/reftests/svg/filters/feSpecularLighting-1-ref.svg +++ b/layout/reftests/svg/filters/feSpecularLighting-1-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/feSpecularLighting-1.svg b/layout/reftests/svg/filters/feSpecularLighting-1.svg index 6af38483209..50d363cdcb3 100644 --- a/layout/reftests/svg/filters/feSpecularLighting-1.svg +++ b/layout/reftests/svg/filters/feSpecularLighting-1.svg @@ -1,6 +1,6 @@ Testcase for tile larger than surface diff --git a/layout/reftests/svg/filters/filter-clipped-rect-01.svg b/layout/reftests/svg/filters/filter-clipped-rect-01.svg index b73b8492a0b..0e339cf42aa 100644 --- a/layout/reftests/svg/filters/filter-clipped-rect-01.svg +++ b/layout/reftests/svg/filters/filter-clipped-rect-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-filterRes-high-01.svg b/layout/reftests/svg/filters/filter-filterRes-high-01.svg index c43a6a667db..d6fc16475c9 100644 --- a/layout/reftests/svg/filters/filter-filterRes-high-01.svg +++ b/layout/reftests/svg/filters/filter-filterRes-high-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-filterRes-high-02.svg b/layout/reftests/svg/filters/filter-filterRes-high-02.svg index a94bb720707..a6466590443 100644 --- a/layout/reftests/svg/filters/filter-filterRes-high-02.svg +++ b/layout/reftests/svg/filters/filter-filterRes-high-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-filterRes-low-01.svg b/layout/reftests/svg/filters/filter-filterRes-low-01.svg index 59c9b9543db..997007303eb 100644 --- a/layout/reftests/svg/filters/filter-filterRes-low-01.svg +++ b/layout/reftests/svg/filters/filter-filterRes-low-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-inner-svg-01.svg b/layout/reftests/svg/filters/filter-inner-svg-01.svg index cd17e589e5e..e00bde4636d 100644 --- a/layout/reftests/svg/filters/filter-inner-svg-01.svg +++ b/layout/reftests/svg/filters/filter-inner-svg-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-inner-svg-02.svg b/layout/reftests/svg/filters/filter-inner-svg-02.svg index 0a1ac52c556..82809d93019 100644 --- a/layout/reftests/svg/filters/filter-inner-svg-02.svg +++ b/layout/reftests/svg/filters/filter-inner-svg-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-inner-svg-03.svg b/layout/reftests/svg/filters/filter-inner-svg-03.svg index 4c73fb2eeb4..0ce543e157a 100644 --- a/layout/reftests/svg/filters/filter-inner-svg-03.svg +++ b/layout/reftests/svg/filters/filter-inner-svg-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-marked-line-01.svg b/layout/reftests/svg/filters/filter-marked-line-01.svg index f00d474250d..406615443c0 100644 --- a/layout/reftests/svg/filters/filter-marked-line-01.svg +++ b/layout/reftests/svg/filters/filter-marked-line-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-marked-line-02.svg b/layout/reftests/svg/filters/filter-marked-line-02.svg index 127e9293e9d..76dea08b9c6 100644 --- a/layout/reftests/svg/filters/filter-marked-line-02.svg +++ b/layout/reftests/svg/filters/filter-marked-line-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-marked-line-03.svg b/layout/reftests/svg/filters/filter-marked-line-03.svg index 37dc2d6de47..d59c71f49eb 100644 --- a/layout/reftests/svg/filters/filter-marked-line-03.svg +++ b/layout/reftests/svg/filters/filter-marked-line-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-marked-line-04.svg b/layout/reftests/svg/filters/filter-marked-line-04.svg index 91c0e9ef90f..0b90aaf557c 100644 --- a/layout/reftests/svg/filters/filter-marked-line-04.svg +++ b/layout/reftests/svg/filters/filter-marked-line-04.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-marked-line-05.svg b/layout/reftests/svg/filters/filter-marked-line-05.svg index dea8e0011c4..6f3fc0938fe 100644 --- a/layout/reftests/svg/filters/filter-marked-line-05.svg +++ b/layout/reftests/svg/filters/filter-marked-line-05.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-marked-line-06.svg b/layout/reftests/svg/filters/filter-marked-line-06.svg index 89e853759a5..147d3a2aa08 100644 --- a/layout/reftests/svg/filters/filter-marked-line-06.svg +++ b/layout/reftests/svg/filters/filter-marked-line-06.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-marked-line-07.svg b/layout/reftests/svg/filters/filter-marked-line-07.svg index 5706d036893..94d1deca8ea 100644 --- a/layout/reftests/svg/filters/filter-marked-line-07.svg +++ b/layout/reftests/svg/filters/filter-marked-line-07.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-marked-line-08.svg b/layout/reftests/svg/filters/filter-marked-line-08.svg index de03b2fb77a..58d4f9e983e 100644 --- a/layout/reftests/svg/filters/filter-marked-line-08.svg +++ b/layout/reftests/svg/filters/filter-marked-line-08.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-marked-line-09.svg b/layout/reftests/svg/filters/filter-marked-line-09.svg index 3bf051c491b..55ff7160672 100644 --- a/layout/reftests/svg/filters/filter-marked-line-09.svg +++ b/layout/reftests/svg/filters/filter-marked-line-09.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-nested-filtering-01.svg b/layout/reftests/svg/filters/filter-nested-filtering-01.svg index 86ece29e524..0939ca679bb 100644 --- a/layout/reftests/svg/filters/filter-nested-filtering-01.svg +++ b/layout/reftests/svg/filters/filter-nested-filtering-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-nested-filtering-02.svg b/layout/reftests/svg/filters/filter-nested-filtering-02.svg index db2141664cd..77de499799a 100644 --- a/layout/reftests/svg/filters/filter-nested-filtering-02.svg +++ b/layout/reftests/svg/filters/filter-nested-filtering-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-patterned-rect-01.svg b/layout/reftests/svg/filters/filter-patterned-rect-01.svg index f043e3ba9d5..436d3648cf3 100644 --- a/layout/reftests/svg/filters/filter-patterned-rect-01.svg +++ b/layout/reftests/svg/filters/filter-patterned-rect-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/filter-patterned-rect-02.svg b/layout/reftests/svg/filters/filter-patterned-rect-02.svg index 2312500800a..f15baa4afc8 100644 --- a/layout/reftests/svg/filters/filter-patterned-rect-02.svg +++ b/layout/reftests/svg/filters/filter-patterned-rect-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/filters/pass.svg b/layout/reftests/svg/filters/pass.svg index b113287a3e2..c09c6601e8c 100644 --- a/layout/reftests/svg/filters/pass.svg +++ b/layout/reftests/svg/filters/pass.svg @@ -1,6 +1,6 @@ Testcase reference file for generic pass condition diff --git a/layout/reftests/svg/foreignObject-01.svg b/layout/reftests/svg/foreignObject-01.svg index ea2ae3e8dfc..68d4072f4a1 100644 --- a/layout/reftests/svg/foreignObject-01.svg +++ b/layout/reftests/svg/foreignObject-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/foreignObject-02-ref.svg b/layout/reftests/svg/foreignObject-02-ref.svg index 5620594b293..999e2780743 100644 --- a/layout/reftests/svg/foreignObject-02-ref.svg +++ b/layout/reftests/svg/foreignObject-02-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/foreignObject-ancestor-style-change-01.svg b/layout/reftests/svg/foreignObject-ancestor-style-change-01.svg index f2bc00cec03..8378066c56c 100644 --- a/layout/reftests/svg/foreignObject-ancestor-style-change-01.svg +++ b/layout/reftests/svg/foreignObject-ancestor-style-change-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/foreignObject-change-transform-01.svg b/layout/reftests/svg/foreignObject-change-transform-01.svg index aa60738b4f5..e395a1907df 100644 --- a/layout/reftests/svg/foreignObject-change-transform-01.svg +++ b/layout/reftests/svg/foreignObject-change-transform-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/foreignObject-move-repaint-01.svg b/layout/reftests/svg/foreignObject-move-repaint-01.svg index 12dec3a4eec..9c058d9a488 100644 --- a/layout/reftests/svg/foreignObject-move-repaint-01.svg +++ b/layout/reftests/svg/foreignObject-move-repaint-01.svg @@ -1,6 +1,6 @@ @@ -21,4 +21,4 @@ - \ No newline at end of file + diff --git a/layout/reftests/svg/getElementById-a-element-01.svg b/layout/reftests/svg/getElementById-a-element-01.svg index e4e51ebc008..272e3129131 100644 --- a/layout/reftests/svg/getElementById-a-element-01.svg +++ b/layout/reftests/svg/getElementById-a-element-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/image/image-fill-01.svg b/layout/reftests/svg/image/image-fill-01.svg index 30677dbe4a4..832be6c0482 100644 --- a/layout/reftests/svg/image/image-fill-01.svg +++ b/layout/reftests/svg/image/image-fill-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/image/image-scaling-01.svg b/layout/reftests/svg/image/image-scaling-01.svg index 84e260ffb4c..449101a4d67 100644 --- a/layout/reftests/svg/image/image-scaling-01.svg +++ b/layout/reftests/svg/image/image-scaling-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/invalid-text-01.svg b/layout/reftests/svg/invalid-text-01.svg index 4773b6fbe3a..fd8b12f48b9 100644 --- a/layout/reftests/svg/invalid-text-01.svg +++ b/layout/reftests/svg/invalid-text-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/linearGradient-basic-01.svg b/layout/reftests/svg/linearGradient-basic-01.svg index e5be9a92b29..63486368d81 100644 --- a/layout/reftests/svg/linearGradient-basic-01.svg +++ b/layout/reftests/svg/linearGradient-basic-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/linearGradient-basic-02.svg b/layout/reftests/svg/linearGradient-basic-02.svg index d9d4206b38b..368363c711b 100644 --- a/layout/reftests/svg/linearGradient-basic-02.svg +++ b/layout/reftests/svg/linearGradient-basic-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/linked-pattern-01.svg b/layout/reftests/svg/linked-pattern-01.svg index 8cd51e6e1c1..aef9df12582 100644 --- a/layout/reftests/svg/linked-pattern-01.svg +++ b/layout/reftests/svg/linked-pattern-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/marker-attribute-01.svg b/layout/reftests/svg/marker-attribute-01.svg index f7577800d4f..9ba365b75e9 100644 --- a/layout/reftests/svg/marker-attribute-01.svg +++ b/layout/reftests/svg/marker-attribute-01.svg @@ -1,6 +1,6 @@ Test there is no 'marker' presentation attribute diff --git a/layout/reftests/svg/marker-viewBox-01-ref.svg b/layout/reftests/svg/marker-viewBox-01-ref.svg index c03000c0e76..9a573666314 100644 --- a/layout/reftests/svg/marker-viewBox-01-ref.svg +++ b/layout/reftests/svg/marker-viewBox-01-ref.svg @@ -1,6 +1,6 @@ Reference for the 'marker' element with viewBox and preserveAspectRatio diff --git a/layout/reftests/svg/marker-viewBox-01.svg b/layout/reftests/svg/marker-viewBox-01.svg index 39fbb68a2f8..84afb97ee89 100644 --- a/layout/reftests/svg/marker-viewBox-01.svg +++ b/layout/reftests/svg/marker-viewBox-01.svg @@ -1,6 +1,6 @@ Test the 'marker' element with viewBox and preserveAspectRatio diff --git a/layout/reftests/svg/markers-and-group-opacity-01.svg b/layout/reftests/svg/markers-and-group-opacity-01.svg index c04e2597998..18b7d807c04 100644 --- a/layout/reftests/svg/markers-and-group-opacity-01.svg +++ b/layout/reftests/svg/markers-and-group-opacity-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/mask-basic-01.svg b/layout/reftests/svg/mask-basic-01.svg index 35b671389fa..99764efa050 100644 --- a/layout/reftests/svg/mask-basic-01.svg +++ b/layout/reftests/svg/mask-basic-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/mask-containing-masked-content-01.svg b/layout/reftests/svg/mask-containing-masked-content-01.svg index eab2e2ad713..eb672a9771c 100644 --- a/layout/reftests/svg/mask-containing-masked-content-01.svg +++ b/layout/reftests/svg/mask-containing-masked-content-01.svg @@ -1,6 +1,6 @@ Test 'mask' containing masked content diff --git a/layout/reftests/svg/mask-transformed-01-ref.svg b/layout/reftests/svg/mask-transformed-01-ref.svg index 54cbb68ebe8..28ae8e28288 100644 --- a/layout/reftests/svg/mask-transformed-01-ref.svg +++ b/layout/reftests/svg/mask-transformed-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/mask-transformed-01.svg b/layout/reftests/svg/mask-transformed-01.svg index 8b5a8dc57a1..254c3e96668 100644 --- a/layout/reftests/svg/mask-transformed-01.svg +++ b/layout/reftests/svg/mask-transformed-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/feImage-zoom-01-ref.svg b/layout/reftests/svg/moz-only/feImage-zoom-01-ref.svg index 8187dad9ca1..92046f8d2ce 100644 --- a/layout/reftests/svg/moz-only/feImage-zoom-01-ref.svg +++ b/layout/reftests/svg/moz-only/feImage-zoom-01-ref.svg @@ -1,6 +1,6 @@ test image-rendering: -moz-crisp-edges diff --git a/layout/reftests/svg/moz-only/feImage-zoom-01a.svg b/layout/reftests/svg/moz-only/feImage-zoom-01a.svg index caf488505e7..3b63c5bdc01 100644 --- a/layout/reftests/svg/moz-only/feImage-zoom-01a.svg +++ b/layout/reftests/svg/moz-only/feImage-zoom-01a.svg @@ -1,6 +1,6 @@ test image-rendering: -moz-crisp-edges diff --git a/layout/reftests/svg/moz-only/feImage-zoom-01b.svg b/layout/reftests/svg/moz-only/feImage-zoom-01b.svg index 39e5b2366e8..af1871d6d26 100644 --- a/layout/reftests/svg/moz-only/feImage-zoom-01b.svg +++ b/layout/reftests/svg/moz-only/feImage-zoom-01b.svg @@ -1,6 +1,6 @@ test image-rendering: -moz-crisp-edges diff --git a/layout/reftests/svg/moz-only/foreignObject-zoom-01.svg b/layout/reftests/svg/moz-only/foreignObject-zoom-01.svg index 345b7cceabd..20c4f199950 100644 --- a/layout/reftests/svg/moz-only/foreignObject-zoom-01.svg +++ b/layout/reftests/svg/moz-only/foreignObject-zoom-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/pass-black.svg b/layout/reftests/svg/moz-only/pass-black.svg index 148df7313f9..d80f66d63eb 100644 --- a/layout/reftests/svg/moz-only/pass-black.svg +++ b/layout/reftests/svg/moz-only/pass-black.svg @@ -1,6 +1,6 @@ Testcase reference file for black pass condition diff --git a/layout/reftests/svg/moz-only/pass.svg b/layout/reftests/svg/moz-only/pass.svg index b113287a3e2..c09c6601e8c 100644 --- a/layout/reftests/svg/moz-only/pass.svg +++ b/layout/reftests/svg/moz-only/pass.svg @@ -1,6 +1,6 @@ Testcase reference file for generic pass condition diff --git a/layout/reftests/svg/moz-only/reftest.list b/layout/reftests/svg/moz-only/reftest.list index 24c357d1396..8118cedf14a 100644 --- a/layout/reftests/svg/moz-only/reftest.list +++ b/layout/reftests/svg/moz-only/reftest.list @@ -15,7 +15,7 @@ fails == xbl-grad-ref--grad-in-resources-02.svg pass.svg == xbl-grad-ref--grad-in-bound-04.svg pass.svg # Tests for zooming with the full page zoom UI -fails-if(Android) == feImage-zoom-01a.svg feImage-zoom-01-ref.svg -fails-if(Android) == feImage-zoom-01b.svg feImage-zoom-01-ref.svg +== feImage-zoom-01a.svg feImage-zoom-01-ref.svg +== feImage-zoom-01b.svg feImage-zoom-01-ref.svg == foreignObject-zoom-01.svg pass.svg skip == zoomed-svg-with-viewBox-01.svg zoomed-svg-with-viewBox-01-ref.svg diff --git a/layout/reftests/svg/moz-only/xbl-basic-01.svg b/layout/reftests/svg/moz-only/xbl-basic-01.svg index 6a86f7babf4..8abbb29e656 100644 --- a/layout/reftests/svg/moz-only/xbl-basic-01.svg +++ b/layout/reftests/svg/moz-only/xbl-basic-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-basic-02.svg b/layout/reftests/svg/moz-only/xbl-basic-02.svg index efc5a097186..c031af8c2a9 100644 --- a/layout/reftests/svg/moz-only/xbl-basic-02.svg +++ b/layout/reftests/svg/moz-only/xbl-basic-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-basic-03.svg b/layout/reftests/svg/moz-only/xbl-basic-03.svg index 79d6b4f1cf6..33ff88f21ac 100644 --- a/layout/reftests/svg/moz-only/xbl-basic-03.svg +++ b/layout/reftests/svg/moz-only/xbl-basic-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-02.svg b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-02.svg index 6e2f32aca35..172ea971ea3 100644 --- a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-02.svg +++ b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-03.svg b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-03.svg index 211d216e97d..b2e576b0042 100644 --- a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-03.svg +++ b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-04.svg b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-04.svg index b4c97b3e047..4b9c11f562c 100644 --- a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-04.svg +++ b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-04.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-04.xbl b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-04.xbl index 12531d9b056..48b0336330f 100644 --- a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-04.xbl +++ b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-binding-04.xbl @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-01.svg b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-01.svg index 745382435de..c53e98db372 100644 --- a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-01.svg +++ b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-02.svg b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-02.svg index 091b797dbcd..9e2334193d5 100644 --- a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-02.svg +++ b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-03.svg b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-03.svg index 99909cedfa8..2e248218236 100644 --- a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-03.svg +++ b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-04.svg b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-04.svg index ba52fd1507a..dc18921488a 100644 --- a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-04.svg +++ b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-04.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-04.xbl b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-04.xbl index cde3302d4fe..076d9bbc942 100644 --- a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-04.xbl +++ b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-bound-04.xbl @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-resources-01.svg b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-resources-01.svg index b784cd17083..e46d3dfd2d2 100644 --- a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-resources-01.svg +++ b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-resources-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-resources-02.svg b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-resources-02.svg index b39eed2b152..7b81f749c96 100644 --- a/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-resources-02.svg +++ b/layout/reftests/svg/moz-only/xbl-grad-ref--grad-in-resources-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/zoomed-svg-with-viewBox-01-ref.svg b/layout/reftests/svg/moz-only/zoomed-svg-with-viewBox-01-ref.svg index 921b16ca8e7..99a3d36b529 100644 --- a/layout/reftests/svg/moz-only/zoomed-svg-with-viewBox-01-ref.svg +++ b/layout/reftests/svg/moz-only/zoomed-svg-with-viewBox-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/moz-only/zoomed-svg-with-viewBox-01.svg b/layout/reftests/svg/moz-only/zoomed-svg-with-viewBox-01.svg index c22e6debae9..8b4217ad221 100644 --- a/layout/reftests/svg/moz-only/zoomed-svg-with-viewBox-01.svg +++ b/layout/reftests/svg/moz-only/zoomed-svg-with-viewBox-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/nested-viewBox-01.svg b/layout/reftests/svg/nested-viewBox-01.svg index 2db05b4b991..d78ca4c4c50 100644 --- a/layout/reftests/svg/nested-viewBox-01.svg +++ b/layout/reftests/svg/nested-viewBox-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/nesting-invalid-01-ref.svg b/layout/reftests/svg/nesting-invalid-01-ref.svg index 2983cbbec32..8b61e19756b 100644 --- a/layout/reftests/svg/nesting-invalid-01-ref.svg +++ b/layout/reftests/svg/nesting-invalid-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/nesting-invalid-01.js b/layout/reftests/svg/nesting-invalid-01.js index b68bba7d255..b1ff906ce9a 100644 --- a/layout/reftests/svg/nesting-invalid-01.js +++ b/layout/reftests/svg/nesting-invalid-01.js @@ -1,5 +1,5 @@ // Any copyright is dedicated to the Public Domain. -// http://creativecommons.org/licenses/publicdomain/ +// http://creativecommons.org/publicdomain/zero/1.0/ // These are all of the SVG 1.1 element names, except for container elements, // with the addition of an "UNKNOWN" element in the SVG namespace. diff --git a/layout/reftests/svg/nesting-invalid-01.svg b/layout/reftests/svg/nesting-invalid-01.svg index 306a40b25a6..aa9e6f1444a 100644 --- a/layout/reftests/svg/nesting-invalid-01.svg +++ b/layout/reftests/svg/nesting-invalid-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/objectBoundingBox-and-fePointLight-01-ref.svg b/layout/reftests/svg/objectBoundingBox-and-fePointLight-01-ref.svg index a4da87f03bf..e60b913b8bf 100644 --- a/layout/reftests/svg/objectBoundingBox-and-fePointLight-01-ref.svg +++ b/layout/reftests/svg/objectBoundingBox-and-fePointLight-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/objectBoundingBox-and-fePointLight-01.svg b/layout/reftests/svg/objectBoundingBox-and-fePointLight-01.svg index 354061fe017..f4ffd50326e 100644 --- a/layout/reftests/svg/objectBoundingBox-and-fePointLight-01.svg +++ b/layout/reftests/svg/objectBoundingBox-and-fePointLight-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/objectBoundingBox-and-mask-02.svg b/layout/reftests/svg/objectBoundingBox-and-mask-02.svg index 0184b288eb5..8cab2d32ac2 100644 --- a/layout/reftests/svg/objectBoundingBox-and-mask-02.svg +++ b/layout/reftests/svg/objectBoundingBox-and-mask-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/objectBoundingBox-and-mask.svg b/layout/reftests/svg/objectBoundingBox-and-mask.svg index 05bdd495928..e247913aed5 100644 --- a/layout/reftests/svg/objectBoundingBox-and-mask.svg +++ b/layout/reftests/svg/objectBoundingBox-and-mask.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/objectBoundingBox-and-pattern-01-ref.svg b/layout/reftests/svg/objectBoundingBox-and-pattern-01-ref.svg index 0ca696438e8..fcf4e8d164f 100644 --- a/layout/reftests/svg/objectBoundingBox-and-pattern-01-ref.svg +++ b/layout/reftests/svg/objectBoundingBox-and-pattern-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/objectBoundingBox-and-pattern-01a.svg b/layout/reftests/svg/objectBoundingBox-and-pattern-01a.svg index fe7a74bf6d7..10623a95bf6 100644 --- a/layout/reftests/svg/objectBoundingBox-and-pattern-01a.svg +++ b/layout/reftests/svg/objectBoundingBox-and-pattern-01a.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/objectBoundingBox-and-pattern-01b.svg b/layout/reftests/svg/objectBoundingBox-and-pattern-01b.svg index 478eef89184..e932cf91b58 100644 --- a/layout/reftests/svg/objectBoundingBox-and-pattern-01b.svg +++ b/layout/reftests/svg/objectBoundingBox-and-pattern-01b.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/objectBoundingBox-and-pattern-01c.svg b/layout/reftests/svg/objectBoundingBox-and-pattern-01c.svg index 62944557e25..ef63c994c3f 100644 --- a/layout/reftests/svg/objectBoundingBox-and-pattern-01c.svg +++ b/layout/reftests/svg/objectBoundingBox-and-pattern-01c.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/objectBoundingBox-and-pattern-02.svg b/layout/reftests/svg/objectBoundingBox-and-pattern-02.svg index d1ed01456aa..ca77584198d 100644 --- a/layout/reftests/svg/objectBoundingBox-and-pattern-02.svg +++ b/layout/reftests/svg/objectBoundingBox-and-pattern-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/opacity-and-gradient-01.svg b/layout/reftests/svg/opacity-and-gradient-01.svg index 935b9adde6e..178525b0ae5 100644 --- a/layout/reftests/svg/opacity-and-gradient-01.svg +++ b/layout/reftests/svg/opacity-and-gradient-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/opacity-and-gradient-02-ref.svg b/layout/reftests/svg/opacity-and-gradient-02-ref.svg index 846db471aba..085d8b6f1a0 100644 --- a/layout/reftests/svg/opacity-and-gradient-02-ref.svg +++ b/layout/reftests/svg/opacity-and-gradient-02-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/opacity-and-gradient-02.svg b/layout/reftests/svg/opacity-and-gradient-02.svg index 2fc659efc56..d4f34f0cc9b 100644 --- a/layout/reftests/svg/opacity-and-gradient-02.svg +++ b/layout/reftests/svg/opacity-and-gradient-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/opacity-and-pattern-01.svg b/layout/reftests/svg/opacity-and-pattern-01.svg index eb05ec8ad56..665c9064a41 100644 --- a/layout/reftests/svg/opacity-and-pattern-01.svg +++ b/layout/reftests/svg/opacity-and-pattern-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/outer-svg-border-and-padding-01-ref.svg b/layout/reftests/svg/outer-svg-border-and-padding-01-ref.svg index bd5aa9cc6c3..688c760d42a 100644 --- a/layout/reftests/svg/outer-svg-border-and-padding-01-ref.svg +++ b/layout/reftests/svg/outer-svg-border-and-padding-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/outer-svg-border-and-padding-01.svg b/layout/reftests/svg/outer-svg-border-and-padding-01.svg index 7494ee734a7..6eb34c8401b 100644 --- a/layout/reftests/svg/outer-svg-border-and-padding-01.svg +++ b/layout/reftests/svg/outer-svg-border-and-padding-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/pass.svg b/layout/reftests/svg/pass.svg index b113287a3e2..c09c6601e8c 100644 --- a/layout/reftests/svg/pass.svg +++ b/layout/reftests/svg/pass.svg @@ -1,6 +1,6 @@ Testcase reference file for generic pass condition diff --git a/layout/reftests/svg/path-01-ref.svg b/layout/reftests/svg/path-01-ref.svg index 16221f702dc..fa54799c47c 100644 --- a/layout/reftests/svg/path-01-ref.svg +++ b/layout/reftests/svg/path-01-ref.svg @@ -1,6 +1,6 @@ Reference for path consisting of a single point diff --git a/layout/reftests/svg/path-01.svg b/layout/reftests/svg/path-01.svg index e03f836b3c3..7085d8701d1 100644 --- a/layout/reftests/svg/path-01.svg +++ b/layout/reftests/svg/path-01.svg @@ -1,6 +1,6 @@ Testcase for path consisting of a single point diff --git a/layout/reftests/svg/path-02.svg b/layout/reftests/svg/path-02.svg index a00fa35c6fb..c863c083384 100644 --- a/layout/reftests/svg/path-02.svg +++ b/layout/reftests/svg/path-02.svg @@ -1,6 +1,6 @@ Testcase for path with errors diff --git a/layout/reftests/svg/path-03.svg b/layout/reftests/svg/path-03.svg index 78057bbac41..f3f8c57df08 100644 --- a/layout/reftests/svg/path-03.svg +++ b/layout/reftests/svg/path-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/path-04.svg b/layout/reftests/svg/path-04.svg index 3324db30ef1..e58254da159 100644 --- a/layout/reftests/svg/path-04.svg +++ b/layout/reftests/svg/path-04.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/path-05.svg b/layout/reftests/svg/path-05.svg index abb1548f87c..28a7305b29e 100644 --- a/layout/reftests/svg/path-05.svg +++ b/layout/reftests/svg/path-05.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/pathLength-01.svg b/layout/reftests/svg/pathLength-01.svg index 952fa147bf3..c9261fd46ba 100644 --- a/layout/reftests/svg/pathLength-01.svg +++ b/layout/reftests/svg/pathLength-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/pathLength-02.svg b/layout/reftests/svg/pathLength-02.svg index 78470e9d28d..8e939bd0fd3 100644 --- a/layout/reftests/svg/pathLength-02.svg +++ b/layout/reftests/svg/pathLength-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/pattern-invalid-01-ref.svg b/layout/reftests/svg/pattern-invalid-01-ref.svg index 86ccc326181..289335a1732 100644 --- a/layout/reftests/svg/pattern-invalid-01-ref.svg +++ b/layout/reftests/svg/pattern-invalid-01-ref.svg @@ -1,6 +1,6 @@ Reference that pattern without width/height does not display diff --git a/layout/reftests/svg/pattern-invalid-01.svg b/layout/reftests/svg/pattern-invalid-01.svg index 5a1885abaaf..bbcdda85c10 100644 --- a/layout/reftests/svg/pattern-invalid-01.svg +++ b/layout/reftests/svg/pattern-invalid-01.svg @@ -1,6 +1,6 @@ Testcase for pattern with no width/height is not displayed diff --git a/layout/reftests/svg/polygon-marker-01.svg b/layout/reftests/svg/polygon-marker-01.svg index 9f7854641e2..a6092ceb6ad 100644 --- a/layout/reftests/svg/polygon-marker-01.svg +++ b/layout/reftests/svg/polygon-marker-01.svg @@ -1,6 +1,6 @@ Test that marker-start and marker-end are co-located for polygon elements diff --git a/layout/reftests/svg/polygon-points-negative-01.svg b/layout/reftests/svg/polygon-points-negative-01.svg index 0b4920b5878..a2286055899 100644 --- a/layout/reftests/svg/polygon-points-negative-01.svg +++ b/layout/reftests/svg/polygon-points-negative-01.svg @@ -1,6 +1,6 @@ Testing for x-y |points| attribute diff --git a/layout/reftests/svg/pseudo-classes-01.svg b/layout/reftests/svg/pseudo-classes-01.svg index a8bd950b2f5..74ffaf9aa38 100644 --- a/layout/reftests/svg/pseudo-classes-01.svg +++ b/layout/reftests/svg/pseudo-classes-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/pseudo-classes-02-ref.svg b/layout/reftests/svg/pseudo-classes-02-ref.svg index 6855cdf9856..a76db85a41b 100644 --- a/layout/reftests/svg/pseudo-classes-02-ref.svg +++ b/layout/reftests/svg/pseudo-classes-02-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/pseudo-classes-02.svg b/layout/reftests/svg/pseudo-classes-02.svg index 8e028a69d73..22cfc5ce36d 100644 --- a/layout/reftests/svg/pseudo-classes-02.svg +++ b/layout/reftests/svg/pseudo-classes-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/radialGradient-basic-01.svg b/layout/reftests/svg/radialGradient-basic-01.svg index efa7ab15b4b..c875b2dc3b4 100644 --- a/layout/reftests/svg/radialGradient-basic-01.svg +++ b/layout/reftests/svg/radialGradient-basic-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/radialGradient-basic-02.svg b/layout/reftests/svg/radialGradient-basic-02.svg index ceba3c24a58..dda5a7a1d1b 100644 --- a/layout/reftests/svg/radialGradient-basic-02.svg +++ b/layout/reftests/svg/radialGradient-basic-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/radialGradient-basic-03-ref.svg b/layout/reftests/svg/radialGradient-basic-03-ref.svg index 954099afe7e..9e524acb14a 100644 --- a/layout/reftests/svg/radialGradient-basic-03-ref.svg +++ b/layout/reftests/svg/radialGradient-basic-03-ref.svg @@ -1,6 +1,6 @@ @@ -36,4 +36,4 @@ - \ No newline at end of file + diff --git a/layout/reftests/svg/radialGradient-basic-03.svg b/layout/reftests/svg/radialGradient-basic-03.svg index 82905de3dd3..cb74eae3854 100644 --- a/layout/reftests/svg/radialGradient-basic-03.svg +++ b/layout/reftests/svg/radialGradient-basic-03.svg @@ -1,6 +1,6 @@ @@ -36,4 +36,4 @@ - \ No newline at end of file + diff --git a/layout/reftests/svg/rect-01.svg b/layout/reftests/svg/rect-01.svg index a464a25a95c..c1157e65ff0 100644 --- a/layout/reftests/svg/rect-01.svg +++ b/layout/reftests/svg/rect-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/rect-02.svg b/layout/reftests/svg/rect-02.svg index ee2fe96f0d6..69aac4e8ef4 100644 --- a/layout/reftests/svg/rect-02.svg +++ b/layout/reftests/svg/rect-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/rect-03.svg b/layout/reftests/svg/rect-03.svg index ead36af9e81..3b16bbabcf2 100644 --- a/layout/reftests/svg/rect-03.svg +++ b/layout/reftests/svg/rect-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/rect-with-rx-and-ry-01.svg b/layout/reftests/svg/rect-with-rx-and-ry-01.svg index ef70cb31dcd..081314b5ac9 100644 --- a/layout/reftests/svg/rect-with-rx-and-ry-01.svg +++ b/layout/reftests/svg/rect-with-rx-and-ry-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/rect-with-rx-or-ry-01-ref.svg b/layout/reftests/svg/rect-with-rx-or-ry-01-ref.svg index 30f2e6dd0f8..63f7d5d04fc 100644 --- a/layout/reftests/svg/rect-with-rx-or-ry-01-ref.svg +++ b/layout/reftests/svg/rect-with-rx-or-ry-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/rect-with-rx-or-ry-01.svg b/layout/reftests/svg/rect-with-rx-or-ry-01.svg index 6feb63af373..7050ed9617c 100644 --- a/layout/reftests/svg/rect-with-rx-or-ry-01.svg +++ b/layout/reftests/svg/rect-with-rx-or-ry-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index 266e207ff42..45a0698cba3 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -92,9 +92,12 @@ fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == dynamic-text-04.svg dynam == dynamic-textPath-01.svg dynamic-textPath-01-ref.svg == dynamic-use-01.svg pass.svg == dynamic-use-02.svg pass.svg +== dynamic-use-03.svg pass.svg +== dynamic-use-04.svg pass.svg random == dynamic-use-nested-01.svg dynamic-use-nested-01-ref.svg # bug 467498 == dynamic-use-remove-width.svg dynamic-use-remove-width-ref.svg == linked-pattern-01.svg pass.svg +== use-01.svg pass.svg == use-01-extref.svg pass.svg == use-02-extref.svg use-02-extref-ref.svg == use-children.svg pass.svg @@ -120,10 +123,10 @@ random == dynamic-use-nested-01.svg dynamic-use-nested-01-ref.svg # bug 467498 == foreignObject-start-hidden-01.svg pass.svg # followup from Bug 596765 == foreignObject-start-hidden-02.svg pass.svg == getElementById-a-element-01.svg pass.svg -fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == gradient-live-01a.svg gradient-live-01-ref.svg # bug 623403 -fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == gradient-live-01b.svg gradient-live-01-ref.svg # bug 623403 -fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == gradient-live-01c.svg gradient-live-01-ref.svg # bug 623403 -fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == gradient-live-01d.svg gradient-live-01-ref.svg # bug 623403 +== gradient-live-01a.svg gradient-live-01-ref.svg +== gradient-live-01b.svg gradient-live-01-ref.svg +== gradient-live-01c.svg gradient-live-01-ref.svg +== gradient-live-01d.svg gradient-live-01-ref.svg fails == inline-in-xul-basic-01.xul pass.svg == invalid-text-01.svg pass.svg == linearGradient-basic-01.svg pass.svg diff --git a/layout/reftests/svg/rootElement-null-01.svg b/layout/reftests/svg/rootElement-null-01.svg index 55d0ce0acc9..38ed92d85fb 100644 --- a/layout/reftests/svg/rootElement-null-01.svg +++ b/layout/reftests/svg/rootElement-null-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/selector-01.svg b/layout/reftests/svg/selector-01.svg index 00e1514a532..595d92ea438 100644 --- a/layout/reftests/svg/selector-01.svg +++ b/layout/reftests/svg/selector-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/dynamic--inline-css-height.xhtml b/layout/reftests/svg/sizing/dynamic--inline-css-height.xhtml index 3f3bd0fdf5c..2abf3a32b1b 100644 --- a/layout/reftests/svg/sizing/dynamic--inline-css-height.xhtml +++ b/layout/reftests/svg/sizing/dynamic--inline-css-height.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/dynamic--inline-css-width.xhtml b/layout/reftests/svg/sizing/dynamic--inline-css-width.xhtml index 419fdacbf04..b23407b6dc9 100644 --- a/layout/reftests/svg/sizing/dynamic--inline-css-width.xhtml +++ b/layout/reftests/svg/sizing/dynamic--inline-css-width.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/dynamic--inline-resize-cb-height.xhtml b/layout/reftests/svg/sizing/dynamic--inline-resize-cb-height.xhtml index a2703bfedcd..bea695f6afa 100644 --- a/layout/reftests/svg/sizing/dynamic--inline-resize-cb-height.xhtml +++ b/layout/reftests/svg/sizing/dynamic--inline-resize-cb-height.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/dynamic--inline-resize-cb-width.xhtml b/layout/reftests/svg/sizing/dynamic--inline-resize-cb-width.xhtml index 8b62f2ff14b..1d0ff495b85 100644 --- a/layout/reftests/svg/sizing/dynamic--inline-resize-cb-width.xhtml +++ b/layout/reftests/svg/sizing/dynamic--inline-resize-cb-width.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/dynamic--inline-resize-window-height.xhtml b/layout/reftests/svg/sizing/dynamic--inline-resize-window-height.xhtml index 4a8c9eaaf67..3091947d88d 100644 --- a/layout/reftests/svg/sizing/dynamic--inline-resize-window-height.xhtml +++ b/layout/reftests/svg/sizing/dynamic--inline-resize-window-height.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/dynamic--inline-resize-window-width.xhtml b/layout/reftests/svg/sizing/dynamic--inline-resize-window-width.xhtml index ccb5f0633f3..dbf0c876200 100644 --- a/layout/reftests/svg/sizing/dynamic--inline-resize-window-width.xhtml +++ b/layout/reftests/svg/sizing/dynamic--inline-resize-window-width.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/dynamic--object--auto-auto--pct-px.html b/layout/reftests/svg/sizing/dynamic--object--auto-auto--pct-px.html index 8879ebadb3b..1fbecb0dc75 100644 --- a/layout/reftests/svg/sizing/dynamic--object--auto-auto--pct-px.html +++ b/layout/reftests/svg/sizing/dynamic--object--auto-auto--pct-px.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-a.svg b/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-a.svg index ad8c13799bb..8ee8e25709d 100644 --- a/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-a.svg +++ b/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-a.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-b.xhtml b/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-b.xhtml index b0d1243f265..7ed4c539ce1 100644 --- a/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-b.xhtml +++ b/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-b.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/dynamic--object-svg-unloaded.xhtml b/layout/reftests/svg/sizing/dynamic--object-svg-unloaded.xhtml index 8d6be9a314f..6095e7cb189 100644 --- a/layout/reftests/svg/sizing/dynamic--object-svg-unloaded.xhtml +++ b/layout/reftests/svg/sizing/dynamic--object-svg-unloaded.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--display-block--01-ref.xhtml b/layout/reftests/svg/sizing/inline--display-block--01-ref.xhtml index a79aa7e9cec..f2588737291 100644 --- a/layout/reftests/svg/sizing/inline--display-block--01-ref.xhtml +++ b/layout/reftests/svg/sizing/inline--display-block--01-ref.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--display-block--01.xhtml b/layout/reftests/svg/sizing/inline--display-block--01.xhtml index 2c4336b3014..4b8cbe42662 100644 --- a/layout/reftests/svg/sizing/inline--display-block--01.xhtml +++ b/layout/reftests/svg/sizing/inline--display-block--01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--display-inline--01-ref.xhtml b/layout/reftests/svg/sizing/inline--display-inline--01-ref.xhtml index 89d5af892e0..65cb6542ba2 100644 --- a/layout/reftests/svg/sizing/inline--display-inline--01-ref.xhtml +++ b/layout/reftests/svg/sizing/inline--display-inline--01-ref.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--display-inline--01.xhtml b/layout/reftests/svg/sizing/inline--display-inline--01.xhtml index 32fea4284a0..5139f6e477a 100644 --- a/layout/reftests/svg/sizing/inline--display-inline--01.xhtml +++ b/layout/reftests/svg/sizing/inline--display-inline--01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--display-inline-block--01-ref.xhtml b/layout/reftests/svg/sizing/inline--display-inline-block--01-ref.xhtml index 0ef2cc987fa..93cb2d1ddf7 100644 --- a/layout/reftests/svg/sizing/inline--display-inline-block--01-ref.xhtml +++ b/layout/reftests/svg/sizing/inline--display-inline-block--01-ref.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--display-inline-block--01.xhtml b/layout/reftests/svg/sizing/inline--display-inline-block--01.xhtml index a8f68b7250c..f2f9a84812a 100644 --- a/layout/reftests/svg/sizing/inline--display-inline-block--01.xhtml +++ b/layout/reftests/svg/sizing/inline--display-inline-block--01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--float-left--01-ref.xhtml b/layout/reftests/svg/sizing/inline--float-left--01-ref.xhtml index 9a8005e95ed..f46dc859198 100644 --- a/layout/reftests/svg/sizing/inline--float-left--01-ref.xhtml +++ b/layout/reftests/svg/sizing/inline--float-left--01-ref.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--float-left--01.xhtml b/layout/reftests/svg/sizing/inline--float-left--01.xhtml index 2fd347978c8..f575db2e749 100644 --- a/layout/reftests/svg/sizing/inline--float-left--01.xhtml +++ b/layout/reftests/svg/sizing/inline--float-left--01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--float-right--01-ref.xhtml b/layout/reftests/svg/sizing/inline--float-right--01-ref.xhtml index 2ab9742b1ae..1803862f9e7 100644 --- a/layout/reftests/svg/sizing/inline--float-right--01-ref.xhtml +++ b/layout/reftests/svg/sizing/inline--float-right--01-ref.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--float-right--01.xhtml b/layout/reftests/svg/sizing/inline--float-right--01.xhtml index 4c488de2f08..1054c1b62fd 100644 --- a/layout/reftests/svg/sizing/inline--float-right--01.xhtml +++ b/layout/reftests/svg/sizing/inline--float-right--01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--position-absolute--01-ref.xhtml b/layout/reftests/svg/sizing/inline--position-absolute--01-ref.xhtml index 96ed87940ac..24464c520a5 100644 --- a/layout/reftests/svg/sizing/inline--position-absolute--01-ref.xhtml +++ b/layout/reftests/svg/sizing/inline--position-absolute--01-ref.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--position-absolute--01.xhtml b/layout/reftests/svg/sizing/inline--position-absolute--01.xhtml index bcf632a2bbf..370a9bc438d 100644 --- a/layout/reftests/svg/sizing/inline--position-absolute--01.xhtml +++ b/layout/reftests/svg/sizing/inline--position-absolute--01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--position-absolute--02.xhtml b/layout/reftests/svg/sizing/inline--position-absolute--02.xhtml index ba2b0c466c1..a9f7a2b7ed4 100644 --- a/layout/reftests/svg/sizing/inline--position-absolute--02.xhtml +++ b/layout/reftests/svg/sizing/inline--position-absolute--02.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--position-relative--01-ref.xhtml b/layout/reftests/svg/sizing/inline--position-relative--01-ref.xhtml index 96798b6bb04..dd7cff1e184 100644 --- a/layout/reftests/svg/sizing/inline--position-relative--01-ref.xhtml +++ b/layout/reftests/svg/sizing/inline--position-relative--01-ref.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/inline--position-relative--01.xhtml b/layout/reftests/svg/sizing/inline--position-relative--01.xhtml index 46b96a90a2c..0e4c334fd10 100644 --- a/layout/reftests/svg/sizing/inline--position-relative--01.xhtml +++ b/layout/reftests/svg/sizing/inline--position-relative--01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--0-0.html b/layout/reftests/svg/sizing/object--auto-auto--0-0.html index 0b99b2877a4..4601a0c37a0 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--0-0.html +++ b/layout/reftests/svg/sizing/object--auto-auto--0-0.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--0-0.svg b/layout/reftests/svg/sizing/object--auto-auto--0-0.svg index 3881d1d1e53..fa0eddd82c0 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--0-0.svg +++ b/layout/reftests/svg/sizing/object--auto-auto--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--0-pct--ref.html b/layout/reftests/svg/sizing/object--auto-auto--0-pct--ref.html index a973dd55df5..1dff62fda56 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--0-pct--ref.html +++ b/layout/reftests/svg/sizing/object--auto-auto--0-pct--ref.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--0-pct.html b/layout/reftests/svg/sizing/object--auto-auto--0-pct.html index e6c3a35630c..92e266e5fd5 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--0-pct.html +++ b/layout/reftests/svg/sizing/object--auto-auto--0-pct.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--0-pct.svg b/layout/reftests/svg/sizing/object--auto-auto--0-pct.svg index e937c973dc4..e955c400f05 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--0-pct.svg +++ b/layout/reftests/svg/sizing/object--auto-auto--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--0-px--ref.html b/layout/reftests/svg/sizing/object--auto-auto--0-px--ref.html index e322e82770c..5c44bf52b60 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--0-px--ref.html +++ b/layout/reftests/svg/sizing/object--auto-auto--0-px--ref.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--0-px.html b/layout/reftests/svg/sizing/object--auto-auto--0-px.html index a2564771045..ec0d8d694e5 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--0-px.html +++ b/layout/reftests/svg/sizing/object--auto-auto--0-px.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--0-px.svg b/layout/reftests/svg/sizing/object--auto-auto--0-px.svg index cd1eaff657e..0b4b0984d41 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--0-px.svg +++ b/layout/reftests/svg/sizing/object--auto-auto--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--pct-0--ref.html b/layout/reftests/svg/sizing/object--auto-auto--pct-0--ref.html index 639524d52de..257ff526842 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--pct-0--ref.html +++ b/layout/reftests/svg/sizing/object--auto-auto--pct-0--ref.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--pct-0.html b/layout/reftests/svg/sizing/object--auto-auto--pct-0.html index 2e634debf90..231d4e4b3cc 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--pct-0.html +++ b/layout/reftests/svg/sizing/object--auto-auto--pct-0.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--pct-0.svg b/layout/reftests/svg/sizing/object--auto-auto--pct-0.svg index ccbe78b4b1f..d460c2fa69c 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--pct-0.svg +++ b/layout/reftests/svg/sizing/object--auto-auto--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--pct-pct--ref.html b/layout/reftests/svg/sizing/object--auto-auto--pct-pct--ref.html index 97e98fc998c..8e9ae6f878a 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--pct-pct--ref.html +++ b/layout/reftests/svg/sizing/object--auto-auto--pct-pct--ref.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--pct-pct.html b/layout/reftests/svg/sizing/object--auto-auto--pct-pct.html index 1b61c4cc61e..3d05e12c418 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--pct-pct.html +++ b/layout/reftests/svg/sizing/object--auto-auto--pct-pct.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--pct-pct.svg b/layout/reftests/svg/sizing/object--auto-auto--pct-pct.svg index eb8e65b8fce..c96b04a7382 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--pct-pct.svg +++ b/layout/reftests/svg/sizing/object--auto-auto--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--pct-px--ref.html b/layout/reftests/svg/sizing/object--auto-auto--pct-px--ref.html index 8d76faaa0f5..af3fa39a7d5 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--pct-px--ref.html +++ b/layout/reftests/svg/sizing/object--auto-auto--pct-px--ref.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--pct-px.html b/layout/reftests/svg/sizing/object--auto-auto--pct-px.html index 6b9666076c3..d711e1bda16 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--pct-px.html +++ b/layout/reftests/svg/sizing/object--auto-auto--pct-px.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--pct-px.svg b/layout/reftests/svg/sizing/object--auto-auto--pct-px.svg index c97b0f6caf9..41fe8bd1d7c 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--pct-px.svg +++ b/layout/reftests/svg/sizing/object--auto-auto--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--px-0--ref.html b/layout/reftests/svg/sizing/object--auto-auto--px-0--ref.html index e8b7581149f..19a3ac08a60 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--px-0--ref.html +++ b/layout/reftests/svg/sizing/object--auto-auto--px-0--ref.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--px-0.html b/layout/reftests/svg/sizing/object--auto-auto--px-0.html index 58bc444195c..9bdd4ed4a18 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--px-0.html +++ b/layout/reftests/svg/sizing/object--auto-auto--px-0.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--px-0.svg b/layout/reftests/svg/sizing/object--auto-auto--px-0.svg index 86ab1d7813d..9e0c2b1cf79 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--px-0.svg +++ b/layout/reftests/svg/sizing/object--auto-auto--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--px-pct--ref.html b/layout/reftests/svg/sizing/object--auto-auto--px-pct--ref.html index 3d9969f3e1b..7464351dd57 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--px-pct--ref.html +++ b/layout/reftests/svg/sizing/object--auto-auto--px-pct--ref.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--px-pct.html b/layout/reftests/svg/sizing/object--auto-auto--px-pct.html index 9cb932cd6f7..3d1591077e3 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--px-pct.html +++ b/layout/reftests/svg/sizing/object--auto-auto--px-pct.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--px-pct.svg b/layout/reftests/svg/sizing/object--auto-auto--px-pct.svg index 1820a328537..b409562ac3c 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--px-pct.svg +++ b/layout/reftests/svg/sizing/object--auto-auto--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--px-px--ref.html b/layout/reftests/svg/sizing/object--auto-auto--px-px--ref.html index d17f85d1e94..8f7b4ff7699 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--px-px--ref.html +++ b/layout/reftests/svg/sizing/object--auto-auto--px-px--ref.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--px-px.html b/layout/reftests/svg/sizing/object--auto-auto--px-px.html index 54f0c2e8e58..7cb3011b4a9 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--px-px.html +++ b/layout/reftests/svg/sizing/object--auto-auto--px-px.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--auto-auto--px-px.svg b/layout/reftests/svg/sizing/object--auto-auto--px-px.svg index 23fcd1b67ea..67218980760 100644 --- a/layout/reftests/svg/sizing/object--auto-auto--px-px.svg +++ b/layout/reftests/svg/sizing/object--auto-auto--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/object--pct-pct--0-0.html b/layout/reftests/svg/sizing/object--pct-pct--0-0.html index c2e094de61f..22b287df622 100644 --- a/layout/reftests/svg/sizing/object--pct-pct--0-0.html +++ b/layout/reftests/svg/sizing/object--pct-pct--0-0.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/pass-empty.svg b/layout/reftests/svg/sizing/pass-empty.svg index 153dd584091..67be674dc30 100644 --- a/layout/reftests/svg/sizing/pass-empty.svg +++ b/layout/reftests/svg/sizing/pass-empty.svg @@ -1,6 +1,6 @@ Reference SVG for comparisons diff --git a/layout/reftests/svg/sizing/pass-pct-height-square.xhtml b/layout/reftests/svg/sizing/pass-pct-height-square.xhtml index 3d8447875ef..ac6a60d1b4a 100644 --- a/layout/reftests/svg/sizing/pass-pct-height-square.xhtml +++ b/layout/reftests/svg/sizing/pass-pct-height-square.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/pass-pct-pct.xhtml b/layout/reftests/svg/sizing/pass-pct-pct.xhtml index 64d8a8fe1a7..e53d3e5fda6 100644 --- a/layout/reftests/svg/sizing/pass-pct-pct.xhtml +++ b/layout/reftests/svg/sizing/pass-pct-pct.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/pass-pct-px.xhtml b/layout/reftests/svg/sizing/pass-pct-px.xhtml index 4e27ec0908a..e1f5b4f7aee 100644 --- a/layout/reftests/svg/sizing/pass-pct-px.xhtml +++ b/layout/reftests/svg/sizing/pass-pct-px.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/pass-pct-width-square.xhtml b/layout/reftests/svg/sizing/pass-pct-width-square.xhtml index 727f416d835..e257bde4aaf 100644 --- a/layout/reftests/svg/sizing/pass-pct-width-square.xhtml +++ b/layout/reftests/svg/sizing/pass-pct-width-square.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/pass-px-pct.xhtml b/layout/reftests/svg/sizing/pass-px-pct.xhtml index a73737a65c5..73f92e2adc0 100644 --- a/layout/reftests/svg/sizing/pass-px-pct.xhtml +++ b/layout/reftests/svg/sizing/pass-px-pct.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/pass-px-px.xhtml b/layout/reftests/svg/sizing/pass-px-px.xhtml index f913cf9cd2b..5e2f598d539 100644 --- a/layout/reftests/svg/sizing/pass-px-px.xhtml +++ b/layout/reftests/svg/sizing/pass-px-px.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/pass.svg b/layout/reftests/svg/sizing/pass.svg index b113287a3e2..c09c6601e8c 100644 --- a/layout/reftests/svg/sizing/pass.svg +++ b/layout/reftests/svg/sizing/pass.svg @@ -1,6 +1,6 @@ Testcase reference file for generic pass condition diff --git a/layout/reftests/svg/sizing/standalone--0-0--0-0.svg b/layout/reftests/svg/sizing/standalone--0-0--0-0.svg index ff198abff90..06ee1b22b8e 100644 --- a/layout/reftests/svg/sizing/standalone--0-0--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--0-0--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-0--0-pct.svg b/layout/reftests/svg/sizing/standalone--0-0--0-pct.svg index 795eec4aaa1..e5a9a9f777c 100644 --- a/layout/reftests/svg/sizing/standalone--0-0--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--0-0--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-0--0-px.svg b/layout/reftests/svg/sizing/standalone--0-0--0-px.svg index 523593aac26..5fa9391ad62 100644 --- a/layout/reftests/svg/sizing/standalone--0-0--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--0-0--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-0--pct-0.svg b/layout/reftests/svg/sizing/standalone--0-0--pct-0.svg index fa909b3af55..a017d7d66a1 100644 --- a/layout/reftests/svg/sizing/standalone--0-0--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--0-0--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-0--pct-pct.svg b/layout/reftests/svg/sizing/standalone--0-0--pct-pct.svg index 8c2d511e59e..8f50583adfb 100644 --- a/layout/reftests/svg/sizing/standalone--0-0--pct-pct.svg +++ b/layout/reftests/svg/sizing/standalone--0-0--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-0--pct-px.svg b/layout/reftests/svg/sizing/standalone--0-0--pct-px.svg index 969da9fc33e..5ceba989bf6 100644 --- a/layout/reftests/svg/sizing/standalone--0-0--pct-px.svg +++ b/layout/reftests/svg/sizing/standalone--0-0--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-0--px-0.svg b/layout/reftests/svg/sizing/standalone--0-0--px-0.svg index ea07cd2075c..3bcf7670954 100644 --- a/layout/reftests/svg/sizing/standalone--0-0--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--0-0--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-0--px-pct.svg b/layout/reftests/svg/sizing/standalone--0-0--px-pct.svg index 0e3d7473758..c414d1301aa 100644 --- a/layout/reftests/svg/sizing/standalone--0-0--px-pct.svg +++ b/layout/reftests/svg/sizing/standalone--0-0--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-0--px-px.svg b/layout/reftests/svg/sizing/standalone--0-0--px-px.svg index cc4a470abc9..8bb0391948b 100644 --- a/layout/reftests/svg/sizing/standalone--0-0--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--0-0--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-auto--0-0.svg b/layout/reftests/svg/sizing/standalone--0-auto--0-0.svg index 4f930266d7b..a7f9833d75c 100644 --- a/layout/reftests/svg/sizing/standalone--0-auto--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--0-auto--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-auto--0-pct.svg b/layout/reftests/svg/sizing/standalone--0-auto--0-pct.svg index 8cbfb94445a..206b4111cf7 100644 --- a/layout/reftests/svg/sizing/standalone--0-auto--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--0-auto--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-auto--0-px.svg b/layout/reftests/svg/sizing/standalone--0-auto--0-px.svg index f43baf08a73..e130c8ffc1b 100644 --- a/layout/reftests/svg/sizing/standalone--0-auto--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--0-auto--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-auto--pct-0.svg b/layout/reftests/svg/sizing/standalone--0-auto--pct-0.svg index 32b5694bdea..25f4e4dd9e1 100644 --- a/layout/reftests/svg/sizing/standalone--0-auto--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--0-auto--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-auto--pct-pct.svg b/layout/reftests/svg/sizing/standalone--0-auto--pct-pct.svg index 043145a49da..c9bfd7ac3fe 100644 --- a/layout/reftests/svg/sizing/standalone--0-auto--pct-pct.svg +++ b/layout/reftests/svg/sizing/standalone--0-auto--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-auto--pct-px.svg b/layout/reftests/svg/sizing/standalone--0-auto--pct-px.svg index 1de34289976..c86f758553a 100644 --- a/layout/reftests/svg/sizing/standalone--0-auto--pct-px.svg +++ b/layout/reftests/svg/sizing/standalone--0-auto--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-auto--px-0.svg b/layout/reftests/svg/sizing/standalone--0-auto--px-0.svg index 6389f2d1e00..38fca0bd7f3 100644 --- a/layout/reftests/svg/sizing/standalone--0-auto--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--0-auto--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-auto--px-pct.svg b/layout/reftests/svg/sizing/standalone--0-auto--px-pct.svg index 5766480eb58..7fc50a5b6a5 100644 --- a/layout/reftests/svg/sizing/standalone--0-auto--px-pct.svg +++ b/layout/reftests/svg/sizing/standalone--0-auto--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-auto--px-px.svg b/layout/reftests/svg/sizing/standalone--0-auto--px-px.svg index f20bdda3152..a7d132473d9 100644 --- a/layout/reftests/svg/sizing/standalone--0-auto--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--0-auto--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-pct--0-0.svg b/layout/reftests/svg/sizing/standalone--0-pct--0-0.svg index 9346c7773f2..9938ee68929 100644 --- a/layout/reftests/svg/sizing/standalone--0-pct--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--0-pct--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-pct--0-pct.svg b/layout/reftests/svg/sizing/standalone--0-pct--0-pct.svg index d3f5bda6035..8917bf10fe5 100644 --- a/layout/reftests/svg/sizing/standalone--0-pct--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--0-pct--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-pct--0-px.svg b/layout/reftests/svg/sizing/standalone--0-pct--0-px.svg index 9a52dcbc6fe..5d1ccdc873a 100644 --- a/layout/reftests/svg/sizing/standalone--0-pct--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--0-pct--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-pct--pct-0.svg b/layout/reftests/svg/sizing/standalone--0-pct--pct-0.svg index 4ad56afdf3e..8df3fa2c795 100644 --- a/layout/reftests/svg/sizing/standalone--0-pct--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--0-pct--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-pct--pct-pct.svg b/layout/reftests/svg/sizing/standalone--0-pct--pct-pct.svg index 85e6bc74060..22c6a8f8177 100644 --- a/layout/reftests/svg/sizing/standalone--0-pct--pct-pct.svg +++ b/layout/reftests/svg/sizing/standalone--0-pct--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-pct--pct-px.svg b/layout/reftests/svg/sizing/standalone--0-pct--pct-px.svg index a4e0a161125..99e317c3109 100644 --- a/layout/reftests/svg/sizing/standalone--0-pct--pct-px.svg +++ b/layout/reftests/svg/sizing/standalone--0-pct--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-pct--px-0.svg b/layout/reftests/svg/sizing/standalone--0-pct--px-0.svg index ae470bf2835..98e1a838034 100644 --- a/layout/reftests/svg/sizing/standalone--0-pct--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--0-pct--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-pct--px-pct.svg b/layout/reftests/svg/sizing/standalone--0-pct--px-pct.svg index f74debbffab..cb06033245d 100644 --- a/layout/reftests/svg/sizing/standalone--0-pct--px-pct.svg +++ b/layout/reftests/svg/sizing/standalone--0-pct--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-pct--px-px.svg b/layout/reftests/svg/sizing/standalone--0-pct--px-px.svg index 80776ee2e22..80e9c1ac887 100644 --- a/layout/reftests/svg/sizing/standalone--0-pct--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--0-pct--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-px--0-0.svg b/layout/reftests/svg/sizing/standalone--0-px--0-0.svg index 6b4617ef0cc..6ee5a3b425d 100644 --- a/layout/reftests/svg/sizing/standalone--0-px--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--0-px--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-px--0-pct.svg b/layout/reftests/svg/sizing/standalone--0-px--0-pct.svg index 5f37ee2e159..9b62bac9dd6 100644 --- a/layout/reftests/svg/sizing/standalone--0-px--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--0-px--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-px--0-px.svg b/layout/reftests/svg/sizing/standalone--0-px--0-px.svg index 4ade5b345dd..a3241302908 100644 --- a/layout/reftests/svg/sizing/standalone--0-px--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--0-px--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-px--pct-0.svg b/layout/reftests/svg/sizing/standalone--0-px--pct-0.svg index 7969bed1ef2..c9179e12ed4 100644 --- a/layout/reftests/svg/sizing/standalone--0-px--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--0-px--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-px--pct-pct.svg b/layout/reftests/svg/sizing/standalone--0-px--pct-pct.svg index bc84023fbaf..c4d82009cbf 100644 --- a/layout/reftests/svg/sizing/standalone--0-px--pct-pct.svg +++ b/layout/reftests/svg/sizing/standalone--0-px--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-px--pct-px.svg b/layout/reftests/svg/sizing/standalone--0-px--pct-px.svg index c87660ae3a7..df2055df87c 100644 --- a/layout/reftests/svg/sizing/standalone--0-px--pct-px.svg +++ b/layout/reftests/svg/sizing/standalone--0-px--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-px--px-0.svg b/layout/reftests/svg/sizing/standalone--0-px--px-0.svg index db75acff557..920cf6ef270 100644 --- a/layout/reftests/svg/sizing/standalone--0-px--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--0-px--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-px--px-pct.svg b/layout/reftests/svg/sizing/standalone--0-px--px-pct.svg index 36f06d03133..bf9200e159f 100644 --- a/layout/reftests/svg/sizing/standalone--0-px--px-pct.svg +++ b/layout/reftests/svg/sizing/standalone--0-px--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--0-px--px-px.svg b/layout/reftests/svg/sizing/standalone--0-px--px-px.svg index 23d31c6cf0d..7a62c3f633a 100644 --- a/layout/reftests/svg/sizing/standalone--0-px--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--0-px--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-0--0-0.svg b/layout/reftests/svg/sizing/standalone--auto-0--0-0.svg index e22e43336a6..4dd222ddc16 100644 --- a/layout/reftests/svg/sizing/standalone--auto-0--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--auto-0--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-0--0-pct.svg b/layout/reftests/svg/sizing/standalone--auto-0--0-pct.svg index bdf8e278fa5..c564b9fd0d8 100644 --- a/layout/reftests/svg/sizing/standalone--auto-0--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--auto-0--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-0--0-px.svg b/layout/reftests/svg/sizing/standalone--auto-0--0-px.svg index bd3913db74e..44defae6b63 100644 --- a/layout/reftests/svg/sizing/standalone--auto-0--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--auto-0--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-0--pct-0.svg b/layout/reftests/svg/sizing/standalone--auto-0--pct-0.svg index 9620f677482..649b8224cc6 100644 --- a/layout/reftests/svg/sizing/standalone--auto-0--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--auto-0--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-0--pct-pct.svg b/layout/reftests/svg/sizing/standalone--auto-0--pct-pct.svg index 5592b98d020..8c9b139b7be 100644 --- a/layout/reftests/svg/sizing/standalone--auto-0--pct-pct.svg +++ b/layout/reftests/svg/sizing/standalone--auto-0--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-0--pct-px.svg b/layout/reftests/svg/sizing/standalone--auto-0--pct-px.svg index bb2bcbaf9a0..f62c14757df 100644 --- a/layout/reftests/svg/sizing/standalone--auto-0--pct-px.svg +++ b/layout/reftests/svg/sizing/standalone--auto-0--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-0--px-0.svg b/layout/reftests/svg/sizing/standalone--auto-0--px-0.svg index 0bf4073db4c..5e38222fca1 100644 --- a/layout/reftests/svg/sizing/standalone--auto-0--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--auto-0--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-0--px-pct.svg b/layout/reftests/svg/sizing/standalone--auto-0--px-pct.svg index cd0c9c5e359..cb77527312a 100644 --- a/layout/reftests/svg/sizing/standalone--auto-0--px-pct.svg +++ b/layout/reftests/svg/sizing/standalone--auto-0--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-0--px-px.svg b/layout/reftests/svg/sizing/standalone--auto-0--px-px.svg index a020bc8fc58..f4b0539ba9e 100644 --- a/layout/reftests/svg/sizing/standalone--auto-0--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--auto-0--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-auto--0-0.svg b/layout/reftests/svg/sizing/standalone--auto-auto--0-0.svg index 493d7d31349..4156c11b418 100644 --- a/layout/reftests/svg/sizing/standalone--auto-auto--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--auto-auto--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-auto--0-pct.svg b/layout/reftests/svg/sizing/standalone--auto-auto--0-pct.svg index b0001927e32..b72fafff851 100644 --- a/layout/reftests/svg/sizing/standalone--auto-auto--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--auto-auto--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-auto--0-px.svg b/layout/reftests/svg/sizing/standalone--auto-auto--0-px.svg index 53c9c3f7867..284d422bad9 100644 --- a/layout/reftests/svg/sizing/standalone--auto-auto--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--auto-auto--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-auto--pct-0.svg b/layout/reftests/svg/sizing/standalone--auto-auto--pct-0.svg index d217136b1ca..fb93cccc8a6 100644 --- a/layout/reftests/svg/sizing/standalone--auto-auto--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--auto-auto--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-auto--pct-pct.svg b/layout/reftests/svg/sizing/standalone--auto-auto--pct-pct.svg index 0fcdd06ce5f..4692dfc6fa5 100644 --- a/layout/reftests/svg/sizing/standalone--auto-auto--pct-pct.svg +++ b/layout/reftests/svg/sizing/standalone--auto-auto--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-auto--pct-px.svg b/layout/reftests/svg/sizing/standalone--auto-auto--pct-px.svg index 3cd42c1462d..be7d7736c59 100644 --- a/layout/reftests/svg/sizing/standalone--auto-auto--pct-px.svg +++ b/layout/reftests/svg/sizing/standalone--auto-auto--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-auto--px-0.svg b/layout/reftests/svg/sizing/standalone--auto-auto--px-0.svg index 938bee87240..1ee6488d680 100644 --- a/layout/reftests/svg/sizing/standalone--auto-auto--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--auto-auto--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-auto--px-pct.svg b/layout/reftests/svg/sizing/standalone--auto-auto--px-pct.svg index 53b70ac16aa..97efb10be55 100644 --- a/layout/reftests/svg/sizing/standalone--auto-auto--px-pct.svg +++ b/layout/reftests/svg/sizing/standalone--auto-auto--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-auto--px-px.svg b/layout/reftests/svg/sizing/standalone--auto-auto--px-px.svg index 4bc480ccb1e..20c2717b556 100644 --- a/layout/reftests/svg/sizing/standalone--auto-auto--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--auto-auto--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-pct--0-0.svg b/layout/reftests/svg/sizing/standalone--auto-pct--0-0.svg index c717b01eb62..8b76885e1c1 100644 --- a/layout/reftests/svg/sizing/standalone--auto-pct--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--auto-pct--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-pct--0-pct.svg b/layout/reftests/svg/sizing/standalone--auto-pct--0-pct.svg index c1789d00820..6409627b4c8 100644 --- a/layout/reftests/svg/sizing/standalone--auto-pct--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--auto-pct--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-pct--0-px.svg b/layout/reftests/svg/sizing/standalone--auto-pct--0-px.svg index 8a63f44125b..0e1edda2ede 100644 --- a/layout/reftests/svg/sizing/standalone--auto-pct--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--auto-pct--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-pct--pct-0.svg b/layout/reftests/svg/sizing/standalone--auto-pct--pct-0.svg index 0c6ea0f6bbf..85c961c788d 100644 --- a/layout/reftests/svg/sizing/standalone--auto-pct--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--auto-pct--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-pct--pct-pct--viewBox.svg b/layout/reftests/svg/sizing/standalone--auto-pct--pct-pct--viewBox.svg index 9454daceade..c7262a5ebd6 100644 --- a/layout/reftests/svg/sizing/standalone--auto-pct--pct-pct--viewBox.svg +++ b/layout/reftests/svg/sizing/standalone--auto-pct--pct-pct--viewBox.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-pct--pct-px--viewBox.svg b/layout/reftests/svg/sizing/standalone--auto-pct--pct-px--viewBox.svg index c54b4b551b2..caf4a17d91f 100644 --- a/layout/reftests/svg/sizing/standalone--auto-pct--pct-px--viewBox.svg +++ b/layout/reftests/svg/sizing/standalone--auto-pct--pct-px--viewBox.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-pct--px-0.svg b/layout/reftests/svg/sizing/standalone--auto-pct--px-0.svg index a54c5312e21..c2fd1e603b8 100644 --- a/layout/reftests/svg/sizing/standalone--auto-pct--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--auto-pct--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-pct--px-pct--viewBox.svg b/layout/reftests/svg/sizing/standalone--auto-pct--px-pct--viewBox.svg index ee6637ee952..f2a789684a7 100644 --- a/layout/reftests/svg/sizing/standalone--auto-pct--px-pct--viewBox.svg +++ b/layout/reftests/svg/sizing/standalone--auto-pct--px-pct--viewBox.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-pct--px-px.svg b/layout/reftests/svg/sizing/standalone--auto-pct--px-px.svg index 65e1340a6c2..ffe7fd570d9 100644 --- a/layout/reftests/svg/sizing/standalone--auto-pct--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--auto-pct--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-px--0-0.svg b/layout/reftests/svg/sizing/standalone--auto-px--0-0.svg index 67ae16462fd..df1800ec28e 100644 --- a/layout/reftests/svg/sizing/standalone--auto-px--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--auto-px--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-px--0-pct.svg b/layout/reftests/svg/sizing/standalone--auto-px--0-pct.svg index 4060c4d82ed..ffb2400a62c 100644 --- a/layout/reftests/svg/sizing/standalone--auto-px--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--auto-px--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-px--0-px.svg b/layout/reftests/svg/sizing/standalone--auto-px--0-px.svg index 7bdd8afdf79..72809a13050 100644 --- a/layout/reftests/svg/sizing/standalone--auto-px--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--auto-px--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-px--pct-0.svg b/layout/reftests/svg/sizing/standalone--auto-px--pct-0.svg index ad9d090075d..efdab07b21c 100644 --- a/layout/reftests/svg/sizing/standalone--auto-px--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--auto-px--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-px--pct-pct--viewBox.svg b/layout/reftests/svg/sizing/standalone--auto-px--pct-pct--viewBox.svg index e8750194e7e..f98e2b9d687 100644 --- a/layout/reftests/svg/sizing/standalone--auto-px--pct-pct--viewBox.svg +++ b/layout/reftests/svg/sizing/standalone--auto-px--pct-pct--viewBox.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-px--pct-px--viewBox.svg b/layout/reftests/svg/sizing/standalone--auto-px--pct-px--viewBox.svg index 3a75a8d6837..1327012dca8 100644 --- a/layout/reftests/svg/sizing/standalone--auto-px--pct-px--viewBox.svg +++ b/layout/reftests/svg/sizing/standalone--auto-px--pct-px--viewBox.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-px--px-0.svg b/layout/reftests/svg/sizing/standalone--auto-px--px-0.svg index eadaa719506..32c113b4299 100644 --- a/layout/reftests/svg/sizing/standalone--auto-px--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--auto-px--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-px--px-pct--viewBox.svg b/layout/reftests/svg/sizing/standalone--auto-px--px-pct--viewBox.svg index 8b028eec522..32151187a93 100644 --- a/layout/reftests/svg/sizing/standalone--auto-px--px-pct--viewBox.svg +++ b/layout/reftests/svg/sizing/standalone--auto-px--px-pct--viewBox.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--auto-px--px-px.svg b/layout/reftests/svg/sizing/standalone--auto-px--px-px.svg index c4a70c0f71a..f7cfc6f9e49 100644 --- a/layout/reftests/svg/sizing/standalone--auto-px--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--auto-px--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-0--0-0.svg b/layout/reftests/svg/sizing/standalone--pct-0--0-0.svg index 0e51f9b2919..788019e256a 100644 --- a/layout/reftests/svg/sizing/standalone--pct-0--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--pct-0--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-0--0-pct.svg b/layout/reftests/svg/sizing/standalone--pct-0--0-pct.svg index 70322c2ed59..b9734786bc0 100644 --- a/layout/reftests/svg/sizing/standalone--pct-0--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--pct-0--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-0--0-px.svg b/layout/reftests/svg/sizing/standalone--pct-0--0-px.svg index 3c011f6d8f9..f092b9a0383 100644 --- a/layout/reftests/svg/sizing/standalone--pct-0--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--pct-0--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-0--pct-0.svg b/layout/reftests/svg/sizing/standalone--pct-0--pct-0.svg index 84fdb11f8e8..bc29ce6a3ee 100644 --- a/layout/reftests/svg/sizing/standalone--pct-0--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--pct-0--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-0--pct-pct.svg b/layout/reftests/svg/sizing/standalone--pct-0--pct-pct.svg index 30fbb02588d..0cc62c50499 100644 --- a/layout/reftests/svg/sizing/standalone--pct-0--pct-pct.svg +++ b/layout/reftests/svg/sizing/standalone--pct-0--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-0--pct-px.svg b/layout/reftests/svg/sizing/standalone--pct-0--pct-px.svg index c9dc182a3cd..c65ed72dca9 100644 --- a/layout/reftests/svg/sizing/standalone--pct-0--pct-px.svg +++ b/layout/reftests/svg/sizing/standalone--pct-0--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-0--px-0.svg b/layout/reftests/svg/sizing/standalone--pct-0--px-0.svg index 1a3c349d670..2fb91a78d72 100644 --- a/layout/reftests/svg/sizing/standalone--pct-0--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--pct-0--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-0--px-pct.svg b/layout/reftests/svg/sizing/standalone--pct-0--px-pct.svg index 13549ff8690..32d8c31738d 100644 --- a/layout/reftests/svg/sizing/standalone--pct-0--px-pct.svg +++ b/layout/reftests/svg/sizing/standalone--pct-0--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-0--px-px.svg b/layout/reftests/svg/sizing/standalone--pct-0--px-px.svg index 66609015d90..99d685c106b 100644 --- a/layout/reftests/svg/sizing/standalone--pct-0--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--pct-0--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-auto--0-0.svg b/layout/reftests/svg/sizing/standalone--pct-auto--0-0.svg index 4e9ab46099a..1615ea6d37a 100644 --- a/layout/reftests/svg/sizing/standalone--pct-auto--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--pct-auto--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-auto--0-pct.svg b/layout/reftests/svg/sizing/standalone--pct-auto--0-pct.svg index 80809bba867..46b14f432c1 100644 --- a/layout/reftests/svg/sizing/standalone--pct-auto--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--pct-auto--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-auto--0-px.svg b/layout/reftests/svg/sizing/standalone--pct-auto--0-px.svg index ddca3d014f6..44e82d75ad2 100644 --- a/layout/reftests/svg/sizing/standalone--pct-auto--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--pct-auto--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-auto--pct-0.svg b/layout/reftests/svg/sizing/standalone--pct-auto--pct-0.svg index 9f7b2735e7d..bc9917af283 100644 --- a/layout/reftests/svg/sizing/standalone--pct-auto--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--pct-auto--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-auto--pct-pct--viewBox.svg b/layout/reftests/svg/sizing/standalone--pct-auto--pct-pct--viewBox.svg index 31767df2e40..f29e6fca75e 100644 --- a/layout/reftests/svg/sizing/standalone--pct-auto--pct-pct--viewBox.svg +++ b/layout/reftests/svg/sizing/standalone--pct-auto--pct-pct--viewBox.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-auto--pct-px--viewBox.svg b/layout/reftests/svg/sizing/standalone--pct-auto--pct-px--viewBox.svg index 6d247f578a4..6622bd6f753 100644 --- a/layout/reftests/svg/sizing/standalone--pct-auto--pct-px--viewBox.svg +++ b/layout/reftests/svg/sizing/standalone--pct-auto--pct-px--viewBox.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-auto--px-0.svg b/layout/reftests/svg/sizing/standalone--pct-auto--px-0.svg index a4040bedf6d..058d60b0cd3 100644 --- a/layout/reftests/svg/sizing/standalone--pct-auto--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--pct-auto--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-auto--px-pct--viewBox.svg b/layout/reftests/svg/sizing/standalone--pct-auto--px-pct--viewBox.svg index b6e8a75b87a..9e5d41bf8af 100644 --- a/layout/reftests/svg/sizing/standalone--pct-auto--px-pct--viewBox.svg +++ b/layout/reftests/svg/sizing/standalone--pct-auto--px-pct--viewBox.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-auto--px-px.svg b/layout/reftests/svg/sizing/standalone--pct-auto--px-px.svg index e061e38fe7f..ef19a9be114 100644 --- a/layout/reftests/svg/sizing/standalone--pct-auto--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--pct-auto--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-pct--0-0.svg b/layout/reftests/svg/sizing/standalone--pct-pct--0-0.svg index 35557beaa28..d13cb402eb9 100644 --- a/layout/reftests/svg/sizing/standalone--pct-pct--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--pct-pct--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-pct--0-pct.svg b/layout/reftests/svg/sizing/standalone--pct-pct--0-pct.svg index 4fb54339170..42f674f1c74 100644 --- a/layout/reftests/svg/sizing/standalone--pct-pct--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--pct-pct--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-pct--0-px.svg b/layout/reftests/svg/sizing/standalone--pct-pct--0-px.svg index 95c53da9b1b..31c2d0f9174 100644 --- a/layout/reftests/svg/sizing/standalone--pct-pct--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--pct-pct--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-pct--pct-0.svg b/layout/reftests/svg/sizing/standalone--pct-pct--pct-0.svg index ef628d25fe4..6ebadb5fed1 100644 --- a/layout/reftests/svg/sizing/standalone--pct-pct--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--pct-pct--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-pct--pct-pct.svg b/layout/reftests/svg/sizing/standalone--pct-pct--pct-pct.svg index 1abbb8b6063..85ff4a96bda 100644 --- a/layout/reftests/svg/sizing/standalone--pct-pct--pct-pct.svg +++ b/layout/reftests/svg/sizing/standalone--pct-pct--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-pct--pct-px.svg b/layout/reftests/svg/sizing/standalone--pct-pct--pct-px.svg index 369e3942508..7c5c13d7a8b 100644 --- a/layout/reftests/svg/sizing/standalone--pct-pct--pct-px.svg +++ b/layout/reftests/svg/sizing/standalone--pct-pct--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-pct--px-0.svg b/layout/reftests/svg/sizing/standalone--pct-pct--px-0.svg index eb3ce65170c..08b549457d3 100644 --- a/layout/reftests/svg/sizing/standalone--pct-pct--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--pct-pct--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-pct--px-pct.svg b/layout/reftests/svg/sizing/standalone--pct-pct--px-pct.svg index d930030a268..9c7cff9dac9 100644 --- a/layout/reftests/svg/sizing/standalone--pct-pct--px-pct.svg +++ b/layout/reftests/svg/sizing/standalone--pct-pct--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-pct--px-px.svg b/layout/reftests/svg/sizing/standalone--pct-pct--px-px.svg index 6d80b30095f..131719ec99f 100644 --- a/layout/reftests/svg/sizing/standalone--pct-pct--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--pct-pct--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-px--0-0.svg b/layout/reftests/svg/sizing/standalone--pct-px--0-0.svg index 6073d557ebe..7de487cc275 100644 --- a/layout/reftests/svg/sizing/standalone--pct-px--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--pct-px--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-px--0-pct.svg b/layout/reftests/svg/sizing/standalone--pct-px--0-pct.svg index 226d251c8c8..82e8c58ebe0 100644 --- a/layout/reftests/svg/sizing/standalone--pct-px--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--pct-px--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-px--0-px.svg b/layout/reftests/svg/sizing/standalone--pct-px--0-px.svg index b69507d0a0d..165613e31ae 100644 --- a/layout/reftests/svg/sizing/standalone--pct-px--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--pct-px--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-px--pct-0.svg b/layout/reftests/svg/sizing/standalone--pct-px--pct-0.svg index b067c279d04..e194b61893a 100644 --- a/layout/reftests/svg/sizing/standalone--pct-px--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--pct-px--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-px--pct-pct.svg b/layout/reftests/svg/sizing/standalone--pct-px--pct-pct.svg index 28e54a01d7d..47a36ddbd9c 100644 --- a/layout/reftests/svg/sizing/standalone--pct-px--pct-pct.svg +++ b/layout/reftests/svg/sizing/standalone--pct-px--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-px--pct-px.svg b/layout/reftests/svg/sizing/standalone--pct-px--pct-px.svg index c05e957560b..0c90cf5fbc1 100644 --- a/layout/reftests/svg/sizing/standalone--pct-px--pct-px.svg +++ b/layout/reftests/svg/sizing/standalone--pct-px--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-px--px-0.svg b/layout/reftests/svg/sizing/standalone--pct-px--px-0.svg index 4c46db4e26c..892cd41ed3b 100644 --- a/layout/reftests/svg/sizing/standalone--pct-px--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--pct-px--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-px--px-pct.svg b/layout/reftests/svg/sizing/standalone--pct-px--px-pct.svg index 419dd11e13f..bb95c9b6f03 100644 --- a/layout/reftests/svg/sizing/standalone--pct-px--px-pct.svg +++ b/layout/reftests/svg/sizing/standalone--pct-px--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--pct-px--px-px.svg b/layout/reftests/svg/sizing/standalone--pct-px--px-px.svg index 784a4859e09..c846ffda9cb 100644 --- a/layout/reftests/svg/sizing/standalone--pct-px--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--pct-px--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-0--0-0.svg b/layout/reftests/svg/sizing/standalone--px-0--0-0.svg index ad4dfab9f3a..16f26042ab9 100644 --- a/layout/reftests/svg/sizing/standalone--px-0--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--px-0--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-0--0-pct.svg b/layout/reftests/svg/sizing/standalone--px-0--0-pct.svg index 235e261688b..ba8566af7a9 100644 --- a/layout/reftests/svg/sizing/standalone--px-0--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--px-0--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-0--0-px.svg b/layout/reftests/svg/sizing/standalone--px-0--0-px.svg index 74ef0582c80..c227eb9887a 100644 --- a/layout/reftests/svg/sizing/standalone--px-0--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--px-0--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-0--pct-0.svg b/layout/reftests/svg/sizing/standalone--px-0--pct-0.svg index f16c6aa9c0a..af2e327bc59 100644 --- a/layout/reftests/svg/sizing/standalone--px-0--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--px-0--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-0--pct-pct.svg b/layout/reftests/svg/sizing/standalone--px-0--pct-pct.svg index 6cb6b4bac58..014341caa99 100644 --- a/layout/reftests/svg/sizing/standalone--px-0--pct-pct.svg +++ b/layout/reftests/svg/sizing/standalone--px-0--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-0--pct-px.svg b/layout/reftests/svg/sizing/standalone--px-0--pct-px.svg index a67169d466a..89d5a4725b7 100644 --- a/layout/reftests/svg/sizing/standalone--px-0--pct-px.svg +++ b/layout/reftests/svg/sizing/standalone--px-0--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-0--px-0.svg b/layout/reftests/svg/sizing/standalone--px-0--px-0.svg index 8debdb9a267..d9cded74b05 100644 --- a/layout/reftests/svg/sizing/standalone--px-0--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--px-0--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-0--px-pct.svg b/layout/reftests/svg/sizing/standalone--px-0--px-pct.svg index cc1f6823198..ae3f2e83a37 100644 --- a/layout/reftests/svg/sizing/standalone--px-0--px-pct.svg +++ b/layout/reftests/svg/sizing/standalone--px-0--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-0--px-px.svg b/layout/reftests/svg/sizing/standalone--px-0--px-px.svg index 3aeafefc715..9fd20fe474b 100644 --- a/layout/reftests/svg/sizing/standalone--px-0--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--px-0--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-auto--0-0.svg b/layout/reftests/svg/sizing/standalone--px-auto--0-0.svg index 522a9f22546..a5dceb2643d 100644 --- a/layout/reftests/svg/sizing/standalone--px-auto--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--px-auto--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-auto--0-pct.svg b/layout/reftests/svg/sizing/standalone--px-auto--0-pct.svg index 24e0ecea922..7fe4ee8275f 100644 --- a/layout/reftests/svg/sizing/standalone--px-auto--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--px-auto--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-auto--0-px.svg b/layout/reftests/svg/sizing/standalone--px-auto--0-px.svg index 601b6c9c115..06b4bd45ba0 100644 --- a/layout/reftests/svg/sizing/standalone--px-auto--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--px-auto--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-auto--pct-0.svg b/layout/reftests/svg/sizing/standalone--px-auto--pct-0.svg index 178977957f5..23db638fb40 100644 --- a/layout/reftests/svg/sizing/standalone--px-auto--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--px-auto--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-auto--pct-pct--viewBox.svg b/layout/reftests/svg/sizing/standalone--px-auto--pct-pct--viewBox.svg index ccca09cd59a..3551c67b8ab 100644 --- a/layout/reftests/svg/sizing/standalone--px-auto--pct-pct--viewBox.svg +++ b/layout/reftests/svg/sizing/standalone--px-auto--pct-pct--viewBox.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-auto--pct-px--viewBox.svg b/layout/reftests/svg/sizing/standalone--px-auto--pct-px--viewBox.svg index ba27763c2ca..d311a1681e4 100644 --- a/layout/reftests/svg/sizing/standalone--px-auto--pct-px--viewBox.svg +++ b/layout/reftests/svg/sizing/standalone--px-auto--pct-px--viewBox.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-auto--px-0.svg b/layout/reftests/svg/sizing/standalone--px-auto--px-0.svg index b1a20f9440d..8e62aff883c 100644 --- a/layout/reftests/svg/sizing/standalone--px-auto--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--px-auto--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-auto--px-pct--viewBox.svg b/layout/reftests/svg/sizing/standalone--px-auto--px-pct--viewBox.svg index 3cec891de0b..79d6e39e707 100644 --- a/layout/reftests/svg/sizing/standalone--px-auto--px-pct--viewBox.svg +++ b/layout/reftests/svg/sizing/standalone--px-auto--px-pct--viewBox.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-auto--px-px.svg b/layout/reftests/svg/sizing/standalone--px-auto--px-px.svg index 6f29dba5803..ce7872b4564 100644 --- a/layout/reftests/svg/sizing/standalone--px-auto--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--px-auto--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-pct--0-0.svg b/layout/reftests/svg/sizing/standalone--px-pct--0-0.svg index ddface5db9b..66c7159c528 100644 --- a/layout/reftests/svg/sizing/standalone--px-pct--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--px-pct--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-pct--0-pct.svg b/layout/reftests/svg/sizing/standalone--px-pct--0-pct.svg index 0ea70d051fc..43b2fe4f3af 100644 --- a/layout/reftests/svg/sizing/standalone--px-pct--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--px-pct--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-pct--0-px.svg b/layout/reftests/svg/sizing/standalone--px-pct--0-px.svg index 2d001336450..caa951ca20d 100644 --- a/layout/reftests/svg/sizing/standalone--px-pct--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--px-pct--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-pct--pct-0.svg b/layout/reftests/svg/sizing/standalone--px-pct--pct-0.svg index ee99f5e43b4..5dd6e8cf4fe 100644 --- a/layout/reftests/svg/sizing/standalone--px-pct--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--px-pct--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-pct--pct-pct.svg b/layout/reftests/svg/sizing/standalone--px-pct--pct-pct.svg index 33bb1e4ffbf..bca83300e1d 100644 --- a/layout/reftests/svg/sizing/standalone--px-pct--pct-pct.svg +++ b/layout/reftests/svg/sizing/standalone--px-pct--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-pct--pct-px.svg b/layout/reftests/svg/sizing/standalone--px-pct--pct-px.svg index 6a97266c575..7e5036407cd 100644 --- a/layout/reftests/svg/sizing/standalone--px-pct--pct-px.svg +++ b/layout/reftests/svg/sizing/standalone--px-pct--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-pct--px-0.svg b/layout/reftests/svg/sizing/standalone--px-pct--px-0.svg index 596b8a5fde2..b81a35d96db 100644 --- a/layout/reftests/svg/sizing/standalone--px-pct--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--px-pct--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-pct--px-pct.svg b/layout/reftests/svg/sizing/standalone--px-pct--px-pct.svg index 6f89c6db2bf..9a0cabbf11a 100644 --- a/layout/reftests/svg/sizing/standalone--px-pct--px-pct.svg +++ b/layout/reftests/svg/sizing/standalone--px-pct--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-pct--px-px.svg b/layout/reftests/svg/sizing/standalone--px-pct--px-px.svg index bc0d5dc994b..85f4bc946ac 100644 --- a/layout/reftests/svg/sizing/standalone--px-pct--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--px-pct--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-px--0-0.svg b/layout/reftests/svg/sizing/standalone--px-px--0-0.svg index 4353a90b960..5cd0d5cd2b8 100644 --- a/layout/reftests/svg/sizing/standalone--px-px--0-0.svg +++ b/layout/reftests/svg/sizing/standalone--px-px--0-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-px--0-pct.svg b/layout/reftests/svg/sizing/standalone--px-px--0-pct.svg index f85c469450a..f9c54e45af9 100644 --- a/layout/reftests/svg/sizing/standalone--px-px--0-pct.svg +++ b/layout/reftests/svg/sizing/standalone--px-px--0-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-px--0-px.svg b/layout/reftests/svg/sizing/standalone--px-px--0-px.svg index 354c130b047..1c802d12e2f 100644 --- a/layout/reftests/svg/sizing/standalone--px-px--0-px.svg +++ b/layout/reftests/svg/sizing/standalone--px-px--0-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-px--pct-0.svg b/layout/reftests/svg/sizing/standalone--px-px--pct-0.svg index 8a1f503700d..c311b88edd1 100644 --- a/layout/reftests/svg/sizing/standalone--px-px--pct-0.svg +++ b/layout/reftests/svg/sizing/standalone--px-px--pct-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-px--pct-pct.svg b/layout/reftests/svg/sizing/standalone--px-px--pct-pct.svg index adce3546fdc..3f89fe4e139 100644 --- a/layout/reftests/svg/sizing/standalone--px-px--pct-pct.svg +++ b/layout/reftests/svg/sizing/standalone--px-px--pct-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-px--pct-px.svg b/layout/reftests/svg/sizing/standalone--px-px--pct-px.svg index 61805f16e6f..567bff95384 100644 --- a/layout/reftests/svg/sizing/standalone--px-px--pct-px.svg +++ b/layout/reftests/svg/sizing/standalone--px-px--pct-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-px--px-0.svg b/layout/reftests/svg/sizing/standalone--px-px--px-0.svg index b28d7ad531b..d33e3539181 100644 --- a/layout/reftests/svg/sizing/standalone--px-px--px-0.svg +++ b/layout/reftests/svg/sizing/standalone--px-px--px-0.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-px--px-pct.svg b/layout/reftests/svg/sizing/standalone--px-px--px-pct.svg index 8695be033a5..94d3d6e9dec 100644 --- a/layout/reftests/svg/sizing/standalone--px-px--px-pct.svg +++ b/layout/reftests/svg/sizing/standalone--px-px--px-pct.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone--px-px--px-px.svg b/layout/reftests/svg/sizing/standalone--px-px--px-px.svg index d86b74dc8f7..fbd9142af8a 100644 --- a/layout/reftests/svg/sizing/standalone--px-px--px-px.svg +++ b/layout/reftests/svg/sizing/standalone--px-px--px-px.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/sizing/standalone-sanity-height-150px.svg b/layout/reftests/svg/sizing/standalone-sanity-height-150px.svg index 33b96b93efd..b460f4b8080 100644 --- a/layout/reftests/svg/sizing/standalone-sanity-height-150px.svg +++ b/layout/reftests/svg/sizing/standalone-sanity-height-150px.svg @@ -1,6 +1,6 @@ Sanity check percentage width diff --git a/layout/reftests/svg/sizing/standalone-sanity-height-pct.svg b/layout/reftests/svg/sizing/standalone-sanity-height-pct.svg index b95718bc1aa..113613fa36f 100644 --- a/layout/reftests/svg/sizing/standalone-sanity-height-pct.svg +++ b/layout/reftests/svg/sizing/standalone-sanity-height-pct.svg @@ -1,6 +1,6 @@ Sanity check percentage width diff --git a/layout/reftests/svg/sizing/standalone-sanity-height-px.svg b/layout/reftests/svg/sizing/standalone-sanity-height-px.svg index a2ec15d9250..01c72df5a8c 100644 --- a/layout/reftests/svg/sizing/standalone-sanity-height-px.svg +++ b/layout/reftests/svg/sizing/standalone-sanity-height-px.svg @@ -1,6 +1,6 @@ Sanity check percentage width diff --git a/layout/reftests/svg/sizing/standalone-sanity-width-300px.svg b/layout/reftests/svg/sizing/standalone-sanity-width-300px.svg index 6e0247642f5..318bf38af22 100644 --- a/layout/reftests/svg/sizing/standalone-sanity-width-300px.svg +++ b/layout/reftests/svg/sizing/standalone-sanity-width-300px.svg @@ -1,6 +1,6 @@ Sanity check percentage width diff --git a/layout/reftests/svg/sizing/standalone-sanity-width-pct.svg b/layout/reftests/svg/sizing/standalone-sanity-width-pct.svg index ae1973e0407..050cad09432 100644 --- a/layout/reftests/svg/sizing/standalone-sanity-width-pct.svg +++ b/layout/reftests/svg/sizing/standalone-sanity-width-pct.svg @@ -1,6 +1,6 @@ Sanity check percentage width diff --git a/layout/reftests/svg/sizing/standalone-sanity-width-px.svg b/layout/reftests/svg/sizing/standalone-sanity-width-px.svg index c65c3c093fe..2abcc29dd6e 100644 --- a/layout/reftests/svg/sizing/standalone-sanity-width-px.svg +++ b/layout/reftests/svg/sizing/standalone-sanity-width-px.svg @@ -1,6 +1,6 @@ Sanity check percentage width diff --git a/layout/reftests/svg/smil/anim-class-01.svg b/layout/reftests/svg/smil/anim-class-01.svg index 365ef1613c0..4fe4faab213 100644 --- a/layout/reftests/svg/smil/anim-class-01.svg +++ b/layout/reftests/svg/smil/anim-class-01.svg @@ -1,6 +1,6 @@ Reference for animation of the class attribute to an invalid value on "rect" elements diff --git a/layout/reftests/svg/smil/anim-class-04.svg b/layout/reftests/svg/smil/anim-class-04.svg index f99fb1a37ca..191b5d3b976 100644 --- a/layout/reftests/svg/smil/anim-class-04.svg +++ b/layout/reftests/svg/smil/anim-class-04.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/smil/anim-feDistantLight-01.svg b/layout/reftests/svg/smil/anim-feDistantLight-01.svg index 43194709176..42221cdb48b 100644 --- a/layout/reftests/svg/smil/anim-feDistantLight-01.svg +++ b/layout/reftests/svg/smil/anim-feDistantLight-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/smil/anim-feSpotLight-01.svg b/layout/reftests/svg/smil/anim-feSpotLight-01.svg index 39f5a7096e8..011a9ecff90 100644 --- a/layout/reftests/svg/smil/anim-feSpotLight-01.svg +++ b/layout/reftests/svg/smil/anim-feSpotLight-01.svg @@ -1,6 +1,6 @@ + + Test animation of the "width" & "height" <length> attributes on the "use" element + + + + + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/smil/lime.svg b/layout/reftests/svg/smil/lime.svg index b113287a3e2..c09c6601e8c 100644 --- a/layout/reftests/svg/smil/lime.svg +++ b/layout/reftests/svg/smil/lime.svg @@ -1,6 +1,6 @@ Testcase reference file for generic pass condition diff --git a/layout/reftests/svg/smil/motion/lime.svg b/layout/reftests/svg/smil/motion/lime.svg index b113287a3e2..c09c6601e8c 100644 --- a/layout/reftests/svg/smil/motion/lime.svg +++ b/layout/reftests/svg/smil/motion/lime.svg @@ -1,6 +1,6 @@ Testcase reference file for generic pass condition diff --git a/layout/reftests/svg/smil/reftest.list b/layout/reftests/svg/smil/reftest.list index 5242f892ce0..5ac49bdc4f7 100644 --- a/layout/reftests/svg/smil/reftest.list +++ b/layout/reftests/svg/smil/reftest.list @@ -88,6 +88,7 @@ fails == anim-fillcolor-1.svg anim-standard-ref.svg # bug 436296 == anim-filter-size-01.svg lime.svg == anim-length-reset-01.svg lime.svg == anim-nonpixel-length-reset-01.svg lime.svg +== anim-use-length-01.svg lime.svg # animate some attributes: == anim-feComponentTransfer-01.svg lime.svg diff --git a/layout/reftests/svg/smil/syncbase/cycle-self-ref-4.svg b/layout/reftests/svg/smil/syncbase/cycle-self-ref-4.svg new file mode 100644 index 00000000000..c53b3c5fa78 --- /dev/null +++ b/layout/reftests/svg/smil/syncbase/cycle-self-ref-4.svg @@ -0,0 +1,32 @@ + + + + + + + + + + diff --git a/layout/reftests/svg/smil/syncbase/cycle-self-ref-5.svg b/layout/reftests/svg/smil/syncbase/cycle-self-ref-5.svg new file mode 100644 index 00000000000..e0e36e152ac --- /dev/null +++ b/layout/reftests/svg/smil/syncbase/cycle-self-ref-5.svg @@ -0,0 +1,56 @@ + + + + + + + + + + diff --git a/layout/reftests/svg/smil/syncbase/reftest.list b/layout/reftests/svg/smil/syncbase/reftest.list index 0430c3b1423..52258e782fc 100644 --- a/layout/reftests/svg/smil/syncbase/reftest.list +++ b/layout/reftests/svg/smil/syncbase/reftest.list @@ -64,6 +64,8 @@ == cycle-self-ref-1.svg green-box-ref.svg == cycle-self-ref-2.svg green-box-ref.svg == cycle-self-ref-3.svg green-box-ref.svg +== cycle-self-ref-4.svg green-box-ref.svg +== cycle-self-ref-5.svg green-box-ref.svg == cycle-invalid-1.svg green-box-ref.svg == cycle-invalid-2.svg green-box-ref.svg == cycle-invalid-3.svg green-box-ref.svg diff --git a/layout/reftests/svg/smil/transform/lime.svg b/layout/reftests/svg/smil/transform/lime.svg index b113287a3e2..c09c6601e8c 100644 --- a/layout/reftests/svg/smil/transform/lime.svg +++ b/layout/reftests/svg/smil/transform/lime.svg @@ -1,6 +1,6 @@ Testcase reference file for generic pass condition diff --git a/layout/reftests/svg/stroke-linecap-square-w-zero-length-segs-01.svg b/layout/reftests/svg/stroke-linecap-square-w-zero-length-segs-01.svg index f7d93efc1b1..2a147fc82cb 100644 --- a/layout/reftests/svg/stroke-linecap-square-w-zero-length-segs-01.svg +++ b/layout/reftests/svg/stroke-linecap-square-w-zero-length-segs-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/stroke-linecap-square-w-zero-length-segs-02.svg b/layout/reftests/svg/stroke-linecap-square-w-zero-length-segs-02.svg index 1579dea5955..13c980abad7 100644 --- a/layout/reftests/svg/stroke-linecap-square-w-zero-length-segs-02.svg +++ b/layout/reftests/svg/stroke-linecap-square-w-zero-length-segs-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/stroke-width-percentage-01.svg b/layout/reftests/svg/stroke-width-percentage-01.svg index 789f311f310..e147ed2fa96 100644 --- a/layout/reftests/svg/stroke-width-percentage-01.svg +++ b/layout/reftests/svg/stroke-width-percentage-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/style-property-not-on-script-element-01.svg b/layout/reftests/svg/style-property-not-on-script-element-01.svg index 70bdf9fcb64..40ce4ebd569 100644 --- a/layout/reftests/svg/style-property-not-on-script-element-01.svg +++ b/layout/reftests/svg/style-property-not-on-script-element-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/style-without-type-attribute.svg b/layout/reftests/svg/style-without-type-attribute.svg index 59686b72dd7..7ea8787198f 100644 --- a/layout/reftests/svg/style-without-type-attribute.svg +++ b/layout/reftests/svg/style-without-type-attribute.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-in-foreignObject-01-ref.xhtml b/layout/reftests/svg/svg-in-foreignObject-01-ref.xhtml index aca517432ab..f701e5d0101 100644 --- a/layout/reftests/svg/svg-in-foreignObject-01-ref.xhtml +++ b/layout/reftests/svg/svg-in-foreignObject-01-ref.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-in-foreignObject-01.xhtml b/layout/reftests/svg/svg-in-foreignObject-01.xhtml index 504672937a0..0c5cc85cf15 100644 --- a/layout/reftests/svg/svg-in-foreignObject-01.xhtml +++ b/layout/reftests/svg/svg-in-foreignObject-01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-in-foreignObject-02.xhtml b/layout/reftests/svg/svg-in-foreignObject-02.xhtml index dfcdb095abc..c7d7bc8bcf6 100644 --- a/layout/reftests/svg/svg-in-foreignObject-02.xhtml +++ b/layout/reftests/svg/svg-in-foreignObject-02.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/clipPath-html-01-extref.xhtml b/layout/reftests/svg/svg-integration/clipPath-html-01-extref.xhtml index e8605ed172f..7751e5f1fb9 100644 --- a/layout/reftests/svg/svg-integration/clipPath-html-01-extref.xhtml +++ b/layout/reftests/svg/svg-integration/clipPath-html-01-extref.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/clipPath-html-01.xhtml b/layout/reftests/svg/svg-integration/clipPath-html-01.xhtml index 181f5729a17..d1f5135053c 100644 --- a/layout/reftests/svg/svg-integration/clipPath-html-01.xhtml +++ b/layout/reftests/svg/svg-integration/clipPath-html-01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/clipPath-html-02-extref.xhtml b/layout/reftests/svg/svg-integration/clipPath-html-02-extref.xhtml index 93e559d5322..433d5d471f5 100644 --- a/layout/reftests/svg/svg-integration/clipPath-html-02-extref.xhtml +++ b/layout/reftests/svg/svg-integration/clipPath-html-02-extref.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/clipPath-html-02.xhtml b/layout/reftests/svg/svg-integration/clipPath-html-02.xhtml index 1afffd4cb96..8429e71c7ad 100644 --- a/layout/reftests/svg/svg-integration/clipPath-html-02.xhtml +++ b/layout/reftests/svg/svg-integration/clipPath-html-02.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/clipPath-html-03.xhtml b/layout/reftests/svg/svg-integration/clipPath-html-03.xhtml index e170a200de4..80d313a70bb 100644 --- a/layout/reftests/svg/svg-integration/clipPath-html-03.xhtml +++ b/layout/reftests/svg/svg-integration/clipPath-html-03.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/clipPath-html-04-extref.xhtml b/layout/reftests/svg/svg-integration/clipPath-html-04-extref.xhtml index ee1ab0cf981..4f35f255bfb 100644 --- a/layout/reftests/svg/svg-integration/clipPath-html-04-extref.xhtml +++ b/layout/reftests/svg/svg-integration/clipPath-html-04-extref.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/conditions-outer-svg-01.xhtml b/layout/reftests/svg/svg-integration/conditions-outer-svg-01.xhtml index 49c727399b2..006361d881d 100644 --- a/layout/reftests/svg/svg-integration/conditions-outer-svg-01.xhtml +++ b/layout/reftests/svg/svg-integration/conditions-outer-svg-01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/conditions-outer-svg-02.xhtml b/layout/reftests/svg/svg-integration/conditions-outer-svg-02.xhtml index 662c3f9436e..e60477f1120 100644 --- a/layout/reftests/svg/svg-integration/conditions-outer-svg-02.xhtml +++ b/layout/reftests/svg/svg-integration/conditions-outer-svg-02.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/dynamic-conditions-outer-svg-02.xhtml b/layout/reftests/svg/svg-integration/dynamic-conditions-outer-svg-02.xhtml index 85e4b3175b2..a2087c5da56 100644 --- a/layout/reftests/svg/svg-integration/dynamic-conditions-outer-svg-02.xhtml +++ b/layout/reftests/svg/svg-integration/dynamic-conditions-outer-svg-02.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/dynamic-conditions-outer-svg-03.xhtml b/layout/reftests/svg/svg-integration/dynamic-conditions-outer-svg-03.xhtml index c3176e2af4d..809584d1728 100644 --- a/layout/reftests/svg/svg-integration/dynamic-conditions-outer-svg-03.xhtml +++ b/layout/reftests/svg/svg-integration/dynamic-conditions-outer-svg-03.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/dynamic-conditions-outer-svg-04.xhtml b/layout/reftests/svg/svg-integration/dynamic-conditions-outer-svg-04.xhtml index 2d8e108051f..f82f3d510a1 100644 --- a/layout/reftests/svg/svg-integration/dynamic-conditions-outer-svg-04.xhtml +++ b/layout/reftests/svg/svg-integration/dynamic-conditions-outer-svg-04.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/filter-html-01-extref.xhtml b/layout/reftests/svg/svg-integration/filter-html-01-extref.xhtml index 0d72b681543..cb6a72388ec 100644 --- a/layout/reftests/svg/svg-integration/filter-html-01-extref.xhtml +++ b/layout/reftests/svg/svg-integration/filter-html-01-extref.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/filter-html-01.xhtml b/layout/reftests/svg/svg-integration/filter-html-01.xhtml index 131be34d55e..8e048cb1ac4 100644 --- a/layout/reftests/svg/svg-integration/filter-html-01.xhtml +++ b/layout/reftests/svg/svg-integration/filter-html-01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/filter-html-zoomed-01.xhtml b/layout/reftests/svg/svg-integration/filter-html-zoomed-01.xhtml index 873416e5752..b84d4e9d74d 100644 --- a/layout/reftests/svg/svg-integration/filter-html-zoomed-01.xhtml +++ b/layout/reftests/svg/svg-integration/filter-html-zoomed-01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/mask-html-01-extref-01.xhtml b/layout/reftests/svg/svg-integration/mask-html-01-extref-01.xhtml index 6a6ec3c852b..fba9fc4b0b2 100644 --- a/layout/reftests/svg/svg-integration/mask-html-01-extref-01.xhtml +++ b/layout/reftests/svg/svg-integration/mask-html-01-extref-01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/mask-html-01.xhtml b/layout/reftests/svg/svg-integration/mask-html-01.xhtml index 464f307ce33..77c3b5c9c99 100644 --- a/layout/reftests/svg/svg-integration/mask-html-01.xhtml +++ b/layout/reftests/svg/svg-integration/mask-html-01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/mask-html-xbl-bound-01.html b/layout/reftests/svg/svg-integration/mask-html-xbl-bound-01.html index bb4e4160446..5a20fe50523 100644 --- a/layout/reftests/svg/svg-integration/mask-html-xbl-bound-01.html +++ b/layout/reftests/svg/svg-integration/mask-html-xbl-bound-01.html @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/mask-html-xbl-bound-01.xbl b/layout/reftests/svg/svg-integration/mask-html-xbl-bound-01.xbl index e6ec1bd7aa8..07005953869 100644 --- a/layout/reftests/svg/svg-integration/mask-html-xbl-bound-01.xbl +++ b/layout/reftests/svg/svg-integration/mask-html-xbl-bound-01.xbl @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/mask-html-zoomed-01.xhtml b/layout/reftests/svg/svg-integration/mask-html-zoomed-01.xhtml index fc5d613b437..bc89dfa7236 100644 --- a/layout/reftests/svg/svg-integration/mask-html-zoomed-01.xhtml +++ b/layout/reftests/svg/svg-integration/mask-html-zoomed-01.xhtml @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/svg-integration/reftest.list b/layout/reftests/svg/svg-integration/reftest.list index 86be0d6ee64..ca65ac1f445 100644 --- a/layout/reftests/svg/svg-integration/reftest.list +++ b/layout/reftests/svg/svg-integration/reftest.list @@ -23,5 +23,5 @@ == mask-html-01.xhtml mask-html-01-ref.svg == mask-html-01-extref-01.xhtml mask-html-01-ref.svg == mask-html-01-extref-02.xhtml mask-html-01-ref.svg -fails-if(Android) == mask-html-zoomed-01.xhtml mask-html-01-ref.svg +== mask-html-zoomed-01.xhtml mask-html-01-ref.svg == mask-html-xbl-bound-01.html mask-html-01-ref.svg diff --git a/layout/reftests/svg/switch-01.svg b/layout/reftests/svg/switch-01.svg index cf8b5d1d5d8..82f5add674e 100644 --- a/layout/reftests/svg/switch-01.svg +++ b/layout/reftests/svg/switch-01.svg @@ -1,7 +1,7 @@ Testcase for switch diff --git a/layout/reftests/svg/symbol-01-ref.svg b/layout/reftests/svg/symbol-01-ref.svg index 019f354160a..efddfe82736 100644 --- a/layout/reftests/svg/symbol-01-ref.svg +++ b/layout/reftests/svg/symbol-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/symbol-01.svg b/layout/reftests/svg/symbol-01.svg index d12992515af..cc56f7b4ceb 100644 --- a/layout/reftests/svg/symbol-01.svg +++ b/layout/reftests/svg/symbol-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-font-weight-01.svg b/layout/reftests/svg/text-font-weight-01.svg index f9ba6bb0475..ae784b8e5b3 100644 --- a/layout/reftests/svg/text-font-weight-01.svg +++ b/layout/reftests/svg/text-font-weight-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-gradient-01-ref.svg b/layout/reftests/svg/text-gradient-01-ref.svg index 628bf024ae3..7acd518487e 100644 --- a/layout/reftests/svg/text-gradient-01-ref.svg +++ b/layout/reftests/svg/text-gradient-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-gradient-01.svg b/layout/reftests/svg/text-gradient-01.svg index 2d088dcff13..9185d106c3a 100644 --- a/layout/reftests/svg/text-gradient-01.svg +++ b/layout/reftests/svg/text-gradient-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-gradient-02-ref.svg b/layout/reftests/svg/text-gradient-02-ref.svg index 38f78b520e8..e3d74773dc3 100644 --- a/layout/reftests/svg/text-gradient-02-ref.svg +++ b/layout/reftests/svg/text-gradient-02-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-gradient-02.svg b/layout/reftests/svg/text-gradient-02.svg index 70a71102a54..b418bec9909 100644 --- a/layout/reftests/svg/text-gradient-02.svg +++ b/layout/reftests/svg/text-gradient-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-gradient-03.svg b/layout/reftests/svg/text-gradient-03.svg index 3e915bf2a17..c1b1bbfb82f 100644 --- a/layout/reftests/svg/text-gradient-03.svg +++ b/layout/reftests/svg/text-gradient-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-in-link-01-ref.svg b/layout/reftests/svg/text-in-link-01-ref.svg index 7b959ee5100..67beb778acc 100644 --- a/layout/reftests/svg/text-in-link-01-ref.svg +++ b/layout/reftests/svg/text-in-link-01-ref.svg @@ -1,6 +1,6 @@ Reference to check that links with viewBoxes work diff --git a/layout/reftests/svg/text-in-link-02.svg b/layout/reftests/svg/text-in-link-02.svg index ac86614b0cf..4fa8d5f949d 100644 --- a/layout/reftests/svg/text-in-link-02.svg +++ b/layout/reftests/svg/text-in-link-02.svg @@ -1,6 +1,6 @@ Testcase to check that links with viewBoxes work diff --git a/layout/reftests/svg/text-in-link-03-ref.svg b/layout/reftests/svg/text-in-link-03-ref.svg index 6012674181c..c667992494d 100644 --- a/layout/reftests/svg/text-in-link-03-ref.svg +++ b/layout/reftests/svg/text-in-link-03-ref.svg @@ -1,6 +1,6 @@ Reference to check that CSS works for links diff --git a/layout/reftests/svg/text-in-link-03.svg b/layout/reftests/svg/text-in-link-03.svg index 4c56c7099ca..9db19b0176d 100644 --- a/layout/reftests/svg/text-in-link-03.svg +++ b/layout/reftests/svg/text-in-link-03.svg @@ -1,6 +1,6 @@ Testcase to check that CSS works for links diff --git a/layout/reftests/svg/text-layout-01-ref.svg b/layout/reftests/svg/text-layout-01-ref.svg index ba48c83dd32..43e4464a469 100644 --- a/layout/reftests/svg/text-layout-01-ref.svg +++ b/layout/reftests/svg/text-layout-01-ref.svg @@ -1,6 +1,6 @@ Reference to check that nodes without text don't affect whitespace handling diff --git a/layout/reftests/svg/text-layout-03.svg b/layout/reftests/svg/text-layout-03.svg index 27d491c27f0..934dab5772f 100644 --- a/layout/reftests/svg/text-layout-03.svg +++ b/layout/reftests/svg/text-layout-03.svg @@ -1,6 +1,6 @@ Testcase to check that nodes without text don't affect whitespace handling diff --git a/layout/reftests/svg/text-layout-04-ref.svg b/layout/reftests/svg/text-layout-04-ref.svg index f63d84521bc..638e0336b89 100644 --- a/layout/reftests/svg/text-layout-04-ref.svg +++ b/layout/reftests/svg/text-layout-04-ref.svg @@ -1,6 +1,6 @@ Reference to check whitespace handling diff --git a/layout/reftests/svg/text-layout-04.svg b/layout/reftests/svg/text-layout-04.svg index c91e0b44e5d..1c72cb4354e 100644 --- a/layout/reftests/svg/text-layout-04.svg +++ b/layout/reftests/svg/text-layout-04.svg @@ -1,6 +1,6 @@ Testcase to check whitespace handling diff --git a/layout/reftests/svg/text-scale-01-ref.svg b/layout/reftests/svg/text-scale-01-ref.svg index eb000792a54..bf481bfdfaf 100644 --- a/layout/reftests/svg/text-scale-01-ref.svg +++ b/layout/reftests/svg/text-scale-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-scale-01.svg b/layout/reftests/svg/text-scale-01.svg index 868795a760c..e109d915414 100644 --- a/layout/reftests/svg/text-scale-01.svg +++ b/layout/reftests/svg/text-scale-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-style-01-ref.svg b/layout/reftests/svg/text-style-01-ref.svg index 36480d7ad94..9e5b67263e1 100644 --- a/layout/reftests/svg/text-style-01-ref.svg +++ b/layout/reftests/svg/text-style-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-style-01a.svg b/layout/reftests/svg/text-style-01a.svg index 21adc757fcb..4e8fc8ea352 100644 --- a/layout/reftests/svg/text-style-01a.svg +++ b/layout/reftests/svg/text-style-01a.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-style-01b.svg b/layout/reftests/svg/text-style-01b.svg index 9e27aad6bdd..dd07f3a930c 100644 --- a/layout/reftests/svg/text-style-01b.svg +++ b/layout/reftests/svg/text-style-01b.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-style-01c.svg b/layout/reftests/svg/text-style-01c.svg index 7ffe75df6f1..aeff296fb38 100644 --- a/layout/reftests/svg/text-style-01c.svg +++ b/layout/reftests/svg/text-style-01c.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-style-01d.svg b/layout/reftests/svg/text-style-01d.svg index 9b58ae3b404..c32a70545ee 100644 --- a/layout/reftests/svg/text-style-01d.svg +++ b/layout/reftests/svg/text-style-01d.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/text-style-01e.svg b/layout/reftests/svg/text-style-01e.svg index 0f13cb3bec3..9f621bcdbe4 100644 --- a/layout/reftests/svg/text-style-01e.svg +++ b/layout/reftests/svg/text-style-01e.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/textPath-01-ref.svg b/layout/reftests/svg/textPath-01-ref.svg index 47a560719b6..711e0fe5aa7 100644 --- a/layout/reftests/svg/textPath-01-ref.svg +++ b/layout/reftests/svg/textPath-01-ref.svg @@ -1,6 +1,6 @@ Reference to check that percentage startOffset ignores pathLength diff --git a/layout/reftests/svg/textPath-01.svg b/layout/reftests/svg/textPath-01.svg index 13b002fdabc..6543044e675 100644 --- a/layout/reftests/svg/textPath-01.svg +++ b/layout/reftests/svg/textPath-01.svg @@ -1,6 +1,6 @@ Testcase to check that percentage startOffset ignores pathLength diff --git a/layout/reftests/svg/thin-stroke-01.svg b/layout/reftests/svg/thin-stroke-01.svg index 70c05f84abf..204bc90a6ee 100644 --- a/layout/reftests/svg/thin-stroke-01.svg +++ b/layout/reftests/svg/thin-stroke-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-dxdy-01.svg b/layout/reftests/svg/tspan-dxdy-01.svg index e82563596b9..1113ab95a8b 100644 --- a/layout/reftests/svg/tspan-dxdy-01.svg +++ b/layout/reftests/svg/tspan-dxdy-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-dxdy-02.svg b/layout/reftests/svg/tspan-dxdy-02.svg index 3a55870b195..8f605102883 100644 --- a/layout/reftests/svg/tspan-dxdy-02.svg +++ b/layout/reftests/svg/tspan-dxdy-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-dxdy-03.svg b/layout/reftests/svg/tspan-dxdy-03.svg index c0fe014d915..febe8623f15 100644 --- a/layout/reftests/svg/tspan-dxdy-03.svg +++ b/layout/reftests/svg/tspan-dxdy-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-dxdy-04.svg b/layout/reftests/svg/tspan-dxdy-04.svg index 413e7026f5d..f8a2e2ad250 100644 --- a/layout/reftests/svg/tspan-dxdy-04.svg +++ b/layout/reftests/svg/tspan-dxdy-04.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-dxdy-05.svg b/layout/reftests/svg/tspan-dxdy-05.svg index 4c6c8336438..205c71f62e7 100644 --- a/layout/reftests/svg/tspan-dxdy-05.svg +++ b/layout/reftests/svg/tspan-dxdy-05.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-dxdy-06.svg b/layout/reftests/svg/tspan-dxdy-06.svg index 660eaf7588c..57eb0c64815 100644 --- a/layout/reftests/svg/tspan-dxdy-06.svg +++ b/layout/reftests/svg/tspan-dxdy-06.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-dxdy-ref.svg b/layout/reftests/svg/tspan-dxdy-ref.svg index 89862d6ce83..543866c47b5 100644 --- a/layout/reftests/svg/tspan-dxdy-ref.svg +++ b/layout/reftests/svg/tspan-dxdy-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-dxdy-textPath-01-ref.svg b/layout/reftests/svg/tspan-dxdy-textPath-01-ref.svg index 7af34cb6b9c..940554855ad 100644 --- a/layout/reftests/svg/tspan-dxdy-textPath-01-ref.svg +++ b/layout/reftests/svg/tspan-dxdy-textPath-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-dxdy-textPath-01.svg b/layout/reftests/svg/tspan-dxdy-textPath-01.svg index 9d18d84caaf..40eb331c382 100644 --- a/layout/reftests/svg/tspan-dxdy-textPath-01.svg +++ b/layout/reftests/svg/tspan-dxdy-textPath-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-rotate-01.svg b/layout/reftests/svg/tspan-rotate-01.svg index 5bcc7ce9e55..8f13b298812 100644 --- a/layout/reftests/svg/tspan-rotate-01.svg +++ b/layout/reftests/svg/tspan-rotate-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-rotate-02.svg b/layout/reftests/svg/tspan-rotate-02.svg index a0777b06cf4..63b479f99e3 100644 --- a/layout/reftests/svg/tspan-rotate-02.svg +++ b/layout/reftests/svg/tspan-rotate-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-rotate-03.svg b/layout/reftests/svg/tspan-rotate-03.svg index a95a815142a..77edefece02 100644 --- a/layout/reftests/svg/tspan-rotate-03.svg +++ b/layout/reftests/svg/tspan-rotate-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-rotate-04.svg b/layout/reftests/svg/tspan-rotate-04.svg index c28bc0c8ad3..b817ab15479 100644 --- a/layout/reftests/svg/tspan-rotate-04.svg +++ b/layout/reftests/svg/tspan-rotate-04.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-rotate-05.svg b/layout/reftests/svg/tspan-rotate-05.svg index cdcef528edc..562b3f8c3ac 100644 --- a/layout/reftests/svg/tspan-rotate-05.svg +++ b/layout/reftests/svg/tspan-rotate-05.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-rotate-06.svg b/layout/reftests/svg/tspan-rotate-06.svg index 09805a95ef9..5bece763e84 100644 --- a/layout/reftests/svg/tspan-rotate-06.svg +++ b/layout/reftests/svg/tspan-rotate-06.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-rotate-ref.svg b/layout/reftests/svg/tspan-rotate-ref.svg index 2e5b0d29a89..1f2d213426a 100644 --- a/layout/reftests/svg/tspan-rotate-ref.svg +++ b/layout/reftests/svg/tspan-rotate-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-rotate-textPath-01-ref.svg b/layout/reftests/svg/tspan-rotate-textPath-01-ref.svg index ce3020f3112..02234fb470e 100644 --- a/layout/reftests/svg/tspan-rotate-textPath-01-ref.svg +++ b/layout/reftests/svg/tspan-rotate-textPath-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-rotate-textPath-01.svg b/layout/reftests/svg/tspan-rotate-textPath-01.svg index 1aecbad960d..0b4a63cab2c 100644 --- a/layout/reftests/svg/tspan-rotate-textPath-01.svg +++ b/layout/reftests/svg/tspan-rotate-textPath-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-xy-01.svg b/layout/reftests/svg/tspan-xy-01.svg index f36e385d3b2..1951b2746e0 100644 --- a/layout/reftests/svg/tspan-xy-01.svg +++ b/layout/reftests/svg/tspan-xy-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-xy-02.svg b/layout/reftests/svg/tspan-xy-02.svg index d65f5459450..41125214a40 100644 --- a/layout/reftests/svg/tspan-xy-02.svg +++ b/layout/reftests/svg/tspan-xy-02.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-xy-03.svg b/layout/reftests/svg/tspan-xy-03.svg index 3482577c950..07605288dd1 100644 --- a/layout/reftests/svg/tspan-xy-03.svg +++ b/layout/reftests/svg/tspan-xy-03.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-xy-04.svg b/layout/reftests/svg/tspan-xy-04.svg index 6e13c42bcd4..09d0b018dc8 100644 --- a/layout/reftests/svg/tspan-xy-04.svg +++ b/layout/reftests/svg/tspan-xy-04.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-xy-05.svg b/layout/reftests/svg/tspan-xy-05.svg index 164fe20521c..a4a065578c7 100644 --- a/layout/reftests/svg/tspan-xy-05.svg +++ b/layout/reftests/svg/tspan-xy-05.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-xy-06.svg b/layout/reftests/svg/tspan-xy-06.svg index ac1a7103762..cad1e47b017 100644 --- a/layout/reftests/svg/tspan-xy-06.svg +++ b/layout/reftests/svg/tspan-xy-06.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-xy-anchor-end-01.svg b/layout/reftests/svg/tspan-xy-anchor-end-01.svg index e5b5c8df8d4..0937f69829f 100644 --- a/layout/reftests/svg/tspan-xy-anchor-end-01.svg +++ b/layout/reftests/svg/tspan-xy-anchor-end-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-xy-anchor-end-ref.svg b/layout/reftests/svg/tspan-xy-anchor-end-ref.svg index 7883388579d..34f8c60e417 100644 --- a/layout/reftests/svg/tspan-xy-anchor-end-ref.svg +++ b/layout/reftests/svg/tspan-xy-anchor-end-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-xy-anchor-middle-01.svg b/layout/reftests/svg/tspan-xy-anchor-middle-01.svg index dfd480aad45..a692acd5969 100644 --- a/layout/reftests/svg/tspan-xy-anchor-middle-01.svg +++ b/layout/reftests/svg/tspan-xy-anchor-middle-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-xy-anchor-middle-ref.svg b/layout/reftests/svg/tspan-xy-anchor-middle-ref.svg index 7b88cee61c8..616787fc012 100644 --- a/layout/reftests/svg/tspan-xy-anchor-middle-ref.svg +++ b/layout/reftests/svg/tspan-xy-anchor-middle-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/tspan-xy-ref.svg b/layout/reftests/svg/tspan-xy-ref.svg index a9d0fd7eb55..28c2b040d82 100644 --- a/layout/reftests/svg/tspan-xy-ref.svg +++ b/layout/reftests/svg/tspan-xy-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/use-01-extref-resource.svg b/layout/reftests/svg/use-01-extref-resource.svg index 255a44052ef..b3484478d29 100644 --- a/layout/reftests/svg/use-01-extref-resource.svg +++ b/layout/reftests/svg/use-01-extref-resource.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/use-01-extref.svg b/layout/reftests/svg/use-01-extref.svg index b66ac5f8927..8a2c0a68a72 100644 --- a/layout/reftests/svg/use-01-extref.svg +++ b/layout/reftests/svg/use-01-extref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/use-01.svg b/layout/reftests/svg/use-01.svg new file mode 100644 index 00000000000..7daba86253a --- /dev/null +++ b/layout/reftests/svg/use-01.svg @@ -0,0 +1,21 @@ + + + Testing that 'use' with zero width/height is not displayed + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/use-children.svg b/layout/reftests/svg/use-children.svg index ec3533e5d4d..f0b04e3163c 100644 --- a/layout/reftests/svg/use-children.svg +++ b/layout/reftests/svg/use-children.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/userSpaceOnUse-and-pattern-01-ref.svg b/layout/reftests/svg/userSpaceOnUse-and-pattern-01-ref.svg index a77d415fe06..03315272d48 100644 --- a/layout/reftests/svg/userSpaceOnUse-and-pattern-01-ref.svg +++ b/layout/reftests/svg/userSpaceOnUse-and-pattern-01-ref.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/userSpaceOnUse-and-pattern-01.svg b/layout/reftests/svg/userSpaceOnUse-and-pattern-01.svg index 001430808f7..11638e0b1ea 100644 --- a/layout/reftests/svg/userSpaceOnUse-and-pattern-01.svg +++ b/layout/reftests/svg/userSpaceOnUse-and-pattern-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/viewBox-and-pattern-01.svg b/layout/reftests/svg/viewBox-and-pattern-01.svg index 278cdd0b3c1..065d77a3154 100644 --- a/layout/reftests/svg/viewBox-and-pattern-01.svg +++ b/layout/reftests/svg/viewBox-and-pattern-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/svg/viewport-percent-graphic-user-01.svg b/layout/reftests/svg/viewport-percent-graphic-user-01.svg index 465255514c6..808888b4596 100644 --- a/layout/reftests/svg/viewport-percent-graphic-user-01.svg +++ b/layout/reftests/svg/viewport-percent-graphic-user-01.svg @@ -1,6 +1,6 @@ diff --git a/layout/reftests/text-overflow/TestEllipsisFallback.woff b/layout/reftests/text-overflow/TestEllipsisFallback.woff new file mode 100644 index 00000000000..4de40fbbb22 Binary files /dev/null and b/layout/reftests/text-overflow/TestEllipsisFallback.woff differ diff --git a/layout/reftests/text-overflow/anonymous-block-ref.html b/layout/reftests/text-overflow/anonymous-block-ref.html new file mode 100644 index 00000000000..29c9c1678f8 --- /dev/null +++ b/layout/reftests/text-overflow/anonymous-block-ref.html @@ -0,0 +1,59 @@ + + + +text-overflow: anonymous block + + + + + +
Some oveanonymous
block
and
unin
+
Soanonymous
block
an
+
             
+
Some overly l   anonymous
block
and
uninformative sentence
+
Some overly longanonymous
block
a  
uninformative sentence
+ + + diff --git a/layout/reftests/text-overflow/anonymous-block.html b/layout/reftests/text-overflow/anonymous-block.html new file mode 100644 index 00000000000..1070d2121ee --- /dev/null +++ b/layout/reftests/text-overflow/anonymous-block.html @@ -0,0 +1,61 @@ + + + +text-overflow: anonymous block + + + + + +
Some overly longanonymous
block
and
uninformative sentence
+
Some overly longanonymous
block
and uninformative sentence
+
Some overly longanonymous
block
and
uninformative sentence
+
Some overly longanonymous
block
and
uninformative sentence
+ + + diff --git a/layout/reftests/text-overflow/bidi-simple-ref.html b/layout/reftests/text-overflow/bidi-simple-ref.html new file mode 100644 index 00000000000..3a28b6df0a6 --- /dev/null +++ b/layout/reftests/text-overflow/bidi-simple-ref.html @@ -0,0 +1,85 @@ + + + +text-overflow: simple mixed-bidi cases + + + + + + +
AxxxxB  HelloWorAxxxxHelloWorldAxxxxBHelloWorldAxxxxBHelloWorld
+ +
He  oWorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloWorld
+ +
He  oWorld
+ + + + + + + + + + +
AxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloW  ld
+ +
HelloWorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloW  ld
+ +
HelloW  ld
+ + + + + + + + + + + + + diff --git a/layout/reftests/text-overflow/bidi-simple-scrolled-ref.html b/layout/reftests/text-overflow/bidi-simple-scrolled-ref.html new file mode 100644 index 00000000000..65eff80bce3 --- /dev/null +++ b/layout/reftests/text-overflow/bidi-simple-scrolled-ref.html @@ -0,0 +1,106 @@ + + + +text-overflow: simple mixed-bidi cases + + + + + + + +
  xxB …             xxxxHelloWorldAxxxxBHelloWorldAxxxxBHelloWorld
+ +
     Wor       BHelloWorldAxxxxBHelloWorldAxxxxBHelloWorld
+ +
     Wor  
+ + +
AxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxB  llo     
+ +
HelloWorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxB  llo     
+ +
  llo     
+ + + + + + + + + + + + + + + + +


  lloW    HelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHelloWorld
+
+ + diff --git a/layout/reftests/text-overflow/bidi-simple-scrolled.html b/layout/reftests/text-overflow/bidi-simple-scrolled.html new file mode 100644 index 00000000000..5036958687c --- /dev/null +++ b/layout/reftests/text-overflow/bidi-simple-scrolled.html @@ -0,0 +1,98 @@ + + + +text-overflow: simple mixed-bidi cases, scrolled a bit from the start position + + + + + + + +
AxxxB HelloWorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloWorld
+ +
Hell WorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloWorld
+ +
Hell World
+ + + +
AxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHello orld
+ +
HelloWorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHello orld
+ +
Hello orld
+ + + + + + + + + + + + + + + + + + +


HelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHelloWorld
+
+ + diff --git a/layout/reftests/text-overflow/bidi-simple.html b/layout/reftests/text-overflow/bidi-simple.html new file mode 100644 index 00000000000..82dcdfb5cef --- /dev/null +++ b/layout/reftests/text-overflow/bidi-simple.html @@ -0,0 +1,81 @@ + + + +text-overflow: simple mixed-bidi cases + + + + + + +
AxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloWorld
+ +
HelloWorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloWorld
+ +
HelloWorld
+ + + + + + + + + + +
AxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloWorld
+ +
HelloWorldAxxxxBHelloWorldAxxxxBHelloWorldAxxxxBHelloWorld
+ +
HelloWorld
+ + + + + + + + + + + + + diff --git a/layout/reftests/text-overflow/block-padding-ref.html b/layout/reftests/text-overflow/block-padding-ref.html new file mode 100644 index 00000000000..d699ea61bc2 --- /dev/null +++ b/layout/reftests/text-overflow/block-padding-ref.html @@ -0,0 +1,83 @@ + + + + + +text-overflow: text-overflow block padding + + + + +
                   
+
| | | | | | | | | |…        
+ +
| | | | | | | | | |       
+ + +
                   
| | | | | | | | | |
+ +
| | | | | | | | | | | | | 
+ + +
                   
+
 | | | | | | | | | 
+ +
| | | | | | | | | | | | | 
+ + +
                   
| | | | | | | | | |
… 
+ +
| | | | | | | | | | | | | 
+ + diff --git a/layout/reftests/text-overflow/block-padding.html b/layout/reftests/text-overflow/block-padding.html new file mode 100644 index 00000000000..36839f0c3de --- /dev/null +++ b/layout/reftests/text-overflow/block-padding.html @@ -0,0 +1,71 @@ + + + + + +text-overflow: text-overflow block padding + + + + + +
| | | | | | | | | | | | | 
+
| | | | | | | | | | | | | 
+ + +
| | | | | | | | | | | | | 
+
| | | | | | | | | | | | | 
+ + +
| | | | | | | | | | | | | 
+
| | | | | | | | | | | | | 
+ + +
| | | | | | | | | | | | | 
+
| | | | | | | | | | | | | 
+ + diff --git a/layout/reftests/text-overflow/ellipsis-font-fallback-ref.html b/layout/reftests/text-overflow/ellipsis-font-fallback-ref.html new file mode 100644 index 00000000000..be43c36f09c --- /dev/null +++ b/layout/reftests/text-overflow/ellipsis-font-fallback-ref.html @@ -0,0 +1,149 @@ + + + + text-overflow: ellipsis fallback + + + +
+ + +
 ...X...     
+
     ...X... 
+
     ...X... 
+
 ...X...     
+ + +
XXXXX... 
+
 ...XXXXX
+
 ...XXXXX
+
XXXXX... 
+ + +
 X...
+
...
+
...
+
 X...
+ + +
...
+
...
+
...
+
...
+ + +
... 
+
 ...
+
 ...
+
... 
+ +
+ + + diff --git a/layout/reftests/text-overflow/ellipsis-font-fallback.html b/layout/reftests/text-overflow/ellipsis-font-fallback.html new file mode 100644 index 00000000000..4e4c32e4864 --- /dev/null +++ b/layout/reftests/text-overflow/ellipsis-font-fallback.html @@ -0,0 +1,150 @@ + + + + text-overflow: ellipsis fallback + + + +
+ + +
XXXXXXXXXXXX
+
XXXXXXXXXXXX
+
XXXXXXXXXXXX
+
XXXXXXXXXXXX
+ + +
XXXXXXXXXXXX
+
XXXXXXXXXXXX
+
XXXXXXXXXXXX
+
XXXXXXXXXXXX
+ + +
XXXXXX
+
XXXXXX
+
XXXXXX
+
XXXXXX
+ + +
XXXXXXXXXXXX
+
XXXXXXXXXXXX
+
XXXXXXXXXXXX
+
XXXXXXXXXXXX
+ + +
XXX
+
XXX
+
XXX
+
XXX
+ + +
+ + + diff --git a/layout/reftests/text-overflow/false-marker-overlap-ref.html b/layout/reftests/text-overflow/false-marker-overlap-ref.html new file mode 100644 index 00000000000..6421d5f5fcb --- /dev/null +++ b/layout/reftests/text-overflow/false-marker-overlap-ref.html @@ -0,0 +1,71 @@ + + + +text-overflow: form control elements + + + + +
 | | | | | | | | | | | | | | | | | | | | | |
+
| | | | | | | | | | | | | | | | | | | | | | |
+
 | | | | | | | | | | | | | | | | | | | | | |
+
| | | | | | | | | | | | | | | | | | | | | | |
+ + + diff --git a/layout/reftests/text-overflow/false-marker-overlap.html b/layout/reftests/text-overflow/false-marker-overlap.html new file mode 100644 index 00000000000..55ead4533cf --- /dev/null +++ b/layout/reftests/text-overflow/false-marker-overlap.html @@ -0,0 +1,72 @@ + + + +text-overflow: false marker overlap + + + + +
| | | | | | | | | | | | | | | | | | | | | | |
+
| | | | | | | | | | | | | | | | | | | | | | |
+
| | | | | | | | | | | | | | | | | | | | | | |
+
| | | | | | | | | | | | | | | | | | | | | | |
+ + + diff --git a/layout/reftests/text-overflow/marker-basic-ref.html b/layout/reftests/text-overflow/marker-basic-ref.html new file mode 100644 index 00000000000..42736eee178 --- /dev/null +++ b/layout/reftests/text-overflow/marker-basic-ref.html @@ -0,0 +1,305 @@ + + + + text-overflow: basic marker position tests + + + +
+ +
+
+
   ||||
+
   
+
+
+
+
+
   ||||
+
   
+
+
+
+
+
   ||||
+
   
+
+
+
+
+
   ||||
+
   
+
+
+ +
+
+
 
+
+
+
+
+
 
+
+
+
+
+
   
+
+
+
+
+
   
+
+
+ +
+
+
 
+
+
+
+
+
 
+
+
+
+
+
   
+
+
+
+
+
   
+
+
+ +
+
+
 
+
+
+
+
+
 
+
+
+
+
+
   
+
+
+
+
+
   
+
+
+ +
+
+
 
+
 
+
+
+
+
+
 
+
 
+
+
+
+
+
 
+
 
+
+
+
+
+
 
+
 
+
+
+ +
+
+
   
+
   
+
+
+
+
+
   
+
   
+
+
+
+
+
   
+
   
+
+
+
+
+
   
+
   
+
+
+ +
+
|
+
+ +
 
+ +
+
|
+
+ +
 
+ + +
+
+ +
    
+
    
+
    
+
    
+ + +
+ + diff --git a/layout/reftests/text-overflow/marker-basic.html b/layout/reftests/text-overflow/marker-basic.html new file mode 100644 index 00000000000..9f67d026085 --- /dev/null +++ b/layout/reftests/text-overflow/marker-basic.html @@ -0,0 +1,197 @@ + + + + text-overflow: basic marker position tests + + + +
+ + +
||||||||||
+
||||||||||
+
||||||||||
+
||||||||||
+ + +
x
+
x
+
x
+
x
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
|||
+
|||
+
|||
+
|||
+ + +
|
+
|
+ +
|
+
|
+ + +
|
+
|
+ + +
    |||
+
    |||
+
    |||
+
    |||
+ +
+ + + diff --git a/layout/reftests/text-overflow/marker-string-ref.html b/layout/reftests/text-overflow/marker-string-ref.html new file mode 100644 index 00000000000..ee30ee77729 --- /dev/null +++ b/layout/reftests/text-overflow/marker-string-ref.html @@ -0,0 +1,66 @@ + + + +text-overflow: text-overflow:<string> + + + + + +
 x
+
 x
+
Hello World
+
Hello World
+ +
Hel
+
Hel
+
XX
+
XX
+ + + diff --git a/layout/reftests/text-overflow/marker-string.html b/layout/reftests/text-overflow/marker-string.html new file mode 100644 index 00000000000..3cfee6e7fda --- /dev/null +++ b/layout/reftests/text-overflow/marker-string.html @@ -0,0 +1,73 @@ + + + +text-overflow: text-overflow:<string> + + + + + + +
xx
+
xx
+ +
xx
+
xx
+ + +
xx
+
xx
+ + +
+
+ + + + diff --git a/layout/reftests/text-overflow/quirks-decorations-ref.html b/layout/reftests/text-overflow/quirks-decorations-ref.html new file mode 100644 index 00000000000..a78658602d5 --- /dev/null +++ b/layout/reftests/text-overflow/quirks-decorations-ref.html @@ -0,0 +1,73 @@ + + +text-overflow: Quirks mode text-decorations + + + + +
0123 56789012
+
1 56789012345
+
 
+
 
+
 
+ + + + diff --git a/layout/reftests/text-overflow/quirks-decorations.html b/layout/reftests/text-overflow/quirks-decorations.html new file mode 100644 index 00000000000..945dfb63a9a --- /dev/null +++ b/layout/reftests/text-overflow/quirks-decorations.html @@ -0,0 +1,74 @@ + + +text-overflow: Quirks mode text-decorations + + + + +
0123 567890123456789x
+
x0321 56789012345
+
xxxxx
+
xx
+
xx
+ + + + diff --git a/layout/reftests/text-overflow/quirks-line-height-ref.html b/layout/reftests/text-overflow/quirks-line-height-ref.html new file mode 100644 index 00000000000..e05dc88d533 --- /dev/null +++ b/layout/reftests/text-overflow/quirks-line-height-ref.html @@ -0,0 +1,57 @@ + + +text-overflow: Quirks mode line height + + + + +
0123456|
+
0123456|
+ + + + diff --git a/layout/reftests/text-overflow/quirks-line-height.html b/layout/reftests/text-overflow/quirks-line-height.html new file mode 100644 index 00000000000..fe9b1747a9e --- /dev/null +++ b/layout/reftests/text-overflow/quirks-line-height.html @@ -0,0 +1,56 @@ + + +text-overflow: Quirks mode line height + + + + +
0123456|890123456789
+
0123456|89012345
+ + + + diff --git a/layout/reftests/text-overflow/reftest.list b/layout/reftests/text-overflow/reftest.list new file mode 100644 index 00000000000..092c2fc144e --- /dev/null +++ b/layout/reftests/text-overflow/reftest.list @@ -0,0 +1,14 @@ +== ellipsis-font-fallback.html ellipsis-font-fallback-ref.html +HTTP(..) == marker-basic.html marker-basic-ref.html +HTTP(..) == marker-string.html marker-string-ref.html +skip-if(Android) HTTP(..) == bidi-simple.html bidi-simple-ref.html # Fails on Android due to anti-aliasing +skip-if(!gtk2Widget) HTTP(..) == bidi-simple-scrolled.html bidi-simple-scrolled-ref.html # Fails on Windows and OSX due to anti-aliasing +HTTP(..) == scroll-rounding.html scroll-rounding-ref.html +HTTP(..) == anonymous-block.html anonymous-block-ref.html +HTTP(..) == false-marker-overlap.html false-marker-overlap-ref.html +HTTP(..) == visibility-hidden.html visibility-hidden-ref.html +HTTP(..) == block-padding.html block-padding-ref.html +HTTP(..) == quirks-decorations.html quirks-decorations-ref.html +HTTP(..) == quirks-line-height.html quirks-line-height-ref.html +HTTP(..) == standards-decorations.html standards-decorations-ref.html +HTTP(..) == standards-line-height.html standards-line-height-ref.html diff --git a/layout/reftests/text-overflow/scroll-rounding-ref.html b/layout/reftests/text-overflow/scroll-rounding-ref.html new file mode 100644 index 00000000000..f2b1cf4cfb1 --- /dev/null +++ b/layout/reftests/text-overflow/scroll-rounding-ref.html @@ -0,0 +1,92 @@ + + + +text-overflow: scroll rounding + + + + + + + + + + + + + + + + + +
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+ + diff --git a/layout/reftests/text-overflow/scroll-rounding.html b/layout/reftests/text-overflow/scroll-rounding.html new file mode 100644 index 00000000000..882231f5e18 --- /dev/null +++ b/layout/reftests/text-overflow/scroll-rounding.html @@ -0,0 +1,93 @@ + + + +text-overflow: scroll rounding + + + + + + + + + + + + + + + + + +
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+
HelloKittyוסוכנויות
+ + diff --git a/layout/reftests/text-overflow/standards-decorations-ref.html b/layout/reftests/text-overflow/standards-decorations-ref.html new file mode 100644 index 00000000000..02757b63067 --- /dev/null +++ b/layout/reftests/text-overflow/standards-decorations-ref.html @@ -0,0 +1,72 @@ + + + +text-overflow: Standards mode text-decorations + + + + +
0123 56789012
+
1 56789012345
+
 
+
 
+
 
+ + + + diff --git a/layout/reftests/text-overflow/standards-decorations.html b/layout/reftests/text-overflow/standards-decorations.html new file mode 100644 index 00000000000..04c2b84d093 --- /dev/null +++ b/layout/reftests/text-overflow/standards-decorations.html @@ -0,0 +1,73 @@ + + + +text-overflow: Standards mode text-decorations + + + + +
0123 567890123456789
+
0321 56789012345
+
xxxx
+
x
+
x
+ + + + diff --git a/layout/reftests/text-overflow/standards-line-height-ref.html b/layout/reftests/text-overflow/standards-line-height-ref.html new file mode 100644 index 00000000000..ffab81e8217 --- /dev/null +++ b/layout/reftests/text-overflow/standards-line-height-ref.html @@ -0,0 +1,58 @@ + + + +text-overflow: Standards mode line height + + + + +
0123456|
+
0123456|
+ + + + diff --git a/layout/reftests/text-overflow/standards-line-height.html b/layout/reftests/text-overflow/standards-line-height.html new file mode 100644 index 00000000000..aa8b655dd81 --- /dev/null +++ b/layout/reftests/text-overflow/standards-line-height.html @@ -0,0 +1,57 @@ + + + +text-overflow: Standards mode line height + + + + +
0123456|890123456789
+
0123456|89012345
+ + + + diff --git a/layout/reftests/text-overflow/visibility-hidden-ref.html b/layout/reftests/text-overflow/visibility-hidden-ref.html new file mode 100644 index 00000000000..ba05d4f6dd9 --- /dev/null +++ b/layout/reftests/text-overflow/visibility-hidden-ref.html @@ -0,0 +1,72 @@ + + + +text-overflow: visibility:hidden + + + + +
+CSS is awesome
+CSS is awesome x  +
+
CSS is awesome
+
CSS is awesome x 
+
CSS is awesome x
+
CSS is awesome 
+ +
+
+CSS is awesome
+CSS is awesome x +
+
CSS is awesome
+
CSS is awesome x 
+
CSS is awesome x
+
CSS is awesome 
+
+ + diff --git a/layout/reftests/text-overflow/visibility-hidden.html b/layout/reftests/text-overflow/visibility-hidden.html new file mode 100644 index 00000000000..18b917616e5 --- /dev/null +++ b/layout/reftests/text-overflow/visibility-hidden.html @@ -0,0 +1,74 @@ + + + +text-overflow: visibility:hidden + + + + +
+CSS is awesome
+CSS is awesome x    +
+
CSS is awesome
+
CSS is awesome x   
+
CSS is awesome x
+
CSS is awesome x
+ +
+
+CSS is awesome
+CSS is awesome x +
+
CSS is awesome
+
CSS is awesome x   
+
CSS is awesome x
+
CSS is awesome x
+
+ + diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index 54cb317c8e4..291db23e307 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -708,7 +708,6 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const } break; } -#ifdef MOZ_CSS_ANIMATIONS case eCSSProperty_animation: { const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_animation); @@ -759,7 +758,6 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const } break; } -#endif case eCSSProperty_marker: { const nsCSSValue &endValue = *data->ValueFor(eCSSProperty_marker_end); diff --git a/layout/style/Makefile.in b/layout/style/Makefile.in index 330fe21321e..7f3f6f08c50 100644 --- a/layout/style/Makefile.in +++ b/layout/style/Makefile.in @@ -113,6 +113,7 @@ CPPSRCS = \ Declaration.cpp \ nsCSSKeywords.cpp \ Loader.cpp \ + nsAnimationManager.cpp \ nsCSSParser.cpp \ nsCSSProps.cpp \ nsCSSPseudoClasses.cpp \ @@ -149,12 +150,6 @@ CPPSRCS = \ StyleRule.cpp \ $(NULL) -ifdef MOZ_CSS_ANIMATIONS -CPPSRCS += \ - nsAnimationManager.cpp \ - $(NULL) -endif - FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk diff --git a/layout/style/Rule.h b/layout/style/Rule.h index 55ffc118139..6add21ad9c3 100644 --- a/layout/style/Rule.h +++ b/layout/style/Rule.h @@ -98,10 +98,8 @@ public: MEDIA_RULE, FONT_FACE_RULE, PAGE_RULE, -#ifdef MOZ_CSS_ANIMATIONS KEYFRAME_RULE, KEYFRAMES_RULE, -#endif DOCUMENT_RULE }; diff --git a/layout/style/crashtests/665209-1.html b/layout/style/crashtests/665209-1.html new file mode 100644 index 00000000000..30e8055ebb6 --- /dev/null +++ b/layout/style/crashtests/665209-1.html @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/layout/style/crashtests/crashtests.list b/layout/style/crashtests/crashtests.list index f02b5681d09..bae023528f9 100644 --- a/layout/style/crashtests/crashtests.list +++ b/layout/style/crashtests/crashtests.list @@ -68,3 +68,4 @@ load 605689-1.html load 645142.html load 611922-1.html == 645951-1.html 645951-1-ref.html +load 665209-1.html diff --git a/layout/style/forms.css b/layout/style/forms.css index 3c9741831e4..b6f498b0fd7 100644 --- a/layout/style/forms.css +++ b/layout/style/forms.css @@ -19,6 +19,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Mats Palmgren * * 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"), @@ -45,6 +46,7 @@ *|*::-moz-fieldset-content { display: block; unicode-bidi: inherit; + text-overflow: inherit; height: 100%; /* Need this so percentage heights of kids work right */ } @@ -624,6 +626,7 @@ input > .anonymous-div, *|*::-moz-display-comboboxcontrol-frame, optgroup:before { unicode-bidi: inherit; + text-overflow: inherit; } /* diff --git a/layout/style/nsCSSDataBlock.cpp b/layout/style/nsCSSDataBlock.cpp index f276c3ffef3..9d5c4e3880f 100644 --- a/layout/style/nsCSSDataBlock.cpp +++ b/layout/style/nsCSSDataBlock.cpp @@ -299,8 +299,8 @@ nsCSSCompressedDataBlock::~nsCSSCompressedDataBlock() const char* cursor = Block(); const char* cursor_end = BlockEnd(); while (cursor < cursor_end) { - nsCSSProperty iProp = PropertyAtCursor(cursor); - NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(iProp), "out of range"); + NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(PropertyAtCursor(cursor)), + "out of range"); const nsCSSValue* val = ValueAtCursor(cursor); NS_ABORT_IF_FALSE(val->GetUnit() != eCSSUnit_Null, "oops"); @@ -390,7 +390,9 @@ nsCSSExpandedDataBlock::ComputeSize() for (size_t iLow = 0; iLow < nsCSSPropertySet::kBitsInChunk; ++iLow) { if (!mPropertiesSet.HasPropertyAt(iHigh, iLow)) continue; +#ifdef DEBUG nsCSSProperty iProp = nsCSSPropertySet::CSSPropertyAt(iHigh, iLow); +#endif NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(iProp), "out of range"); NS_ABORT_IF_FALSE(PropertyAt(iProp)->GetUnit() != eCSSUnit_Null, "null value while computing size"); diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 57eafaa7c45..1a53a146b1e 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -20,6 +20,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Mats Palmgren * * 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"), @@ -221,6 +222,7 @@ CSS_KEY(center, center) CSS_KEY(ch, ch) CSS_KEY(circle, circle) CSS_KEY(cjk-ideographic, cjk_ideographic) +CSS_KEY(clip, clip) CSS_KEY(close-quote, close_quote) CSS_KEY(closest-corner, closest_corner) CSS_KEY(closest-side, closest_side) @@ -257,6 +259,7 @@ CSS_KEY(ease-out, ease_out) CSS_KEY(element, element) CSS_KEY(elements, elements) CSS_KEY(ellipse, ellipse) +CSS_KEY(ellipsis, ellipsis) CSS_KEY(em, em) CSS_KEY(embed, embed) CSS_KEY(enabled, enabled) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 862edef0f4f..79d6d2dfdbe 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -251,7 +251,6 @@ public: PRUint32 aLineNumber, // for error reporting nsCSSSelectorList **aSelectorList); -#ifdef MOZ_CSS_ANIMATIONS already_AddRefed ParseKeyframeRule(const nsSubstring& aBuffer, nsIURI* aURL, @@ -261,7 +260,6 @@ public: nsIURI* aURL, // for error reporting PRUint32 aLineNumber, // for error reporting nsTArray& aSelectorList); -#endif protected: class nsAutoParseCompoundProperty; @@ -361,11 +359,9 @@ protected: nsCSSValue& aValue); PRBool ParsePageRule(RuleAppendFunc aAppendFunc, void* aProcessData); -#ifdef MOZ_CSS_ANIMATIONS PRBool ParseKeyframesRule(RuleAppendFunc aAppendFunc, void* aProcessData); already_AddRefed ParseKeyframeRule(); PRBool ParseKeyframeSelectorList(nsTArray& aSelectorList); -#endif enum nsSelectorParsingStatus { // we have parsed a selector and we saw a token that cannot be @@ -536,9 +532,7 @@ protected: nsCSSValue* aValues, size_t aNumProperties); PRBool ParseTransition(); -#ifdef MOZ_CSS_ANIMATIONS PRBool ParseAnimation(); -#endif PRBool ParsePaint(nsCSSProperty aPropID); PRBool ParseDasharray(); @@ -1285,7 +1279,6 @@ CSSParserImpl::ParseSelectorString(const nsSubstring& aSelectorString, } -#ifdef MOZ_CSS_ANIMATIONS already_AddRefed CSSParserImpl::ParseKeyframeRule(const nsSubstring& aBuffer, nsIURI* aURI, @@ -1334,7 +1327,6 @@ CSSParserImpl::ParseKeyframeSelectorString(const nsSubstring& aSelectorString, return success; } -#endif //---------------------------------------------------------------------- @@ -1566,11 +1558,9 @@ CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc, parseFunc = &CSSParserImpl::ParsePageRule; newSection = eCSSSection_General; -#ifdef MOZ_CSS_ANIMATIONS } else if (mToken.mIdent.LowerCaseEqualsLiteral("-moz-keyframes")) { parseFunc = &CSSParserImpl::ParseKeyframesRule; newSection = eCSSSection_General; -#endif } else { if (!NonMozillaVendorIdentifier(mToken.mIdent)) { @@ -2302,7 +2292,6 @@ CSSParserImpl::ParsePageRule(RuleAppendFunc aAppendFunc, void* aData) return PR_FALSE; } -#ifdef MOZ_CSS_ANIMATIONS PRBool CSSParserImpl::ParseKeyframesRule(RuleAppendFunc aAppendFunc, void* aData) { @@ -2397,7 +2386,6 @@ CSSParserImpl::ParseKeyframeSelectorList(nsTArray& aSelectorList) } } } -#endif void CSSParserImpl::SkipUntil(PRUnichar aStopSymbol) @@ -5557,10 +5545,8 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSProperty aPropID) return ParseMozTransformOrigin(); case eCSSProperty_transition: return ParseTransition(); -#ifdef MOZ_CSS_ANIMATIONS case eCSSProperty_animation: return ParseAnimation(); -#endif case eCSSProperty_transition_property: return ParseTransitionProperty(); case eCSSProperty_fill: @@ -8363,7 +8349,6 @@ CSSParserImpl::ParseTransition() return PR_TRUE; } -#ifdef MOZ_CSS_ANIMATIONS PRBool CSSParserImpl::ParseAnimation() { @@ -8414,7 +8399,6 @@ CSSParserImpl::ParseAnimation() } return PR_TRUE; } -#endif PRBool CSSParserImpl::ParseShadowItem(nsCSSValue& aValue, PRBool aIsBoxShadow) @@ -8806,7 +8790,6 @@ nsCSSParser::ParseSelectorString(const nsSubstring& aSelectorString, ParseSelectorString(aSelectorString, aURI, aLineNumber, aSelectorList); } -#ifdef MOZ_CSS_ANIMATIONS already_AddRefed nsCSSParser::ParseKeyframeRule(const nsSubstring& aBuffer, nsIURI* aURI, @@ -8826,4 +8809,3 @@ nsCSSParser::ParseKeyframeSelectorString(const nsSubstring& aSelectorString, ParseKeyframeSelectorString(aSelectorString, aURI, aLineNumber, aSelectorList); } -#endif diff --git a/layout/style/nsCSSParser.h b/layout/style/nsCSSParser.h index 77151caf385..56f11eb6bf9 100644 --- a/layout/style/nsCSSParser.h +++ b/layout/style/nsCSSParser.h @@ -51,9 +51,7 @@ class nsIPrincipal; class nsIURI; struct nsCSSSelectorList; class nsMediaList; -#ifdef MOZ_CSS_ANIMATIONS class nsCSSKeyframeRule; -#endif namespace mozilla { namespace css { @@ -190,7 +188,6 @@ public: PRUint32 aLineNumber, nsCSSSelectorList** aSelectorList); -#ifdef MOZ_CSS_ANIMATIONS /* * Parse a keyframe rule (which goes inside an @keyframes rule). * Return it if the parse was successful. @@ -208,7 +205,6 @@ public: nsIURI* aURL, PRUint32 aLineNumber, nsTArray& aSelectorList); -#endif protected: // This is a CSSParserImpl*, but if we expose that type name in this diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 07c087b81ea..dc0f7cb387b 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -21,7 +21,7 @@ * * Contributor(s): * L. David Baron , Mozilla Corporation - * Mats Palmgren + * Mats Palmgren * * 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"), @@ -368,7 +368,6 @@ CSS_PROP_FONT( CSS_PROP_NO_OFFSET, eStyleAnimType_None) #endif -#ifdef MOZ_CSS_ANIMATIONS CSS_PROP_SHORTHAND( -moz-animation, animation, @@ -459,7 +458,6 @@ CSS_PROP_DISPLAY( kTransitionTimingFunctionKTable, CSS_PROP_NO_OFFSET, eStyleAnimType_None) -#endif CSS_PROP_SHORTHAND( background, background, @@ -2209,6 +2207,15 @@ CSS_PROP_TEXT( nsnull, offsetof(nsStyleText, mTextIndent), eStyleAnimType_Coord) +CSS_PROP_TEXTRESET( + text-overflow, + text_overflow, + TextOverflow, + CSS_PROPERTY_PARSE_VALUE, + VARIANT_HK | VARIANT_STRING, + kTextOverflowKTable, + offsetof(nsStyleTextReset, mTextOverflow), + eStyleAnimType_None) CSS_PROP_TEXT( text-shadow, text_shadow, diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index daebe2759d7..633def4d7c9 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -20,7 +20,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Mats Palmgren + * Mats Palmgren * Jonathon Jongsma , Collabora Ltd. * * Alternatively, the contents of this file may be used under the terms of @@ -445,7 +445,6 @@ nsCSSProps::OtherNameFor(nsCSSProperty aProperty) /***************************************************************************/ -#ifdef MOZ_CSS_ANIMATIONS const PRInt32 nsCSSProps::kAnimationDirectionKTable[] = { eCSSKeyword_normal, NS_STYLE_ANIMATION_DIRECTION_NORMAL, eCSSKeyword_alternate, NS_STYLE_ANIMATION_DIRECTION_ALTERNATE, @@ -470,7 +469,6 @@ const PRInt32 nsCSSProps::kAnimationPlayStateKTable[] = { eCSSKeyword_paused, NS_STYLE_ANIMATION_PLAY_STATE_PAUSED, eCSSKeyword_UNKNOWN,-1 }; -#endif const PRInt32 nsCSSProps::kAppearanceKTable[] = { eCSSKeyword_none, NS_THEME_NONE, @@ -1216,6 +1214,12 @@ const PRInt32 nsCSSProps::kTextDecorationStyleKTable[] = { eCSSKeyword_UNKNOWN,-1 }; +const PRInt32 nsCSSProps::kTextOverflowKTable[] = { + eCSSKeyword_clip, NS_STYLE_TEXT_OVERFLOW_CLIP, + eCSSKeyword_ellipsis, NS_STYLE_TEXT_OVERFLOW_ELLIPSIS, + eCSSKeyword_UNKNOWN, -1 +}; + const PRInt32 nsCSSProps::kTextTransformKTable[] = { eCSSKeyword_none, NS_STYLE_TEXT_TRANSFORM_NONE, eCSSKeyword_capitalize, NS_STYLE_TEXT_TRANSFORM_CAPITALIZE, @@ -1577,7 +1581,6 @@ const PRUint32 nsCSSProps::kFlagsTable[eCSSProperty_COUNT] = { #undef CSS_PROP_SHORTHAND }; -#ifdef MOZ_CSS_ANIMATIONS static const nsCSSProperty gAnimationSubpropTable[] = { eCSSProperty_animation_duration, eCSSProperty_animation_timing_function, @@ -1591,7 +1594,6 @@ static const nsCSSProperty gAnimationSubpropTable[] = { eCSSProperty_animation_name, eCSSProperty_UNKNOWN }; -#endif static const nsCSSProperty gBorderRadiusSubpropTable[] = { // Code relies on these being in topleft-topright-bottomright-bottomleft diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 9e67f26ae52..504f81ecc60 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -20,7 +20,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Mats Palmgren + * Mats Palmgren * Jonathon Jongsma , Collabora Ltd. * * Alternatively, the contents of this file may be used under the terms of @@ -326,13 +326,11 @@ public: *iter_ != eCSSProperty_UNKNOWN; ++iter_) // Keyword/Enum value tables -#ifdef MOZ_CSS_ANIMATIONS static const PRInt32 kAnimationDirectionKTable[]; static const PRInt32 kAnimationFillModeKTable[]; static const PRInt32 kAnimationIterationCountKTable[]; static const PRInt32 kAnimationPlayStateKTable[]; static const PRInt32 kAnimationTimingFunctionKTable[]; -#endif static const PRInt32 kAppearanceKTable[]; static const PRInt32 kAzimuthKTable[]; static const PRInt32 kBackgroundAttachmentKTable[]; @@ -409,6 +407,7 @@ public: static const PRInt32 kTextBlinkKTable[]; static const PRInt32 kTextDecorationLineKTable[]; static const PRInt32 kTextDecorationStyleKTable[]; + static const PRInt32 kTextOverflowKTable[]; static const PRInt32 kTextTransformKTable[]; static const PRInt32 kTransitionTimingFunctionKTable[]; static const PRInt32 kUnicodeBidiKTable[]; diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 54f93d69f6d..679b24ca3af 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -844,9 +844,7 @@ struct RuleCascadeData { #endif nsTArray mFontFaceRules; -#ifdef MOZ_CSS_ANIMATIONS nsTArray mKeyframesRules; -#endif // Looks up or creates the appropriate list in |mAttributeSelectors|. // Returns null only on allocation failure. @@ -2473,7 +2471,6 @@ nsCSSRuleProcessor::AppendFontFaceRules( return PR_TRUE; } -#ifdef MOZ_CSS_ANIMATIONS // Append all the currently-active keyframes rules to aArray. Return // true for success and false for failure. PRBool @@ -2490,7 +2487,6 @@ nsCSSRuleProcessor::AppendKeyframesRules( return PR_TRUE; } -#endif nsresult nsCSSRuleProcessor::ClearRuleCascades() @@ -2768,17 +2764,13 @@ static PLDHashTableOps gRulesByWeightOps = { struct CascadeEnumData { CascadeEnumData(nsPresContext* aPresContext, nsTArray& aFontFaceRules, -#ifdef MOZ_CSS_ANIMATIONS nsTArray& aKeyframesRules, -#endif nsMediaQueryResultCacheKey& aKey, PLArenaPool& aArena, PRUint8 aSheetType) : mPresContext(aPresContext), mFontFaceRules(aFontFaceRules), -#ifdef MOZ_CSS_ANIMATIONS mKeyframesRules(aKeyframesRules), -#endif mCacheKey(aKey), mArena(aArena), mSheetType(aSheetType) @@ -2796,9 +2788,7 @@ struct CascadeEnumData { nsPresContext* mPresContext; nsTArray& mFontFaceRules; -#ifdef MOZ_CSS_ANIMATIONS nsTArray& mKeyframesRules; -#endif nsMediaQueryResultCacheKey& mCacheKey; PLArenaPool& mArena; // Hooray, a manual PLDHashTable since nsClassHashtable doesn't @@ -2854,7 +2844,6 @@ CascadeRuleEnumFunc(css::Rule* aRule, void* aData) ptr->mRule = fontFaceRule; ptr->mSheetType = data->mSheetType; } -#ifdef MOZ_CSS_ANIMATIONS else if (css::Rule::KEYFRAMES_RULE == type) { nsCSSKeyframesRule *keyframesRule = static_cast(aRule); @@ -2862,7 +2851,6 @@ CascadeRuleEnumFunc(css::Rule* aRule, void* aData) return PR_FALSE; } } -#endif return PR_TRUE; } @@ -2963,9 +2951,7 @@ nsCSSRuleProcessor::RefreshRuleCascade(nsPresContext* aPresContext) eCompatibility_NavQuirks == aPresContext->CompatibilityMode())); if (newCascade) { CascadeEnumData data(aPresContext, newCascade->mFontFaceRules, -#ifdef MOZ_CSS_ANIMATIONS newCascade->mKeyframesRules, -#endif newCascade->mCacheKey, newCascade->mRuleHash.Arena(), mSheetType); diff --git a/layout/style/nsCSSRuleProcessor.h b/layout/style/nsCSSRuleProcessor.h index f006f8288ee..4ad1583eca8 100644 --- a/layout/style/nsCSSRuleProcessor.h +++ b/layout/style/nsCSSRuleProcessor.h @@ -56,9 +56,7 @@ struct RuleCascadeData; struct nsCSSSelectorList; struct CascadeEnumData; struct TreeMatchContext; -#ifdef MOZ_CSS_ANIMATIONS class nsCSSKeyframesRule; -#endif /** * The CSS style rule processor provides a mechanism for sibling style @@ -143,10 +141,8 @@ public: PRBool AppendFontFaceRules(nsPresContext* aPresContext, nsTArray& aArray); -#ifdef MOZ_CSS_ANIMATIONS PRBool AppendKeyframesRules(nsPresContext* aPresContext, nsTArray& aArray); -#endif #ifdef DEBUG void AssertQuirksChangeOK() { diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index fcbc8eced03..4b50cdd6f4c 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -1664,7 +1664,6 @@ nsCSSFontFaceRule::GetDesc(nsCSSFontDesc aDescID, nsCSSValue & aValue) aValue = mDecl.*nsCSSFontFaceStyleDecl::Fields[aDescID]; } -#ifdef MOZ_CSS_ANIMATIONS // ------------------------------------------- // nsCSSKeyframeStyleDeclaration // @@ -2087,4 +2086,3 @@ nsCSSKeyframesRule::UseForPresentation(nsPresContext* aPresContext, return PR_FALSE; } -#endif diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h index e90c19d1d82..8adac2f0b33 100644 --- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -47,10 +47,8 @@ #include "nsIDOMCSSMediaRule.h" #include "nsIDOMCSSMozDocumentRule.h" #include "nsIDOMCSSFontFaceRule.h" -#ifdef MOZ_CSS_ANIMATIONS #include "nsIDOMMozCSSKeyframeRule.h" #include "nsIDOMMozCSSKeyframesRule.h" -#endif #include "nsIDOMCSSStyleDeclaration.h" #include "nsICSSRuleList.h" #include "nsAutoPtr.h" @@ -313,7 +311,6 @@ private: } // namespace css } // namespace mozilla -#ifdef MOZ_CSS_ANIMATIONS class nsCSSKeyframeRule; class NS_FINAL_CLASS nsCSSKeyframeStyleDeclaration @@ -436,6 +433,5 @@ private: nsString mName; }; -#endif #endif /* !defined(nsCSSRules_h_) */ diff --git a/layout/style/nsCSSStyleSheet.cpp b/layout/style/nsCSSStyleSheet.cpp index c7091bd0c3f..54e35d9c6ca 100644 --- a/layout/style/nsCSSStyleSheet.cpp +++ b/layout/style/nsCSSStyleSheet.cpp @@ -1576,14 +1576,15 @@ nsCSSStyleSheet::SubjectSubsumesInnerPrincipal() const nsContentUtils::GetSecurityManager(); nsCOMPtr subjectPrincipal; - securityManager->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal)); + nsresult rv = securityManager->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal)); + NS_ENSURE_SUCCESS(rv, rv); if (!subjectPrincipal) { return NS_ERROR_DOM_SECURITY_ERR; } PRBool subsumes; - nsresult rv = subjectPrincipal->Subsumes(mInner->mPrincipal, &subsumes); + rv = subjectPrincipal->Subsumes(mInner->mPrincipal, &subsumes); NS_ENSURE_SUCCESS(rv, rv); if (subsumes) { diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 47f70ba385a..95f73a49b12 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -23,7 +23,7 @@ * Daniel Glazman * Boris Zbarsky * Christopher A. Aillon - * Mats Palmgren + * Mats Palmgren * Christian Biesinger * Michael Ventnor * Jonathon Jongsma , Collabora Ltd. @@ -2384,6 +2384,24 @@ nsComputedDOMStyle::DoGetTextIndent() return val; } +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTextOverflow() +{ + nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); + const nsStyleTextReset *style = GetStyleTextReset(); + + if (style->mTextOverflow.mType == NS_STYLE_TEXT_OVERFLOW_STRING) { + nsString str; + nsStyleUtil::AppendEscapedCSSString(style->mTextOverflow.mString, str); + val->SetString(str); + } else { + val->SetIdent( + nsCSSProps::ValueToKeywordEnum(style->mTextOverflow.mType, + nsCSSProps::kTextOverflowKTable)); + } + return val; +} + nsIDOMCSSValue* nsComputedDOMStyle::DoGetTextShadow() { @@ -4001,7 +4019,6 @@ nsComputedDOMStyle::DoGetTransitionTimingFunction() return valueList; } -#ifdef MOZ_CSS_ANIMATIONS nsIDOMCSSValue* nsComputedDOMStyle::DoGetAnimationName() { @@ -4188,7 +4205,6 @@ nsComputedDOMStyle::DoGetAnimationPlayState() return valueList; } -#endif #define COMPUTED_STYLE_MAP_ENTRY(_prop, _method) \ { eCSSProperty_##_prop, &nsComputedDOMStyle::DoGet##_method, PR_FALSE } @@ -4316,6 +4332,7 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength) COMPUTED_STYLE_MAP_ENTRY(text_align, TextAlign), COMPUTED_STYLE_MAP_ENTRY(text_decoration, TextDecoration), COMPUTED_STYLE_MAP_ENTRY_LAYOUT(text_indent, TextIndent), + COMPUTED_STYLE_MAP_ENTRY(text_overflow, TextOverflow), COMPUTED_STYLE_MAP_ENTRY(text_shadow, TextShadow), COMPUTED_STYLE_MAP_ENTRY(text_transform, TextTransform), COMPUTED_STYLE_MAP_ENTRY_LAYOUT(top, Top), @@ -4333,7 +4350,6 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength) * Implementations of -moz- styles * \* ******************************* */ -#ifdef MOZ_CSS_ANIMATIONS COMPUTED_STYLE_MAP_ENTRY(animation_delay, AnimationDelay), COMPUTED_STYLE_MAP_ENTRY(animation_direction, AnimationDirection), COMPUTED_STYLE_MAP_ENTRY(animation_duration, AnimationDuration), @@ -4342,7 +4358,6 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength) COMPUTED_STYLE_MAP_ENTRY(animation_name, AnimationName), COMPUTED_STYLE_MAP_ENTRY(animation_play_state, AnimationPlayState), COMPUTED_STYLE_MAP_ENTRY(animation_timing_function, AnimationTimingFunction), -#endif COMPUTED_STYLE_MAP_ENTRY(appearance, Appearance), COMPUTED_STYLE_MAP_ENTRY(_moz_background_inline_policy, BackgroundInlinePolicy), COMPUTED_STYLE_MAP_ENTRY(binding, Binding), diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index e9415dd0f12..46354f556cb 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -313,6 +313,7 @@ private: nsIDOMCSSValue* DoGetMozTextDecorationLine(); nsIDOMCSSValue* DoGetMozTextDecorationStyle(); nsIDOMCSSValue* DoGetTextIndent(); + nsIDOMCSSValue* DoGetTextOverflow(); nsIDOMCSSValue* DoGetTextTransform(); nsIDOMCSSValue* DoGetTextShadow(); nsIDOMCSSValue* DoGetLetterSpacing(); @@ -371,7 +372,6 @@ private: nsIDOMCSSValue* DoGetTransitionDelay(); nsIDOMCSSValue* DoGetTransitionTimingFunction(); -#ifdef MOZ_CSS_ANIMATIONS /* CSS Animations */ nsIDOMCSSValue* DoGetAnimationName(); nsIDOMCSSValue* DoGetAnimationDuration(); @@ -381,7 +381,6 @@ private: nsIDOMCSSValue* DoGetAnimationFillMode(); nsIDOMCSSValue* DoGetAnimationIterationCount(); nsIDOMCSSValue* DoGetAnimationPlayState(); -#endif /* SVG properties */ nsIDOMCSSValue* DoGetFill(); diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index ba99a43c260..d81adca1ec5 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -23,7 +23,7 @@ * Original Author: David W. Hyatt (hyatt@netscape.com) * Daniel Glazman * Roger B. Sidje - * Mats Palmgren + * Mats Palmgren * L. David Baron * Christian Biesinger * Michael Ventnor @@ -79,6 +79,7 @@ #include "mozilla/dom/Element.h" #include "CSSCalc.h" #include "nsPrintfCString.h" +#include "mozilla/Util.h" #if defined(_MSC_VER) || defined(__MINGW32__) #include @@ -702,8 +703,8 @@ SetPairCoords(const nsCSSValue& aValue, PRBool cX = SetCoord(valX, aCoordX, aParentX, aMask, aStyleContext, aPresContext, aCanStoreInRuleTree); - PRBool cY = SetCoord(valY, aCoordY, aParentY, aMask, aStyleContext, - aPresContext, aCanStoreInRuleTree); + mozilla::DebugOnly cY = SetCoord(valY, aCoordY, aParentY, aMask, + aStyleContext, aPresContext, aCanStoreInRuleTree); NS_ABORT_IF_FALSE(cX == cY, "changed one but not the other"); return cX; } @@ -3450,6 +3451,24 @@ nsRuleNode::ComputeTextResetData(void* aStartStruct, text->SetDecorationStyle(NS_STYLE_TEXT_DECORATION_STYLE_SOLID); } + // text-overflow: enum, string, inherit, initial + const nsCSSValue* textOverflowValue = + aRuleData->ValueForTextOverflow(); + if (eCSSUnit_Enumerated == textOverflowValue->GetUnit() || + eCSSUnit_Initial == textOverflowValue->GetUnit()) { + SetDiscrete(*textOverflowValue, text->mTextOverflow.mType, + canStoreInRuleTree, + SETDSC_ENUMERATED, parentText->mTextOverflow.mType, + NS_STYLE_TEXT_OVERFLOW_CLIP, 0, 0, 0, 0); + text->mTextOverflow.mString.Truncate(); + } else if (eCSSUnit_Inherit == textOverflowValue->GetUnit()) { + canStoreInRuleTree = PR_FALSE; + text->mTextOverflow = parentText->mTextOverflow; + } else if (eCSSUnit_String == textOverflowValue->GetUnit()) { + textOverflowValue->GetStringValue(text->mTextOverflow.mString); + text->mTextOverflow.mType = NS_STYLE_TEXT_OVERFLOW_STRING; + } + // unicode-bidi: enum, inherit, initial SetDiscrete(*aRuleData->ValueForUnicodeBidi(), text->mUnicodeBidi, canStoreInRuleTree, SETDSC_ENUMERATED, parentText->mUnicodeBidi, @@ -3610,7 +3629,6 @@ static const TransitionPropInfo transitionPropInfo[4] = { &nsStyleDisplay::mTransitionTimingFunctionCount }, }; -#ifdef MOZ_CSS_ANIMATIONS // Each property's index in this array must match its index in the // mutable array |animationPropData| below. static const TransitionPropInfo animationPropInfo[8] = { @@ -3631,7 +3649,6 @@ static const TransitionPropInfo animationPropInfo[8] = { { eCSSProperty_animation_iteration_count, &nsStyleDisplay::mAnimationIterationCountCount }, }; -#endif // Information about each transition or animation property that changes // during ComputeDisplayData. @@ -3927,7 +3944,6 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, } } -#ifdef MOZ_CSS_ANIMATIONS // Each property's index in this array must match its index in the // const array |animationPropInfo| above. TransitionPropData animationPropData[8]; @@ -4171,7 +4187,6 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, } } } -#endif // opacity: factor, inherit, initial SetFactor(*aRuleData->ValueForOpacity(), display->mOpacity, canStoreInRuleTree, diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index 1187caeb1f5..050d272b495 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -59,9 +59,7 @@ #include "nsContentUtils.h" #include "nsRuleProcessorData.h" #include "nsTransitionManager.h" -#ifdef MOZ_CSS_ANIMATIONS #include "nsAnimationManager.h" -#endif #include "nsEventStates.h" #include "mozilla/dom/Element.h" @@ -120,9 +118,7 @@ nsStyleSet::Init(nsPresContext *aPresContext) return NS_ERROR_OUT_OF_MEMORY; } -#ifdef MOZ_CSS_ANIMATIONS GatherRuleProcessors(eAnimationSheet); -#endif GatherRuleProcessors(eTransitionSheet); return NS_OK; @@ -203,7 +199,6 @@ nsStyleSet::GatherRuleProcessors(sheetType aType) //don't regather if this level is disabled return NS_OK; } -#ifdef MOZ_CSS_ANIMATIONS if (aType == eAnimationSheet) { // We have no sheet for the animations level; just a rule // processor. (XXX: We should probably do this for the other @@ -211,7 +206,6 @@ nsStyleSet::GatherRuleProcessors(sheetType aType) mRuleProcessors[aType] = PresContext()->AnimationManager(); return NS_OK; } -#endif if (aType == eTransitionSheet) { // We have no sheet for the transitions level; just a rule // processor. (XXX: We should probably do this for the other @@ -588,7 +582,6 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext, NS_ASSERTION(result->GetPseudo() == aPseudoTag, "Unexpected pseudo"); } -#ifdef MOZ_CSS_ANIMATIONS if (aDoAnimations) { // Normally the animation manager has already added the correct // style rule. However, if the animation-name just changed, it @@ -616,7 +609,6 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext, aPseudoTag, aPseudoType, PR_FALSE, nsnull); } } -#endif if (aElementForAnimation && aElementForAnimation->IsHTML(nsGkAtoms::body) && aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement && @@ -782,11 +774,9 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc, } #endif -#ifdef MOZ_CSS_ANIMATIONS // This needs to match IsMoreSpecificThanAnimation() above. aRuleWalker->SetLevel(eAnimationSheet, PR_FALSE, PR_FALSE); (*aCollectorFunc)(mRuleProcessors[eAnimationSheet], aData); -#endif #ifdef DEBUG AssertNoCSSRules(lastPresHintRN, lastUserRN); @@ -860,9 +850,7 @@ nsStyleSet::WalkRuleProcessors(nsIStyleRuleProcessor::EnumFunc aFunc, (*aFunc)(mRuleProcessors[eStyleAttrSheet], aData); if (mRuleProcessors[eOverrideSheet]) (*aFunc)(mRuleProcessors[eOverrideSheet], aData); -#ifdef MOZ_CSS_ANIMATIONS (*aFunc)(mRuleProcessors[eAnimationSheet], aData); -#endif (*aFunc)(mRuleProcessors[eTransitionSheet], aData); } @@ -1219,7 +1207,6 @@ nsStyleSet::AppendFontFaceRules(nsPresContext* aPresContext, return PR_TRUE; } -#ifdef MOZ_CSS_ANIMATIONS PRBool nsStyleSet::AppendKeyframesRules(nsPresContext* aPresContext, nsTArray& aArray) @@ -1234,7 +1221,6 @@ nsStyleSet::AppendKeyframesRules(nsPresContext* aPresContext, } return PR_TRUE; } -#endif void nsStyleSet::BeginShutdown(nsPresContext* aPresContext) diff --git a/layout/style/nsStyleSet.h b/layout/style/nsStyleSet.h index 9c778f9d24f..cb767b25d0f 100644 --- a/layout/style/nsStyleSet.h +++ b/layout/style/nsStyleSet.h @@ -60,9 +60,7 @@ class nsIURI; class nsCSSFontFaceRule; -#ifdef MOZ_CSS_ANIMATIONS class nsCSSKeyframesRule; -#endif class nsRuleWalker; struct RuleProcessorData; struct TreeMatchContext; @@ -174,12 +172,10 @@ class nsStyleSet PRBool AppendFontFaceRules(nsPresContext* aPresContext, nsTArray& aArray); -#ifdef MOZ_CSS_ANIMATIONS // Append all the currently-active keyframes rules to aArray. Return // true for success and false for failure. PRBool AppendKeyframesRules(nsPresContext* aPresContext, nsTArray& aArray); -#endif // Begin ignoring style context destruction, to avoid lots of unnecessary // work on document teardown. @@ -243,9 +239,7 @@ class nsStyleSet eDocSheet, // CSS eStyleAttrSheet, eOverrideSheet, // CSS -#ifdef MOZ_CSS_ANIMATIONS eAnimationSheet, -#endif eTransitionSheet, eSheetTypeCount // be sure to keep the number of bits in |mDirty| below and in diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 6bf3e84183f..2d3434b2f78 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -21,7 +21,7 @@ * * Contributor(s): * David Hyatt (hyatt@netscape.com) - * Mats Palmgren + * Mats Palmgren * Michael Ventnor * Jonathon Jongsma , Collabora Ltd. * L. David Baron , Mozilla Corporation @@ -53,7 +53,7 @@ #include "nsPresContext.h" #include "nsIWidget.h" #include "nsIStyleRule.h" -#include "nsCRT.h" +#include "nsCRTGlue.h" #include "nsCSSProps.h" #include "nsCOMPtr.h" @@ -109,6 +109,15 @@ static PRBool EqualImages(imgIRequest *aImage1, imgIRequest* aImage2) return EqualURIs(uri1, uri2); } +// A nullsafe wrapper for strcmp. We depend on null-safety. +static int safe_strcmp(const PRUnichar* a, const PRUnichar* b) +{ + if (!a || !b) { + return (int)(a - b); + } + return NS_strcmp(a, b); +} + static nsChangeHint CalcShadowDifference(nsCSSShadowArray* lhs, nsCSSShadowArray* rhs); @@ -1444,7 +1453,7 @@ nsStyleImage::SetNull() else if (mType == eStyleImageType_Image) NS_RELEASE(mImage); else if (mType == eStyleImageType_Element) - nsCRT::free(mElementId); + NS_Free(mElementId); mType = eStyleImageType_Null; mCropRect = nsnull; @@ -1527,7 +1536,7 @@ nsStyleImage::SetElementId(const PRUnichar* aElementId) SetNull(); if (aElementId) { - mElementId = nsCRT::strdup(aElementId); + mElementId = NS_strdup(aElementId); mType = eStyleImageType_Element; } } @@ -1685,7 +1694,7 @@ nsStyleImage::operator==(const nsStyleImage& aOther) const return *mGradient == *aOther.mGradient; if (mType == eStyleImageType_Element) - return nsCRT::strcmp(mElementId, aOther.mElementId) == 0; + return NS_strcmp(mElementId, aOther.mElementId) == 0; return PR_TRUE; } @@ -1979,7 +1988,6 @@ void nsTransition::SetUnknownProperty(const nsAString& aUnknownProperty) mUnknownProperty = do_GetAtom(aUnknownProperty); } -#ifdef MOZ_CSS_ANIMATIONS nsAnimation::nsAnimation(const nsAnimation& aCopy) : mTimingFunction(aCopy.mTimingFunction) , mDuration(aCopy.mDuration) @@ -2004,7 +2012,6 @@ nsAnimation::SetInitialValues() mPlayState = NS_STYLE_ANIMATION_PLAY_STATE_RUNNING; mIterationCount = 1.0f; } -#endif nsStyleDisplay::nsStyleDisplay() { @@ -2037,7 +2044,6 @@ nsStyleDisplay::nsStyleDisplay() mTransitionDelayCount = 1; mTransitionPropertyCount = 1; -#ifdef MOZ_CSS_ANIMATIONS mAnimations.AppendElement(); NS_ABORT_IF_FALSE(mAnimations.Length() == 1, "appending within auto buffer should never fail"); @@ -2050,7 +2056,6 @@ nsStyleDisplay::nsStyleDisplay() mAnimationFillModeCount = 1; mAnimationPlayStateCount = 1; mAnimationIterationCountCount = 1; -#endif } nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource) @@ -2059,7 +2064,6 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource) , mTransitionDurationCount(aSource.mTransitionDurationCount) , mTransitionDelayCount(aSource.mTransitionDelayCount) , mTransitionPropertyCount(aSource.mTransitionPropertyCount) -#ifdef MOZ_CSS_ANIMATIONS , mAnimations(aSource.mAnimations) , mAnimationTimingFunctionCount(aSource.mAnimationTimingFunctionCount) , mAnimationDurationCount(aSource.mAnimationDurationCount) @@ -2069,7 +2073,6 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource) , mAnimationFillModeCount(aSource.mAnimationFillModeCount) , mAnimationPlayStateCount(aSource.mAnimationPlayStateCount) , mAnimationIterationCountCount(aSource.mAnimationIterationCountCount) -#endif { MOZ_COUNT_CTOR(nsStyleDisplay); mAppearance = aSource.mAppearance; @@ -2312,7 +2315,7 @@ PRBool nsStyleContentData::operator==(const nsStyleContentData& aOther) const if (mType == eStyleContentType_Counter || mType == eStyleContentType_Counters) return *mContent.mCounters == *aOther.mContent.mCounters; - return nsCRT::strcmp(mContent.mString, aOther.mContent.mString) == 0; + return safe_strcmp(mContent.mString, aOther.mContent.mString) == 0; } void @@ -2612,7 +2615,7 @@ nsStyleTextReset::nsStyleTextReset(void) nsStyleTextReset::nsStyleTextReset(const nsStyleTextReset& aSource) { MOZ_COUNT_CTOR(nsStyleTextReset); - memcpy((nsStyleTextReset*)this, &aSource, sizeof(nsStyleTextReset)); + *this = aSource; } nsStyleTextReset::~nsStyleTextReset(void) @@ -2655,6 +2658,9 @@ nsChangeHint nsStyleTextReset::CalcDifference(const nsStyleTextReset& aOther) co return NS_STYLE_HINT_VISUAL; } + if (mTextOverflow != aOther.mTextOverflow) { + return NS_STYLE_HINT_VISUAL; + } return NS_STYLE_HINT_NONE; } return NS_STYLE_HINT_REFLOW; diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index e2eab26b081..ce39553049f 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1130,6 +1130,22 @@ private: } }; +struct nsStyleTextOverflow { + nsStyleTextOverflow() : mType(NS_STYLE_TEXT_OVERFLOW_CLIP) {} + + bool operator==(const nsStyleTextOverflow& aOther) const { + return mType == aOther.mType && + (mType != NS_STYLE_TEXT_OVERFLOW_STRING || + mString == aOther.mString); + } + bool operator!=(const nsStyleTextOverflow& aOther) const { + return !(*this == aOther); + } + + nsString mString; + PRUint8 mType; +}; + struct nsStyleTextReset { nsStyleTextReset(void); nsStyleTextReset(const nsStyleTextReset& aOther); @@ -1187,6 +1203,7 @@ struct nsStyleTextReset { static PRBool ForceCompare() { return PR_FALSE; } nsStyleCoord mVerticalAlign; // [reset] coord, percent, calc, enum (see nsStyleConsts.h) + nsStyleTextOverflow mTextOverflow; // [reset] enum, string PRUint8 mTextBlink; // [reset] see nsStyleConsts.h PRUint8 mTextDecorationLine; // [reset] see nsStyleConsts.h @@ -1411,7 +1428,6 @@ private: // eCSSProperty_UNKNOWN }; -#ifdef MOZ_CSS_ANIMATIONS struct nsAnimation { nsAnimation() { /* leaves uninitialized; see also SetInitialValues */ } explicit nsAnimation(const nsAnimation& aCopy); @@ -1452,7 +1468,6 @@ private: PRUint8 mPlayState; float mIterationCount; // NS_IEEEPositiveInfinity() means infinite }; -#endif struct nsStyleDisplay { nsStyleDisplay(); @@ -1510,7 +1525,6 @@ struct nsStyleDisplay { mTransitionDelayCount, mTransitionPropertyCount; -#ifdef MOZ_CSS_ANIMATIONS nsAutoTArray mAnimations; // [reset] // The number of elements in mAnimations that are not from repeating // a list due to another property being longer. @@ -1522,7 +1536,6 @@ struct nsStyleDisplay { mAnimationFillModeCount, mAnimationPlayStateCount, mAnimationIterationCountCount; -#endif PRBool IsBlockInside() const { return NS_STYLE_DISPLAY_BLOCK == mDisplay || diff --git a/layout/style/test/Makefile.in b/layout/style/test/Makefile.in index 4b8d383d313..0b90c88846e 100644 --- a/layout/style/test/Makefile.in +++ b/layout/style/test/Makefile.in @@ -82,6 +82,7 @@ GARBAGE += css_properties.js _TEST_FILES = test_acid3_test46.html \ + test_animations.html \ test_any_dynamic.html \ test_at_rule_parse_serialize.html \ test_bug73586.html \ @@ -142,6 +143,7 @@ _TEST_FILES = test_acid3_test46.html \ test_inherit_storage.html \ test_initial_computation.html \ test_initial_storage.html \ + test_keyframes_rules.html \ test_media_queries.html \ test_media_queries_dynamic.html \ test_media_queries_dynamic_xbl.html \ @@ -219,13 +221,6 @@ _TEST_FILES = test_acid3_test46.html \ visited_image_loading_frame_empty.html \ $(NULL) -ifdef MOZ_CSS_ANIMATIONS -_TEST_FILES += \ - test_animations.html \ - test_keyframes_rules.html \ - $(NULL) -endif - _VISITED_REFTEST_FILES = \ $(shell find $(topsrcdir)/layout/reftests/css-visited/ -name '*.html' -o -name '*.xhtml') \ $(topsrcdir)/layout/reftests/svg/pseudo-classes-02.svg \ diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index f9d688b8fbb..0ac43cbead6 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -21,6 +21,7 @@ * * Contributor(s): * L. David Baron , Mozilla Corporation (original author) + * Mats Palmgren * * 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 @@ -2498,6 +2499,14 @@ var gCSSProperties = { ], invalid_values: [] }, + "text-overflow": { + domProp: "textOverflow", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "clip" ], + other_values: [ "ellipsis", '""', "''", '"hello"' ], + invalid_values: [ "none", "auto" ] + }, "text-shadow": { domProp: "textShadow", inherited: true, diff --git a/layout/style/ua.css b/layout/style/ua.css index fa8b82de67c..9651f077b72 100644 --- a/layout/style/ua.css +++ b/layout/style/ua.css @@ -19,6 +19,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Mats Palmgren * * 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"), @@ -122,6 +123,7 @@ display: block !important; position: static !important; unicode-bidi: inherit; + text-overflow: inherit; } *|*::-moz-anonymous-block, *|*::-moz-anonymous-positioned-block { @@ -153,6 +155,7 @@ /* make unicode-bidi inherit, otherwise it has no effect on text inputs and blocks with overflow: scroll; */ unicode-bidi: inherit; + text-overflow: inherit; -moz-column-count: inherit; -moz-column-width: inherit; -moz-column-gap: inherit; @@ -179,6 +182,7 @@ /* the column boxes inside a column-flowed block */ /* make unicode-bidi inherit, otherwise it has no effect on column boxes */ unicode-bidi: inherit; + text-overflow: inherit; /* inherit the outer frame's display, otherwise we turn into an inline */ display: inherit !important; /* Carry through our parent's height so that %-height children get @@ -222,6 +226,7 @@ clip: inherit; opacity: inherit; unicode-bidi: inherit; + text-overflow: inherit; } /* Printing */ diff --git a/layout/svg/base/src/nsSVGIntegrationUtils.cpp b/layout/svg/base/src/nsSVGIntegrationUtils.cpp index a52b7c9da4c..cc106de4bac 100644 --- a/layout/svg/base/src/nsSVGIntegrationUtils.cpp +++ b/layout/svg/base/src/nsSVGIntegrationUtils.cpp @@ -55,9 +55,11 @@ PRBool nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame) { + if (aFrame->IsFrameOfType(nsIFrame::eSVG)) { + return PR_FALSE; + } const nsStyleSVGReset *style = aFrame->GetStyleSVGReset(); - return (style->mFilter || style->mClipPath || style->mMask) && - !aFrame->IsFrameOfType(nsIFrame::eSVG); + return (style->mFilter || style->mClipPath || style->mMask); } /* static */ nsRect diff --git a/layout/tables/celldata.h b/layout/tables/celldata.h index 89ba17a5e70..09d50715123 100644 --- a/layout/tables/celldata.h +++ b/layout/tables/celldata.h @@ -39,7 +39,7 @@ #include "nsISupports.h" #include "nsCoord.h" -#include "gfxCore.h" +#include "mozilla/gfx/Types.h" class nsTableCellFrame; class nsCellMap; diff --git a/layout/tools/reftest/runreftest.py b/layout/tools/reftest/runreftest.py index ee2d522ecd1..2b3c0900827 100644 --- a/layout/tools/reftest/runreftest.py +++ b/layout/tools/reftest/runreftest.py @@ -133,7 +133,7 @@ class RefTest(object): def cleanup(self, profileDir): if profileDir: - shutil.rmtree(profileDir) + shutil.rmtree(profileDir, True) def runTests(self, testPath, options): debuggerInfo = getDebuggerInfo(self.oldcwd, options.debugger, options.debuggerArgs, diff --git a/layout/xul/base/public/nsIMenuFrame.h b/layout/xul/base/public/nsIMenuFrame.h index aee0ec847e5..3c65ba8cbca 100644 --- a/layout/xul/base/public/nsIMenuFrame.h +++ b/layout/xul/base/public/nsIMenuFrame.h @@ -40,6 +40,12 @@ #include "nsQueryFrame.h" +enum nsMenuListType { + eNotMenuList, + eReadonlyMenuList, + eEditableMenuList +}; + // this interface exists solely because native themes need to call into it. // Only menu frames should implement it @@ -52,6 +58,7 @@ public: virtual PRBool IsMenu() = 0; virtual PRBool IsOnMenuBar() = 0; virtual PRBool IsOnActiveMenuBar() = 0; + virtual nsMenuListType GetParentMenuListType() = 0; }; #endif diff --git a/layout/xul/base/src/nsMenuBarListener.cpp b/layout/xul/base/src/nsMenuBarListener.cpp index 2a080a215da..1c9495e3d30 100644 --- a/layout/xul/base/src/nsMenuBarListener.cpp +++ b/layout/xul/base/src/nsMenuBarListener.cpp @@ -42,7 +42,6 @@ #include "nsMenuBarFrame.h" #include "nsMenuPopupFrame.h" #include "nsIDOMKeyListener.h" -#include "nsIDOMEventTarget.h" #include "nsIDOMEventListener.h" #include "nsIDOMNSUIEvent.h" #include "nsIDOMNSEvent.h" diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index a0180a6ebed..63027319468 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -871,6 +871,24 @@ nsMenuFrame::IsMenu() return mIsMenu; } +nsMenuListType +nsMenuFrame::GetParentMenuListType() +{ + if (mMenuParent && mMenuParent->IsMenu()) { + nsMenuPopupFrame* popupFrame = static_cast(mMenuParent); + nsIFrame* parentMenu = popupFrame->GetParent(); + if (parentMenu) { + nsCOMPtr menulist = do_QueryInterface(parentMenu->GetContent()); + if (menulist) { + PRBool isEditable = PR_FALSE; + menulist->GetEditable(&isEditable); + return isEditable ? eEditableMenuList : eReadonlyMenuList; + } + } + } + return eNotMenuList; +} + nsresult nsMenuFrame::Notify(nsITimer* aTimer) { @@ -1198,18 +1216,9 @@ nsMenuFrame::ShouldBlink() return PR_FALSE; // Don't blink in editable menulists. - if (mMenuParent && mMenuParent->IsMenu()) { - nsMenuPopupFrame* popupFrame = static_cast(mMenuParent); - nsIFrame* parentMenu = popupFrame->GetParent(); - if (parentMenu) { - nsCOMPtr menulist = do_QueryInterface(parentMenu->GetContent()); - if (menulist) { - PRBool isEditable = PR_FALSE; - menulist->GetEditable(&isEditable); - return !isEditable; - } - } - } + if (GetParentMenuListType() == eEditableMenuList) + return PR_FALSE; + return PR_TRUE; } diff --git a/layout/xul/base/src/nsMenuFrame.h b/layout/xul/base/src/nsMenuFrame.h index d6a69ae0a4c..fdc34c614f8 100644 --- a/layout/xul/base/src/nsMenuFrame.h +++ b/layout/xul/base/src/nsMenuFrame.h @@ -189,6 +189,7 @@ public: virtual PRBool IsOnActiveMenuBar() { return IsOnMenuBar() && mMenuParent->IsActive(); } virtual PRBool IsOpen(); virtual PRBool IsMenu(); + virtual nsMenuListType GetParentMenuListType(); PRBool IsDisabled(); void ToggleMenuState(); diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index f9b4473842b..5adc6de25ba 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -3393,6 +3393,9 @@ nsTreeBodyFrame::PaintImage(PRInt32 aRowIndex, // Resolve style for the image. nsStyleContext* imageContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreeimage); + // Obtain opacity value for the image. + float opacity = imageContext->GetStyleDisplay()->mOpacity; + // Obtain the margins for the image and then deflate our rect by that // amount. The image is assumed to be contained within the deflated rect. nsRect imageRect(aImageRect); @@ -3499,10 +3502,20 @@ nsTreeBodyFrame::PaintImage(PRInt32 aRowIndex, nsLayoutUtils::GetWholeImageDestination(rawImageSize, sourceRect, nsRect(destRect.TopLeft(), imageDestSize)); + gfxContext* ctx = aRenderingContext.ThebesContext(); + if (opacity != 1.0f) { + ctx->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA); + } + nsLayoutUtils::DrawImage(&aRenderingContext, image, nsLayoutUtils::GetGraphicsFilterForFrame(this), wholeImageDest, destRect, destRect.TopLeft(), aDirtyRect, imgIContainer::FLAG_NONE); + + if (opacity != 1.0f) { + ctx->PopGroupToSource(); + ctx->Paint(opacity); + } } // Update the aRemainingWidth and aCurrX values. diff --git a/memory/mozalloc/Makefile.in b/memory/mozalloc/Makefile.in index 80e22dc6225..b2e932314b2 100644 --- a/memory/mozalloc/Makefile.in +++ b/memory/mozalloc/Makefile.in @@ -114,4 +114,6 @@ else SDK_LIBRARY = $(SHARED_LIBRARY) endif +LOCAL_INCLUDES += -I$(DEPTH)/xpcom + include $(topsrcdir)/config/rules.mk diff --git a/memory/mozalloc/mozalloc.h b/memory/mozalloc/mozalloc.h index 745330bd0e6..f8fc5e5d467 100644 --- a/memory/mozalloc/mozalloc.h +++ b/memory/mozalloc/mozalloc.h @@ -50,7 +50,7 @@ #if defined(__cplusplus) # include #endif - +#include "xpcom-config.h" #define MOZALLOC_HAVE_XMALLOC diff --git a/mfbt/RefPtr.h b/mfbt/RefPtr.h index 0b6fa60db27..3c9be7ff8af 100644 --- a/mfbt/RefPtr.h +++ b/mfbt/RefPtr.h @@ -131,6 +131,8 @@ class RefPtr friend class TemporaryRef; friend class OutParamRef; + struct dontRef {}; + public: RefPtr() : ptr(0) { } RefPtr(const RefPtr& o) : ptr(ref(o.ptr)) {} @@ -164,13 +166,15 @@ public: TemporaryRef forget() { T* tmp = ptr; ptr = 0; - return TemporaryRef(tmp); + return TemporaryRef(tmp, dontRef()); } T* get() const { return ptr; } operator T*() const { return ptr; } T* operator->() const { return ptr; } T& operator*() const { return *ptr; } + template + operator TemporaryRef() { return forget(); } private: void assign(T* t) { @@ -206,7 +210,10 @@ class TemporaryRef // To allow it to construct TemporaryRef from a bare T* friend class RefPtr; + typedef typename RefPtr::dontRef dontRef; + public: + TemporaryRef(T* t) : ptr(RefPtr::ref(t)) {} TemporaryRef(const TemporaryRef& o) : ptr(o.drop()) {} template @@ -221,7 +228,7 @@ public: } private: - TemporaryRef(T* t) : ptr(t) {} + TemporaryRef(T* t, const dontRef&) : ptr(t) {} mutable T* ptr; @@ -231,10 +238,13 @@ private: /** * OutParamRef is a wrapper that tracks a refcounted pointer passed as - * an outparam argument to a function. If OutParamRef holds a ref to - * an object that's reassigned during a function call in which the - * OutParamRef is an outparam, then the old object is unref'd and the - * new object is ref'd. + * an outparam argument to a function. OutParamRef implements COM T** + * outparam semantics: this requires the callee to AddRef() the T* + * returned through the T** outparam on behalf of the caller. This + * means the caller (through OutParamRef) must Release() the old + * object contained in the tracked RefPtr. It's OK if the callee + * returns the same T* passed to it through the T** outparam, as long + * as the callee obeys the COM discipline. * * Prefer returning TemporaryRef from functions over creating T** * outparams and passing OutParamRef to T**. Prefer RefPtr* @@ -246,7 +256,10 @@ class OutParamRef friend OutParamRef byRef(RefPtr&); public: - ~OutParamRef() { refPtr = tmp; } + ~OutParamRef() { + RefPtr::unref(refPtr.ptr); + refPtr.ptr = tmp; + } operator T**() { return &tmp; } @@ -260,6 +273,9 @@ private: OutParamRef& operator=(const OutParamRef&); }; +/** + * byRef cooperates with OutParamRef to implement COM outparam semantics. + */ template OutParamRef byRef(RefPtr& ptr) @@ -299,26 +315,29 @@ struct Bar : public Foo { }; TemporaryRef NewFoo() { - RefPtr f = new Foo(); - return f.forget(); + return RefPtr(new Foo()); } TemporaryRef NewBar() { - RefPtr b = new Bar(); - return b.forget(); + return new Bar(); } void GetNewFoo(Foo** f) { *f = new Bar(); + // Kids, don't try this at home + (*f)->AddRef(); } void GetPassedFoo(Foo** f) -{} +{ + // Kids, don't try this at home + (*f)->AddRef(); +} void GetNewFoo(RefPtr* f) @@ -330,6 +349,12 @@ void GetPassedFoo(RefPtr* f) {} +TemporaryRef +GetNullFoo() +{ + return 0; +} + int main(int argc, char** argv) { @@ -407,6 +432,12 @@ main(int argc, char** argv) } MOZ_ASSERT(13 == Foo::numDestroyed); + { + RefPtr f = GetNullFoo(); + MOZ_ASSERT(13 == Foo::numDestroyed); + } + MOZ_ASSERT(13 == Foo::numDestroyed); + return 0; } diff --git a/mobile/app/mobile.js b/mobile/app/mobile.js index a943c64d17d..542e20581ee 100644 --- a/mobile/app/mobile.js +++ b/mobile/app/mobile.js @@ -73,9 +73,6 @@ pref("toolkit.zoomManager.zoomValues", ".2,.3,.5,.67,.8,.9,1,1.1,1.2,1.33,1.5,1. // Device pixel to CSS px ratio, in percent. Set to -1 to calculate based on display density. pref("browser.viewport.scaleRatio", -1); -/* use custom widget for html:select */ -pref("ui.use_native_popup_windows", true); - /* allow scrollbars to float above chrome ui */ pref("ui.scrollbarsCanOverlapContent", 1); @@ -503,7 +500,6 @@ pref("app.update.channel", "@MOZ_UPDATE_CHANNEL@"); pref("app.update.mode", 1); pref("app.update.silent", false); pref("app.update.url", "https://aus2.mozilla.org/update/4/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PLATFORM_VERSION%/update.xml"); -pref("app.update.nagTimer.restart", 86400); pref("app.update.promptWaitTime", 43200); pref("app.update.idletime", 60); pref("app.update.showInstalledUI", false); @@ -587,7 +583,7 @@ pref("widget.ime.android.fullscreen_threshold", 250); // in hundreths of inches // optimize images memory usage pref("image.mem.decodeondraw", true); pref("content.image.allow_locking", false); -pref("image.mem.min_discard_timeout_ms", 20000); +pref("image.mem.min_discard_timeout_ms", 10000); // enable touch events interfaces pref("dom.w3c_touch_events.enabled", true); diff --git a/mobile/chrome/content/AppMenu.js b/mobile/chrome/content/AppMenu.js index 42ff45aa86a..b8c88f666ef 100644 --- a/mobile/chrome/content/AppMenu.js +++ b/mobile/chrome/content/AppMenu.js @@ -11,7 +11,8 @@ var AppMenu = { overflowMenu : [], show: function show() { - if (BrowserUI.activePanel || BrowserUI.isPanelVisible()) + let modals = document.getElementsByClassName("modal-block").length; + if (BrowserUI.activePanel || BrowserUI.isPanelVisible() || modals > 0 || BrowserUI.activeDialog) return; let shown = 0; diff --git a/mobile/chrome/content/aboutHome.xhtml b/mobile/chrome/content/aboutHome.xhtml index fb4bc155a52..d394361702f 100644 --- a/mobile/chrome/content/aboutHome.xhtml +++ b/mobile/chrome/content/aboutHome.xhtml @@ -196,14 +196,13 @@ let tabs = data.windows[0].tabs; for (let i=0; i 0) + history.PurgeHistory(history.count); + history.QueryInterface(Ci.nsISHistoryInternal); + + // helper hashes for ensuring unique frame IDs and unique document + // identifiers. + let idMap = { used: {} }; + let docIdentMap = {}; + + for (let i = 0; i < aTabData.entries.length; i++) { + if (!aTabData.entries[i].url) + continue; + history.addEntry(this._deserializeHistoryEntry(aTabData.entries[i], idMap, docIdentMap), true); + } + + // We need to force set the active history item and cause it to reload since + // we stop the load above + let activeIndex = (aTabData.index || aTabData.entries.length) - 1; + history.getEntryAtIndex(activeIndex, true); + history.QueryInterface(Ci.nsISHistory).reloadCurrentEntry(); + }, + + _deserializeHistoryEntry: function _deserializeHistoryEntry(aEntry, aIdMap, aDocIdentMap) { + let shEntry = Cc["@mozilla.org/browser/session-history-entry;1"].createInstance(Ci.nsISHEntry); + + shEntry.setURI(Services.io.newURI(aEntry.url, null, null)); + shEntry.setTitle(aEntry.title || aEntry.url); + if (aEntry.subframe) + shEntry.setIsSubFrame(aEntry.subframe || false); + shEntry.loadType = Ci.nsIDocShellLoadInfo.loadHistory; + if (aEntry.contentType) + shEntry.contentType = aEntry.contentType; + if (aEntry.referrer) + shEntry.referrerURI = Services.io.newURI(aEntry.referrer, null, null); + + if (aEntry.cacheKey) { + let cacheKey = Cc["@mozilla.org/supports-PRUint32;1"].createInstance(Ci.nsISupportsPRUint32); + cacheKey.data = aEntry.cacheKey; + shEntry.cacheKey = cacheKey; + } + + if (aEntry.ID) { + // get a new unique ID for this frame (since the one from the last + // start might already be in use) + let id = aIdMap[aEntry.ID] || 0; + if (!id) { + for (id = Date.now(); id in aIdMap.used; id++); + aIdMap[aEntry.ID] = id; + aIdMap.used[id] = true; + } + shEntry.ID = id; + } + + if (aEntry.docshellID) + shEntry.docshellID = aEntry.docshellID; + + if (aEntry.stateData) + shEntry.stateData = aEntry.stateData; + + if (aEntry.scroll) { + let scrollPos = aEntry.scroll.split(","); + scrollPos = [parseInt(scrollPos[0]) || 0, parseInt(scrollPos[1]) || 0]; + shEntry.setScrollPosition(scrollPos[0], scrollPos[1]); + } + + if (aEntry.docIdentifier) { + // Get a new document identifier for this entry to ensure that history + // entries after a session restore are considered to have different + // documents from the history entries before the session restore. + // Document identifiers are 64-bit ints, so JS will loose precision and + // start assigning all entries the same doc identifier if these ever get + // large enough. + // + // It's a potential security issue if document identifiers aren't + // globally unique, but shEntry.setUniqueDocIdentifier() below guarantees + // that we won't re-use a doc identifier within a given instance of the + // application. + let ident = aDocIdentMap[aEntry.docIdentifier]; + if (!ident) { + shEntry.setUniqueDocIdentifier(); + aDocIdentMap[aEntry.docIdentifier] = shEntry.docIdentifier; + } else { + shEntry.docIdentifier = ident; + } + } + + if (aEntry.owner_b64) { + let ownerInput = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(Ci.nsIStringInputStream); + let binaryData = atob(aEntry.owner_b64); + ownerInput.setData(binaryData, binaryData.length); + let binaryStream = Cc["@mozilla.org/binaryinputstream;1"].createInstance(Ci.nsIObjectInputStream); + binaryStream.setInputStream(ownerInput); + try { // Catch possible deserialization exceptions + shEntry.owner = binaryStream.readObject(true); + } catch (ex) { dump(ex); } + } + + if (aEntry.children && shEntry instanceof Ci.nsISHContainer) { + for (let i = 0; i < aEntry.children.length; i++) { + if (!aEntry.children[i].url) + continue; + shEntry.AddChild(this._deserializeHistoryEntry(aEntry.children[i], aIdMap, aDocIdentMap), i); + } + } + + return shEntry; + }, + + sendHistory: function sendHistory() { + // We need to package up the session history and send it to the sessionstore + let entries = []; + let history = docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory; + for (let i = 0; i < history.count; i++) { + let entry = this._serializeHistoryEntry(history.getEntryAtIndex(i, false)); + entries.push(entry); + } + let index = history.index + 1; + sendAsyncMessage("Content:SessionHistory", { entries: entries, index: index }); + }, + + _serializeHistoryEntry: function _serializeHistoryEntry(aEntry) { + let entry = { url: aEntry.URI.spec }; + + if (aEntry.title && aEntry.title != entry.url) + entry.title = aEntry.title; + + if (!(aEntry instanceof Ci.nsISHEntry)) + return entry; + + let cacheKey = aEntry.cacheKey; + if (cacheKey && cacheKey instanceof Ci.nsISupportsPRUint32 && cacheKey.data != 0) + entry.cacheKey = cacheKey.data; + + entry.ID = aEntry.ID; + entry.docshellID = aEntry.docshellID; + + if (aEntry.referrerURI) + entry.referrer = aEntry.referrerURI.spec; + + if (aEntry.contentType) + entry.contentType = aEntry.contentType; + + let x = {}, y = {}; + aEntry.getScrollPosition(x, y); + if (x.value != 0 || y.value != 0) + entry.scroll = x.value + "," + y.value; + + if (aEntry.owner) { + try { + let binaryStream = Cc["@mozilla.org/binaryoutputstream;1"].createInstance(Ci.nsIObjectOutputStream); + let pipe = Cc["@mozilla.org/pipe;1"].createInstance(Ci.nsIPipe); + pipe.init(false, false, 0, 0xffffffff, null); + binaryStream.setOutputStream(pipe.outputStream); + binaryStream.writeCompoundObject(aEntry.owner, Ci.nsISupports, true); + binaryStream.close(); + + // Now we want to read the data from the pipe's input end and encode it. + let scriptableStream = Cc["@mozilla.org/binaryinputstream;1"].createInstance(Ci.nsIBinaryInputStream); + scriptableStream.setInputStream(pipe.inputStream); + let ownerBytes = scriptableStream.readByteArray(scriptableStream.available()); + // We can stop doing base64 encoding once our serialization into JSON + // is guaranteed to handle all chars in strings, including embedded + // nulls. + entry.owner_b64 = btoa(String.fromCharCode.apply(null, ownerBytes)); + } catch (e) { dump(e); } + } + + if (aEntry.docIdentifier) + entry.docIdentifier = aEntry.docIdentifier; + + if (aEntry.stateData) + entry.stateData = aEntry.stateData; + + if (!(aEntry instanceof Ci.nsISHContainer)) + return entry; + + if (aEntry.childCount > 0) { + entry.children = []; + for (let i = 0; i < aEntry.childCount; i++) { + let child = aEntry.GetChildAt(i); + if (child) + entry.children.push(this._serializeHistoryEntry(child)); + else // to maintain the correct frame order, insert a dummy entry + entry.children.push({ url: "about:blank" }); + + // don't try to restore framesets containing wyciwyg URLs (cf. bug 424689 and bug 450595) + if (/^wyciwyg:\/\//.test(entry.children[i].url)) { + delete entry.children; + break; + } + } + } + + return entry; } }; @@ -194,6 +421,9 @@ let DOMEvents = { return; sendAsyncMessage("DOMContentLoaded", { }); + + // Send the session history now too + WebNavigation.sendHistory(); break; case "pageshow": @@ -355,15 +585,6 @@ let ContentScroll = { let winCwu = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); winCwu.setDisplayPortForElement(x, y, displayport.width, displayport.height, element); - // XXX If we scrolled during this displayport update, then it is the - // end of a pan. Due to bug 637852, there may be seaming issues - // with the visible content, so we need to redraw. - if (json.id == 1 && json.scrollX >= 0 && json.scrollY >= 0) - win.setTimeout( - function() { - winCwu.redraw(); - }, 0); - break; } @@ -488,7 +709,7 @@ let IndexedDB = { host: contentDocument.documentURIObject.asciiHost, location: contentDocument.location.toString(), data: aData, - observerId: this.addWaitingObserver(observer), + observerId: this.addWaitingObserver(observer) }); }, @@ -513,7 +734,7 @@ let IndexedDB = { let observer = this.waitingObservers[aObserverId]; delete this.waitingObservers[aObserverId]; return observer; - }, + } }; IndexedDB.init(); diff --git a/mobile/chrome/content/bindings/browser.xml b/mobile/chrome/content/bindings/browser.xml index f51d7d9bde8..f500a6897ee 100644 --- a/mobile/chrome/content/bindings/browser.xml +++ b/mobile/chrome/content/bindings/browser.xml @@ -530,7 +530,6 @@ + + + + + + + + +