mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-i to m-c
This commit is contained in:
commit
01dd061fd3
2
CLOBBER
2
CLOBBER
@ -18,4 +18,4 @@
|
||||
# Modifying this file will now automatically clobber the buildbot machines \o/
|
||||
#
|
||||
|
||||
Bug 933120 needs a clobber because of bug 852814
|
||||
Bug 906990 needs a clobber because of bug 928195
|
||||
|
@ -2,71 +2,63 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
#include "nsIArray.idl"
|
||||
|
||||
interface nsIAccessible;
|
||||
interface nsIArray;
|
||||
|
||||
/**
|
||||
* An interface for the accessibility module and in-process accessibility clients
|
||||
* for dealing with getting and changing the selection of accessible nodes.
|
||||
* An accessibility interface for selectable widgets.
|
||||
*/
|
||||
[scriptable, uuid(34d268d6-1dd2-11b2-9d63-83a5e0ada290)]
|
||||
[scriptable, uuid(3e507fc4-4fcc-4223-a674-a095f591eba1)]
|
||||
interface nsIAccessibleSelectable : nsISupports
|
||||
{
|
||||
const unsigned long eSelection_Add = 0;
|
||||
const unsigned long eSelection_Remove = 1;
|
||||
const unsigned long eSelection_GetState = 2;
|
||||
/**
|
||||
* Return an nsIArray of selected items within the widget.
|
||||
*/
|
||||
readonly attribute nsIArray selectedItems;
|
||||
|
||||
/**
|
||||
* Return an nsIArray of selected nsIAccessible children
|
||||
*/
|
||||
nsIArray GetSelectedChildren();
|
||||
|
||||
/**
|
||||
* Returns the number of accessible children currently selected.
|
||||
*/
|
||||
readonly attribute long selectionCount;
|
||||
/**
|
||||
* Return the number of currently selected items.
|
||||
*/
|
||||
readonly attribute unsigned long selectedItemCount;
|
||||
|
||||
/**
|
||||
* Adds the specified accessible child of the object to the
|
||||
* object's selection.
|
||||
* If the specified object is already selected, then it does nothing.
|
||||
* @throws NS_ERROR_FAILURE if the specified object is not selectable.
|
||||
*/
|
||||
void addChildToSelection(in long index);
|
||||
/**
|
||||
* Return a nth selected item within the widget.
|
||||
*/
|
||||
nsIAccessible getSelectedItemAt(in unsigned long index);
|
||||
|
||||
/**
|
||||
* Removes the specified child of the object from the object's selection.
|
||||
* If the specified object was not selected, then it does nothing.
|
||||
* @throws NS_ERROR_FAILURE if the specified object is not selectable.
|
||||
*/
|
||||
void removeChildFromSelection(in long index);
|
||||
/**
|
||||
* Return true if the given item is selected.
|
||||
*/
|
||||
[binaryname(ScriptableIsItemSelected)]
|
||||
boolean isItemSelected(in unsigned long index);
|
||||
|
||||
/**
|
||||
* Clears the selection in the object so that no children in the object
|
||||
* are selected.
|
||||
*/
|
||||
void clearSelection();
|
||||
/**
|
||||
* Adds the specified item to the widget's selection.
|
||||
*/
|
||||
[binaryname(ScriptableAddItemToSelection)]
|
||||
void addItemToSelection(in unsigned long index);
|
||||
|
||||
/**
|
||||
* Returns a reference to the accessible object representing the specified
|
||||
* selected child of the object.
|
||||
* @param index Zero-based selected accessible child index
|
||||
* @return The nth selected accessible child
|
||||
*/
|
||||
nsIAccessible refSelection(in long index);
|
||||
/**
|
||||
* Removes the specified item from the widget's selection.
|
||||
*/
|
||||
[binaryname(ScriptableRemoveItemFromSelection)]
|
||||
void removeItemFromSelection(in unsigned long index);
|
||||
|
||||
/**
|
||||
* Determines if the current child of this object is selected
|
||||
* @param The zero-based accessible child index
|
||||
* @return Returns true if the child is selected, false if not.
|
||||
*/
|
||||
boolean isChildSelected(in long index);
|
||||
/**
|
||||
* Select all items.
|
||||
*
|
||||
* @return false if the object does not accept multiple selection,
|
||||
* otherwise true.
|
||||
*/
|
||||
[binaryname(ScriptableSelectAll)]
|
||||
boolean selectAll();
|
||||
|
||||
/**
|
||||
* Select all children
|
||||
* @return If the object does not accept multiple selection, return false.
|
||||
* Otherwise, returns true.
|
||||
*/
|
||||
boolean selectAllSelection();
|
||||
/**
|
||||
* Unselect all items.
|
||||
*/
|
||||
[binaryname(ScriptableUnselectAll)]
|
||||
void unselectAll();
|
||||
};
|
||||
|
@ -1013,7 +1013,7 @@ Accessible::TakeSelection()
|
||||
Accessible* select = nsAccUtils::GetSelectableContainer(this, State());
|
||||
if (select) {
|
||||
if (select->State() & states::MULTISELECTABLE)
|
||||
select->ClearSelection();
|
||||
select->UnselectAll();
|
||||
return SetSelected(true);
|
||||
}
|
||||
|
||||
@ -2332,118 +2332,6 @@ Accessible::ScrollToPoint(uint32_t aCoordinateType, int32_t aX, int32_t aY)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIAccessibleSelectable
|
||||
NS_IMETHODIMP
|
||||
Accessible::GetSelectedChildren(nsIArray** aSelectedAccessibles)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSelectedAccessibles);
|
||||
*aSelectedAccessibles = nullptr;
|
||||
|
||||
if (IsDefunct() || !IsSelect())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIArray> items = SelectedItems();
|
||||
if (items) {
|
||||
uint32_t length = 0;
|
||||
items->GetLength(&length);
|
||||
if (length)
|
||||
items.swap(*aSelectedAccessibles);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// return the nth selected descendant nsIAccessible object
|
||||
NS_IMETHODIMP
|
||||
Accessible::RefSelection(int32_t aIndex, nsIAccessible** aSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSelected);
|
||||
*aSelected = nullptr;
|
||||
|
||||
if (IsDefunct() || !IsSelect())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aIndex < 0) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*aSelected = GetSelectedItem(aIndex);
|
||||
if (*aSelected) {
|
||||
NS_ADDREF(*aSelected);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Accessible::GetSelectionCount(int32_t* aSelectionCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSelectionCount);
|
||||
*aSelectionCount = 0;
|
||||
|
||||
if (IsDefunct() || !IsSelect())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aSelectionCount = SelectedItemCount();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Accessible::AddChildToSelection(int32_t aIndex)
|
||||
{
|
||||
if (IsDefunct() || !IsSelect())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return aIndex >= 0 && AddItemToSelection(aIndex) ?
|
||||
NS_OK : NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Accessible::RemoveChildFromSelection(int32_t aIndex)
|
||||
{
|
||||
if (IsDefunct() || !IsSelect())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return aIndex >=0 && RemoveItemFromSelection(aIndex) ?
|
||||
NS_OK : NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Accessible::IsChildSelected(int32_t aIndex, bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = false;
|
||||
|
||||
if (IsDefunct() || !IsSelect())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_ENSURE_TRUE(aIndex >= 0, NS_ERROR_FAILURE);
|
||||
|
||||
*aIsSelected = IsItemSelected(aIndex);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Accessible::ClearSelection()
|
||||
{
|
||||
if (IsDefunct() || !IsSelect())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
UnselectAll();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Accessible::SelectAllSelection(bool* aIsMultiSelect)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsMultiSelect);
|
||||
*aIsMultiSelect = false;
|
||||
|
||||
if (IsDefunct() || !IsSelect())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aIsMultiSelect = SelectAll();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIAccessibleHyperLink
|
||||
// Because of new-atk design, any embedded object in text can implement
|
||||
// nsIAccessibleHyperLink, which helps determine where it is located
|
||||
|
@ -13,9 +13,9 @@
|
||||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleHyperLink.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
#include "nsIAccessibleValue.h"
|
||||
#include "nsIAccessibleStates.h"
|
||||
#include "xpcAccessibleSelectable.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "nsString.h"
|
||||
@ -104,7 +104,7 @@ typedef nsRefPtrHashtable<nsPtrHashKey<const void>, Accessible>
|
||||
|
||||
class Accessible : public nsIAccessible,
|
||||
public nsIAccessibleHyperLink,
|
||||
public nsIAccessibleSelectable,
|
||||
public xpcAccessibleSelectable,
|
||||
public nsIAccessibleValue
|
||||
{
|
||||
public:
|
||||
@ -116,7 +116,6 @@ public:
|
||||
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
NS_DECL_NSIACCESSIBLEHYPERLINK
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
NS_DECL_NSIACCESSIBLEVALUE
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCESSIBLE_IMPL_IID)
|
||||
|
||||
|
@ -6,8 +6,13 @@
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
EXPORTS += [
|
||||
'xpcAccessibleSelectable.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'nsAccessibleRelation.cpp',
|
||||
'xpcAccessibleSelectable.cpp',
|
||||
'xpcAccessibleTable.cpp',
|
||||
'xpcAccessibleTableCell.cpp',
|
||||
]
|
||||
|
134
accessible/src/xpcom/xpcAccessibleSelectable.cpp
Normal file
134
accessible/src/xpcom/xpcAccessibleSelectable.cpp
Normal file
@ -0,0 +1,134 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "xpcAccessibleSelectable.h"
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleSelectable::GetSelectedItems(nsIArray** aSelectedItems)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSelectedItems);
|
||||
*aSelectedItems = nullptr;
|
||||
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_PRECONDITION(acc->IsSelect(), "Called on non selectable widget!");
|
||||
|
||||
nsCOMPtr<nsIArray> items = acc->SelectedItems();
|
||||
if (items) {
|
||||
uint32_t length = 0;
|
||||
items->GetLength(&length);
|
||||
if (length)
|
||||
items.swap(*aSelectedItems);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleSelectable::GetSelectedItemCount(uint32_t* aSelectionCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSelectionCount);
|
||||
*aSelectionCount = 0;
|
||||
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_PRECONDITION(acc->IsSelect(), "Called on non selectable widget!");
|
||||
|
||||
*aSelectionCount = acc->SelectedItemCount();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleSelectable::GetSelectedItemAt(uint32_t aIndex,
|
||||
nsIAccessible** aSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSelected);
|
||||
*aSelected = nullptr;
|
||||
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_PRECONDITION(acc->IsSelect(), "Called on non selectable widget!");
|
||||
|
||||
*aSelected = acc->GetSelectedItem(aIndex);
|
||||
if (*aSelected) {
|
||||
NS_ADDREF(*aSelected);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleSelectable::ScriptableIsItemSelected(uint32_t aIndex,
|
||||
bool* aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = false;
|
||||
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_PRECONDITION(acc->IsSelect(), "Called on non selectable widget!");
|
||||
|
||||
*aIsSelected = acc->IsItemSelected(aIndex);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleSelectable::ScriptableAddItemToSelection(uint32_t aIndex)
|
||||
{
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_PRECONDITION(acc->IsSelect(), "Called on non selectable widget!");
|
||||
|
||||
return acc->AddItemToSelection(aIndex) ? NS_OK : NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleSelectable::ScriptableRemoveItemFromSelection(uint32_t aIndex)
|
||||
{
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_PRECONDITION(acc->IsSelect(), "Called on non selectable widget!");
|
||||
|
||||
return acc->RemoveItemFromSelection(aIndex) ? NS_OK : NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleSelectable::ScriptableSelectAll(bool* aIsMultiSelect)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsMultiSelect);
|
||||
*aIsMultiSelect = false;
|
||||
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_PRECONDITION(acc->IsSelect(), "Called on non selectable widget!");
|
||||
|
||||
*aIsMultiSelect = acc->SelectAll();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleSelectable::ScriptableUnselectAll()
|
||||
{
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_PRECONDITION(acc->IsSelect(), "Called on non selectable widget!");
|
||||
|
||||
acc->UnselectAll();
|
||||
return NS_OK;
|
||||
}
|
41
accessible/src/xpcom/xpcAccessibleSelectable.h
Normal file
41
accessible/src/xpcom/xpcAccessibleSelectable.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_a11y_xpcAccessibleSelectable_h_
|
||||
#define mozilla_a11y_xpcAccessibleSelectable_h_
|
||||
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
|
||||
class nsIAccessible;
|
||||
class nsIArray;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class xpcAccessibleSelectable : public nsIAccessibleSelectable
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD GetSelectedItems(nsIArray** aSelectedItems) MOZ_FINAL;
|
||||
NS_IMETHOD GetSelectedItemCount(uint32_t* aSelectedItemCount) MOZ_FINAL;
|
||||
NS_IMETHOD GetSelectedItemAt(uint32_t aIndex, nsIAccessible** aItem) MOZ_FINAL;
|
||||
NS_IMETHOD ScriptableIsItemSelected(uint32_t aIndex, bool* aIsSelected) MOZ_FINAL;
|
||||
NS_IMETHOD ScriptableAddItemToSelection(uint32_t aIndex) MOZ_FINAL;
|
||||
NS_IMETHOD ScriptableRemoveItemFromSelection(uint32_t aIndex) MOZ_FINAL;
|
||||
NS_IMETHOD ScriptableSelectAll(bool* aIsMultiSelect) MOZ_FINAL;
|
||||
NS_IMETHOD ScriptableUnselectAll() MOZ_FINAL;
|
||||
|
||||
private:
|
||||
xpcAccessibleSelectable() { }
|
||||
friend class Accessible;
|
||||
|
||||
xpcAccessibleSelectable(const xpcAccessibleSelectable&) MOZ_DELETE;
|
||||
xpcAccessibleSelectable& operator =(const xpcAccessibleSelectable&) MOZ_DELETE;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
@ -61,21 +61,14 @@ XULTreeGridAccessible::SelectedColCount()
|
||||
// If all the row has been selected, then all the columns are selected,
|
||||
// because we can't select a column alone.
|
||||
|
||||
int32_t selectedRowCount = 0;
|
||||
nsresult rv = GetSelectionCount(&selectedRowCount);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
|
||||
uint32_t selectedRowCount = SelectedItemCount();
|
||||
return selectedRowCount > 0 && selectedRowCount == RowCount() ? ColCount() : 0;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
XULTreeGridAccessible::SelectedRowCount()
|
||||
{
|
||||
int32_t selectedRowCount = 0;
|
||||
nsresult rv = GetSelectionCount(&selectedRowCount);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
|
||||
return selectedRowCount >= 0 ? selectedRowCount : 0;
|
||||
return SelectedItemCount();
|
||||
}
|
||||
|
||||
void
|
||||
@ -164,12 +157,7 @@ XULTreeGridAccessible::IsColSelected(uint32_t aColIdx)
|
||||
{
|
||||
// If all the row has been selected, then all the columns are selected.
|
||||
// Because we can't select a column alone.
|
||||
|
||||
int32_t selectedrowCount = 0;
|
||||
nsresult rv = GetSelectionCount(&selectedrowCount);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
return selectedrowCount == RowCount();
|
||||
return SelectedItemCount() == RowCount();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -14,7 +14,7 @@ function testSelectableSelection(aIdentifier, aSelectedChildren, aMsg)
|
||||
var len = aSelectedChildren.length;
|
||||
|
||||
// getSelectedChildren
|
||||
var selectedChildren = acc.GetSelectedChildren();
|
||||
var selectedChildren = acc.selectedItems;
|
||||
is(selectedChildren ? selectedChildren.length : 0, len,
|
||||
msg + "getSelectedChildren: wrong selected children count for " +
|
||||
prettyName(aIdentifier));
|
||||
@ -28,28 +28,26 @@ function testSelectableSelection(aIdentifier, aSelectedChildren, aMsg)
|
||||
prettyName(actualAcc) + ", expected: " + prettyName(expectedAcc) + "}");
|
||||
}
|
||||
|
||||
// selectionCount
|
||||
// XXX: nsIAccessibleText and nsIAccessibleSelectable both have
|
||||
// selectionCount property.
|
||||
//is(acc.selectionCount, aSelectedChildren.length,
|
||||
// "selectionCount: wrong selected children count for " + prettyName(aIdentifier));
|
||||
// selectedItemCount
|
||||
is(acc.selectedItemCount, aSelectedChildren.length,
|
||||
"selectedItemCount: wrong selected children count for " + prettyName(aIdentifier));
|
||||
|
||||
// refSelection
|
||||
// getSelectedItemAt
|
||||
for (var idx = 0; idx < len; idx++) {
|
||||
var expectedAcc = getAccessible(aSelectedChildren[idx]);
|
||||
is(acc.refSelection(idx), expectedAcc,
|
||||
msg + "refSelection: wrong selected child at index " + idx + " for " +
|
||||
is(acc.getSelectedItemAt(idx), expectedAcc,
|
||||
msg + "getSelectedItemAt: wrong selected child at index " + idx + " for " +
|
||||
prettyName(aIdentifier));
|
||||
}
|
||||
|
||||
// isChildSelected
|
||||
testIsChildSelected(acc, acc, { value: 0 }, aSelectedChildren, msg);
|
||||
// isItemSelected
|
||||
testIsItemSelected(acc, acc, { value: 0 }, aSelectedChildren, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test isChildSelected method, helper for testSelectableSelection
|
||||
* Test isItemSelected method, helper for testSelectableSelection
|
||||
*/
|
||||
function testIsChildSelected(aSelectAcc, aTraversedAcc, aIndexObj, aSelectedChildren, aMsg)
|
||||
function testIsItemSelected(aSelectAcc, aTraversedAcc, aIndexObj, aSelectedChildren, aMsg)
|
||||
{
|
||||
var childCount = aTraversedAcc.childCount;
|
||||
for (var idx = 0; idx < childCount; idx++) {
|
||||
@ -65,9 +63,9 @@ function testIsChildSelected(aSelectAcc, aTraversedAcc, aIndexObj, aSelectedChil
|
||||
}
|
||||
}
|
||||
|
||||
// isChildSelected
|
||||
is(aSelectAcc.isChildSelected(aIndexObj.value++), isSelected,
|
||||
aMsg + "isChildSelected: wrong selected child " + prettyName(child) +
|
||||
// isItemSelected
|
||||
is(aSelectAcc.isItemSelected(aIndexObj.value++), isSelected,
|
||||
aMsg + "isItemSelected: wrong selected child " + prettyName(child) +
|
||||
" for " + prettyName(aSelectAcc));
|
||||
|
||||
// selected state
|
||||
@ -77,6 +75,6 @@ function testIsChildSelected(aSelectAcc, aTraversedAcc, aIndexObj, aSelectedChil
|
||||
continue;
|
||||
}
|
||||
|
||||
testIsChildSelected(aSelectAcc, child, aIndexObj, aSelectedChildren);
|
||||
testIsItemSelected(aSelectAcc, child, aIndexObj, aSelectedChildren);
|
||||
}
|
||||
}
|
||||
|
@ -27,10 +27,10 @@
|
||||
|
||||
testSelectableSelection(acc, []);
|
||||
|
||||
acc.selectAllSelection();
|
||||
acc.selectAll();
|
||||
testSelectableSelection(acc, aSelectableChildren);
|
||||
|
||||
acc.clearSelection();
|
||||
acc.unselectAll();
|
||||
testSelectableSelection(acc, []);
|
||||
}
|
||||
|
||||
@ -64,13 +64,13 @@
|
||||
testSelectableSelection(id, [ ]);
|
||||
|
||||
select = getAccessible(id, [nsIAccessibleSelectable]);
|
||||
select.addChildToSelection(0);
|
||||
select.addItemToSelection(0);
|
||||
testSelectableSelection(id, [ "listbox2_item1" ]);
|
||||
select.removeChildFromSelection(0);
|
||||
select.removeItemFromSelection(0);
|
||||
testSelectableSelection(id, [ ]);
|
||||
select.selectAllSelection();
|
||||
select.selectAll();
|
||||
testSelectableSelection(id, [ "listbox2_item1", "listbox2_item2" ]);
|
||||
select.clearSelection();
|
||||
select.unselectAll();
|
||||
testSelectableSelection(id, [ ]);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -41,20 +41,20 @@
|
||||
var select = getAccessible(id, [nsIAccessibleSelectable]);
|
||||
testSelectableSelection(select, [ ]);
|
||||
|
||||
select.addChildToSelection(1);
|
||||
testSelectableSelection(select, [ "lb1_item2" ], "addChildToSelect(1): ");
|
||||
select.addItemToSelection(1);
|
||||
testSelectableSelection(select, [ "lb1_item2" ], "addItemToSelect(1): ");
|
||||
|
||||
select.removeChildFromSelection(1);
|
||||
select.removeItemFromSelection(1);
|
||||
testSelectableSelection(select, [ ],
|
||||
"removeChildFromSelection(1): ");
|
||||
"removeItemFromSelection(1): ");
|
||||
|
||||
todo(select.selectAllSelection() == false,
|
||||
todo(select.selectAll() == false,
|
||||
"No way to select all items in listbox '" + id + "'");
|
||||
testSelectableSelection(select, [ "lb1_item1" ], "selectAllSelection: ");
|
||||
testSelectableSelection(select, [ "lb1_item1" ], "selectAll: ");
|
||||
|
||||
select.addChildToSelection(1);
|
||||
select.clearSelection();
|
||||
testSelectableSelection(select, [ ], "clearSelection: ");
|
||||
select.addItemToSelection(1);
|
||||
select.unselectAll();
|
||||
testSelectableSelection(select, [ ], "unselectAll: ");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// multiple selectable listbox
|
||||
@ -66,30 +66,30 @@
|
||||
var select = getAccessible(id, [nsIAccessibleSelectable]);
|
||||
testSelectableSelection(select, [ ]);
|
||||
|
||||
select.addChildToSelection(1);
|
||||
testSelectableSelection(select, [ "lb2_item2" ], "addChildToSelect(1): ");
|
||||
select.addItemToSelection(1);
|
||||
testSelectableSelection(select, [ "lb2_item2" ], "addItemToSelect(1): ");
|
||||
|
||||
select.removeChildFromSelection(1);
|
||||
select.removeItemFromSelection(1);
|
||||
testSelectableSelection(select, [ ],
|
||||
"removeChildFromSelection(1): ");
|
||||
"removeItemFromSelection(1): ");
|
||||
|
||||
is(select.selectAllSelection(), true,
|
||||
is(select.selectAll(), true,
|
||||
"All items should be selected in listbox '" + id + "'");
|
||||
testSelectableSelection(select, [ "lb2_item1", "lb2_item2" ],
|
||||
"selectAllSelection: ");
|
||||
"selectAll: ");
|
||||
|
||||
select.clearSelection();
|
||||
testSelectableSelection(select, [ ], "clearSelection: ");
|
||||
select.unselectAll();
|
||||
testSelectableSelection(select, [ ], "unselectAll: ");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// listbox with headers
|
||||
|
||||
// XXX: addChildToSelection/removeChildFromSelection don't work correctly
|
||||
// XXX: addItemToSelection/removeItemFromSelection don't work correctly
|
||||
// on listboxes with headers because header is inserted into hierarchy
|
||||
// and child indexes that are used in these methods are shifted (see bug
|
||||
// 591939).
|
||||
todo(false,
|
||||
"Fix addChildToSelection/removeChildFromSelection on listboxes with headers.");
|
||||
"Fix addItemToSelection/removeItemFromSelection on listboxes with headers.");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
@ -43,20 +43,20 @@
|
||||
var select = getAccessible(comboboxList, [nsIAccessibleSelectable]);
|
||||
testSelectableSelection(select, [ "cb1_item1" ]);
|
||||
|
||||
select.addChildToSelection(1);
|
||||
testSelectableSelection(select, [ "cb1_item2" ], "addChildToSelect(1): ");
|
||||
select.addItemToSelection(1);
|
||||
testSelectableSelection(select, [ "cb1_item2" ], "addItemToSelection(1): ");
|
||||
|
||||
select.removeChildFromSelection(1);
|
||||
select.removeItemFromSelection(1);
|
||||
testSelectableSelection(select, [ ],
|
||||
"removeChildFromSelection(1): ");
|
||||
"removeItemFromSelection(1): ");
|
||||
|
||||
is(select.selectAllSelection(), false,
|
||||
is(select.selectAll(), false,
|
||||
"No way to select all items in combobox '" + id + "'");
|
||||
testSelectableSelection(select, [ ], "selectAllSelection: ");
|
||||
testSelectableSelection(select, [ ], "selectAll: ");
|
||||
|
||||
select.addChildToSelection(1);
|
||||
select.clearSelection();
|
||||
testSelectableSelection(select, [ ], "clearSelection: ");
|
||||
select.addItemToSelection(1);
|
||||
select.unselectAll();
|
||||
testSelectableSelection(select, [ ], "unselectAll: ");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
@ -37,22 +37,22 @@
|
||||
testSelectableSelection(select, [ "cb1_item1" ]);
|
||||
|
||||
// select 2nd item
|
||||
select.addChildToSelection(1);
|
||||
testSelectableSelection(select, [ "cb1_item2" ], "addChildToSelect(1): ");
|
||||
select.addItemToSelection(1);
|
||||
testSelectableSelection(select, [ "cb1_item2" ], "addItemToSelection(1): ");
|
||||
|
||||
// unselect 2nd item, 1st item gets selected automatically
|
||||
select.removeChildFromSelection(1);
|
||||
select.removeItemFromSelection(1);
|
||||
testSelectableSelection(select, [ "cb1_item1" ],
|
||||
"removeChildFromSelection(1): ");
|
||||
"removeItemFromSelection(1): ");
|
||||
|
||||
// doesn't change selection
|
||||
is(select.selectAllSelection(), false,
|
||||
is(select.selectAll(), false,
|
||||
"No way to select all items in combobox '" + id + "'");
|
||||
testSelectableSelection(select, [ "cb1_item1" ], "selectAllSelection: ");
|
||||
testSelectableSelection(select, [ "cb1_item1" ], "selectAll: ");
|
||||
|
||||
// doesn't change selection
|
||||
select.clearSelection();
|
||||
testSelectableSelection(select, [ "cb1_item1" ], "clearSelection: ");
|
||||
select.unselectAll();
|
||||
testSelectableSelection(select, [ "cb1_item1" ], "unselectAll: ");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// select@size="1" with optgroups
|
||||
@ -66,17 +66,17 @@
|
||||
select = getAccessible(comboboxList, [nsIAccessibleSelectable]);
|
||||
testSelectableSelection(select, [ "cb2_item1" ]);
|
||||
|
||||
select.addChildToSelection(1);
|
||||
select.addItemToSelection(1);
|
||||
testSelectableSelection(select, [ "cb2_item2" ]);
|
||||
|
||||
select.removeChildFromSelection(1);
|
||||
select.removeItemFromSelection(1);
|
||||
testSelectableSelection(select, [ "cb2_item1" ]);
|
||||
|
||||
is(select.selectAllSelection(), false,
|
||||
is(select.selectAll(), false,
|
||||
"No way to select all items in combobox " + id + "'");
|
||||
testSelectableSelection(select, [ "cb2_item1" ]);
|
||||
|
||||
select.clearSelection();
|
||||
select.unselectAll();
|
||||
testSelectableSelection(select, [ "cb2_item1" ]);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -90,22 +90,22 @@
|
||||
testSelectableSelection(select, [ ]);
|
||||
|
||||
// select 2nd item
|
||||
select.addChildToSelection(1);
|
||||
testSelectableSelection(select, [ "lb1_item2" ], "addChildToSelect(1): ");
|
||||
select.addItemToSelection(1);
|
||||
testSelectableSelection(select, [ "lb1_item2" ], "addItemToSelection(1): ");
|
||||
|
||||
// unselect 2nd item, 1st item gets selected automatically
|
||||
select.removeChildFromSelection(1);
|
||||
select.removeItemFromSelection(1);
|
||||
testSelectableSelection(select, [ ],
|
||||
"removeChildFromSelection(1): ");
|
||||
"removeItemFromSelection(1): ");
|
||||
|
||||
// doesn't change selection
|
||||
is(select.selectAllSelection(), false,
|
||||
is(select.selectAll(), false,
|
||||
"No way to select all items in single selectable listbox '" + id + "'");
|
||||
testSelectableSelection(select, [ ], "selectAllSelection: ");
|
||||
testSelectableSelection(select, [ ], "selectAll: ");
|
||||
|
||||
// doesn't change selection
|
||||
select.clearSelection();
|
||||
testSelectableSelection(select, [ ], "clearSelection: ");
|
||||
select.unselectAll();
|
||||
testSelectableSelection(select, [ ], "unselectAll: ");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// select@size="4" with optgroups, single selectable
|
||||
@ -117,17 +117,17 @@
|
||||
select = getAccessible(id, [nsIAccessibleSelectable]);
|
||||
testSelectableSelection(select, [ ]);
|
||||
|
||||
select.addChildToSelection(1);
|
||||
select.addItemToSelection(1);
|
||||
testSelectableSelection(select, [ "lb2_item2" ]);
|
||||
|
||||
select.removeChildFromSelection(1);
|
||||
select.removeItemFromSelection(1);
|
||||
testSelectableSelection(select, [ ]);
|
||||
|
||||
is(select.selectAllSelection(), false,
|
||||
is(select.selectAll(), false,
|
||||
"No way to select all items in single selectable listbox " + id + "'");
|
||||
testSelectableSelection(select, [ ]);
|
||||
|
||||
select.clearSelection();
|
||||
select.unselectAll();
|
||||
testSelectableSelection(select, [ ]);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -140,19 +140,19 @@
|
||||
select = getAccessible(id, [nsIAccessibleSelectable]);
|
||||
testSelectableSelection(select, [ ]);
|
||||
|
||||
select.addChildToSelection(0);
|
||||
testSelectableSelection(select, [ "lb3_item1" ], "addChildToSelection: ");
|
||||
select.addItemToSelection(0);
|
||||
testSelectableSelection(select, [ "lb3_item1" ], "addItemToSelection: ");
|
||||
|
||||
select.removeChildFromSelection(0);
|
||||
testSelectableSelection(select, [ ], "removeChildFromSelection: ");
|
||||
select.removeItemFromSelection(0);
|
||||
testSelectableSelection(select, [ ], "removeItemFromSelection: ");
|
||||
|
||||
is(select.selectAllSelection(), true,
|
||||
is(select.selectAll(), true,
|
||||
"All items in listbox '" + id + "' should be selected");
|
||||
testSelectableSelection(select, [ "lb3_item1", "lb3_item2"],
|
||||
"selectAllSelection: ");
|
||||
"selectAll: ");
|
||||
|
||||
select.clearSelection();
|
||||
testSelectableSelection(select, [ ], "clearSelection: ");
|
||||
select.unselectAll();
|
||||
testSelectableSelection(select, [ ], "unselectAll: ");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// select@size="4" multiselect with optgroups
|
||||
@ -164,17 +164,17 @@
|
||||
select = getAccessible(id, [nsIAccessibleSelectable]);
|
||||
testSelectableSelection(select, [ ]);
|
||||
|
||||
select.addChildToSelection(0);
|
||||
select.addItemToSelection(0);
|
||||
testSelectableSelection(select, [ "lb4_item1" ]);
|
||||
|
||||
select.removeChildFromSelection(0);
|
||||
select.removeItemFromSelection(0);
|
||||
testSelectableSelection(select, [ ]);
|
||||
|
||||
is(select.selectAllSelection(), true,
|
||||
is(select.selectAll(), true,
|
||||
"All items in listbox '" + id + "' should be selected");
|
||||
testSelectableSelection(select, [ "lb4_item1", "lb4_item2"]);
|
||||
|
||||
select.clearSelection();
|
||||
select.unselectAll();
|
||||
testSelectableSelection(select, [ ]);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
@ -53,13 +53,13 @@
|
||||
if (seltype != "single" && seltype != "cell" && seltype != "text")
|
||||
isTreeMultiSelectable = true;
|
||||
|
||||
// selectAllSelection
|
||||
// selectAll
|
||||
var accSelectable = getAccessible(this.DOMNode,
|
||||
[nsIAccessibleSelectable]);
|
||||
ok(accSelectable, "tree is not selectable!");
|
||||
if (accSelectable) {
|
||||
is(accSelectable.selectAllSelection(), isTreeMultiSelectable,
|
||||
"SelectAllSelection is not correct for seltype: " + seltype);
|
||||
is(accSelectable.selectAll(), isTreeMultiSelectable,
|
||||
"SelectAll is not correct for seltype: " + seltype);
|
||||
}
|
||||
|
||||
var selectedChildren = [];
|
||||
@ -72,29 +72,29 @@
|
||||
}
|
||||
}
|
||||
testSelectableSelection(accSelectable, selectedChildren,
|
||||
"selectAllSelection test. ");
|
||||
"selectAll test. ");
|
||||
|
||||
// clearSelection
|
||||
accSelectable.clearSelection();
|
||||
testSelectableSelection(accSelectable, [], "clearSelection test. ");
|
||||
// unselectAll
|
||||
accSelectable.unselectAll();
|
||||
testSelectableSelection(accSelectable, [], "unselectAll test. ");
|
||||
|
||||
// addChildToSelection
|
||||
accSelectable.addChildToSelection(1);
|
||||
accSelectable.addChildToSelection(3);
|
||||
// addItemToSelection
|
||||
accSelectable.addItemToSelection(1);
|
||||
accSelectable.addItemToSelection(3);
|
||||
|
||||
selectedChildren = isTreeMultiSelectable ?
|
||||
[ accSelectable.getChildAt(2), accSelectable.getChildAt(4) ] :
|
||||
[ accSelectable.getChildAt(2) ];
|
||||
testSelectableSelection(accSelectable, selectedChildren,
|
||||
"addChildToSelection test. ");
|
||||
"addItemToSelection test. ");
|
||||
|
||||
// removeChildFromSelection
|
||||
accSelectable.removeChildFromSelection(1);
|
||||
// removeItemFromSelection
|
||||
accSelectable.removeItemFromSelection(1);
|
||||
|
||||
selectedChildren = isTreeMultiSelectable ?
|
||||
[ accSelectable.getChildAt(4) ] : [ ];
|
||||
testSelectableSelection(accSelectable, selectedChildren,
|
||||
"removeChildFromSelection test. ");
|
||||
"removeItemFromSelection test. ");
|
||||
}
|
||||
|
||||
this.getID = function getID()
|
||||
|
@ -8,15 +8,10 @@
|
||||
//****************************************************************************//
|
||||
// Constants & Enumeration Values
|
||||
|
||||
/*
|
||||
#ifndef XP_MACOSX
|
||||
*/
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cr = Components.results;
|
||||
/*
|
||||
#endif
|
||||
*/
|
||||
|
||||
Components.utils.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
|
||||
@ -159,14 +154,14 @@ function isFeedType(t) {
|
||||
* This object wraps nsIHandlerInfo with some additional functionality
|
||||
* the Applications prefpane needs to display and allow modification of
|
||||
* the list of handled types.
|
||||
*
|
||||
*
|
||||
* We create an instance of this wrapper for each entry we might display
|
||||
* in the prefpane, and we compose the instances from various sources,
|
||||
* including navigator.plugins and the handler service.
|
||||
* including plugins and the handler service.
|
||||
*
|
||||
* We don't implement all the original nsIHandlerInfo functionality,
|
||||
* just the stuff that the prefpane needs.
|
||||
*
|
||||
*
|
||||
* In theory, all of the custom functionality in this wrapper should get
|
||||
* pushed down into nsIHandlerInfo eventually.
|
||||
*/
|
||||
@ -276,7 +271,7 @@ HandlerInfoWrapper.prototype = {
|
||||
// What to do with content of this type.
|
||||
get preferredAction() {
|
||||
// If we have an enabled plugin, then the action is to use that plugin.
|
||||
if (this.plugin && !this.isDisabledPluginType)
|
||||
if (this.pluginName && !this.isDisabledPluginType)
|
||||
return kActionUsePlugin;
|
||||
|
||||
// If the action is to use a helper app, but we don't have a preferred
|
||||
@ -312,7 +307,7 @@ HandlerInfoWrapper.prototype = {
|
||||
// of any user configuration, and the default in that case is to always ask,
|
||||
// even though we never ask for content handled by a plugin, so special case
|
||||
// plugin-handled types by returning false here.
|
||||
if (this.plugin && this.handledOnlyByPlugin)
|
||||
if (this.pluginName && this.handledOnlyByPlugin)
|
||||
return false;
|
||||
|
||||
// If this is a protocol type and the preferred action is "save to disk",
|
||||
@ -1092,10 +1087,17 @@ var gApplicationsPane = {
|
||||
* check the pref ourselves to find out if it's enabled.
|
||||
*/
|
||||
_loadPluginHandlers: function() {
|
||||
for (let i = 0; i < navigator.plugins.length; ++i) {
|
||||
let plugin = navigator.plugins[i];
|
||||
for (let j = 0; j < plugin.length; ++j) {
|
||||
let type = plugin[j].type;
|
||||
"use strict";
|
||||
|
||||
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
||||
let pluginTags = pluginHost.getPluginTags();
|
||||
|
||||
for (let i = 0; i < pluginTags.length; ++i) {
|
||||
let pluginTag = pluginTags[i];
|
||||
|
||||
let mimeTypes = pluginTag.getMimeTypes();
|
||||
for (let j = 0; j < mimeTypes.length; ++j) {
|
||||
let type = mimeTypes[j];
|
||||
|
||||
let handlerInfoWrapper;
|
||||
if (type in this._handledTypes)
|
||||
@ -1108,7 +1110,7 @@ var gApplicationsPane = {
|
||||
this._handledTypes[type] = handlerInfoWrapper;
|
||||
}
|
||||
|
||||
handlerInfoWrapper.plugin = plugin;
|
||||
handlerInfoWrapper.pluginName = pluginTag.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1302,7 +1304,7 @@ var gApplicationsPane = {
|
||||
|
||||
case kActionUsePlugin:
|
||||
return this._prefsBundle.getFormattedString("usePluginIn",
|
||||
[aHandlerInfo.plugin.name,
|
||||
[aHandlerInfo.pluginName,
|
||||
this._brandShortName]);
|
||||
}
|
||||
},
|
||||
@ -1484,11 +1486,11 @@ var gApplicationsPane = {
|
||||
}
|
||||
|
||||
// Create a menu item for the plugin.
|
||||
if (handlerInfo.plugin) {
|
||||
if (handlerInfo.pluginName) {
|
||||
var pluginMenuItem = document.createElement("menuitem");
|
||||
pluginMenuItem.setAttribute("action", kActionUsePlugin);
|
||||
let label = this._prefsBundle.getFormattedString("usePluginIn",
|
||||
[handlerInfo.plugin.name,
|
||||
[handlerInfo.pluginName,
|
||||
this._brandShortName]);
|
||||
pluginMenuItem.setAttribute("label", label);
|
||||
pluginMenuItem.setAttribute("tooltiptext", label);
|
||||
@ -1651,7 +1653,7 @@ var gApplicationsPane = {
|
||||
// Set the plugin state if we're enabling or disabling a plugin.
|
||||
if (action == kActionUsePlugin)
|
||||
handlerInfo.enablePluginType();
|
||||
else if (handlerInfo.plugin && !handlerInfo.isDisabledPluginType)
|
||||
else if (handlerInfo.pluginName && !handlerInfo.isDisabledPluginType)
|
||||
handlerInfo.disablePluginType();
|
||||
|
||||
// Set the preferred application handler.
|
||||
|
@ -146,14 +146,14 @@ function isFeedType(t) {
|
||||
* This object wraps nsIHandlerInfo with some additional functionality
|
||||
* the Applications prefpane needs to display and allow modification of
|
||||
* the list of handled types.
|
||||
*
|
||||
*
|
||||
* We create an instance of this wrapper for each entry we might display
|
||||
* in the prefpane, and we compose the instances from various sources,
|
||||
* including navigator.plugins and the handler service.
|
||||
* including plugins and the handler service.
|
||||
*
|
||||
* We don't implement all the original nsIHandlerInfo functionality,
|
||||
* just the stuff that the prefpane needs.
|
||||
*
|
||||
*
|
||||
* In theory, all of the custom functionality in this wrapper should get
|
||||
* pushed down into nsIHandlerInfo eventually.
|
||||
*/
|
||||
@ -263,7 +263,7 @@ HandlerInfoWrapper.prototype = {
|
||||
// What to do with content of this type.
|
||||
get preferredAction() {
|
||||
// If we have an enabled plugin, then the action is to use that plugin.
|
||||
if (this.plugin && !this.isDisabledPluginType)
|
||||
if (this.pluginName && !this.isDisabledPluginType)
|
||||
return kActionUsePlugin;
|
||||
|
||||
// If the action is to use a helper app, but we don't have a preferred
|
||||
@ -299,7 +299,7 @@ HandlerInfoWrapper.prototype = {
|
||||
// of any user configuration, and the default in that case is to always ask,
|
||||
// even though we never ask for content handled by a plugin, so special case
|
||||
// plugin-handled types by returning false here.
|
||||
if (this.plugin && this.handledOnlyByPlugin)
|
||||
if (this.pluginName && this.handledOnlyByPlugin)
|
||||
return false;
|
||||
|
||||
// If this is a protocol type and the preferred action is "save to disk",
|
||||
@ -1079,10 +1079,17 @@ var gApplicationsPane = {
|
||||
* check the pref ourselves to find out if it's enabled.
|
||||
*/
|
||||
_loadPluginHandlers: function() {
|
||||
for (let i = 0; i < navigator.plugins.length; ++i) {
|
||||
let plugin = navigator.plugins[i];
|
||||
for (let j = 0; j < plugin.length; ++j) {
|
||||
let type = plugin[j].type;
|
||||
"use strict";
|
||||
|
||||
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
||||
let pluginTags = pluginHost.getPluginTags();
|
||||
|
||||
for (let i = 0; i < pluginTags.length; ++i) {
|
||||
let pluginTag = pluginTags[i];
|
||||
|
||||
let mimeTypes = pluginTag.getMimeTypes();
|
||||
for (let j = 0; j < mimeTypes.length; ++j) {
|
||||
let type = mimeTypes[j];
|
||||
|
||||
let handlerInfoWrapper;
|
||||
if (type in this._handledTypes)
|
||||
@ -1095,7 +1102,7 @@ var gApplicationsPane = {
|
||||
this._handledTypes[type] = handlerInfoWrapper;
|
||||
}
|
||||
|
||||
handlerInfoWrapper.plugin = plugin;
|
||||
handlerInfoWrapper.pluginName = pluginTag.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1289,7 +1296,7 @@ var gApplicationsPane = {
|
||||
|
||||
case kActionUsePlugin:
|
||||
return this._prefsBundle.getFormattedString("usePluginIn",
|
||||
[aHandlerInfo.plugin.name,
|
||||
[aHandlerInfo.pluginName,
|
||||
this._brandShortName]);
|
||||
}
|
||||
},
|
||||
@ -1471,11 +1478,11 @@ var gApplicationsPane = {
|
||||
}
|
||||
|
||||
// Create a menu item for the plugin.
|
||||
if (handlerInfo.plugin) {
|
||||
if (handlerInfo.pluginName) {
|
||||
var pluginMenuItem = document.createElement("menuitem");
|
||||
pluginMenuItem.setAttribute("action", kActionUsePlugin);
|
||||
let label = this._prefsBundle.getFormattedString("usePluginIn",
|
||||
[handlerInfo.plugin.name,
|
||||
[handlerInfo.pluginName,
|
||||
this._brandShortName]);
|
||||
pluginMenuItem.setAttribute("label", label);
|
||||
pluginMenuItem.setAttribute("tooltiptext", label);
|
||||
@ -1638,7 +1645,7 @@ var gApplicationsPane = {
|
||||
// Set the plugin state if we're enabling or disabling a plugin.
|
||||
if (action == kActionUsePlugin)
|
||||
handlerInfo.enablePluginType();
|
||||
else if (handlerInfo.plugin && !handlerInfo.isDisabledPluginType)
|
||||
else if (handlerInfo.pluginName && !handlerInfo.isDisabledPluginType)
|
||||
handlerInfo.disablePluginType();
|
||||
|
||||
// Set the preferred application handler.
|
||||
|
31
configure.in
31
configure.in
@ -5516,19 +5516,19 @@ if test -n "$MOZ_OPUS"; then
|
||||
AC_DEFINE(MOZ_OPUS)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Check alsa availability on Linux if using sydneyaudio
|
||||
dnl ========================================================
|
||||
dnl ====================================================
|
||||
dnl = Check alsa availability on Linux if using libcubeb
|
||||
dnl ====================================================
|
||||
|
||||
dnl If using sydneyaudio with Linux, ensure that the alsa library is available
|
||||
dnl If using libcubeb with Linux, ensure that the alsa library is available
|
||||
if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux"; then
|
||||
MOZ_ALSA=1
|
||||
fi
|
||||
|
||||
MOZ_ARG_ENABLE_BOOL(alsa,
|
||||
[ --enable-alsa Enable Alsa support (default on Linux)],
|
||||
MOZ_ALSA=1,
|
||||
MOZ_ALSA=)
|
||||
MOZ_ALSA=1,
|
||||
MOZ_ALSA=)
|
||||
|
||||
if test -n "$MOZ_ALSA"; then
|
||||
AC_DEFINE(MOZ_CUBEB)
|
||||
@ -5542,13 +5542,18 @@ AC_SUBST(MOZ_ALSA_CFLAGS)
|
||||
AC_SUBST(MOZ_ALSA_LIBS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable PulseAudio
|
||||
dnl = Disable PulseAudio
|
||||
dnl ========================================================
|
||||
|
||||
MOZ_ARG_ENABLE_BOOL(pulseaudio,
|
||||
[ --enable-pulseaudio Enable PulseAudio support (experimental)],
|
||||
MOZ_PULSEAUDIO=1,
|
||||
MOZ_PULSEAUDIO=)
|
||||
dnl If using libcubeb with Linux, ensure that the PA library is available
|
||||
if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux" -a -z "$MOZ_B2G"; then
|
||||
MOZ_PULSEAUDIO=1
|
||||
fi
|
||||
|
||||
MOZ_ARG_DISABLE_BOOL(pulseaudio,
|
||||
[ --disable-pulseaudio Disable PulseAudio support],
|
||||
MOZ_PULSEAUDIO=,
|
||||
MOZ_PULSEAUDIO=1)
|
||||
|
||||
if test -n "$MOZ_PULSEAUDIO"; then
|
||||
AC_DEFINE(MOZ_CUBEB)
|
||||
@ -5558,13 +5563,11 @@ if test -n "$MOZ_PULSEAUDIO"; then
|
||||
AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
|
||||
else
|
||||
MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
|
||||
MOZ_PULSEAUDIO_LIBS="-lpulse"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(MOZ_PULSEAUDIO)
|
||||
AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
|
||||
AC_SUBST(MOZ_PULSEAUDIO_LIBS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable GStreamer
|
||||
@ -9129,7 +9132,7 @@ MOZ_ARG_WITH_STRING(intl-api,
|
||||
but doesn't use ICU or expose the API to script. The third doesn't build
|
||||
ICU at all.],
|
||||
WITH_INTL="--with-intl-api=$withval"
|
||||
])
|
||||
)
|
||||
if test -z "$WITH_INTL"; then
|
||||
if test "$MOZ_BUILD_APP" = "browser"; then
|
||||
WITH_INTL="--with-intl-api"
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "nsMathUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "ActiveLayerTracker.h"
|
||||
|
||||
#ifdef MOZ_WEBGL
|
||||
#include "../canvas/src/WebGL2Context.h"
|
||||
@ -835,7 +836,7 @@ HTMLCanvasElement::InvalidateCanvasContent(const gfx::Rect* damageRect)
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
frame->MarkLayersActive(nsChangeHint(0));
|
||||
ActiveLayerTracker::NotifyContentChange(frame);
|
||||
|
||||
Layer* layer = nullptr;
|
||||
if (damageRect) {
|
||||
|
@ -323,11 +323,12 @@ MediaSource::EndOfStreamInternal(const Optional<MediaSourceEndOfStreamError>& aE
|
||||
}
|
||||
}
|
||||
|
||||
static const char* const gMediaSourceTypes[5] = {
|
||||
static const char* const gMediaSourceTypes[6] = {
|
||||
"video/webm",
|
||||
"audio/webm",
|
||||
"video/mp4",
|
||||
"audio/mp4",
|
||||
"audio/mpeg",
|
||||
nullptr
|
||||
};
|
||||
|
||||
|
@ -4,12 +4,15 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/SVGCircleElement.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "gfxContext.h"
|
||||
#include "mozilla/dom/SVGCircleElementBinding.h"
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Circle)
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@ -90,5 +93,20 @@ SVGCircleElement::ConstructPath(gfxContext *aCtx)
|
||||
aCtx->Arc(gfxPoint(x, y), r, 0, 2*M_PI);
|
||||
}
|
||||
|
||||
TemporaryRef<Path>
|
||||
SVGCircleElement::BuildPath()
|
||||
{
|
||||
RefPtr<PathBuilder> pathBuilder = CreatePathBuilder();
|
||||
|
||||
float x, y, r;
|
||||
GetAnimatedLengthValues(&x, &y, &r, nullptr);
|
||||
|
||||
if (r > 0.0f) {
|
||||
pathBuilder->Arc(Point(x, y), r, 0, Float(2*M_PI));
|
||||
}
|
||||
|
||||
return pathBuilder->Finish();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
|
||||
virtual TemporaryRef<Path> BuildPath() MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
||||
|
||||
|
@ -565,3 +565,25 @@ SVGContentUtils::ParseInteger(const nsAString& aString,
|
||||
int64_t(std::numeric_limits<int32_t>::max())));
|
||||
return true;
|
||||
}
|
||||
|
||||
float
|
||||
SVGContentUtils::CoordToFloat(nsPresContext *aPresContext,
|
||||
nsSVGElement *aContent,
|
||||
const nsStyleCoord &aCoord)
|
||||
{
|
||||
switch (aCoord.GetUnit()) {
|
||||
case eStyleUnit_Factor:
|
||||
// user units
|
||||
return aCoord.GetFactorValue();
|
||||
|
||||
case eStyleUnit_Coord:
|
||||
return nsPresContext::AppUnitsToFloatCSSPixels(aCoord.GetCoordValue());
|
||||
|
||||
case eStyleUnit_Percent: {
|
||||
SVGSVGElement* ctx = aContent->GetCtx();
|
||||
return ctx ? aCoord.GetPercentValue() * ctx->GetLength(SVGContentUtils::XY) : 0.0f;
|
||||
}
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,9 @@
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIFrame;
|
||||
class nsPresContext;
|
||||
class nsStyleContext;
|
||||
class nsStyleCoord;
|
||||
class nsSVGElement;
|
||||
|
||||
namespace mozilla {
|
||||
@ -169,6 +171,15 @@ public:
|
||||
*/
|
||||
static bool
|
||||
ParseInteger(const nsAString& aString, int32_t& aValue);
|
||||
|
||||
/**
|
||||
* Converts an nsStyleCoord into a userspace value. Handles units
|
||||
* Factor (straight userspace), Coord (dimensioned), and Percent (of
|
||||
* aContent's SVG viewport)
|
||||
*/
|
||||
static float CoordToFloat(nsPresContext *aPresContext,
|
||||
nsSVGElement *aContent,
|
||||
const nsStyleCoord &aCoord);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -5,10 +5,14 @@
|
||||
|
||||
#include "mozilla/dom/SVGEllipseElement.h"
|
||||
#include "mozilla/dom/SVGEllipseElementBinding.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include "gfxContext.h"
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Ellipse)
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@ -100,5 +104,20 @@ SVGEllipseElement::ConstructPath(gfxContext *aCtx)
|
||||
}
|
||||
}
|
||||
|
||||
TemporaryRef<Path>
|
||||
SVGEllipseElement::BuildPath()
|
||||
{
|
||||
RefPtr<PathBuilder> pathBuilder = CreatePathBuilder();
|
||||
|
||||
float x, y, rx, ry;
|
||||
GetAnimatedLengthValues(&x, &y, &rx, &ry, nullptr);
|
||||
|
||||
if (rx > 0.0f && ry > 0.0f) {
|
||||
AppendEllipseToPath(pathBuilder, Point(x, y), Size(2.0*rx, 2.0*ry));
|
||||
}
|
||||
|
||||
return pathBuilder->Finish();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
|
||||
virtual TemporaryRef<Path> BuildPath() MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "mozilla/dom/SVGImageElement.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
@ -16,6 +17,8 @@
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Image)
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@ -236,6 +239,29 @@ SVGImageElement::ConstructPath(gfxContext *aCtx)
|
||||
aCtx->Rectangle(gfxRect(x, y, width, height));
|
||||
}
|
||||
|
||||
TemporaryRef<Path>
|
||||
SVGImageElement::BuildPath()
|
||||
{
|
||||
// We get called in order to get bounds for this element, and for
|
||||
// hit-testing against it. For that we just pretend to be a rectangle.
|
||||
|
||||
RefPtr<PathBuilder> pathBuilder = CreatePathBuilder();
|
||||
|
||||
float x, y, width, height;
|
||||
GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
|
||||
|
||||
if (width <= 0 || height <= 0) {
|
||||
Rect r(x, y, width, height);
|
||||
pathBuilder->MoveTo(r.TopLeft());
|
||||
pathBuilder->LineTo(r.TopRight());
|
||||
pathBuilder->LineTo(r.BottomRight());
|
||||
pathBuilder->LineTo(r.BottomLeft());
|
||||
pathBuilder->Close();
|
||||
}
|
||||
|
||||
return pathBuilder->Finish();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
|
||||
virtual TemporaryRef<Path> BuildPath() MOZ_OVERRIDE;
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const MOZ_OVERRIDE;
|
||||
|
@ -5,10 +5,13 @@
|
||||
|
||||
#include "mozilla/dom/SVGLineElement.h"
|
||||
#include "mozilla/dom/SVGLineElementBinding.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "gfxContext.h"
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Line)
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@ -115,5 +118,19 @@ SVGLineElement::ConstructPath(gfxContext *aCtx)
|
||||
aCtx->LineTo(gfxPoint(x2, y2));
|
||||
}
|
||||
|
||||
TemporaryRef<Path>
|
||||
SVGLineElement::BuildPath()
|
||||
{
|
||||
RefPtr<PathBuilder> pathBuilder = CreatePathBuilder();
|
||||
|
||||
float x1, y1, x2, y2;
|
||||
GetAnimatedLengthValues(&x1, &y1, &x2, &y2, nullptr);
|
||||
|
||||
pathBuilder->MoveTo(Point(x1, y1));
|
||||
pathBuilder->LineTo(Point(x2, y2));
|
||||
|
||||
return pathBuilder->Finish();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
virtual bool IsMarkable() MOZ_OVERRIDE { return true; }
|
||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
|
||||
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
|
||||
virtual TemporaryRef<Path> BuildPath() MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsSVGPathDataParser.h"
|
||||
#include "nsSVGPathGeometryElement.h" // for nsSVGMark
|
||||
#include <stdarg.h>
|
||||
#include "nsStyleConsts.h"
|
||||
#include "SVGContentUtils.h"
|
||||
#include "SVGPathSegUtils.h"
|
||||
#include "gfxContext.h"
|
||||
@ -217,18 +218,51 @@ SVGPathData::GetPathSegAtLength(float aDistance) const
|
||||
*
|
||||
* Cairo only does this for |stroke-linecap: round| and not for
|
||||
* |stroke-linecap: square| (since that's what Adobe Acrobat has always done).
|
||||
* Most likely the other backends that DrawTarget uses have the same behavior.
|
||||
*
|
||||
* To help us conform to the SVG spec we have this helper function to draw an
|
||||
* approximation of square caps for zero length subpaths. It does this by
|
||||
* inserting a subpath containing a single axis aligned straight line that is
|
||||
* as small as it can be without cairo throwing it away for being too small to
|
||||
* affect rendering. Cairo will then draw stroke caps for this axis aligned
|
||||
* line, creating an axis aligned rectangle (approximating the square that
|
||||
* would ideally be drawn).
|
||||
* inserting a subpath containing a single user space axis aligned straight
|
||||
* line that is as small as it can be while minimizing the risk of it being
|
||||
* thrown away by the DrawTarget's backend for being too small to affect
|
||||
* rendering. The idea is that we'll then get stroke caps drawn for this axis
|
||||
* aligned line, creating an axis aligned rectangle that approximates the
|
||||
* square that would ideally be drawn.
|
||||
*
|
||||
* Since we don't have any information about transforms from user space to
|
||||
* device space, we choose the length of the small line that we insert by
|
||||
* making it a small percentage of the stroke width of the path. This should
|
||||
* hopefully allow us to make the line as long as possible (to avoid rounding
|
||||
* issues in the backend resulting in the backend seeing it as having zero
|
||||
* length) while still avoiding the small rectangle being noticably different
|
||||
* from a square.
|
||||
*
|
||||
* Note that this function inserts a subpath into the current gfx path that
|
||||
* will be present during both fill and stroke operations.
|
||||
*/
|
||||
static void
|
||||
ApproximateZeroLengthSubpathSquareCaps(PathBuilder* aPB,
|
||||
const Point& aPoint,
|
||||
Float aStrokeWidth)
|
||||
{
|
||||
// Note that caps are proportional to stroke width, so if stroke width is
|
||||
// zero it's actually fine for |tinyLength| below to end up being zero.
|
||||
// However, it would be a waste to inserting a LineTo in that case, so better
|
||||
// not to.
|
||||
MOZ_ASSERT(aStrokeWidth > 0.0f,
|
||||
"Make the caller check for this, or check it here");
|
||||
|
||||
// The fraction of the stroke width that we choose for the length of the
|
||||
// line is rather arbitrary, other than being chosen to meet the requirements
|
||||
// described in the comment above.
|
||||
|
||||
Float tinyLength = aStrokeWidth / 32;
|
||||
|
||||
aPB->MoveTo(aPoint);
|
||||
aPB->LineTo(aPoint + Point(tinyLength, 0));
|
||||
aPB->MoveTo(aPoint);
|
||||
}
|
||||
|
||||
static void
|
||||
ApproximateZeroLengthSubpathSquareCaps(const gfxPoint &aPoint, gfxContext *aCtx)
|
||||
{
|
||||
@ -244,32 +278,12 @@ ApproximateZeroLengthSubpathSquareCaps(const gfxPoint &aPoint, gfxContext *aCtx)
|
||||
aCtx->MoveTo(aPoint);
|
||||
}
|
||||
|
||||
static void
|
||||
ApproximateZeroLengthSubpathSquareCaps(const Point& aPoint,
|
||||
DrawTarget* aDT,
|
||||
PathBuilder* aPB)
|
||||
{
|
||||
// Cairo's fixed point fractional part is 8 bits wide, so its device space
|
||||
// coordinate granularity is 1/256 pixels. However, to prevent user space
|
||||
// |aPoint| and |aPoint + tinyAdvance| being rounded to the same device
|
||||
// coordinates, we double this for |tinyAdvance|:
|
||||
|
||||
Matrix currentTransform = aDT->GetTransform();
|
||||
currentTransform.Invert();
|
||||
Size tinyAdvance = currentTransform * Size(2.0/256.0, 0.0);
|
||||
|
||||
aPB->MoveTo(aPoint);
|
||||
aPB->LineTo(aPoint + Point(tinyAdvance.width, tinyAdvance.height));
|
||||
aPB->MoveTo(aPoint);
|
||||
}
|
||||
|
||||
#define MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS_TO_DT \
|
||||
do { \
|
||||
if (capsAreSquare && !subpathHasLength && subpathContainsNonArc && \
|
||||
SVGPathSegUtils::IsValidType(prevSegType) && \
|
||||
(!IsMoveto(prevSegType) || \
|
||||
segType == PATHSEG_CLOSEPATH)) { \
|
||||
ApproximateZeroLengthSubpathSquareCaps(segStart, aDT, builder); \
|
||||
if (capsAreSquare && !subpathHasLength && aStrokeWidth > 0 && \
|
||||
subpathContainsNonArc && SVGPathSegUtils::IsValidType(prevSegType) && \
|
||||
(!IsMoveto(prevSegType) || segType == PATHSEG_CLOSEPATH)) { \
|
||||
ApproximateZeroLengthSubpathSquareCaps(builder, segStart, aStrokeWidth);\
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
@ -284,17 +298,23 @@ ApproximateZeroLengthSubpathSquareCaps(const Point& aPoint,
|
||||
} while(0)
|
||||
|
||||
TemporaryRef<Path>
|
||||
SVGPathData::ConstructPath(DrawTarget *aDT,
|
||||
FillRule aFillRule,
|
||||
CapStyle aCapStyle) const
|
||||
SVGPathData::BuildPath(FillRule aFillRule,
|
||||
uint8_t aStrokeLineCap,
|
||||
Float aStrokeWidth) const
|
||||
{
|
||||
if (mData.IsEmpty() || !IsMoveto(SVGPathSegUtils::DecodeType(mData[0]))) {
|
||||
return nullptr; // paths without an initial moveto are invalid
|
||||
}
|
||||
|
||||
RefPtr<PathBuilder> builder = aDT->CreatePathBuilder(aFillRule);
|
||||
RefPtr<DrawTarget> drawTarget =
|
||||
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
||||
NS_ASSERTION(gfxPlatform::GetPlatform()->
|
||||
SupportsAzureContentForDrawTarget(drawTarget),
|
||||
"Should support Moz2D content drawing");
|
||||
|
||||
bool capsAreSquare = aCapStyle == CAP_SQUARE;
|
||||
RefPtr<PathBuilder> builder = drawTarget->CreatePathBuilder(aFillRule);
|
||||
|
||||
bool capsAreSquare = aStrokeLineCap == NS_STYLE_STROKE_LINECAP_SQUARE;
|
||||
bool subpathHasLength = false; // visual length
|
||||
bool subpathContainsNonArc = false;
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "nsINode.h"
|
||||
#include "nsIWeakReferenceUtils.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/Types.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsTArray.h"
|
||||
@ -85,6 +86,7 @@ class SVGPathData
|
||||
typedef gfx::DrawTarget DrawTarget;
|
||||
typedef gfx::Path Path;
|
||||
typedef gfx::FillRule FillRule;
|
||||
typedef gfx::Float Float;
|
||||
typedef gfx::CapStyle CapStyle;
|
||||
|
||||
public:
|
||||
@ -161,9 +163,9 @@ public:
|
||||
ToPath(const gfxMatrix& aMatrix) const;
|
||||
|
||||
void ConstructPath(gfxContext *aCtx) const;
|
||||
TemporaryRef<Path> ConstructPath(DrawTarget* aDT,
|
||||
FillRule aFillRule,
|
||||
CapStyle aCapStyle) const;
|
||||
TemporaryRef<Path> BuildPath(FillRule aFillRule,
|
||||
uint8_t aCapStyle,
|
||||
Float aStrokeWidth) const;
|
||||
|
||||
const_iterator begin() const { return mData.Elements(); }
|
||||
const_iterator end() const { return mData.Elements() + mData.Length(); }
|
||||
|
@ -13,12 +13,18 @@
|
||||
#include "gfxPath.h"
|
||||
#include "mozilla/dom/SVGPathElementBinding.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsComputedDOMStyle.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "SVGContentUtils.h"
|
||||
|
||||
class gfxContext;
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Path)
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@ -350,5 +356,43 @@ SVGPathElement::GetPathLengthScale(PathLengthScaleForType aFor)
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
TemporaryRef<Path>
|
||||
SVGPathElement::BuildPath()
|
||||
{
|
||||
// The Moz2D PathBuilder that our SVGPathData will be using only cares about
|
||||
// the fill rule. However, in order to fulfill the requirements of the SVG
|
||||
// spec regarding zero length sub-paths when square line caps are in use,
|
||||
// SVGPathData needs to know our stroke-linecap style and, if "square", then
|
||||
// also our stroke width. See the comment for
|
||||
// ApproximateZeroLengthSubpathSquareCaps for more info.
|
||||
|
||||
uint8_t strokeLineCap = NS_STYLE_STROKE_LINECAP_BUTT;
|
||||
Float strokeWidth = 0;
|
||||
|
||||
nsRefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr, nullptr);
|
||||
if (styleContext) {
|
||||
const nsStyleSVG* style = styleContext->StyleSVG();
|
||||
// Note: the path that we return may be used for hit-testing, and SVG
|
||||
// exposes hit-testing of strokes that are not actually painted. For that
|
||||
// reason we do not check for eStyleSVGPaintType_None or check the stroke
|
||||
// opacity here.
|
||||
if (style->mStrokeLinecap == NS_STYLE_STROKE_LINECAP_SQUARE) {
|
||||
strokeLineCap = style->mStrokeLinecap;
|
||||
strokeWidth = GetStrokeWidth();
|
||||
}
|
||||
}
|
||||
|
||||
// The fill rule that we pass must be the current
|
||||
// computed value of our CSS 'fill-rule' property if the path that we return
|
||||
// will be used for painting or hit-testing. For all other uses (bounds
|
||||
// calculatons, length measurement, position-at-offset calculations) the fill
|
||||
// rule that we pass doesn't matter. As a result we can just pass the current
|
||||
// computed value regardless of who's calling us, or what they're going to do
|
||||
// with the path that we return.
|
||||
|
||||
return mD.GetAnimValue().BuildPath(GetFillRule(), strokeLineCap, strokeWidth);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
virtual bool IsMarkable() MOZ_OVERRIDE;
|
||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
|
||||
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
|
||||
virtual TemporaryRef<Path> BuildPath() MOZ_OVERRIDE;
|
||||
|
||||
virtual already_AddRefed<gfxPath> GetPath(const gfxMatrix &aMatrix) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "gfxPoint.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -18,6 +19,8 @@ namespace mozilla {
|
||||
*/
|
||||
class SVGPoint
|
||||
{
|
||||
typedef mozilla::gfx::Point Point;
|
||||
|
||||
public:
|
||||
|
||||
SVGPoint()
|
||||
@ -57,6 +60,10 @@ public:
|
||||
return gfxPoint(mX, mY);
|
||||
}
|
||||
|
||||
operator Point() const {
|
||||
return Point(mX, mY);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool IsValid() const {
|
||||
return NS_finite(mX) && NS_finite(mY);
|
||||
|
@ -7,10 +7,14 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "gfxContext.h"
|
||||
#include "mozilla/dom/SVGRectElementBinding.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include <algorithm>
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Rect)
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@ -148,5 +152,51 @@ SVGRectElement::ConstructPath(gfxContext *aCtx)
|
||||
gfxCornerSizes(corner, corner, corner, corner));
|
||||
}
|
||||
|
||||
TemporaryRef<Path>
|
||||
SVGRectElement::BuildPath()
|
||||
{
|
||||
RefPtr<PathBuilder> pathBuilder = CreatePathBuilder();
|
||||
|
||||
float x, y, width, height, rx, ry;
|
||||
GetAnimatedLengthValues(&x, &y, &width, &height, &rx, &ry, nullptr);
|
||||
|
||||
if (width > 0 && height > 0) {
|
||||
rx = std::max(rx, 0.0f);
|
||||
ry = std::max(ry, 0.0f);
|
||||
|
||||
if (rx == 0 && ry == 0) {
|
||||
// Optimization for the no rounded corners case.
|
||||
Rect r(x, y, width, height);
|
||||
pathBuilder->MoveTo(r.TopLeft());
|
||||
pathBuilder->LineTo(r.TopRight());
|
||||
pathBuilder->LineTo(r.BottomRight());
|
||||
pathBuilder->LineTo(r.BottomLeft());
|
||||
pathBuilder->Close();
|
||||
} else {
|
||||
// If either the 'rx' or the 'ry' attribute isn't set, then we have to
|
||||
// set it to the value of the other:
|
||||
bool hasRx = mLengthAttributes[ATTR_RX].IsExplicitlySet();
|
||||
bool hasRy = mLengthAttributes[ATTR_RY].IsExplicitlySet();
|
||||
MOZ_ASSERT(hasRx || hasRy);
|
||||
|
||||
if (hasRx && !hasRy) {
|
||||
ry = rx;
|
||||
} else if (hasRy && !hasRx) {
|
||||
rx = ry;
|
||||
}
|
||||
|
||||
// Clamp rx and ry to half the rect's width and height respectively:
|
||||
rx = std::min(rx, width / 2);
|
||||
ry = std::min(ry, height / 2);
|
||||
|
||||
Size cornerRadii(rx, ry);
|
||||
Size radii[] = { cornerRadii, cornerRadii, cornerRadii, cornerRadii };
|
||||
AppendRoundedRectToPath(pathBuilder, Rect(x, y, width, height), radii);
|
||||
}
|
||||
}
|
||||
|
||||
return pathBuilder->Finish();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
|
||||
virtual TemporaryRef<Path> BuildPath() MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
||||
|
||||
|
@ -4,7 +4,15 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsSVGPathGeometryElement.h"
|
||||
|
||||
#include "gfxPlatform.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "nsComputedDOMStyle.h"
|
||||
#include "nsSVGLength2.h"
|
||||
#include "SVGContentUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
@ -57,3 +65,61 @@ nsSVGPathGeometryElement::GetPath(const gfxMatrix &aMatrix)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TemporaryRef<PathBuilder>
|
||||
nsSVGPathGeometryElement::CreatePathBuilder()
|
||||
{
|
||||
RefPtr<DrawTarget> drawTarget =
|
||||
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
||||
NS_ASSERTION(gfxPlatform::GetPlatform()->
|
||||
SupportsAzureContentForDrawTarget(drawTarget),
|
||||
"Should support Moz2D content drawing");
|
||||
|
||||
// The fill rule that we pass to CreatePathBuilder must be the current
|
||||
// computed value of our CSS 'fill-rule' property if the path that we return
|
||||
// will be used for painting or hit-testing. For all other uses (bounds
|
||||
// calculatons, length measurement, position-at-offset calculations) the fill
|
||||
// rule that we pass doesn't matter. As a result we can just pass the current
|
||||
// computed value regardless of who's calling us, or what they're going to do
|
||||
// with the path that we return.
|
||||
|
||||
return drawTarget->CreatePathBuilder(GetFillRule());
|
||||
}
|
||||
|
||||
FillRule
|
||||
nsSVGPathGeometryElement::GetFillRule()
|
||||
{
|
||||
FillRule fillRule = FILL_WINDING; // Equivalent to NS_STYLE_FILL_RULE_NONZERO
|
||||
|
||||
nsRefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr,
|
||||
nullptr);
|
||||
|
||||
if (styleContext) {
|
||||
MOZ_ASSERT(styleContext->StyleSVG()->mFillRule ==
|
||||
NS_STYLE_FILL_RULE_NONZERO ||
|
||||
styleContext->StyleSVG()->mFillRule ==
|
||||
NS_STYLE_FILL_RULE_EVENODD);
|
||||
|
||||
if (styleContext->StyleSVG()->mFillRule == NS_STYLE_FILL_RULE_EVENODD) {
|
||||
fillRule = FILL_EVEN_ODD;
|
||||
}
|
||||
} else {
|
||||
// ReportToConsole
|
||||
NS_WARNING("Couldn't get style context for content in GetFillRule");
|
||||
}
|
||||
|
||||
return fillRule;
|
||||
}
|
||||
|
||||
Float
|
||||
nsSVGPathGeometryElement::GetStrokeWidth()
|
||||
{
|
||||
nsRefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr,
|
||||
nullptr);
|
||||
return styleContext ?
|
||||
SVGContentUtils::CoordToFloat(styleContext->PresContext(), this,
|
||||
styleContext->StyleSVG()->mStrokeWidth) :
|
||||
0.0f;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#ifndef __NS_SVGPATHGEOMETRYELEMENT_H__
|
||||
#define __NS_SVGPATHGEOMETRYELEMENT_H__
|
||||
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "SVGGraphicsElement.h"
|
||||
|
||||
class gfxPath;
|
||||
@ -33,6 +34,12 @@ typedef mozilla::dom::SVGGraphicsElement nsSVGPathGeometryElementBase;
|
||||
|
||||
class nsSVGPathGeometryElement : public nsSVGPathGeometryElementBase
|
||||
{
|
||||
protected:
|
||||
typedef mozilla::gfx::FillRule FillRule;
|
||||
typedef mozilla::gfx::Float Float;
|
||||
typedef mozilla::gfx::Path Path;
|
||||
typedef mozilla::gfx::PathBuilder PathBuilder;
|
||||
|
||||
public:
|
||||
nsSVGPathGeometryElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
@ -52,7 +59,34 @@ public:
|
||||
virtual bool IsMarkable();
|
||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks);
|
||||
virtual void ConstructPath(gfxContext *aCtx) = 0;
|
||||
|
||||
/**
|
||||
* Returns a Path that can be used to paint, hit-test or calculate bounds for
|
||||
* this element.
|
||||
*/
|
||||
virtual mozilla::TemporaryRef<Path> BuildPath() = 0;
|
||||
|
||||
virtual already_AddRefed<gfxPath> GetPath(const gfxMatrix &aMatrix);
|
||||
|
||||
/**
|
||||
* Returns a PathBuilder object created using the current computed value of
|
||||
* the CSS property 'fill-rule' for this element.
|
||||
*/
|
||||
mozilla::TemporaryRef<PathBuilder> CreatePathBuilder();
|
||||
|
||||
/**
|
||||
* Returns the current computed value of the CSS property 'fill-rule' for
|
||||
* this element.
|
||||
*/
|
||||
FillRule GetFillRule();
|
||||
|
||||
/**
|
||||
* Returns the current computed value of the CSS property 'stroke-width' for
|
||||
* this element. (I.e. this does NOT take account of the value of the
|
||||
* 'stroke' and 'stroke-opacity' properties to, say, return zero if they are
|
||||
* "none" or "0", respectively.)
|
||||
*/
|
||||
Float GetStrokeWidth();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -6,9 +6,11 @@
|
||||
#include "nsSVGPolyElement.h"
|
||||
#include "DOMSVGPointList.h"
|
||||
#include "gfxContext.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "SVGContentUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
@ -120,3 +122,19 @@ nsSVGPolyElement::ConstructPath(gfxContext *aCtx)
|
||||
}
|
||||
}
|
||||
|
||||
TemporaryRef<Path>
|
||||
nsSVGPolyElement::BuildPath()
|
||||
{
|
||||
RefPtr<PathBuilder> pathBuilder = CreatePathBuilder();
|
||||
|
||||
const SVGPointList &points = mPoints.GetAnimValue();
|
||||
|
||||
if (!points.IsEmpty()) {
|
||||
pathBuilder->MoveTo(points[0]);
|
||||
for (uint32_t i = 1; i < points.Length(); ++i) {
|
||||
pathBuilder->LineTo(points[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return pathBuilder->Finish();
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
virtual bool IsMarkable() MOZ_OVERRIDE { return true; }
|
||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
|
||||
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
|
||||
virtual mozilla::TemporaryRef<Path> BuildPath() MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<mozilla::DOMSVGPointList> Points();
|
||||
|
@ -434,6 +434,7 @@ public:
|
||||
{
|
||||
return mIsFrozen;
|
||||
}
|
||||
virtual NS_HIDDEN_(bool) IsRunningTimeout() { return mTimeoutFiringDepth > 0; }
|
||||
|
||||
virtual NS_HIDDEN_(bool) WouldReuseInnerWindow(nsIDocument *aNewDocument);
|
||||
|
||||
|
@ -79,9 +79,7 @@ nsMimeTypeArray::IndexedGetter(uint32_t aIndex, bool &aFound)
|
||||
{
|
||||
aFound = false;
|
||||
|
||||
if (mMimeTypes.IsEmpty()) {
|
||||
EnsureMimeTypes();
|
||||
}
|
||||
EnsurePluginMimeTypes();
|
||||
|
||||
MOZ_ASSERT(mMimeTypes.Length() >= mPluginMimeTypeCount);
|
||||
|
||||
@ -99,9 +97,7 @@ nsMimeTypeArray::NamedGetter(const nsAString& aName, bool &aFound)
|
||||
{
|
||||
aFound = false;
|
||||
|
||||
if (mMimeTypes.IsEmpty()) {
|
||||
EnsureMimeTypes();
|
||||
}
|
||||
EnsurePluginMimeTypes();
|
||||
|
||||
for (uint32_t i = 0; i < mMimeTypes.Length(); ++i) {
|
||||
if (aName.Equals(mMimeTypes[i]->Type())) {
|
||||
@ -161,9 +157,7 @@ nsMimeTypeArray::NamedGetter(const nsAString& aName, bool &aFound)
|
||||
uint32_t
|
||||
nsMimeTypeArray::Length()
|
||||
{
|
||||
if (mMimeTypes.IsEmpty()) {
|
||||
EnsureMimeTypes();
|
||||
}
|
||||
EnsurePluginMimeTypes();
|
||||
|
||||
MOZ_ASSERT(mMimeTypes.Length() >= mPluginMimeTypeCount);
|
||||
|
||||
@ -173,9 +167,7 @@ nsMimeTypeArray::Length()
|
||||
void
|
||||
nsMimeTypeArray::GetSupportedNames(nsTArray< nsString >& aRetval)
|
||||
{
|
||||
if (mMimeTypes.IsEmpty()) {
|
||||
EnsureMimeTypes();
|
||||
}
|
||||
EnsurePluginMimeTypes();
|
||||
|
||||
for (uint32_t i = 0; i < mMimeTypes.Length(); ++i) {
|
||||
aRetval.AppendElement(mMimeTypes[i]->Type());
|
||||
@ -183,7 +175,7 @@ nsMimeTypeArray::GetSupportedNames(nsTArray< nsString >& aRetval)
|
||||
}
|
||||
|
||||
void
|
||||
nsMimeTypeArray::EnsureMimeTypes()
|
||||
nsMimeTypeArray::EnsurePluginMimeTypes()
|
||||
{
|
||||
if (!mMimeTypes.IsEmpty() || !mWindow) {
|
||||
return;
|
||||
@ -203,14 +195,7 @@ nsMimeTypeArray::EnsureMimeTypes()
|
||||
return;
|
||||
}
|
||||
|
||||
nsTArray<nsRefPtr<nsPluginElement> > plugins;
|
||||
pluginArray->GetPlugins(plugins);
|
||||
|
||||
for (uint32_t i = 0; i < plugins.Length(); ++i) {
|
||||
nsPluginElement *plugin = plugins[i];
|
||||
|
||||
mMimeTypes.AppendElements(plugin->MimeTypes());
|
||||
}
|
||||
pluginArray->GetMimeTypes(mMimeTypes);
|
||||
|
||||
mPluginMimeTypeCount = mMimeTypes.Length();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
void GetSupportedNames(nsTArray< nsString >& retval);
|
||||
|
||||
protected:
|
||||
void EnsureMimeTypes();
|
||||
void EnsurePluginMimeTypes();
|
||||
void Clear();
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
|
@ -189,6 +189,8 @@ public:
|
||||
return mDoc;
|
||||
}
|
||||
|
||||
virtual NS_HIDDEN_(bool) IsRunningTimeout() = 0;
|
||||
|
||||
protected:
|
||||
// Lazily instantiate an about:blank document if necessary, and if
|
||||
// we have what it takes to do so.
|
||||
|
@ -68,19 +68,20 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(nsPluginArray,
|
||||
mPlugins)
|
||||
|
||||
void
|
||||
nsPluginArray::GetPlugins(nsTArray<nsRefPtr<nsPluginElement> >& aPlugins)
|
||||
nsPluginArray::GetMimeTypes(nsTArray<nsRefPtr<nsMimeType> >& aMimeTypes)
|
||||
{
|
||||
aPlugins.Clear();
|
||||
aMimeTypes.Clear();
|
||||
|
||||
if (!AllowPlugins()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mPlugins.IsEmpty()) {
|
||||
EnsurePlugins();
|
||||
}
|
||||
EnsurePlugins();
|
||||
|
||||
aPlugins = mPlugins;
|
||||
for (uint32_t i = 0; i < mPlugins.Length(); ++i) {
|
||||
nsPluginElement *plugin = mPlugins[i];
|
||||
aMimeTypes.AppendElements(plugin->MimeTypes());
|
||||
}
|
||||
}
|
||||
|
||||
nsPluginElement*
|
||||
@ -151,9 +152,7 @@ nsPluginArray::IndexedGetter(uint32_t aIndex, bool &aFound)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (mPlugins.IsEmpty()) {
|
||||
EnsurePlugins();
|
||||
}
|
||||
EnsurePlugins();
|
||||
|
||||
aFound = aIndex < mPlugins.Length();
|
||||
|
||||
@ -179,9 +178,7 @@ nsPluginArray::NamedGetter(const nsAString& aName, bool &aFound)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (mPlugins.IsEmpty()) {
|
||||
EnsurePlugins();
|
||||
}
|
||||
EnsurePlugins();
|
||||
|
||||
for (uint32_t i = 0; i < mPlugins.Length(); ++i) {
|
||||
nsAutoString pluginName;
|
||||
@ -205,9 +202,7 @@ nsPluginArray::Length()
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mPlugins.IsEmpty()) {
|
||||
EnsurePlugins();
|
||||
}
|
||||
EnsurePlugins();
|
||||
|
||||
return mPlugins.Length();
|
||||
}
|
||||
@ -250,11 +245,14 @@ nsPluginArray::AllowPlugins() const
|
||||
void
|
||||
nsPluginArray::EnsurePlugins()
|
||||
{
|
||||
if (!mPlugins.IsEmpty()) {
|
||||
// We already have an array of plugin elements.
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
|
||||
|
||||
if (!mPlugins.IsEmpty() || !pluginHost) {
|
||||
// We already have an array of plugin elements, or no plugin host
|
||||
|
||||
if (!pluginHost) {
|
||||
// We have no plugin host.
|
||||
return;
|
||||
}
|
||||
|
||||
@ -327,7 +325,7 @@ nsPluginElement::GetName(nsString& retval) const
|
||||
nsMimeType*
|
||||
nsPluginElement::Item(uint32_t aIndex)
|
||||
{
|
||||
EnsureMimeTypes();
|
||||
EnsurePluginMimeTypes();
|
||||
|
||||
return mMimeTypes.SafeElementAt(aIndex);
|
||||
}
|
||||
@ -342,7 +340,7 @@ nsPluginElement::NamedItem(const nsAString& aName)
|
||||
nsMimeType*
|
||||
nsPluginElement::IndexedGetter(uint32_t aIndex, bool &aFound)
|
||||
{
|
||||
EnsureMimeTypes();
|
||||
EnsurePluginMimeTypes();
|
||||
|
||||
aFound = aIndex < mMimeTypes.Length();
|
||||
|
||||
@ -352,7 +350,7 @@ nsPluginElement::IndexedGetter(uint32_t aIndex, bool &aFound)
|
||||
nsMimeType*
|
||||
nsPluginElement::NamedGetter(const nsAString& aName, bool &aFound)
|
||||
{
|
||||
EnsureMimeTypes();
|
||||
EnsurePluginMimeTypes();
|
||||
|
||||
aFound = false;
|
||||
|
||||
@ -370,7 +368,7 @@ nsPluginElement::NamedGetter(const nsAString& aName, bool &aFound)
|
||||
uint32_t
|
||||
nsPluginElement::Length()
|
||||
{
|
||||
EnsureMimeTypes();
|
||||
EnsurePluginMimeTypes();
|
||||
|
||||
return mMimeTypes.Length();
|
||||
}
|
||||
@ -378,7 +376,7 @@ nsPluginElement::Length()
|
||||
void
|
||||
nsPluginElement::GetSupportedNames(nsTArray< nsString >& retval)
|
||||
{
|
||||
EnsureMimeTypes();
|
||||
EnsurePluginMimeTypes();
|
||||
|
||||
for (uint32_t i = 0; i < mMimeTypes.Length(); ++i) {
|
||||
retval.AppendElement(mMimeTypes[i]->Type());
|
||||
@ -388,13 +386,13 @@ nsPluginElement::GetSupportedNames(nsTArray< nsString >& retval)
|
||||
nsTArray<nsRefPtr<nsMimeType> >&
|
||||
nsPluginElement::MimeTypes()
|
||||
{
|
||||
EnsureMimeTypes();
|
||||
EnsurePluginMimeTypes();
|
||||
|
||||
return mMimeTypes;
|
||||
}
|
||||
|
||||
void
|
||||
nsPluginElement::EnsureMimeTypes()
|
||||
nsPluginElement::EnsurePluginMimeTypes()
|
||||
{
|
||||
if (!mMimeTypes.IsEmpty()) {
|
||||
return;
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
void Init();
|
||||
void Invalidate();
|
||||
|
||||
void GetPlugins(nsTArray<nsRefPtr<nsPluginElement> >& aPlugins);
|
||||
void GetMimeTypes(nsTArray<nsRefPtr<nsMimeType> >& aMimeTypes);
|
||||
|
||||
// PluginArray WebIDL methods
|
||||
|
||||
@ -97,7 +97,7 @@ public:
|
||||
nsTArray<nsRefPtr<nsMimeType> >& MimeTypes();
|
||||
|
||||
protected:
|
||||
void EnsureMimeTypes();
|
||||
void EnsurePluginMimeTypes();
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsRefPtr<nsPluginTag> mPluginTag;
|
||||
|
@ -2955,6 +2955,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||
assert len(dictionaryMemberTypes) == 1
|
||||
name = dictionaryMemberTypes[0].inner.identifier.name
|
||||
setDictionary = CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${val}, ${mutableVal}, tryNext)) || !tryNext;" % (unionArgumentObj, name))
|
||||
names.append(name)
|
||||
else:
|
||||
setDictionary = None
|
||||
|
||||
@ -2963,6 +2964,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||
assert len(objectMemberTypes) == 1
|
||||
object = CGGeneric("%s.SetToObject(cx, argObj);\n"
|
||||
"done = true;" % unionArgumentObj)
|
||||
names.append(objectMemberTypes[0].name)
|
||||
else:
|
||||
object = None
|
||||
|
||||
|
@ -12,7 +12,7 @@ include BluetoothTypes;
|
||||
|
||||
include "mozilla/dom/bluetooth/ipc/BluetoothMessageUtils.h";
|
||||
|
||||
using mozilla::dom::bluetooth::BluetoothObjectType;
|
||||
using mozilla::dom::bluetooth::BluetoothObjectType from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -2,12 +2,11 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include "mozilla/HalTypes.h";
|
||||
|
||||
include protocol PContent;
|
||||
include protocol PFMRadioRequest;
|
||||
|
||||
using mozilla::hal::FMRadioSeekDirection;
|
||||
using mozilla::hal::FMRadioSeekDirection from "mozilla/HalTypes.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
include "mozilla/dom/indexedDB/SerializationHelpers.h";
|
||||
|
||||
using mozilla::dom::indexedDB::Key;
|
||||
using mozilla::dom::indexedDB::IDBCursor::Direction;
|
||||
using mozilla::dom::indexedDB::SerializedStructuredCloneReadInfo;
|
||||
using class mozilla::dom::indexedDB::Key from "mozilla/dom/indexedDB/Key.h";
|
||||
using mozilla::dom::indexedDB::IDBCursor::Direction from "mozilla/dom/indexedDB/IDBCursor.h";
|
||||
using struct mozilla::dom::indexedDB::SerializedStructuredCloneReadInfo from "mozilla/dom/indexedDB/IndexedDatabase.h";
|
||||
|
||||
using mozilla::void_t;
|
||||
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -9,7 +9,7 @@ include protocol PIndexedDBDeleteDatabaseRequest;
|
||||
|
||||
include "mozilla/dom/indexedDB/SerializationHelpers.h";
|
||||
|
||||
using mozilla::dom::quota::PersistenceType;
|
||||
using mozilla::dom::quota::PersistenceType from "mozilla/dom/quota/PersistenceType.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -8,10 +8,10 @@ include protocol PIndexedDBRequest;
|
||||
|
||||
include "mozilla/dom/indexedDB/SerializationHelpers.h";
|
||||
|
||||
using mozilla::dom::indexedDB::Key;
|
||||
using mozilla::dom::indexedDB::IDBCursor::Direction;
|
||||
using class mozilla::dom::indexedDB::Key from "mozilla/dom/indexedDB/Key.h";
|
||||
using mozilla::dom::indexedDB::IDBCursor::Direction from "mozilla/dom/indexedDB/IDBCursor.h";
|
||||
|
||||
using mozilla::void_t;
|
||||
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -7,9 +7,9 @@ include protocol PIndexedDBTransaction;
|
||||
|
||||
include "mozilla/dom/indexedDB/SerializationHelpers.h";
|
||||
|
||||
using mozilla::dom::indexedDB::DatabaseInfoGuts;
|
||||
using mozilla::dom::indexedDB::ObjectStoreInfoGuts;
|
||||
using mozilla::dom::indexedDB::IDBTransaction::Mode;
|
||||
using struct mozilla::dom::indexedDB::DatabaseInfoGuts from "mozilla/dom/indexedDB/DatabaseInfo.h";
|
||||
using struct mozilla::dom::indexedDB::ObjectStoreInfoGuts from "mozilla/dom/indexedDB/DatabaseInfo.h";
|
||||
using mozilla::dom::indexedDB::IDBTransaction::Mode from "mozilla/dom/indexedDB/IDBTransaction.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -10,9 +10,9 @@ include protocol PIndexedDBTransaction;
|
||||
|
||||
include IndexedDBParams;
|
||||
|
||||
using mozilla::dom::indexedDB::IndexInfo;
|
||||
using mozilla::dom::indexedDB::IndexUpdateInfo;
|
||||
using mozilla::dom::indexedDB::SerializedStructuredCloneWriteInfo;
|
||||
using struct mozilla::dom::indexedDB::IndexInfo from "mozilla/dom/indexedDB/DatabaseInfo.h";
|
||||
using struct mozilla::dom::indexedDB::IndexUpdateInfo from "mozilla/dom/indexedDB/DatabaseInfo.h";
|
||||
using struct mozilla::dom::indexedDB::SerializedStructuredCloneWriteInfo from "mozilla/dom/indexedDB/IndexedDatabase.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -9,10 +9,10 @@ include protocol PIndexedDBObjectStore;
|
||||
|
||||
include "mozilla/dom/indexedDB/SerializationHelpers.h";
|
||||
|
||||
using mozilla::dom::indexedDB::Key;
|
||||
using mozilla::dom::indexedDB::SerializedStructuredCloneReadInfo;
|
||||
using class mozilla::dom::indexedDB::Key from "mozilla/dom/indexedDB/Key.h";
|
||||
using struct mozilla::dom::indexedDB::SerializedStructuredCloneReadInfo from "mozilla/dom/indexedDB/IndexedDatabase.h";
|
||||
|
||||
using mozilla::void_t;
|
||||
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -7,7 +7,7 @@ include protocol PIndexedDBObjectStore;
|
||||
|
||||
include "mozilla/dom/indexedDB/SerializationHelpers.h";
|
||||
|
||||
using mozilla::dom::indexedDB::ObjectStoreInfoGuts;
|
||||
using struct mozilla::dom::indexedDB::ObjectStoreInfoGuts from "mozilla/dom/indexedDB/DatabaseInfo.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -117,6 +117,7 @@
|
||||
#include "AudioChannelService.h"
|
||||
#include "JavaScriptChild.h"
|
||||
#include "mozilla/dom/telephony/PTelephonyChild.h"
|
||||
#include "mozilla/net/NeckoMessageUtils.h"
|
||||
|
||||
using namespace base;
|
||||
using namespace mozilla;
|
||||
|
@ -91,6 +91,7 @@
|
||||
#include "URIUtils.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "mozilla/net/NeckoMessageUtils.h"
|
||||
|
||||
#if defined(ANDROID) || defined(LINUX)
|
||||
#include "nsSystemInfo.h"
|
||||
@ -1421,6 +1422,7 @@ ContentParent::ContentParent(mozIApplication* aApp,
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
mSubprocess = new GeckoChildProcessHost(GeckoProcessType_Content,
|
||||
aOSPrivileges);
|
||||
mSubprocess->SetSandboxEnabled(ShouldSandboxContentProcesses());
|
||||
|
||||
IToplevelProtocol::SetTransport(mSubprocess->GetChannel());
|
||||
|
||||
@ -3282,5 +3284,15 @@ ContentParent::ShouldContinueFromReplyTimeout()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::ShouldSandboxContentProcesses()
|
||||
{
|
||||
#ifdef MOZ_CONTENT_SANDBOX
|
||||
return !PR_GetEnv("MOZ_DISABLE_CONTENT_SANDBOX");
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -220,6 +220,7 @@ protected:
|
||||
void OnNuwaForkTimeout();
|
||||
|
||||
bool ShouldContinueFromReplyTimeout() MOZ_OVERRIDE;
|
||||
bool ShouldSandboxContentProcesses();
|
||||
|
||||
private:
|
||||
static nsDataHashtable<nsStringHashKey, ContentParent*> *sAppContentParents;
|
||||
|
@ -7,7 +7,7 @@
|
||||
include protocol PBlob;
|
||||
include InputStreamParams;
|
||||
|
||||
using mozilla::SerializedStructuredCloneBuffer;
|
||||
using struct mozilla::SerializedStructuredCloneBuffer from "ipc/IPCMessageUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -17,42 +17,35 @@ include DOMTypes;
|
||||
include JavaScriptTypes;
|
||||
include URIParams;
|
||||
|
||||
include "gfxMatrix.h";
|
||||
include "FrameMetrics.h";
|
||||
include "ipc/nsGUIEventIPC.h";
|
||||
include "mozilla/dom/TabMessageUtils.h";
|
||||
include "mozilla/dom/ScreenOrientation.h";
|
||||
include "mozilla/dom/PermissionMessageUtils.h";
|
||||
include "mozilla/layout/RenderFrameUtils.h";
|
||||
include "mozilla/layers/CompositorTypes.h";
|
||||
|
||||
using IPC::Principal;
|
||||
using gfxMatrix;
|
||||
using gfxSize;
|
||||
using CSSRect;
|
||||
using mozilla::layers::FrameMetrics;
|
||||
using FrameMetrics::ViewID;
|
||||
using mozilla::layout::ScrollingBehavior;
|
||||
using mozilla::void_t;
|
||||
using mozilla::WindowsHandle;
|
||||
using nscolor;
|
||||
using mozilla::WidgetCompositionEvent;
|
||||
using nsIMEUpdatePreference;
|
||||
using nsIntPoint;
|
||||
using nsIntRect;
|
||||
using nsIntSize;
|
||||
using mozilla::WidgetKeyboardEvent;
|
||||
using mozilla::WidgetMouseEvent;
|
||||
using mozilla::WidgetWheelEvent;
|
||||
using nsRect;
|
||||
using mozilla::WidgetSelectionEvent;
|
||||
using mozilla::WidgetTextEvent;
|
||||
using mozilla::WidgetTouchEvent;
|
||||
using RemoteDOMEvent;
|
||||
using mozilla::dom::ScreenOrientation;
|
||||
using mozilla::layers::TextureFactoryIdentifier;
|
||||
using mozilla::CSSIntPoint;
|
||||
using mozilla::CSSToScreenScale;
|
||||
using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
|
||||
using struct gfxMatrix from "gfxMatrix.h";
|
||||
using struct gfxSize from "gfxPoint.h";
|
||||
using CSSRect from "Units.h";
|
||||
using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
|
||||
using FrameMetrics::ViewID from "FrameMetrics.h";
|
||||
using mozilla::layout::ScrollingBehavior from "mozilla/layout/RenderFrameUtils.h";
|
||||
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
||||
using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
|
||||
using nscolor from "nsColor.h";
|
||||
using class mozilla::WidgetCompositionEvent from "ipc/nsGUIEventIPC.h";
|
||||
using struct nsIMEUpdatePreference from "nsIWidget.h";
|
||||
using struct nsIntPoint from "nsPoint.h";
|
||||
using struct nsIntRect from "nsRect.h";
|
||||
using struct nsIntSize from "nsSize.h";
|
||||
using class mozilla::WidgetKeyboardEvent from "ipc/nsGUIEventIPC.h";
|
||||
using class mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h";
|
||||
using class mozilla::WidgetWheelEvent from "ipc/nsGUIEventIPC.h";
|
||||
using struct nsRect from "nsRect.h";
|
||||
using class mozilla::WidgetSelectionEvent from "ipc/nsGUIEventIPC.h";
|
||||
using class mozilla::WidgetTextEvent from "ipc/nsGUIEventIPC.h";
|
||||
using class mozilla::WidgetTouchEvent from "ipc/nsGUIEventIPC.h";
|
||||
using struct mozilla::dom::RemoteDOMEvent from "mozilla/dom/TabMessageUtils.h";
|
||||
using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
|
||||
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
|
||||
using mozilla::CSSIntPoint from "Units.h";
|
||||
using mozilla::CSSToScreenScale from "Units.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
@ -30,32 +30,21 @@ include PTabContext;
|
||||
include URIParams;
|
||||
include ProtocolTypes;
|
||||
|
||||
include "mozilla/chrome/RegistryMessageUtils.h";
|
||||
include "mozilla/dom/PermissionMessageUtils.h";
|
||||
include "mozilla/dom/TabMessageUtils.h";
|
||||
include "mozilla/HalTypes.h";
|
||||
include "mozilla/layout/RenderFrameUtils.h";
|
||||
include "mozilla/net/NeckoMessageUtils.h";
|
||||
include "nsGeoPositionIPCSerialiser.h";
|
||||
include "gfxPoint.h";
|
||||
using GeoPosition from "nsGeoPositionIPCSerialiser.h";
|
||||
|
||||
using GeoPosition;
|
||||
using PrefTuple;
|
||||
|
||||
using ChromePackage;
|
||||
using ResourceMapping;
|
||||
using OverrideMapping;
|
||||
using base::ChildPrivileges;
|
||||
using IPC::Permission;
|
||||
using IPC::Principal;
|
||||
using mozilla::null_t;
|
||||
using mozilla::void_t;
|
||||
using mozilla::dom::AudioChannelType;
|
||||
using mozilla::dom::AudioChannelState;
|
||||
using mozilla::dom::BlobConstructorParams;
|
||||
using mozilla::dom::NativeThreadId;
|
||||
using mozilla::hal::ProcessPriority;
|
||||
using gfxIntSize;
|
||||
using struct ChromePackage from "mozilla/chrome/RegistryMessageUtils.h";
|
||||
using struct ResourceMapping from "mozilla/chrome/RegistryMessageUtils.h";
|
||||
using struct OverrideMapping from "mozilla/chrome/RegistryMessageUtils.h";
|
||||
using base::ChildPrivileges from "base/process_util.h";
|
||||
using struct IPC::Permission from "mozilla/net/NeckoMessageUtils.h";
|
||||
using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
|
||||
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
|
||||
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
||||
using mozilla::dom::AudioChannelType from "AudioChannelCommon.h";
|
||||
using mozilla::dom::AudioChannelState from "AudioChannelCommon.h";
|
||||
using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
|
||||
using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
|
||||
using gfxIntSize from "nsSize.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -7,7 +7,7 @@ include protocol PBrowser;
|
||||
|
||||
include "mozilla/GfxMessageUtils.h";
|
||||
|
||||
using nsIntSize;
|
||||
using struct nsIntSize from "nsSize.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
@ -6,9 +6,8 @@
|
||||
|
||||
include protocol PBrowser;
|
||||
|
||||
include "mozilla/layout/RenderFrameUtils.h";
|
||||
|
||||
using mozilla::layout::ScrollingBehavior;
|
||||
using mozilla::layout::ScrollingBehavior from "mozilla/layout/RenderFrameUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -69,6 +69,7 @@
|
||||
#include "JavaScriptChild.h"
|
||||
#include "APZCCallbackHelper.h"
|
||||
#include "nsILoadContext.h"
|
||||
#include "ipc/nsGUIEventIPC.h"
|
||||
|
||||
#define BROWSER_ELEMENT_CHILD_SCRIPT \
|
||||
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/TabContext.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/layers/CompositorTypes.h"
|
||||
|
||||
struct gfxMatrix;
|
||||
class nsICachedFileDescriptorListener;
|
||||
@ -45,10 +46,6 @@ namespace layout {
|
||||
class RenderFrameChild;
|
||||
}
|
||||
|
||||
namespace layers {
|
||||
struct TextureFactoryIdentifier;
|
||||
}
|
||||
|
||||
namespace dom {
|
||||
|
||||
class TabChild;
|
||||
|
@ -22,7 +22,9 @@
|
||||
|
||||
struct gfxMatrix;
|
||||
class nsFrameLoader;
|
||||
class nsIContent;
|
||||
class nsIURI;
|
||||
class nsIWidget;
|
||||
class CpowHolder;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "mozilla/dom/MediaStreamTrackBinding.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
|
||||
#define AUDIO_PERMISSION_NAME "audio-capture"
|
||||
|
||||
|
@ -16,7 +16,7 @@ const PC_SESSION_CONTRACT = "@mozilla.org/dom/rtcsessiondescription;1";
|
||||
const PC_MANAGER_CONTRACT = "@mozilla.org/dom/peerconnectionmanager;1";
|
||||
const PC_STATS_CONTRACT = "@mozilla.org/dom/rtcstatsreport;1";
|
||||
|
||||
const PC_CID = Components.ID("{fc684a5c-c729-42c7-aa82-3c10dc4398f3}");
|
||||
const PC_CID = Components.ID("{00e0e20d-1494-4776-8e0e-0f0acbea3c79}");
|
||||
const PC_OBS_CID = Components.ID("{1d44a18e-4545-4ff3-863d-6dbd6234a583}");
|
||||
const PC_ICE_CID = Components.ID("{02b9970c-433d-4cc2-923d-f7028ac66073}");
|
||||
const PC_SESSION_CID = Components.ID("{1775081b-b62d-4954-8ffe-a067bbf508a7}");
|
||||
@ -719,18 +719,26 @@ RTCPeerConnection.prototype = {
|
||||
},
|
||||
|
||||
getStats: function(selector, onSuccess, onError) {
|
||||
this._onGetStatsSuccess = onSuccess;
|
||||
this._onGetStatsFailure = onError;
|
||||
|
||||
this._queueOrRun({
|
||||
func: this._getStats,
|
||||
args: [selector],
|
||||
args: [selector, onSuccess, onError, false],
|
||||
wait: true
|
||||
});
|
||||
},
|
||||
|
||||
_getStats: function(selector) {
|
||||
this._getPC().getStats(selector);
|
||||
getStatsInternal: function(selector, onSuccess, onError) {
|
||||
this._queueOrRun({
|
||||
func: this._getStats,
|
||||
args: [selector, onSuccess, onError, true],
|
||||
wait: true
|
||||
});
|
||||
},
|
||||
|
||||
_getStats: function(selector, onSuccess, onError, internal) {
|
||||
this._onGetStatsSuccess = onSuccess;
|
||||
this._onGetStatsFailure = onError;
|
||||
|
||||
this._getPC().getStats(selector, internal);
|
||||
},
|
||||
|
||||
createDataChannel: function(label, dict) {
|
||||
@ -1077,6 +1085,7 @@ PeerConnectionObserver.prototype = {
|
||||
appendStats(dict.mediaStreamStats, report);
|
||||
appendStats(dict.transportStats, report);
|
||||
appendStats(dict.iceComponentStats, report);
|
||||
appendStats(dict.iceCandidatePairStats, report);
|
||||
appendStats(dict.iceCandidateStats, report);
|
||||
appendStats(dict.codecStats, report);
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
component {fc684a5c-c729-42c7-aa82-3c10dc4398f3} PeerConnection.js
|
||||
component {00e0e20d-1494-4776-8e0e-0f0acbea3c79} PeerConnection.js
|
||||
component {1d44a18e-4545-4ff3-863d-6dbd6234a583} PeerConnection.js
|
||||
component {02b9970c-433d-4cc2-923d-f7028ac66073} PeerConnection.js
|
||||
component {1775081b-b62d-4954-8ffe-a067bbf508a7} PeerConnection.js
|
||||
component {7293e901-2be3-4c02-b4bd-cbef6fc24f78} PeerConnection.js
|
||||
component {7fe6e18b-0da3-4056-bf3b-440ef3809e06} PeerConnection.js
|
||||
|
||||
contract @mozilla.org/dom/peerconnection;1 {fc684a5c-c729-42c7-aa82-3c10dc4398f3}
|
||||
contract @mozilla.org/dom/peerconnection;1 {00e0e20d-1494-4776-8e0e-0f0acbea3c79}
|
||||
contract @mozilla.org/dom/peerconnectionobserver;1 {1d44a18e-4545-4ff3-863d-6dbd6234a583}
|
||||
contract @mozilla.org/dom/rtcicecandidate;1 {02b9970c-433d-4cc2-923d-f7028ac66073}
|
||||
contract @mozilla.org/dom/rtcsessiondescription;1 {1775081b-b62d-4954-8ffe-a067bbf508a7}
|
||||
|
@ -4,8 +4,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include "mozilla/dom/mobilemessage/Types.h";
|
||||
|
||||
include protocol PSms;
|
||||
include protocol PBlob;
|
||||
include SmsTypes;
|
||||
|
@ -4,9 +4,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
include "mozilla/dom/mobilemessage/Types.h";
|
||||
|
||||
include protocol PSms;
|
||||
include protocol PBlob;
|
||||
include SmsTypes;
|
||||
|
@ -4,14 +4,13 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include "mozilla/dom/mobilemessage/Types.h";
|
||||
include protocol PBlob;
|
||||
|
||||
using DeliveryState;
|
||||
using DeliveryStatus;
|
||||
using MessageClass;
|
||||
using ReadState;
|
||||
using MessageType;
|
||||
using DeliveryState from "mozilla/dom/mobilemessage/Types.h";
|
||||
using DeliveryStatus from "mozilla/dom/mobilemessage/Types.h";
|
||||
using MessageClass from "mozilla/dom/mobilemessage/Types.h";
|
||||
using ReadState from "mozilla/dom/mobilemessage/Types.h";
|
||||
using MessageType from "mozilla/dom/mobilemessage/Types.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -9,7 +9,7 @@ include protocol PNecko;
|
||||
|
||||
include "mozilla/net/NeckoMessageUtils.h";
|
||||
|
||||
using mozilla::void_t;
|
||||
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
||||
|
||||
struct TCPError {
|
||||
nsString name;
|
||||
|
@ -5,13 +5,12 @@
|
||||
|
||||
include protocol PPluginInstance;
|
||||
|
||||
include "mozilla/plugins/PluginMessageUtils.h";
|
||||
|
||||
using mozilla::plugins::Buffer;
|
||||
using mozilla::plugins::IPCByteRanges;
|
||||
using mozilla::plugins::Buffer from "mozilla/plugins/PluginMessageUtils.h";
|
||||
using mozilla::plugins::IPCByteRanges from "mozilla/plugins/PluginMessageUtils.h";
|
||||
|
||||
using NPError;
|
||||
using NPReason;
|
||||
using NPError from "npapi.h";
|
||||
using NPReason from "npapi.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
@ -11,27 +11,25 @@ include protocol PPluginStream;
|
||||
include protocol PStreamNotify;
|
||||
include protocol PPluginSurface;
|
||||
|
||||
include "mozilla/plugins/PluginMessageUtils.h";
|
||||
include "ipc/nsGUIEventIPC.h";
|
||||
include "gfxTypes.h";
|
||||
include "mozilla/GfxMessageUtils.h";
|
||||
|
||||
using NPError;
|
||||
using NPRemoteWindow;
|
||||
using NPRemoteEvent;
|
||||
using NPRect;
|
||||
using NPImageFormat;
|
||||
using NPNURLVariable;
|
||||
using NPCoordinateSpace;
|
||||
using NPNVariable;
|
||||
using mozilla::plugins::NativeWindowHandle;
|
||||
using gfxSurfaceType;
|
||||
using gfxIntSize;
|
||||
using mozilla::null_t;
|
||||
using mozilla::plugins::WindowsSharedMemoryHandle;
|
||||
using mozilla::plugins::DXGISharedSurfaceHandle;
|
||||
using mozilla::CrossProcessMutexHandle;
|
||||
using SurfaceDescriptorX11;
|
||||
using nsIntRect;
|
||||
using NPError from "npapi.h";
|
||||
using struct mozilla::plugins::NPRemoteWindow from "mozilla/plugins/PluginMessageUtils.h";
|
||||
using struct mozilla::plugins::NPRemoteEvent from "mozilla/plugins/PluginMessageUtils.h";
|
||||
using NPRect from "npapi.h";
|
||||
using NPImageFormat from "npapi.h";
|
||||
using NPNURLVariable from "npapi.h";
|
||||
using NPCoordinateSpace from "npapi.h";
|
||||
using NPNVariable from "npapi.h";
|
||||
using mozilla::plugins::NativeWindowHandle from "mozilla/plugins/PluginMessageUtils.h";
|
||||
using gfxSurfaceType from "gfxTypes.h";
|
||||
using gfxIntSize from "nsSize.h";
|
||||
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
|
||||
using mozilla::plugins::WindowsSharedMemoryHandle from "mozilla/plugins/PluginMessageUtils.h";
|
||||
using mozilla::plugins::DXGISharedSurfaceHandle from "mozilla/plugins/PluginMessageUtils.h";
|
||||
using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h";
|
||||
using struct SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils.h";
|
||||
using struct nsIntRect from "nsRect.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
@ -8,15 +8,12 @@ include protocol PPluginInstance;
|
||||
include protocol PPluginScriptableObject;
|
||||
include protocol PCrashReporter;
|
||||
|
||||
include "npapi.h";
|
||||
include "mozilla/plugins/PluginMessageUtils.h";
|
||||
include "mozilla/dom/TabMessageUtils.h";
|
||||
|
||||
using NPError;
|
||||
using NPNVariable;
|
||||
using mozilla::dom::NativeThreadId;
|
||||
using mac_plugin_interposing::NSCursorInfo;
|
||||
using nsID;
|
||||
using NPError from "npapi.h";
|
||||
using NPNVariable from "npapi.h";
|
||||
using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
|
||||
using class mac_plugin_interposing::NSCursorInfo from "mozilla/plugins/PluginMessageUtils.h";
|
||||
using struct nsID from "nsID.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
@ -6,12 +6,8 @@
|
||||
include protocol PPluginInstance;
|
||||
include protocol PPluginIdentifier;
|
||||
|
||||
include "npapi.h";
|
||||
include "npruntime.h";
|
||||
include "mozilla/plugins/PluginMessageUtils.h";
|
||||
|
||||
using mozilla::void_t;
|
||||
using mozilla::null_t;
|
||||
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
||||
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
@ -5,11 +5,10 @@
|
||||
|
||||
include protocol PPluginInstance;
|
||||
|
||||
include "mozilla/plugins/PluginMessageUtils.h";
|
||||
|
||||
using mozilla::plugins::Buffer;
|
||||
using NPError;
|
||||
using NPReason;
|
||||
using mozilla::plugins::Buffer from "mozilla/plugins/PluginMessageUtils.h";
|
||||
using NPError from "npapi.h";
|
||||
using NPReason from "npapi.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
@ -6,9 +6,8 @@
|
||||
|
||||
include protocol PPluginInstance;
|
||||
|
||||
include "npapi.h";
|
||||
|
||||
using NPReason;
|
||||
using NPReason from "npapi.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "mozilla/plugins/PPluginModuleChild.h"
|
||||
#include "mozilla/plugins/PluginInstanceChild.h"
|
||||
#include "mozilla/plugins/PluginIdentifierChild.h"
|
||||
#include "mozilla/plugins/PluginMessageUtils.h"
|
||||
|
||||
// NOTE: stolen from nsNPAPIPlugin.h
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "mozilla/plugins/ScopedMethodFactory.h"
|
||||
#include "mozilla/plugins/PluginProcessParent.h"
|
||||
#include "mozilla/plugins/PPluginModuleParent.h"
|
||||
#include "mozilla/plugins/PluginMessageUtils.h"
|
||||
#include "npapi.h"
|
||||
#include "npfunctions.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define dom_plugins_PluginScriptableObjectChild_h 1
|
||||
|
||||
#include "mozilla/plugins/PPluginScriptableObjectChild.h"
|
||||
#include "mozilla/plugins/PluginMessageUtils.h"
|
||||
|
||||
#include "npruntime.h"
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define dom_plugins_PluginScriptableObjectParent_h 1
|
||||
|
||||
#include "mozilla/plugins/PPluginScriptableObjectParent.h"
|
||||
#include "mozilla/plugins/PluginMessageUtils.h"
|
||||
|
||||
#include "npfunctions.h"
|
||||
#include "npruntime.h"
|
||||
|
@ -97,7 +97,7 @@ function waitForPaintHelper(func) {
|
||||
setTimeout(func, 0);
|
||||
return;
|
||||
}
|
||||
setTimeout(function() { waitForPaintHelper(func); }, 100);
|
||||
setTimeout(function() { waitForPaintHelper(func); }, 1000);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "PCOMContentPermissionRequestChild.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
|
||||
class nsIPrincipal;
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#ifdef MOZ_B2G
|
||||
#include "nsIDOMDesktopNotification.h"
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@ interface PeerConnectionImpl {
|
||||
|
||||
/* Stats call */
|
||||
[Throws]
|
||||
void getStats(MediaStreamTrack? selector);
|
||||
void getStats(MediaStreamTrack? selector, boolean internalStats);
|
||||
|
||||
/* Adds the stream created by GetUserMedia */
|
||||
[Throws]
|
||||
|
@ -125,6 +125,11 @@ interface mozRTCPeerConnection : EventTarget {
|
||||
RTCStatsCallback successCallback,
|
||||
RTCPeerConnectionErrorCallback failureCallback);
|
||||
|
||||
[ChromeOnly]
|
||||
void getStatsInternal (MediaStreamTrack? selector,
|
||||
RTCStatsCallback successCallback,
|
||||
RTCPeerConnectionErrorCallback failureCallback);
|
||||
|
||||
// Data channel.
|
||||
RTCDataChannel createDataChannel (DOMString label,
|
||||
optional RTCDataChannelInit dataChannelDict);
|
||||
|
@ -9,7 +9,13 @@
|
||||
|
||||
enum RTCStatsType {
|
||||
"inboundrtp",
|
||||
"outboundrtp"
|
||||
"outboundrtp",
|
||||
"session",
|
||||
"track",
|
||||
"transport",
|
||||
"candidatepair",
|
||||
"localcandidate",
|
||||
"remotecandidate"
|
||||
};
|
||||
|
||||
dictionary RTCStats {
|
||||
@ -70,6 +76,26 @@ dictionary RTCIceComponentStats : RTCStats {
|
||||
boolean activeConnection;
|
||||
};
|
||||
|
||||
enum RTCStatsIceCandidatePairState {
|
||||
"frozen",
|
||||
"waiting",
|
||||
"inprogress",
|
||||
"failed",
|
||||
"succeeded",
|
||||
"cancelled"
|
||||
};
|
||||
|
||||
dictionary RTCIceCandidatePairStats : RTCStats {
|
||||
DOMString componentId;
|
||||
DOMString localCandidateId;
|
||||
DOMString remoteCandidateId;
|
||||
RTCStatsIceCandidatePairState state;
|
||||
unsigned long long mozPriority;
|
||||
boolean readable;
|
||||
boolean nominated;
|
||||
boolean selected;
|
||||
};
|
||||
|
||||
enum RTCStatsIceCandidateType {
|
||||
"host",
|
||||
"serverreflexive",
|
||||
@ -105,6 +131,7 @@ dictionary RTCStatsReportInternal {
|
||||
sequence<RTCMediaStreamStats> mediaStreamStats;
|
||||
sequence<RTCTransportStats> transportStats;
|
||||
sequence<RTCIceComponentStats> iceComponentStats;
|
||||
sequence<RTCIceCandidatePairStats> iceCandidatePairStats;
|
||||
sequence<RTCIceCandidateStats> iceCandidateStats;
|
||||
sequence<RTCCodecStats> codecStats;
|
||||
};
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "mozilla/net/NeckoMessageUtils.h"
|
||||
|
||||
static nsPermissionManager *gPermissionManager = nullptr;
|
||||
|
||||
|
167
gfx/2d/PathHelpers.cpp
Normal file
167
gfx/2d/PathHelpers.cpp
Normal file
@ -0,0 +1,167 @@
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "PathHelpers.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
void
|
||||
AppendRoundedRectToPath(PathBuilder* aPathBuilder,
|
||||
const Rect& aRect,
|
||||
// paren's needed due to operator precedence:
|
||||
const Size(& aCornerRadii)[4],
|
||||
bool aDrawClockwise)
|
||||
{
|
||||
// For CW drawing, this looks like:
|
||||
//
|
||||
// ...******0** 1 C
|
||||
// ****
|
||||
// *** 2
|
||||
// **
|
||||
// *
|
||||
// *
|
||||
// 3
|
||||
// *
|
||||
// *
|
||||
//
|
||||
// Where 0, 1, 2, 3 are the control points of the Bezier curve for
|
||||
// the corner, and C is the actual corner point.
|
||||
//
|
||||
// At the start of the loop, the current point is assumed to be
|
||||
// the point adjacent to the top left corner on the top
|
||||
// horizontal. Note that corner indices start at the top left and
|
||||
// continue clockwise, whereas in our loop i = 0 refers to the top
|
||||
// right corner.
|
||||
//
|
||||
// When going CCW, the control points are swapped, and the first
|
||||
// corner that's drawn is the top left (along with the top segment).
|
||||
//
|
||||
// There is considerable latitude in how one chooses the four
|
||||
// control points for a Bezier curve approximation to an ellipse.
|
||||
// For the overall path to be continuous and show no corner at the
|
||||
// endpoints of the arc, points 0 and 3 must be at the ends of the
|
||||
// straight segments of the rectangle; points 0, 1, and C must be
|
||||
// collinear; and points 3, 2, and C must also be collinear. This
|
||||
// leaves only two free parameters: the ratio of the line segments
|
||||
// 01 and 0C, and the ratio of the line segments 32 and 3C. See
|
||||
// the following papers for extensive discussion of how to choose
|
||||
// these ratios:
|
||||
//
|
||||
// Dokken, Tor, et al. "Good approximation of circles by
|
||||
// curvature-continuous Bezier curves." Computer-Aided
|
||||
// Geometric Design 7(1990) 33--41.
|
||||
// Goldapp, Michael. "Approximation of circular arcs by cubic
|
||||
// polynomials." Computer-Aided Geometric Design 8(1991) 227--238.
|
||||
// Maisonobe, Luc. "Drawing an elliptical arc using polylines,
|
||||
// quadratic, or cubic Bezier curves."
|
||||
// http://www.spaceroots.org/documents/ellipse/elliptical-arc.pdf
|
||||
//
|
||||
// We follow the approach in section 2 of Goldapp (least-error,
|
||||
// Hermite-type approximation) and make both ratios equal to
|
||||
//
|
||||
// 2 2 + n - sqrt(2n + 28)
|
||||
// alpha = - * ---------------------
|
||||
// 3 n - 4
|
||||
//
|
||||
// where n = 3( cbrt(sqrt(2)+1) - cbrt(sqrt(2)-1) ).
|
||||
//
|
||||
// This is the result of Goldapp's equation (10b) when the angle
|
||||
// swept out by the arc is pi/2, and the parameter "a-bar" is the
|
||||
// expression given immediately below equation (21).
|
||||
//
|
||||
// Using this value, the maximum radial error for a circle, as a
|
||||
// fraction of the radius, is on the order of 0.2 x 10^-3.
|
||||
// Neither Dokken nor Goldapp discusses error for a general
|
||||
// ellipse; Maisonobe does, but his choice of control points
|
||||
// follows different constraints, and Goldapp's expression for
|
||||
// 'alpha' gives much smaller radial error, even for very flat
|
||||
// ellipses, than Maisonobe's equivalent.
|
||||
//
|
||||
// For the various corners and for each axis, the sign of this
|
||||
// constant changes, or it might be 0 -- it's multiplied by the
|
||||
// appropriate multiplier from the list before using.
|
||||
|
||||
const Float alpha = Float(0.55191497064665766025);
|
||||
|
||||
typedef struct { Float a, b; } twoFloats;
|
||||
|
||||
twoFloats cwCornerMults[4] = { { -1, 0 }, // cc == clockwise
|
||||
{ 0, -1 },
|
||||
{ +1, 0 },
|
||||
{ 0, +1 } };
|
||||
twoFloats ccwCornerMults[4] = { { +1, 0 }, // ccw == counter-clockwise
|
||||
{ 0, -1 },
|
||||
{ -1, 0 },
|
||||
{ 0, +1 } };
|
||||
|
||||
twoFloats *cornerMults = aDrawClockwise ? cwCornerMults : ccwCornerMults;
|
||||
|
||||
Point cornerCoords[] = { aRect.TopLeft(), aRect.TopRight(),
|
||||
aRect.BottomRight(), aRect.BottomLeft() };
|
||||
|
||||
Point pc, p0, p1, p2, p3;
|
||||
|
||||
// The indexes of the corners:
|
||||
const int kTopLeft = 0, kTopRight = 1;
|
||||
|
||||
if (aDrawClockwise) {
|
||||
aPathBuilder->MoveTo(Point(aRect.X() + aCornerRadii[kTopLeft].width,
|
||||
aRect.Y()));
|
||||
} else {
|
||||
aPathBuilder->MoveTo(Point(aRect.X() + aRect.Width() - aCornerRadii[kTopRight].width,
|
||||
aRect.Y()));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
// the corner index -- either 1 2 3 0 (cw) or 0 3 2 1 (ccw)
|
||||
int c = aDrawClockwise ? ((i+1) % 4) : ((4-i) % 4);
|
||||
|
||||
// i+2 and i+3 respectively. These are used to index into the corner
|
||||
// multiplier table, and were deduced by calculating out the long form
|
||||
// of each corner and finding a pattern in the signs and values.
|
||||
int i2 = (i+2) % 4;
|
||||
int i3 = (i+3) % 4;
|
||||
|
||||
pc = cornerCoords[c];
|
||||
|
||||
if (aCornerRadii[c].width > 0.0 && aCornerRadii[c].height > 0.0) {
|
||||
p0.x = pc.x + cornerMults[i].a * aCornerRadii[c].width;
|
||||
p0.y = pc.y + cornerMults[i].b * aCornerRadii[c].height;
|
||||
|
||||
p3.x = pc.x + cornerMults[i3].a * aCornerRadii[c].width;
|
||||
p3.y = pc.y + cornerMults[i3].b * aCornerRadii[c].height;
|
||||
|
||||
p1.x = p0.x + alpha * cornerMults[i2].a * aCornerRadii[c].width;
|
||||
p1.y = p0.y + alpha * cornerMults[i2].b * aCornerRadii[c].height;
|
||||
|
||||
p2.x = p3.x - alpha * cornerMults[i3].a * aCornerRadii[c].width;
|
||||
p2.y = p3.y - alpha * cornerMults[i3].b * aCornerRadii[c].height;
|
||||
|
||||
aPathBuilder->LineTo(p0);
|
||||
aPathBuilder->BezierTo(p1, p2, p3);
|
||||
} else {
|
||||
aPathBuilder->LineTo(pc);
|
||||
}
|
||||
}
|
||||
|
||||
aPathBuilder->Close();
|
||||
}
|
||||
|
||||
void
|
||||
AppendEllipseToPath(PathBuilder* aPathBuilder,
|
||||
const Point& aCenter,
|
||||
const Size& aDimensions)
|
||||
{
|
||||
Size halfDim = aDimensions / 2.0;
|
||||
Rect rect(aCenter - Point(halfDim.width, halfDim.height), aDimensions);
|
||||
Size radii[] = { halfDim, halfDim, halfDim, halfDim };
|
||||
|
||||
AppendRoundedRectToPath(aPathBuilder, rect, radii);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mozilla
|
||||
|
@ -81,7 +81,35 @@ void ArcToBezier(T* aSink, const Point &aOrigin, float aRadius, float aStartAngl
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Appends a path represending a rounded rectangle to the path being built by
|
||||
* aPathBuilder.
|
||||
*
|
||||
* aRect The rectangle to append.
|
||||
* aCornerRadii Contains the radii of the top-left, top-right, bottom-right
|
||||
* and bottom-left corners, in that order.
|
||||
* aDrawClockwise If set to true, the path will start at the left of the top
|
||||
* left edge and draw clockwise. If set to false the path will
|
||||
* start at the right of the top left edge and draw counter-
|
||||
* clockwise.
|
||||
*/
|
||||
GFX2D_API void AppendRoundedRectToPath(PathBuilder* aPathBuilder,
|
||||
const Rect& aRect,
|
||||
const Size(& aCornerRadii)[4],
|
||||
bool aDrawClockwise = true);
|
||||
|
||||
/**
|
||||
* Appends a path represending an ellipse to the path being built by
|
||||
* aPathBuilder.
|
||||
*
|
||||
* The ellipse extends aDimensions.width / 2.0 in the horizontal direction
|
||||
* from aCenter, and aDimensions.height / 2.0 in the vertical direction.
|
||||
*/
|
||||
GFX2D_API void AppendEllipseToPath(PathBuilder* aPathBuilder,
|
||||
const Point& aCenter,
|
||||
const Size& aDimensions);
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* MOZILLA_GFX_PATHHELPERS_H_ */
|
||||
|
@ -89,6 +89,7 @@ SOURCES += [
|
||||
'ImageScaling.cpp',
|
||||
'Matrix.cpp',
|
||||
'PathCairo.cpp',
|
||||
'PathHelpers.cpp',
|
||||
'PathRecording.cpp',
|
||||
'RecordedEvent.cpp',
|
||||
'Scale.cpp',
|
||||
|
@ -12,30 +12,30 @@ include protocol PGrallocBuffer;
|
||||
include protocol PLayer;
|
||||
include protocol PRenderFrame;
|
||||
|
||||
include "mozilla/WidgetUtils.h";
|
||||
include "mozilla/TimeStamp.h";
|
||||
include "mozilla/dom/ScreenOrientation.h";
|
||||
include "nsCSSProperty.h";
|
||||
include "gfxipc/ShadowLayerUtils.h";
|
||||
include "mozilla/GfxMessageUtils.h";
|
||||
include "ImageLayers.h";
|
||||
include "mozilla/layers/CompositorTypes.h";
|
||||
|
||||
using gfxPoint3D;
|
||||
using nscoord;
|
||||
using nsRect;
|
||||
using nsPoint;
|
||||
using mozilla::TimeDuration;
|
||||
using mozilla::TimeStamp;
|
||||
using mozilla::ScreenRotation;
|
||||
using nsCSSProperty;
|
||||
using mozilla::dom::ScreenOrientation;
|
||||
using mozilla::layers::TextureInfo;
|
||||
using mozilla::LayerMargin;
|
||||
using mozilla::LayerPoint;
|
||||
using mozilla::LayerRect;
|
||||
using mozilla::layers::ScaleMode;
|
||||
using mozilla::layers::DiagnosticTypes;
|
||||
using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h";
|
||||
using struct gfxRGBA from "gfxColor.h";
|
||||
using struct gfxPoint3D from "gfxPoint3D.h";
|
||||
using class gfx3DMatrix from "gfx3DMatrix.h";
|
||||
using nscoord from "nsCoord.h";
|
||||
using struct nsIntPoint from "nsPoint.h";
|
||||
using struct nsRect from "nsRect.h";
|
||||
using struct nsPoint from "nsPoint.h";
|
||||
using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
|
||||
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
using mozilla::ScreenRotation from "mozilla/WidgetUtils.h";
|
||||
using nsCSSProperty from "nsCSSProperty.h";
|
||||
using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
|
||||
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
|
||||
using mozilla::LayerMargin from "Units.h";
|
||||
using mozilla::LayerPoint from "Units.h";
|
||||
using mozilla::LayerRect from "Units.h";
|
||||
using mozilla::layers::ScaleMode from "mozilla/layers/LayersTypes.h";
|
||||
using mozilla::layers::DiagnosticTypes from "mozilla/layers/CompositorTypes.h";
|
||||
using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -4,29 +4,21 @@
|
||||
|
||||
include protocol PGrallocBuffer;
|
||||
|
||||
include "gfxipc/ShadowLayerUtils.h";
|
||||
include "mozilla/gfx/Types.h";
|
||||
include "nsRegion.h";
|
||||
|
||||
using gfx3DMatrix;
|
||||
using gfxIntSize;
|
||||
using gfxPoint;
|
||||
using gfxRGBA;
|
||||
using nsIntPoint;
|
||||
using nsIntRect;
|
||||
using nsIntRegion;
|
||||
using nsIntSize;
|
||||
using mozilla::GraphicsFilterType;
|
||||
using mozilla::layers::FrameMetrics;
|
||||
using mozilla::layers::MagicGrallocBufferHandle;
|
||||
using mozilla::layers::SurfaceDescriptorX11;
|
||||
using mozilla::null_t;
|
||||
using mozilla::WindowsHandle;
|
||||
using mozilla::gl::SharedTextureHandle;
|
||||
using mozilla::gl::SharedTextureShareType;
|
||||
using mozilla::gfx::SurfaceStreamHandle;
|
||||
using mozilla::gfx::SurfaceFormat;
|
||||
using mozilla::gfx::IntSize;
|
||||
using gfxIntSize from "nsSize.h";
|
||||
using struct gfxPoint from "gfxPoint.h";
|
||||
using struct nsIntRect from "nsRect.h";
|
||||
using nsIntRegion from "nsRegion.h";
|
||||
using struct nsIntSize from "nsSize.h";
|
||||
using struct mozilla::layers::MagicGrallocBufferHandle from "gfxipc/ShadowLayerUtils.h";
|
||||
using struct mozilla::layers::SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils.h";
|
||||
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
|
||||
using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
|
||||
using mozilla::gl::SharedTextureHandle from "GLContextTypes.h";
|
||||
using mozilla::gl::SharedTextureShareType from "GLContextTypes.h";
|
||||
using mozilla::gfx::SurfaceStreamHandle from "SurfaceTypes.h";
|
||||
using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
|
||||
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -8,7 +8,6 @@
|
||||
include protocol PLayerTransaction;
|
||||
include protocol PImageBridge;
|
||||
include protocol PCompositor;
|
||||
include "mozilla/layers/CompositorTypes.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -8,12 +8,11 @@
|
||||
include LayersSurfaces;
|
||||
include protocol PGrallocBuffer;
|
||||
include protocol PLayerTransaction;
|
||||
include "mozilla/layers/CompositorTypes.h";
|
||||
include "mozilla/GfxMessageUtils.h";
|
||||
|
||||
using mozilla::null_t;
|
||||
using mozilla::layers::TextureFactoryIdentifier;
|
||||
using mozilla::layers::LayersBackend;
|
||||
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
|
||||
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
|
||||
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -9,11 +9,9 @@ include protocol PGrallocBuffer;
|
||||
include protocol PCompositable;
|
||||
include ProtocolTypes;
|
||||
|
||||
include "mozilla/layers/CompositorTypes.h";
|
||||
include "mozilla/GfxMessageUtils.h";
|
||||
|
||||
using ImageHandle;
|
||||
using mozilla::layers::TextureInfo;
|
||||
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -13,13 +13,9 @@ include protocol PGrallocBuffer;
|
||||
include protocol PLayer;
|
||||
include protocol PRenderFrame;
|
||||
|
||||
include "mozilla/WidgetUtils.h";
|
||||
include "mozilla/dom/ScreenOrientation.h";
|
||||
include "nsCSSProperty.h";
|
||||
include "gfxipc/ShadowLayerUtils.h";
|
||||
include "mozilla/GfxMessageUtils.h";
|
||||
|
||||
using mozilla::layers::TextureInfo;
|
||||
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
|
||||
|
||||
/**
|
||||
* The layers protocol is spoken between thread contexts that manage
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user