Merge mozilla-central to fx-team

This commit is contained in:
Phil Ringnalda 2012-10-19 22:13:58 -07:00
Родитель 1d03067871 7ae7108be8
Коммит b6e6285116
1793 изменённых файлов: 33494 добавлений и 15129 удалений

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

@ -48,8 +48,10 @@ endif
ifdef MOZ_MEMORY
tier_base_dirs += memory/mozjemalloc
ifdef MOZ_JEMALLOC
ifndef MOZ_NATIVE_JEMALLOC
tier_base_dirs += memory/jemalloc
endif
endif
tier_base_dirs += memory/build
endif
ifndef MOZ_NATIVE_ZLIB
@ -80,7 +82,7 @@ default alldep all:: $(topsrcdir)/configure config.status
$(RM) -r $(DIST)/include
$(RM) -r $(DIST)/private
$(RM) -r $(DIST)/public
$(RM) $(DIST)/chrome.manifest
$(RM) $(DIST)/bin/chrome.manifest $(DIST)/bin/components/components.manifest
$(RM) -r _tests
$(topsrcdir)/configure: $(topsrcdir)/configure.in

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

@ -742,22 +742,20 @@ ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes)
AtkAttributeSet*
GetAttributeSet(Accessible* aAccessible)
{
nsCOMPtr<nsIPersistentProperties> attributes;
aAccessible->GetAttributes(getter_AddRefs(attributes));
if (attributes) {
// Deal with attributes that we only need to expose in ATK
if (aAccessible->State() & states::HASPOPUP) {
// There is no ATK state for haspopup, must use object attribute to expose the same info
nsAutoString oldValueUnused;
attributes->SetStringProperty(NS_LITERAL_CSTRING("haspopup"), NS_LITERAL_STRING("true"),
oldValueUnused);
}
return ConvertToAtkAttributeSet(attributes);
nsCOMPtr<nsIPersistentProperties> attributes = aAccessible->Attributes();
if (attributes) {
// There is no ATK state for haspopup, must use object attribute to expose
// the same info.
if (aAccessible->State() & states::HASPOPUP) {
nsAutoString unused;
attributes->SetStringProperty(NS_LITERAL_CSTRING("haspopup"),
NS_LITERAL_STRING("true"), unused);
}
return nullptr;
return ConvertToAtkAttributeSet(attributes);
}
return nullptr;
}
AtkAttributeSet *

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

@ -62,7 +62,7 @@ public:
AccEvent(uint32_t aEventType, Accessible* aAccessible,
EIsFromUserInput aIsFromUserInput = eAutoDetect,
EEventRule aEventRule = eRemoveDupes);
// Initialize with an nsIDOMNode
// Initialize with an nsINode
AccEvent(uint32_t aEventType, nsINode* aNode,
EIsFromUserInput aIsFromUserInput = eAutoDetect,
EEventRule aEventRule = eRemoveDupes);

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

@ -0,0 +1,44 @@
/* -*- 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/. */
#pragma once
namespace mozilla {
namespace a11y {
/**
* Accessible object types used when creating an accessible based on the frame.
*/
enum AccType {
eNoAccessible,
eHTMLBRAccessible,
eHTMLButtonAccessible,
eHTMLCanvasAccessible,
eHTMLCaptionAccessible,
eHTMLCheckboxAccessible,
eHTMLComboboxAccessible,
eHTMLFileInputAccessible,
eHTMLGroupboxAccessible,
eHTMLHRAccessible,
eHTMLImageMapAccessible,
eHTMLLabelAccessible,
eHTMLLiAccessible,
eHTMLSelectListAccessible,
eHTMLMediaAccessible,
eHTMLObjectFrameAccessible,
eHTMLRadioButtonAccessible,
eHTMLTableAccessible,
eHTMLTableCellAccessible,
eHTMLTableRowAccessible,
eHTMLTextFieldAccessible,
eHyperTextAccessible,
eImageAccessible,
eOuterDocAccessible,
eTextLeafAccessible
};
}
}

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

@ -684,7 +684,7 @@ logging::Node(const char* aDescr, nsINode* aNode)
return;
}
nsINode* parentNode = aNode->GetNodeParent();
nsINode* parentNode = aNode->GetParentNode();
int32_t idxInParent = parentNode ? parentNode->IndexOf(aNode) : - 1;
if (aNode->IsNodeOfType(nsINode::eTEXT)) {

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

@ -58,6 +58,7 @@ EXPORTS_NAMESPACES = mozilla/a11y
EXPORTS_mozilla/a11y = \
FocusManager.h \
AccTypes.h \
States.h \
Role.h \
$(NULL)

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

@ -424,8 +424,8 @@ NotificationController::CoalesceEvents()
// Coalesce events by sibling targets (this is a case for reorder
// events).
if (thisEvent->mNode->GetNodeParent() ==
tailEvent->mNode->GetNodeParent()) {
if (thisEvent->mNode->GetParentNode() ==
tailEvent->mNode->GetParentNode()) {
tailEvent->mEventRule = thisEvent->mEventRule;
return;
}
@ -521,7 +521,7 @@ NotificationController::ApplyToSiblings(uint32_t aStart, uint32_t aEnd,
AccEvent* accEvent = mEvents[index];
if (accEvent->mEventType == aEventType &&
accEvent->mEventRule != AccEvent::eDoNotEmit && accEvent->mNode &&
accEvent->mNode->GetNodeParent() == aNode->GetNodeParent()) {
accEvent->mNode->GetParentNode() == aNode->GetParentNode()) {
accEvent->mEventRule = aEventRule;
}
}
@ -705,7 +705,7 @@ NotificationController::TextEnumerator(nsCOMPtrHashKey<nsIContent>* aEntry,
// If the text node is not in tree or doesn't have frame then this case should
// have been handled already by content removal notifications.
nsINode* containerNode = textNode->GetNodeParent();
nsINode* containerNode = textNode->GetParentNode();
if (!containerNode) {
NS_ASSERTION(!textAcc,
"Text node was removed but accessible is kept alive!");

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

@ -92,7 +92,7 @@ const bool kUseNativeRole = false;
/**
* This mask indicates the attribute should not be exposed as an object
* attribute via the catch-all logic in Accessible::GetAttributes.
* attribute via the catch-all logic in Accessible::Attributes().
* This means it either isn't mean't to be exposed as an object attribute, or
* that it should, but is already handled in other code.
*/
@ -100,7 +100,7 @@ const uint8_t ATTR_BYPASSOBJ = 0x0001;
/**
* This mask indicates the attribute is expected to have an NMTOKEN or bool value.
* (See for example usage in Accessible::GetAttributes)
* (See for example usage in Accessible::Attributes())
*/
const uint8_t ATTR_VALTOKEN = 0x0010;

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

@ -40,7 +40,14 @@ public:
*/
DocAccessible* GetDocAccessible(const nsIPresShell* aPresShell)
{
return aPresShell ? GetDocAccessible(aPresShell->GetDocument()) : nullptr;
if (!aPresShell)
return nullptr;
DocAccessible* doc = aPresShell->GetDocAccessible();
if (doc)
return doc;
return GetDocAccessible(aPresShell->GetDocument());
}
/**

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

@ -381,8 +381,9 @@ nsAccUtils::GetScreenCoordsForParent(nsAccessNode *aAccessNode)
if (!parentFrame)
return nsIntPoint(0, 0);
nsIntRect parentRect = parentFrame->GetScreenRectExternal();
return nsIntPoint(parentRect.x, parentRect.y);
nsRect rect = parentFrame->GetScreenRectInAppUnits();
return nsPoint(rect.x, rect.y).
ToNearestPixels(parentFrame->PresContext()->AppUnitsPerDevPixel());
}
uint8_t

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

@ -16,7 +16,6 @@
#include "mozilla/dom/Element.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDOMNode.h"
#include "nsIPersistentProperties2.h"
#include "nsIPresShell.h"
#include "nsPoint.h"

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

@ -167,141 +167,10 @@ nsAccessibilityService::GetRootDocumentAccessible(nsIPresShell* aPresShell,
return nullptr;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateOuterDocAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new OuterDocAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLButtonAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLButtonAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLLIAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLLIAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHyperTextAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HyperTextAccessibleWrap(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLCheckboxAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLCheckboxAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLComboboxAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLCanvasAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLCanvasAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLFileInputAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLFileInputAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLImageAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new ImageAccessibleWrap(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLImageMapAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLImageMapAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLGroupboxAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLGroupboxAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLListboxAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLSelectListAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLMediaAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new EnumRoleAccessible(aContent, GetDocAccessible(aPresShell),
roles::GROUPING);
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
nsIContent* aContent,
nsIPresShell* aPresShell)
DocAccessible* aDoc)
{
// We can have several cases here:
// 1) a text or html embedded document where the contentDocument variable in
@ -314,14 +183,16 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
if (aFrame->GetRect().IsEmpty())
return nullptr;
// 1) for object elements containing either HTML or TXT documents
nsCOMPtr<nsIDOMHTMLObjectElement> obj(do_QueryInterface(aContent));
if (obj) {
nsCOMPtr<nsIDOMDocument> domDoc;
obj->GetContentDocument(getter_AddRefs(domDoc));
if (domDoc)
return CreateOuterDocAccessible(aContent, aPresShell);
if (domDoc) {
Accessible* newAcc = new OuterDocAccessible(aContent, aDoc);
NS_ADDREF(newAcc);
return newAcc;
}
}
#if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
@ -335,8 +206,7 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
aFrame->GetPluginPort(&pluginPort);
Accessible* accessible =
new HTMLWin32ObjectOwnerAccessible(aContent, GetDocAccessible(aPresShell),
pluginPort);
new HTMLWin32ObjectOwnerAccessible(aContent, aDoc, pluginPort);
NS_ADDREF(accessible);
return accessible;
@ -349,8 +219,7 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
NPPVpluginNativeAccessibleAtkPlugId, &plugId);
if (NS_SUCCEEDED(rv) && !plugId.IsEmpty()) {
AtkSocketAccessible* socketAccessible =
new AtkSocketAccessible(aContent, GetDocAccessible(aPresShell),
plugId);
new AtkSocketAccessible(aContent, aDoc, plugId);
NS_ADDREF(socketAccessible);
return socketAccessible;
@ -361,108 +230,9 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
// 3) for images and imagemaps, or anything else with a child frame
// we have the object frame, get the image frame
nsIFrame* frame = aFrame->GetFirstPrincipalChild();
return frame ? frame->CreateAccessible() : nullptr;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLRadioButtonAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLTableAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLTableAccessibleWrap(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLTableCellAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLTableCellAccessibleWrap(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLTableRowAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new EnumRoleAccessible(aContent, GetDocAccessible(aPresShell), roles::ROW);
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateTextLeafAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new TextLeafAccessibleWrap(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLTextFieldAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLTextFieldAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLLabelAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLLabelAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLHRAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLHRAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLBRAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLBRAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLCaptionAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new HTMLCaptionAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
nsIFrame* childFrame = aFrame->GetFirstPrincipalChild();
return childFrame ? CreateAccessibleByFrameType(childFrame, aContent, aDoc) :
nullptr;
}
void
@ -953,7 +723,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
return nullptr;
}
newAcc = frame->CreateAccessible();
newAcc = CreateAccessibleByFrameType(frame, content, aDoc);
if (aDoc->BindToDocument(newAcc, nullptr)) {
newAcc->AsTextLeaf()->SetText(text);
return newAcc;
@ -1110,7 +880,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
}
// Try using frame to do it.
newAcc = frame->CreateAccessible();
newAcc = CreateAccessibleByFrameType(frame, content, aDoc);
}
}
}
@ -1659,6 +1429,95 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
return nullptr;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
nsIContent* aContent,
DocAccessible* aDoc)
{
nsRefPtr<Accessible> newAcc;
switch (aFrame->AccessibleType()) {
case eNoAccessible:
return nullptr;
case eHTMLBRAccessible:
newAcc = new HTMLBRAccessible(aContent, aDoc);
break;
case eHTMLButtonAccessible:
newAcc = new HTMLButtonAccessible(aContent, aDoc);
break;
case eHTMLCanvasAccessible:
newAcc = new HTMLCanvasAccessible(aContent, aDoc);
break;
case eHTMLCaptionAccessible:
newAcc = new HTMLCaptionAccessible(aContent, aDoc);
break;
case eHTMLCheckboxAccessible:
newAcc = new HTMLCheckboxAccessible(aContent, aDoc);
break;
case eHTMLComboboxAccessible:
newAcc = new HTMLComboboxAccessible(aContent, aDoc);
break;
case eHTMLFileInputAccessible:
newAcc = new HTMLFileInputAccessible(aContent, aDoc);
break;
case eHTMLGroupboxAccessible:
newAcc = new HTMLGroupboxAccessible(aContent, aDoc);
break;
case eHTMLHRAccessible:
newAcc = new HTMLHRAccessible(aContent, aDoc);
break;
case eHTMLImageMapAccessible:
newAcc = new HTMLImageMapAccessible(aContent, aDoc);
break;
case eHTMLLabelAccessible:
newAcc = new HTMLLabelAccessible(aContent, aDoc);
break;
case eHTMLLiAccessible:
newAcc = new HTMLLIAccessible(aContent, aDoc);
break;
case eHTMLSelectListAccessible:
newAcc = new HTMLSelectListAccessible(aContent, aDoc);
break;
case eHTMLMediaAccessible:
newAcc = new EnumRoleAccessible(aContent, aDoc, roles::GROUPING);
break;
case eHTMLObjectFrameAccessible: {
nsObjectFrame* objectFrame = do_QueryFrame(aFrame);
newAcc = CreateHTMLObjectFrameAccessible(objectFrame, aContent, aDoc);
break;
}
case eHTMLRadioButtonAccessible:
newAcc = new HTMLRadioButtonAccessible(aContent, aDoc);
break;
case eHTMLTableAccessible:
newAcc = new HTMLTableAccessibleWrap(aContent, aDoc);
break;
case eHTMLTableCellAccessible:
newAcc = new HTMLTableCellAccessibleWrap(aContent, aDoc);
break;
case eHTMLTableRowAccessible:
newAcc = new EnumRoleAccessible(aContent, aDoc, roles::ROW);
break;
case eHTMLTextFieldAccessible:
newAcc = new HTMLTextFieldAccessible(aContent, aDoc);
break;
case eHyperTextAccessible:
newAcc = new HyperTextAccessibleWrap(aContent, aDoc);
break;
case eImageAccessible:
newAcc = new ImageAccessibleWrap(aContent, aDoc);
break;
case eOuterDocAccessible:
newAcc = new OuterDocAccessible(aContent, aDoc);
break;
case eTextLeafAccessible:
newAcc = new TextLeafAccessibleWrap(aContent, aDoc);
break;
}
return newAcc.forget();
}
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibilityService (DON'T put methods here)

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

@ -16,6 +16,7 @@
#include "nsIObserver.h"
class nsImageFrame;
class nsObjectFrame;
class nsITreeView;
namespace mozilla {
@ -79,55 +80,9 @@ public:
// nsIAccessibilityService
virtual Accessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
bool aCanCreate);
already_AddRefed<Accessible>
CreateHTMLButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLBRAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLCanvasAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLCaptionAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLCheckboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLComboboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLFileInputAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLGroupboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLHRAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLImageAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLImageMapAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLLabelAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLLIAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLListboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLMediaAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame, nsIContent* aContent,
nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLRadioButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLTableRowAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateTextLeafAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHTMLTextFieldAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateHyperTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<Accessible>
CreateOuterDocAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
DocAccessible* aDoc);
/**
* Adds/remove ATK root accessible for gtk+ native window to/from children
@ -239,6 +194,13 @@ private:
DocAccessible* aDoc,
bool aIsLegalPartOfHTMLTable);
/**
* Create an accessible whose type depends on the given frame.
*/
already_AddRefed<Accessible>
CreateAccessibleByFrameType(nsIFrame* aFrame, nsIContent* aContent,
DocAccessible* aDoc);
/**
* Create accessible if parent is a deck frame.
*/

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

@ -9,6 +9,8 @@
#include "nsAccessNode.h"
#include "nsIBaseWindow.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLDocument.h"
@ -248,7 +250,7 @@ nsCoreUtils::IsAncestorOf(nsINode *aPossibleAncestorNode,
NS_ENSURE_TRUE(aPossibleAncestorNode && aPossibleDescendantNode, false);
nsINode *parentNode = aPossibleDescendantNode;
while ((parentNode = parentNode->GetNodeParent()) &&
while ((parentNode = parentNode->GetParentNode()) &&
parentNode != aRootNode) {
if (parentNode == aPossibleAncestorNode)
return true;
@ -303,19 +305,14 @@ nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
nsIFrame *aFrame,
const nsIntPoint& aPoint)
{
nsIScrollableFrame *scrollableFrame = do_QueryFrame(aScrollableFrame);
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aScrollableFrame);
if (!scrollableFrame)
return;
nsPresContext *presContext = aFrame->PresContext();
nsIntRect frameRect = aFrame->GetScreenRectExternal();
int32_t devDeltaX = aPoint.x - frameRect.x;
int32_t devDeltaY = aPoint.y - frameRect.y;
nsPoint deltaPoint;
deltaPoint.x = presContext->DevPixelsToAppUnits(devDeltaX);
deltaPoint.y = presContext->DevPixelsToAppUnits(devDeltaY);
nsPoint point =
aPoint.ToAppUnits(aFrame->PresContext()->AppUnitsPerDevPixel());
nsRect frameRect = aFrame->GetScreenRectInAppUnits();
nsPoint deltaPoint(point.x - frameRect.x, point.y - frameRect.y);
nsPoint scrollPoint = scrollableFrame->GetScrollPosition();
scrollPoint -= deltaPoint;
@ -386,19 +383,15 @@ nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode)
if (!treeItem)
return coords;
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
nsCOMPtr<nsIDOMDocument> domDoc = do_GetInterface(rootTreeItem);
if (!domDoc)
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
treeItem->GetTreeOwner(getter_AddRefs(treeOwner));
if (!treeOwner)
return coords;
nsCOMPtr<nsIDOMWindow> window;
domDoc->GetDefaultView(getter_AddRefs(window));
if (!window)
return coords;
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(treeOwner);
if (baseWindow)
baseWindow->GetPosition(&coords.x, &coords.y); // in device pixels
window->GetScreenX(&coords.x);
window->GetScreenY(&coords.y);
return coords;
}
@ -481,26 +474,6 @@ nsCoreUtils::IsErrorPage(nsIDocument *aDocument)
return StringBeginsWith(path, neterror) || StringBeginsWith(path, certerror);
}
already_AddRefed<nsIDOMNode>
nsCoreUtils::GetDOMNodeForContainer(nsIDocShellTreeItem *aContainer)
{
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(aContainer);
nsCOMPtr<nsIContentViewer> cv;
shell->GetContentViewer(getter_AddRefs(cv));
if (!cv)
return nullptr;
nsIDocument* doc = cv->GetDocument();
if (!doc)
return nullptr;
nsIDOMNode* node = nullptr;
CallQueryInterface(doc, &node);
return node;
}
bool
nsCoreUtils::GetID(nsIContent *aContent, nsAString& aID)
{

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

@ -16,7 +16,6 @@
#include "nsTArray.h"
class nsRange;
class nsIDOMNode;
class nsIFrame;
class nsIDocShellTreeItem;
class nsITreeColumn;
@ -169,7 +168,8 @@ public:
nsIPresShell::ScrollAxis *aHorizontal);
/**
* Returns coordinates relative screen for the top level window.
* Returns coordinates in device pixels relative screen for the top level
* window.
*
* @param aNode the DOM node hosted in the window.
*/
@ -209,12 +209,6 @@ public:
return aNode->OwnerDoc()->GetShell();
}
/**
* Return document node for the given document shell tree item.
*/
static already_AddRefed<nsIDOMNode>
GetDOMNodeForContainer(nsIDocShellTreeItem *aContainer);
/**
* Get the ID for an element, in some types of XML this may not be the ID attribute
* @param aContent Node to get the ID for

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

@ -32,7 +32,7 @@ nsTextEquivUtils::GetNameFromSubtree(Accessible* aAccessible,
return NS_OK;
gInitiatorAcc = aAccessible;
if (GetRoleRule(aAccessible->Role()) == eFromSubtree) {
if (IsNameFromSubtreeAllowed(aAccessible)) {
//XXX: is it necessary to care the accessible is not a document?
if (aAccessible->IsContent()) {
nsAutoString name;

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

@ -89,6 +89,14 @@ public:
static nsresult AppendTextEquivFromTextContent(nsIContent *aContent,
nsAString *aString);
/**
* Return true if the given accessible allows name from subtree.
*/
static bool IsNameFromSubtreeAllowed(Accessible* aAccessible)
{
return GetRoleRule(aAccessible->Role()) == eFromSubtree;
}
private:
/**
* Iterates accessible children and calculates text equivalent from each

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

@ -614,19 +614,16 @@ ARIAGridCellAccessible::ApplyARIAState(uint64_t* aState) const
*aState |= states::SELECTABLE | states::SELECTED;
}
nsresult
ARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
already_AddRefed<nsIPersistentProperties>
ARIAGridCellAccessible::NativeAttributes()
{
if (IsDefunct())
return NS_ERROR_FAILURE;
nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPersistentProperties> attributes =
HyperTextAccessibleWrap::NativeAttributes();
// Expose "table-cell-index" attribute.
Accessible* thisRow = Row();
if (!thisRow)
return NS_OK;
return attributes.forget();
int32_t colIdx = 0, colCount = 0;
uint32_t childCount = thisRow->ChildCount();
@ -645,10 +642,9 @@ ARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttribut
nsAutoString stringIdx;
stringIdx.AppendInt(rowIdx * colCount + colIdx);
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tableCellIndex,
stringIdx);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::tableCellIndex, stringIdx);
return NS_OK;
return attributes.forget();
}
void

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

@ -116,7 +116,7 @@ public:
virtual TableCellAccessible* AsTableCell() { return this; }
virtual void Shutdown();
virtual void ApplyARIAState(uint64_t* aState) const;
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
protected:

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

@ -275,7 +275,7 @@ Accessible::Name(nsString& aName)
ENameValueFlag nameFlag = NativeName(aName);
if (!aName.IsEmpty())
return eNameOK;
return nameFlag;
// In the end get the name from tooltip.
if (mContent->IsHTML()) {
@ -288,14 +288,12 @@ Accessible::Name(nsString& aName)
aName.CompressWhitespace();
return eNameFromTooltip;
}
} else {
return eNameOK;
}
if (nameFlag != eNoNameOnPurpose)
aName.SetIsVoid(true);
return eNameOK;
return nameFlag;
}
NS_IMETHODIMP
@ -1055,7 +1053,7 @@ Accessible::TakeFocus()
return NS_OK;
}
void
ENameValueFlag
Accessible::GetHTMLName(nsString& aLabel)
{
Accessible* labelAcc = nullptr;
@ -1066,8 +1064,11 @@ Accessible::GetHTMLName(nsString& aLabel)
aLabel.CompressWhitespace();
}
if (aLabel.IsEmpty())
nsTextEquivUtils::GetNameFromSubtree(this, aLabel);
if (!aLabel.IsEmpty())
return eNameOK;
nsTextEquivUtils::GetNameFromSubtree(this, aLabel);
return aLabel.IsEmpty() ? eNameOK : eNameFromSubtree;
}
/**
@ -1082,7 +1083,7 @@ Accessible::GetHTMLName(nsString& aLabel)
* the control that uses the control="controlID" syntax will use
* the child label for its Name.
*/
void
ENameValueFlag
Accessible::GetXULName(nsString& aName)
{
// CASE #1 (via label attribute) -- great majority of the cases
@ -1125,10 +1126,9 @@ Accessible::GetXULName(nsString& aName)
}
}
// XXX If CompressWhiteSpace worked on nsAString we could avoid a copy
aName.CompressWhitespace();
if (!aName.IsEmpty())
return;
return eNameOK;
// Can get text from title of <toolbaritem> if we're a child of a <toolbaritem>
nsIContent *bindingParent = mContent->GetBindingParent();
@ -1138,12 +1138,13 @@ Accessible::GetXULName(nsString& aName)
if (parent->Tag() == nsGkAtoms::toolbaritem &&
parent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aName)) {
aName.CompressWhitespace();
return;
return eNameOK;
}
parent = parent->GetParent();
}
nsTextEquivUtils::GetNameFromSubtree(this, aName);
return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
}
nsresult
@ -1185,62 +1186,39 @@ Accessible::GetRole(uint32_t *aRole)
}
NS_IMETHODIMP
Accessible::GetAttributes(nsIPersistentProperties **aAttributes)
Accessible::GetAttributes(nsIPersistentProperties** aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes); // In/out param. Created if necessary.
NS_ENSURE_ARG_POINTER(aAttributes);
*aAttributes = nullptr;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPersistentProperties> attributes = *aAttributes;
if (!attributes) {
// Create only if an array wasn't already passed in
attributes = do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
NS_ENSURE_TRUE(attributes, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(*aAttributes = attributes);
}
nsresult rv = GetAttributesInternal(attributes);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPersistentProperties> attributes = Attributes();
attributes.swap(*aAttributes);
nsAutoString id;
nsAutoString oldValueUnused;
if (nsCoreUtils::GetID(mContent, id)) {
// Expose ID. If an <iframe id> exists override the one on the <body> of the source doc,
// because the specific instance is what makes the ID useful for scripts
attributes->SetStringProperty(NS_LITERAL_CSTRING("id"), id, oldValueUnused);
}
nsAutoString xmlRoles;
return NS_OK;
}
already_AddRefed<nsIPersistentProperties>
Accessible::Attributes()
{
nsCOMPtr<nsIPersistentProperties> attributes = NativeAttributes();
if (!HasOwnContent() || !mContent->IsElement())
return attributes.forget();
// 'xml-roles' attribute coming from ARIA.
nsAutoString xmlRoles, unused;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::role, xmlRoles)) {
attributes->SetStringProperty(NS_LITERAL_CSTRING("xml-roles"), xmlRoles, oldValueUnused);
attributes->SetStringProperty(NS_LITERAL_CSTRING("xml-roles"),
xmlRoles, unused);
}
if (HasNumericValue()) {
// We support values, so expose the string value as well, via the valuetext object attribute
// We test for the value interface because we don't want to expose traditional get_accValue()
// information such as URL's on links and documents, or text in an input
nsAutoString valuetext;
GetValue(valuetext);
attributes->SetStringProperty(NS_LITERAL_CSTRING("valuetext"), valuetext, oldValueUnused);
}
// Expose checkable object attribute if the accessible has checkable state
if (State() & states::CHECKABLE)
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::checkable, NS_LITERAL_STRING("true"));
// Group attributes (level/setsize/posinset)
GroupPos groupPos = GroupPosition();
nsAccUtils::SetAccGroupAttrs(attributes, groupPos.level,
groupPos.setSize, groupPos.posInSet);
// Expose object attributes from ARIA attributes.
aria::AttrIterator attribIter(mContent);
nsAutoString name, value;
while(attribIter.Next(name, value)) {
attributes->SetStringProperty(NS_ConvertUTF16toUTF8(name), value,
oldValueUnused);
}
while(attribIter.Next(name, value))
attributes->SetStringProperty(NS_ConvertUTF16toUTF8(name), value, unused);
// If there is no aria-live attribute then expose default value of 'live'
// object attribute used for ARIA role of this accessible.
@ -1253,43 +1231,67 @@ Accessible::GetAttributes(nsIPersistentProperties **aAttributes)
}
}
return NS_OK;
return attributes.forget();
}
nsresult
Accessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
already_AddRefed<nsIPersistentProperties>
Accessible::NativeAttributes()
{
// If the accessible isn't primary for its node (such as list item bullet or
// xul tree item then don't calculate content based attributes.
nsCOMPtr<nsIPersistentProperties> attributes =
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
nsAutoString unused;
// We support values, so expose the string value as well, via the valuetext
// object attribute. We test for the value interface because we don't want
// to expose traditional Value() information such as URL's on links and
// documents, or text in an input.
if (HasNumericValue()) {
nsAutoString valuetext;
GetValue(valuetext);
attributes->SetStringProperty(NS_LITERAL_CSTRING("valuetext"), valuetext,
unused);
}
// Expose checkable object attribute if the accessible has checkable state
if (State() & states::CHECKABLE) {
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::checkable,
NS_LITERAL_STRING("true"));
}
// Expose 'explicit-name' attribute.
if (!nsTextEquivUtils::IsNameFromSubtreeAllowed(this) ||
Name(unused) != eNameFromSubtree) {
attributes->SetStringProperty(NS_LITERAL_CSTRING("explicit-name"),
NS_LITERAL_STRING("true"), unused);
}
// Group attributes (level/setsize/posinset)
GroupPos groupPos = GroupPosition();
nsAccUtils::SetAccGroupAttrs(attributes, groupPos.level,
groupPos.setSize, groupPos.posInSet);
// If the accessible doesn't have own content (such as list item bullet or
// xul tree item) then don't calculate content based attributes.
if (!HasOwnContent())
return NS_OK;
return attributes.forget();
// Attributes set by this method will not be used to override attributes on a sub-document accessible
// when there is a <frame>/<iframe> element that spawned the sub-document
nsEventShell::GetEventAttributes(GetNode(), attributes);
nsEventShell::GetEventAttributes(GetNode(), aAttributes);
// Expose class because it may have useful microformat information
// Let the class from an iframe's document be exposed, don't override from <iframe class>
nsAutoString _class;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, _class))
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::_class, _class);
// Get container-foo computed live region properties based on the closest container with
// the live region attribute.
// Inner nodes override outer nodes within the same document --
// The inner nodes can be used to override live region behavior on more general outer nodes
// However, nodes in outer documents override nodes in inner documents:
// Outer doc author may want to override properties on a widget they used in an iframe
// Get container-foo computed live region properties based on the closest
// container with the live region attribute. Inner nodes override outer nodes
// within the same document. The inner nodes can be used to override live
// region behavior on more general outer nodes. However, nodes in outer
// documents override nodes in inner documents: outer doc author may want to
// override properties on a widget they used in an iframe.
nsIContent* startContent = mContent;
while (startContent) {
nsIDocument* doc = startContent->GetDocument();
nsIContent* rootContent = nsCoreUtils::GetRoleContent(doc);
if (!rootContent)
return NS_OK;
if (!doc)
break;
nsAccUtils::SetLiveContainerAttributes(aAttributes, startContent,
rootContent);
nsAccUtils::SetLiveContainerAttributes(attributes, startContent,
nsCoreUtils::GetRoleContent(doc));
// Allow ARIA live region markup from outer documents to override
nsCOMPtr<nsISupports> container = doc->GetContainer();
@ -1303,28 +1305,37 @@ Accessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
if (!sameTypeParent || sameTypeParent == docShellTreeItem)
break;
nsIDocument *parentDoc = doc->GetParentDocument();
nsIDocument* parentDoc = doc->GetParentDocument();
if (!parentDoc)
break;
startContent = parentDoc->FindContentForSubDocument(doc);
startContent = parentDoc->FindContentForSubDocument(doc);
}
if (!mContent->IsElement())
return NS_OK;
return attributes.forget();
nsAutoString id;
if (nsCoreUtils::GetID(mContent, id))
attributes->SetStringProperty(NS_LITERAL_CSTRING("id"), id, unused);
// Expose class because it may have useful microformat information.
nsAutoString _class;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, _class))
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::_class, _class);
// Expose tag.
nsAutoString tagName;
mContent->NodeInfo()->GetName(tagName);
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tag, tagName);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::tag, tagName);
// Expose draggable object attribute?
// Expose draggable object attribute.
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent);
if (htmlElement) {
bool draggable = false;
htmlElement->GetDraggable(&draggable);
if (draggable) {
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::draggable,
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::draggable,
NS_LITERAL_STRING("true"));
}
}
@ -1332,7 +1343,7 @@ Accessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
// Don't calculate CSS-based object attributes when no frame (i.e.
// the accessible is unattached from the tree).
if (!mContent->GetPrimaryFrame())
return NS_OK;
return attributes.forget();
// CSS style based object attributes.
nsAutoString value;
@ -1340,33 +1351,33 @@ Accessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
// Expose 'display' attribute.
styleInfo.Display(value);
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::display, value);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::display, value);
// Expose 'text-align' attribute.
styleInfo.TextAlign(value);
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::textAlign, value);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textAlign, value);
// Expose 'text-indent' attribute.
styleInfo.TextIndent(value);
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::textIndent, value);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textIndent, value);
// Expose 'margin-left' attribute.
styleInfo.MarginLeft(value);
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::marginLeft, value);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::marginLeft, value);
// Expose 'margin-right' attribute.
styleInfo.MarginRight(value);
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::marginRight, value);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::marginRight, value);
// Expose 'margin-top' attribute.
styleInfo.MarginTop(value);
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::marginTop, value);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::marginTop, value);
// Expose 'margin-bottom' attribute.
styleInfo.MarginBottom(value);
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::marginBottom, value);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::marginBottom, value);
return NS_OK;
return attributes.forget();
}
GroupPos
@ -2420,23 +2431,18 @@ Accessible::Shutdown()
// Accessible protected
void
Accessible::ARIAName(nsAString& aName)
Accessible::ARIAName(nsString& aName)
{
nsAutoString label;
// aria-labelledby now takes precedence over aria-label
nsresult rv = nsTextEquivUtils::
GetTextEquivFromIDRefs(this, nsGkAtoms::aria_labelledby, label);
GetTextEquivFromIDRefs(this, nsGkAtoms::aria_labelledby, aName);
if (NS_SUCCEEDED(rv)) {
label.CompressWhitespace();
aName = label;
aName.CompressWhitespace();
}
if (label.IsEmpty() &&
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_label,
label)) {
label.CompressWhitespace();
aName = label;
if (aName.IsEmpty() &&
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_label, aName)) {
aName.CompressWhitespace();
}
}
@ -2445,9 +2451,10 @@ ENameValueFlag
Accessible::NativeName(nsString& aName)
{
if (mContent->IsHTML())
GetHTMLName(aName);
else if (mContent->IsXUL())
GetXULName(aName);
return GetHTMLName(aName);
if (mContent->IsXUL())
return GetXULName(aName);
return eNameOK;
}

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

@ -58,6 +58,11 @@ enum ENameValueFlag {
*/
eNoNameOnPurpose,
/**
* Name was computed from the subtree.
*/
eNameFromSubtree,
/**
* Tooltip was used as a name.
*/
@ -243,10 +248,9 @@ public:
virtual bool NativelyUnavailable() const;
/**
* Returns attributes for accessible without explicitly setted ARIA
* attributes.
* Return object attributes for the accessible.
*/
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual already_AddRefed<nsIPersistentProperties> Attributes();
/**
* Return group position (level, position in set and set size).
@ -505,6 +509,8 @@ public:
inline bool IsMenuPopup() const { return mFlags & eMenuPopupAccessible; }
inline bool IsProgress() const { return mFlags & eProgressAccessible; }
inline bool IsRoot() const { return mFlags & eRootAccessible; }
mozilla::a11y::RootAccessible* AsRoot();
@ -705,6 +711,18 @@ public:
protected:
/**
* Return the accessible name provided by native markup. It doesn't take
* into account ARIA markup used to specify the name.
*/
virtual mozilla::a11y::ENameValueFlag NativeName(nsString& aName);
/**
* Return object attributes provided by native markup. It doesn't take into
* account ARIA.
*/
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes();
//////////////////////////////////////////////////////////////////////////////
// Initializing, cache and tree traverse methods
@ -776,10 +794,11 @@ protected:
eListControlAccessible = 1 << 17,
eMenuButtonAccessible = 1 << 18,
eMenuPopupAccessible = 1 << 19,
eRootAccessible = 1 << 20,
eTextLeafAccessible = 1 << 21,
eXULDeckAccessible = 1 << 22,
eXULTreeAccessible = 1 << 23
eProgressAccessible = 1 << 20,
eRootAccessible = 1 << 21,
eTextLeafAccessible = 1 << 22,
eXULDeckAccessible = 1 << 23,
eXULTreeAccessible = 1 << 24
};
//////////////////////////////////////////////////////////////////////////////
@ -793,22 +812,16 @@ protected:
//////////////////////////////////////////////////////////////////////////////
// Name helpers
/**
* Return the accessible name provided by native markup. It doesn't take
* into account ARIA markup used to specify the name.
*/
virtual mozilla::a11y::ENameValueFlag NativeName(nsString& aName);
/**
* Returns the accessible name specified by ARIA.
*/
void ARIAName(nsAString& aName);
void ARIAName(nsString& aName);
/**
* Compute the name of HTML/XUL node.
*/
void GetHTMLName(nsString& aName);
void GetXULName(nsString& aName);
mozilla::a11y::ENameValueFlag GetHTMLName(nsString& aName);
mozilla::a11y::ENameValueFlag GetXULName(nsString& aName);
// helper method to verify frames
static nsresult GetFullKeyName(const nsAString& aModifierName, const nsAString& aKeyName, nsAString& aStringOut);

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

@ -110,12 +110,10 @@ ApplicationAccessible::State()
return IsDefunct() ? states::DEFUNCT : 0;
}
NS_IMETHODIMP
ApplicationAccessible::GetAttributes(nsIPersistentProperties** aAttributes)
already_AddRefed<nsIPersistentProperties>
ApplicationAccessible::NativeAttributes()
{
NS_ENSURE_ARG_POINTER(aAttributes);
*aAttributes = nullptr;
return NS_OK;
return nullptr;
}
GroupPos

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

@ -45,7 +45,6 @@ public:
NS_IMETHOD GetParent(nsIAccessible **aParent);
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
NS_IMETHOD GetBounds(int32_t *aX, int32_t *aY,
int32_t *aWidth, int32_t *aHeight);
NS_IMETHOD SetSelected(bool aIsSelected);
@ -63,6 +62,7 @@ public:
virtual void Shutdown();
// Accessible
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
virtual GroupPos GroupPosition();
virtual ENameValueFlag Name(nsString& aName);
virtual void ApplyARIAState(uint64_t* aState) const;

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

@ -43,6 +43,7 @@
#include "nsIURI.h"
#include "nsIWebNavigation.h"
#include "nsFocusManager.h"
#include "mozilla/Assertions.h"
#include "mozilla/dom/Element.h"
#ifdef A11Y_LOG
@ -85,8 +86,8 @@ DocAccessible::
mPresShell(aPresShell)
{
mFlags |= eDocAccessible | eNotNodeMapEntry;
if (mPresShell)
mPresShell->SetAccDocument(this);
MOZ_ASSERT(mPresShell, "should have been given a pres shell");
mPresShell->SetDocAccessible(this);
mDependentIDsHash.Init();
// XXX aaronl should we use an algorithm for the initial cache size?
@ -338,17 +339,24 @@ DocAccessible::ApplyARIAState(uint64_t* aState) const
// Allow iframe/frame etc. to have final state override via ARIA
if (mParent)
mParent->ApplyARIAState(aState);
}
NS_IMETHODIMP
DocAccessible::GetAttributes(nsIPersistentProperties** aAttributes)
already_AddRefed<nsIPersistentProperties>
DocAccessible::Attributes()
{
Accessible::GetAttributes(aAttributes);
if (mParent) {
mParent->GetAttributes(aAttributes); // Add parent attributes (override inner)
}
return NS_OK;
nsCOMPtr<nsIPersistentProperties> attributes =
HyperTextAccessibleWrap::Attributes();
if (!mParent)
return attributes.forget();
// Override ARIA object attributes from outerdoc.
aria::AttrIterator attribIter(mParent->GetContent());
nsAutoString name, value, unused;
while(attribIter.Next(name, value))
attributes->SetStringProperty(NS_ConvertUTF16toUTF8(name), value, unused);
return attributes.forget();
}
Accessible*
@ -636,7 +644,7 @@ DocAccessible::Shutdown()
logging::DocDestroy("document shutdown", mDocument, this);
#endif
mPresShell->SetAccDocument(nullptr);
mPresShell->SetDocAccessible(nullptr);
if (mNotificationController) {
mNotificationController->Shutdown();
@ -1121,6 +1129,14 @@ DocAccessible::AttributeChangedImpl(nsIContent* aContent, int32_t aNameSpaceID,
FireDelayedAccessibleEvent(editableChangeEvent);
return;
}
if (aAttribute == nsGkAtoms::value) {
Accessible* accessible = GetAccessible(aContent);
if(accessible && accessible->IsProgress()) {
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
aContent);
}
}
}
// DocAccessible protected member
@ -1378,7 +1394,7 @@ DocAccessible::GetAccessibleOrContainer(nsINode* aNode)
nsINode* currNode = aNode;
Accessible* accessible = nullptr;
while (!(accessible = GetAccessible(currNode)) &&
(currNode = currNode->GetNodeParent()));
(currNode = currNode->GetParentNode()));
return accessible;
}

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

@ -68,7 +68,6 @@ public:
virtual ~DocAccessible();
// nsIAccessible
NS_IMETHOD GetAttributes(nsIPersistentProperties** aAttributes);
NS_IMETHOD TakeFocus(void);
// nsIScrollPositionListener
@ -94,6 +93,7 @@ public:
virtual uint64_t NativeInteractiveState() const;
virtual bool NativelyUnavailable() const;
virtual void ApplyARIAState(uint64_t* aState) const;
virtual already_AddRefed<nsIPersistentProperties> Attributes();
virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
@ -269,7 +269,7 @@ public:
*/
Accessible* GetContainerAccessible(nsINode* aNode)
{
return aNode ? GetAccessibleOrContainer(aNode->GetNodeParent()) : nullptr;
return aNode ? GetAccessibleOrContainer(aNode->GetParentNode()) : nullptr;
}
/**

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

@ -21,7 +21,7 @@ public:
ProgressMeterAccessible(nsIContent* aContent, DocAccessible* aDoc) :
LeafAccessible(aContent, aDoc)
{
mFlags = mFlags | eHasNumericValue;
mFlags |= eHasNumericValue | eProgressAccessible;
}
NS_DECL_ISUPPORTS_INHERITED

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

@ -1135,21 +1135,19 @@ HyperTextAccessible::GetLevelInternal()
return AccessibleWrap::GetLevelInternal();
}
nsresult
HyperTextAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
already_AddRefed<nsIPersistentProperties>
HyperTextAccessible::NativeAttributes()
{
nsresult rv = AccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPersistentProperties> attributes =
AccessibleWrap::NativeAttributes();
// Indicate when the current object uses block-level formatting
// via formatting: block
// XXX: 'formatting' attribute is deprecated and will be removed in Mozilla2,
// use 'display' attribute instead.
// 'formatting' attribute is deprecated, 'display' attribute should be
// instead.
nsIFrame *frame = GetFrame();
if (frame && frame->GetType() == nsGkAtoms::blockFrame) {
nsAutoString oldValueUnused;
aAttributes->SetStringProperty(NS_LITERAL_CSTRING("formatting"), NS_LITERAL_STRING("block"),
oldValueUnused);
nsAutoString unused;
attributes->SetStringProperty(NS_LITERAL_CSTRING("formatting"),
NS_LITERAL_STRING("block"), unused);
}
if (FocusMgr()->IsFocused(this)) {
@ -1157,8 +1155,7 @@ HyperTextAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
if (lineNumber >= 1) {
nsAutoString strLineNumber;
strLineNumber.AppendInt(lineNumber);
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::lineNumber,
strLineNumber);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::lineNumber, strLineNumber);
}
}
@ -1167,22 +1164,22 @@ HyperTextAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
// a landmark since it usually contains headings. We're not yet sure how the
// web will use html:footer but our best bet right now is as contentinfo.
if (mContent->Tag() == nsGkAtoms::nav)
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles,
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
NS_LITERAL_STRING("navigation"));
else if (mContent->Tag() == nsGkAtoms::section)
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles,
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
NS_LITERAL_STRING("region"));
else if (mContent->Tag() == nsGkAtoms::footer)
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles,
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
NS_LITERAL_STRING("contentinfo"));
else if (mContent->Tag() == nsGkAtoms::aside)
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles,
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
NS_LITERAL_STRING("complementary"));
else if (mContent->Tag() == nsGkAtoms::article)
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles,
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
NS_LITERAL_STRING("article"));
return NS_OK;
return attributes.forget();
}
/*
@ -1953,12 +1950,14 @@ HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartIndex,
ENameValueFlag
HyperTextAccessible::NativeName(nsString& aName)
{
AccessibleWrap::NativeName(aName);
ENameValueFlag nameFlag = AccessibleWrap::NativeName(aName);
if (!aName.IsEmpty())
return nameFlag;
// Get name from title attribute for HTML abbr and acronym elements making it
// a valid name from markup. Otherwise their name isn't picked up by recursive
// name computation algorithm. See NS_OK_NAME_FROM_TOOLTIP.
if (aName.IsEmpty() && IsAbbreviation() &&
if (IsAbbreviation() &&
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aName))
aName.CompressWhitespace();

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

@ -51,7 +51,7 @@ public:
// Accessible
virtual int32_t GetLevelInternal();
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
virtual mozilla::a11y::role NativeRole();
virtual uint64_t NativeState();

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

@ -77,16 +77,15 @@ ImageAccessible::NativeName(nsString& aName)
if (!aName.IsEmpty())
return eNameOK;
Accessible::NativeName(aName);
if (aName.IsEmpty() && hasAltAttrib) {
// No accessible name but empty 'alt' attribute is present. If further name
// computation algorithm doesn't provide non empty name then it means
// an empty 'alt' attribute was used to indicate a decorative image (see
// nsIAccessible::name attribute for details).
return eNoNameOnPurpose;
}
ENameValueFlag nameFlag = Accessible::NativeName(aName);
if (!aName.IsEmpty())
return nameFlag;
return eNameOK;
// No accessible name but empty 'alt' attribute is present. If further name
// computation algorithm doesn't provide non empty name then it means
// an empty 'alt' attribute was used to indicate a decorative image (see
// Accessible::Name() method for details).
return hasAltAttrib ? eNoNameOnPurpose : eNameOK;
}
role
@ -170,21 +169,18 @@ ImageAccessible::GetImageSize(int32_t* aWidth, int32_t* aHeight)
}
// Accessible
nsresult
ImageAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
already_AddRefed<nsIPersistentProperties>
ImageAccessible::NativeAttributes()
{
if (IsDefunct())
return NS_ERROR_FAILURE;
nsresult rv = LinkableAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPersistentProperties> attributes =
LinkableAccessible::NativeAttributes();
nsAutoString src;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::src, src);
if (!src.IsEmpty())
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::src, src);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::src, src);
return NS_OK;
return attributes.forget();
}
////////////////////////////////////////////////////////////////////////////////

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

@ -38,7 +38,7 @@ public:
// Accessible
virtual a11y::role NativeRole();
virtual uint64_t NativeState();
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
// ActionAccessible
virtual uint8_t ActionCount();

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

@ -67,19 +67,6 @@ OuterDocAccessible::ChildAtPoint(int32_t aX, int32_t aY,
return child;
}
nsresult
OuterDocAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
{
nsAutoString tag;
aAttributes->GetStringProperty(NS_LITERAL_CSTRING("tag"), tag);
if (!tag.IsEmpty()) {
// We're overriding the ARIA attributes on an sub document, but we don't want to
// override the other attributes
return NS_OK;
}
return Accessible::GetAttributesInternal(aAttributes);
}
////////////////////////////////////////////////////////////////////////////////
// nsIAccessible

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

@ -38,7 +38,6 @@ public:
// Accessible
virtual mozilla::a11y::role NativeRole();
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
EWhichChildAtPoint aWhichChild);

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

@ -475,9 +475,13 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
#endif
}
else if (eventType.EqualsLiteral("ValueChange")) {
targetDocument->
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
targetNode, AccEvent::eRemoveDupes);
//We don't process 'ValueChange' events for progress meters since we listen
//@value attribute change for them.
if (!accessible->IsProgress())
targetDocument->
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
targetNode);
}
#ifdef DEBUG_DRAGDROPSTART
else if (eventType.EqualsLiteral("mouseover")) {

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

@ -58,7 +58,7 @@ ENameValueFlag
HTMLLabelAccessible::NativeName(nsString& aName)
{
nsTextEquivUtils::GetNameFromSubtree(this, aName);
return eNameOK;
return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
}
role
@ -89,15 +89,14 @@ HTMLOutputAccessible::NativeRole()
return roles::SECTION;
}
nsresult
HTMLOutputAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
already_AddRefed<nsIPersistentProperties>
HTMLOutputAccessible::NativeAttributes()
{
nsresult rv = AccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::live,
nsCOMPtr<nsIPersistentProperties> attributes =
AccessibleWrap::NativeAttributes();
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::live,
NS_LITERAL_STRING("polite"));
return NS_OK;
return attributes.forget();
}

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

@ -77,7 +77,7 @@ public:
// Accessible
virtual a11y::role NativeRole();
virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
virtual Relation RelationByType(uint32_t aType);
};

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

@ -259,13 +259,13 @@ HTMLButtonAccessible::NativeRole()
ENameValueFlag
HTMLButtonAccessible::NativeName(nsString& aName)
{
Accessible::NativeName(aName);
ENameValueFlag nameFlag = Accessible::NativeName(aName);
if (!aName.IsEmpty() || mContent->Tag() != nsGkAtoms::input)
return eNameOK;
return nameFlag;
// No name from HTML or ARIA
if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName) &&
!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName)) {
// Note: No need to check @value attribute since it results in anonymous text
// node. The name is calculated from subtree in this case.
if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName)) {
// Use the button's (default) label if nothing else works
nsIFrame* frame = GetFrame();
if (frame) {
@ -323,9 +323,9 @@ HTMLTextFieldAccessible::NativeRole()
ENameValueFlag
HTMLTextFieldAccessible::NativeName(nsString& aName)
{
Accessible::NativeName(aName);
ENameValueFlag nameFlag = Accessible::NativeName(aName);
if (!aName.IsEmpty())
return eNameOK;
return nameFlag;
if (mContent->GetBindingParent()) {
// XXX: bug 459640
@ -613,9 +613,9 @@ HTMLGroupboxAccessible::GetLegend()
ENameValueFlag
HTMLGroupboxAccessible::NativeName(nsString& aName)
{
Accessible::NativeName(aName);
ENameValueFlag nameFlag = Accessible::NativeName(aName);
if (!aName.IsEmpty())
return eNameOK;
return nameFlag;
nsIContent* legendContent = GetLegend();
if (legendContent)
@ -675,16 +675,16 @@ HTMLFigureAccessible::
{
}
nsresult
HTMLFigureAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
already_AddRefed<nsIPersistentProperties>
HTMLFigureAccessible::NativeAttributes()
{
nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPersistentProperties> attributes =
HyperTextAccessibleWrap::NativeAttributes();
// Expose figure xml-role.
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles,
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
NS_LITERAL_STRING("figure"));
return NS_OK;
return attributes.forget();
}
role
@ -696,9 +696,9 @@ HTMLFigureAccessible::NativeRole()
ENameValueFlag
HTMLFigureAccessible::NativeName(nsString& aName)
{
HyperTextAccessibleWrap::NativeName(aName);
ENameValueFlag nameFlag = HyperTextAccessibleWrap::NativeName(aName);
if (!aName.IsEmpty())
return eNameOK;
return nameFlag;
nsIContent* captionContent = Caption();
if (captionContent)

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

@ -189,7 +189,7 @@ public:
HTMLFigureAccessible(nsIContent* aContent, DocAccessible* aDoc);
// Accessible
virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
virtual mozilla::a11y::role NativeRole();
virtual Relation RelationByType(uint32_t aType);

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

@ -163,9 +163,9 @@ HTMLAreaAccessible::
ENameValueFlag
HTMLAreaAccessible::NativeName(nsString& aName)
{
Accessible::NativeName(aName);
ENameValueFlag nameFlag = Accessible::NativeName(aName);
if (!aName.IsEmpty())
return eNameOK;
return nameFlag;
if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName))
GetValue(aName);

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

@ -200,6 +200,7 @@ HTMLSelectOptionAccessible::NativeName(nsString& aName)
if (text && text->IsNodeOfType(nsINode::eTEXT)) {
nsTextEquivUtils::AppendTextEquivFromTextContent(text, &aName);
aName.CompressWhitespace();
return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
}
return eNameOK;

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

@ -93,27 +93,25 @@ HTMLTableCellAccessible::NativeInteractiveState() const
return HyperTextAccessibleWrap::NativeInteractiveState() | states::SELECTABLE;
}
nsresult
HTMLTableCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
already_AddRefed<nsIPersistentProperties>
HTMLTableCellAccessible::NativeAttributes()
{
if (IsDefunct())
return NS_ERROR_FAILURE;
nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPersistentProperties> attributes =
HyperTextAccessibleWrap::NativeAttributes();
// table-cell-index attribute
TableAccessible* table = Table();
if (!table)
return NS_OK;
return attributes.forget();
int32_t rowIdx = -1, colIdx = -1;
rv = GetCellIndexes(rowIdx, colIdx);
NS_ENSURE_SUCCESS(rv, rv);
nsresult rv = GetCellIndexes(rowIdx, colIdx);
if (NS_FAILED(rv))
return attributes.forget();
nsAutoString stringIdx;
stringIdx.AppendInt(table->CellIndexAt(rowIdx, colIdx));
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tableCellIndex, stringIdx);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::tableCellIndex, stringIdx);
// abbr attribute
@ -132,15 +130,15 @@ HTMLTableCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttribu
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::abbr, abbrText);
if (!abbrText.IsEmpty())
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::abbr, abbrText);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::abbr, abbrText);
// axis attribute
nsAutoString axisText;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::axis, axisText);
if (!axisText.IsEmpty())
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::axis, axisText);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::axis, axisText);
return NS_OK;
return attributes.forget();
}
////////////////////////////////////////////////////////////////////////////////
@ -388,9 +386,9 @@ HTMLTableAccessible::NativeState()
ENameValueFlag
HTMLTableAccessible::NativeName(nsString& aName)
{
Accessible::NativeName(aName);
ENameValueFlag nameFlag = Accessible::NativeName(aName);
if (!aName.IsEmpty())
return eNameOK;
return nameFlag;
// Use table caption as a name.
Accessible* caption = Caption();
@ -408,19 +406,18 @@ HTMLTableAccessible::NativeName(nsString& aName)
return eNameOK;
}
nsresult
HTMLTableAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
already_AddRefed<nsIPersistentProperties>
HTMLTableAccessible::NativeAttributes()
{
nsresult rv = AccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPersistentProperties> attributes =
AccessibleWrap::NativeAttributes();
if (IsProbablyLayoutTable()) {
nsAutoString oldValueUnused;
aAttributes->SetStringProperty(NS_LITERAL_CSTRING("layout-guess"),
NS_LITERAL_STRING("true"), oldValueUnused);
nsAutoString unused;
attributes->SetStringProperty(NS_LITERAL_CSTRING("layout-guess"),
NS_LITERAL_STRING("true"), unused);
}
return NS_OK;
return attributes.forget();
}
////////////////////////////////////////////////////////////////////////////////
@ -962,7 +959,7 @@ HTMLTableAccessible::HasDescendant(const nsAString& aTagName, bool aAllowEmpty)
nsCOMPtr<nsIDOMElement> tableElt(do_QueryInterface(mContent));
NS_ENSURE_TRUE(tableElt, false);
nsCOMPtr<nsIDOMNodeList> nodeList;
nsCOMPtr<nsIDOMHTMLCollection> nodeList;
tableElt->GetElementsByTagName(aTagName, getter_AddRefs(nodeList));
NS_ENSURE_TRUE(nodeList, false);

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

@ -42,7 +42,7 @@ public:
virtual a11y::role NativeRole();
virtual uint64_t NativeState();
virtual uint64_t NativeInteractiveState() const;
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
// TableCellAccessible
virtual TableAccessible* Table() const MOZ_OVERRIDE;
@ -145,7 +145,7 @@ public:
virtual void Description(nsString& aDescription);
virtual a11y::role NativeRole();
virtual uint64_t NativeState();
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
virtual Relation RelationByType(uint32_t aRelationType);
// HTMLTableAccessible

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

@ -98,7 +98,9 @@ var AccessFu = {
Services.obs.addObserver(this, 'remote-browser-frame-shown', false);
Services.obs.addObserver(this, 'Accessibility:NextObject', false);
Services.obs.addObserver(this, 'Accessibility:PreviousObject', false);
Services.obs.addObserver(this, 'Accessibility:CurrentObject', false);
Services.obs.addObserver(this, 'Accessibility:Focus', false);
this.chromeWin.addEventListener('TabOpen', this);
this.chromeWin.addEventListener('TabSelect', this);
},
/**
@ -118,10 +120,13 @@ var AccessFu = {
Input.detach();
this.chromeWin.removeEventListener('TabOpen', this);
this.chromeWin.removeEventListener('TabSelect', this);
Services.obs.removeObserver(this, 'remote-browser-frame-shown');
Services.obs.removeObserver(this, 'Accessibility:NextObject');
Services.obs.removeObserver(this, 'Accessibility:PreviousObject');
Services.obs.removeObserver(this, 'Accessibility:CurrentObject');
Services.obs.removeObserver(this, 'Accessibility:Focus');
},
_enableOrDisable: function _enableOrDisable() {
@ -132,7 +137,7 @@ var AccessFu = {
else
this._disable();
} catch (x) {
Logger.error(x);
Logger.logException(x);
}
},
@ -152,7 +157,7 @@ var AccessFu = {
Output[presenter.type](presenter.details, aMessage.target);
}
} catch (x) {
Logger.error(x);
Logger.logException(x);
}
break;
case 'AccessFu:Input':
@ -183,11 +188,13 @@ var AccessFu = {
case 'Accessibility:PreviousObject':
Input.moveCursor('movePrevious', 'Simple', 'gesture');
break;
case 'Accessibility:CurrentObject':
let mm = Utils.getCurrentBrowser(this.chromeWin).
frameLoader.messageManager;
mm.sendAsyncMessage('AccessFu:VirtualCursor',
{action: 'presentLastPivot'});
case 'Accessibility:Focus':
this._focused = JSON.parse(aData);
if (this._focused) {
let mm = Utils.getMessageManager(Utils.getCurrentBrowser(this.chromeWin));
mm.sendAsyncMessage('AccessFu:VirtualCursor',
{action: 'whereIsIt', move: true});
}
break;
case 'nsPref:changed':
if (aData == 'activate') {
@ -205,15 +212,42 @@ var AccessFu = {
},
handleEvent: function handleEvent(aEvent) {
if (aEvent.type == 'mozContentEvent' &&
aEvent.detail.type == 'accessibility-screenreader') {
this._systemPref = aEvent.detail.enabled;
this._enableOrDisable();
switch (aEvent.type) {
case 'mozContentEvent':
{
if (aEvent.detail.type == 'accessibility-screenreader') {
this._systemPref = aEvent.detail.enabled;
this._enableOrDisable();
}
break;
}
case 'TabOpen':
{
this._loadFrameScript(Utils.getMessageManager(aEvent.target));
break;
}
case 'TabSelect':
{
if (this._focused) {
let mm = Utils.getMessageManager(Utils.getCurrentBrowser(this.chromeWin));
// We delay this for half a second so the awesomebar could close,
// and we could use the current coordinates for the content item.
// XXX TODO figure out how to avoid magic wait here.
this.chromeWin.setTimeout(
function () {
mm.sendAsyncMessage('AccessFu:VirtualCursor', {action: 'whereIsIt'});
}, 500);
}
break;
}
}
},
// So we don't enable/disable twice
_enabled: false
_enabled: false,
// Layerview is focused
_focused: false
};
var Output = {
@ -307,7 +341,7 @@ var Input = {
break;
}
} catch (x) {
Logger.error(x);
Logger.logException(x);
}
},

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

@ -42,7 +42,8 @@ var EventManager = {
}
);
} catch (x) {
Logger.error('Failed to start EventManager:', x);
Logger.error('Failed to start EventManager');
Logger.logException(x);
}
},
@ -77,16 +78,25 @@ var EventManager = {
case 'scroll':
case 'resize':
{
// the target could be an element, document or window
let window = null;
if (aEvent.target instanceof Ci.nsIDOMWindow)
window = aEvent.target;
else if (aEvent.target instanceof Ci.nsIDOMDocument)
window = aEvent.target.defaultView;
else if (aEvent.target instanceof Ci.nsIDOMElement)
window = aEvent.target.ownerDocument.defaultView;
this.present(
function(p) {
return p.viewportChanged();;
return p.viewportChanged(window);
}
);
break;
}
}
} catch (x) {
Logger.error('Error handling DOM event:', x);
Logger.error('Error handling DOM event');
Logger.logException(x);
}
},
@ -98,20 +108,13 @@ var EventManager = {
event = aSubject.QueryInterface(Ci.nsIAccessibleEvent);
this.handleAccEvent(event);
} catch (x) {
Logger.error('Error handing accessible event:', x);
Logger.error('Error handing accessible event');
Logger.logException(x);
return;
}
}
},
presentLastPivot: function presentLastPivot() {
this.present(
function(p) {
return p.presentLastPivot();
}
);
},
handleAccEvent: function handleAccEvent(aEvent) {
if (Logger.logLevel >= Logger.DEBUG)
Logger.debug('A11yEvent', Logger.eventToString(aEvent),
@ -248,10 +251,21 @@ var EventManager = {
[aPresenterFunc(p) for each (p in this.presenters)].
filter(function(d) {return !!d;}));
} catch (x) {
Logger.error(x);
Logger.logException(x);
}
},
presentVirtualCursorPosition: function presentVirtualCursorPosition(aVirtualCursor) {
let presenterContext =
new PresenterContext(aVirtualCursor.position, null);
this.present(
function(p) {
return p.pivotChanged(presenterContext, Ci.nsIAccessiblePivot.REASON_NONE);
}
);
},
onStateChange: function onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
let tabstate = '';

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

@ -104,12 +104,7 @@ Presenter.prototype = {
/**
* We have entered or left text editing mode.
*/
editingModeChanged: function editingModeChanged(aIsEditing) {},
/**
* Re-present the last pivot change.
*/
presentLastPivot: function AndroidPresenter_presentLastPivot() {}
editingModeChanged: function editingModeChanged(aIsEditing) {}
};
/**
@ -129,21 +124,23 @@ VisualPresenter.prototype = {
BORDER_PADDING: 2,
viewportChanged: function VisualPresenter_viewportChanged(aWindow) {
if (this._currentContext)
if (this._currentAccessible) {
let context = new PresenterContext(this._currentAccessible);
return {
type: this.type,
details: {
method: 'show',
bounds: this._currentContext.bounds,
bounds: context.bounds,
padding: this.BORDER_PADDING
}
};
}
return null;
},
pivotChanged: function VisualPresenter_pivotChanged(aContext, aReason) {
this._currentContext = aContext;
this._currentAccessible = aContext.accessible;
if (!aContext.accessible)
return {type: this.type, details: {method: 'hide'}};
@ -206,8 +203,6 @@ AndroidPresenter.prototype = {
if (!aContext.accessible)
return null;
this._currentContext = aContext;
let androidEvents = [];
let isExploreByTouch = (aReason == Ci.nsIAccessiblePivot.REASON_POINT &&
@ -273,28 +268,25 @@ AndroidPresenter.prototype = {
textChanged: function AndroidPresenter_textChanged(aIsInserted, aStart,
aLength, aText,
aModifiedText) {
let androidEvent = {
type: this.type,
details: [{
eventType: this.ANDROID_VIEW_TEXT_CHANGED,
text: [aText],
fromIndex: aStart,
removedCount: 0,
addedCount: 0
}]
let eventDetails = {
eventType: this.ANDROID_VIEW_TEXT_CHANGED,
text: [aText],
fromIndex: aStart,
removedCount: 0,
addedCount: 0
};
if (aIsInserted) {
androidEvent.addedCount = aLength;
androidEvent.beforeText =
eventDetails.addedCount = aLength;
eventDetails.beforeText =
aText.substring(0, aStart) + aText.substring(aStart + aLength);
} else {
androidEvent.removedCount = aLength;
androidEvent.beforeText =
eventDetails.removedCount = aLength;
eventDetails.beforeText =
aText.substring(0, aStart) + aModifiedText + aText.substring(aStart);
}
return androidEvent;
return {type: this.type, details: [eventDetails]};
},
viewportChanged: function AndroidPresenter_viewportChanged(aWindow) {
@ -333,13 +325,6 @@ AndroidPresenter.prototype = {
fromIndex: 0
}]
};
},
presentLastPivot: function AndroidPresenter_presentLastPivot() {
if (this._currentContext)
return this.pivotChanged(this._currentContext);
else
return null;
}
};

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

@ -89,7 +89,8 @@ var Utils = {
},
getCurrentContentDoc: function getCurrentContentDoc(aWindow) {
return this.getCurrentBrowser(aWindow).contentDocument;
let browser = this.getCurrentBrowser(aWindow);
return browser ? browser.contentDocument : null;
},
getMessageManager: function getMessageManager(aBrowser) {
@ -97,7 +98,7 @@ var Utils = {
return aBrowser.QueryInterface(Ci.nsIFrameLoaderOwner).
frameLoader.messageManager;
} catch (x) {
Logger.error(x);
Logger.logException(x);
return null;
}
},
@ -108,13 +109,14 @@ var Utils = {
for (let i = 0; i < aWindow.messageManager.childCount; i++)
messageManagers.push(aWindow.messageManager.getChildAt(i));
let remoteframes = this.getCurrentContentDoc(aWindow).
querySelectorAll('iframe[remote=true]');
let document = this.getCurrentContentDoc(aWindow);
for (let i = 0; i < remoteframes.length; ++i)
messageManagers.push(this.getMessageManager(remoteframes[i]));
if (document) {
let remoteframes = document.querySelectorAll('iframe[remote=true]');
Logger.info(messageManagers.length);
for (let i = 0; i < remoteframes.length; ++i)
messageManagers.push(this.getMessageManager(remoteframes[i]));
}
return messageManagers;
},
@ -192,6 +194,16 @@ var Logger = {
this, [this.ERROR].concat(Array.prototype.slice.call(arguments)));
},
logException: function logException(aException) {
try {
this.error(
aException.message,
'(' + aException.fileName + ':' + aException.lineNumber + ')');
} catch (x) {
this.error(x);
}
},
accessibleToString: function accessibleToString(aAccessible) {
let str = '[ defunct ]';
try {

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

@ -54,8 +54,14 @@ function virtualCursorControl(aMessage) {
case 'moveToPoint':
moved = vc.moveToPoint(rule, details.x, details.y, true);
break;
case 'presentLastPivot':
EventManager.presentLastPivot();
case 'whereIsIt':
if (!forwardMessage(vc, aMessage)) {
if (!vc.position && aMessage.json.move)
vc.moveFirst(TraversalRules.Simple);
else
EventManager.presentVirtualCursorPosition(vc);
}
break;
default:
break;

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

@ -439,11 +439,10 @@ GetClosestInterestingAccessible(id anObject)
// XXX maybe we should cache the subrole.
nsAutoString xmlRoles;
nsCOMPtr<nsIPersistentProperties> attributes;
// XXX we don't need all the attributes (see bug 771113)
nsresult rv = mGeckoAccessible->GetAttributes(getter_AddRefs(attributes));
if (NS_SUCCEEDED(rv) && attributes)
nsCOMPtr<nsIPersistentProperties> attributes = mGeckoAccessible->Attributes();
if (attributes)
nsAccUtils::GetAccAttr(attributes, nsGkAtoms::xmlroles, xmlRoles);
nsWhitespaceTokenizer tokenizer(xmlRoles);

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

@ -18,8 +18,7 @@
nsAutoString title;
// XXX use the flattening API when there are available
// see bug 768298
nsresult rv = mGeckoAccessible->GetContent()->GetTextContent(title);
NS_ENSURE_SUCCESS(rv, nil);
mGeckoAccessible->GetContent()->GetTextContent(title);
return nsCocoaUtils::ToNSString(title);
}

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

@ -1440,11 +1440,7 @@ __try {
if (IsDefunct())
return CO_E_OBJNOTCONNECTED;
nsCOMPtr<nsIPersistentProperties> attributes;
nsresult rv = GetAttributes(getter_AddRefs(attributes));
if (NS_FAILED(rv))
return GetHRESULT(rv);
nsCOMPtr<nsIPersistentProperties> attributes = Attributes();
return ConvertToIA2Attributes(attributes, aAttributes);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }

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

@ -21,15 +21,11 @@ using namespace mozilla::a11y;
NS_IMPL_ISUPPORTS_INHERITED0(ApplicationAccessibleWrap,
ApplicationAccessible)
NS_IMETHODIMP
ApplicationAccessibleWrap::GetAttributes(nsIPersistentProperties** aAttributes)
already_AddRefed<nsIPersistentProperties>
ApplicationAccessibleWrap::NativeAttributes()
{
NS_ENSURE_ARG_POINTER(aAttributes);
*aAttributes = nullptr;
nsCOMPtr<nsIPersistentProperties> attributes =
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
NS_ENSURE_STATE(attributes);
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (gfxInfo) {
@ -42,8 +38,7 @@ ApplicationAccessibleWrap::GetAttributes(nsIPersistentProperties** aAttributes)
unused);
}
attributes.swap(*aAttributes);
return NS_OK;
return attributes.forget();
}
////////////////////////////////////////////////////////////////////////////////

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

@ -22,8 +22,8 @@ public:
// nsISupporst
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetAttributes(nsIPersistentProperties** aAttributes);
// nsAccessible
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void**);

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

@ -47,7 +47,7 @@ nsAccessNodeWrap::~nsAccessNodeWrap()
// nsISupports methods
//-----------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED1(nsAccessNodeWrap, nsAccessNode, nsIWinAccessNode);
NS_IMPL_ISUPPORTS_INHERITED1(nsAccessNodeWrap, nsAccessNode, nsIWinAccessNode)
//-----------------------------------------------------
// nsIWinAccessNode methods
@ -92,7 +92,7 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
// A use case for this is for screen readers that need to switch context or
// 'virtual buffer' when focus moves from one browser tab area to another.
static const GUID SID_IAccessibleContentDocument =
{ 0xa5d8e1f3,0x3571,0x4d8f,0x95,0x21,0x07,0xed,0x28,0xfb,0x07,0x2e };
{ 0xa5d8e1f3,0x3571,0x4d8f,{0x95,0x21,0x07,0xed,0x28,0xfb,0x07,0x2e} };
if (guidService == SID_IAccessibleContentDocument) {
if (iid != IID_IAccessible)
return E_NOINTERFACE;
@ -125,7 +125,7 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
*ppv = static_cast<IAccessible*>(docAcc);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return NS_OK;
return S_OK;
}
// Can get to IAccessibleApplication from any node via QS
@ -153,7 +153,7 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
*/
static const GUID IID_SimpleDOMDeprecated =
{ 0x0c539790,0x12e4,0x11cf,0xb6,0x61,0x00,0xaa,0x00,0x4c,0xd6,0xd8 };
{ 0x0c539790,0x12e4,0x11cf,{0xb6,0x61,0x00,0xaa,0x00,0x4c,0xd6,0xd8} };
if (guidService == IID_ISimpleDOMNode ||
guidService == IID_SimpleDOMDeprecated ||
guidService == IID_IAccessible || guidService == IID_IAccessible2)
@ -409,7 +409,7 @@ __try {
if (!node)
return E_FAIL;
*aNode = MakeAccessNode(node->GetNodeParent());
*aNode = MakeAccessNode(node->GetParentNode());
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }

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

@ -188,8 +188,7 @@ uiaRawElmProvider::GetPropertyValue(PROPERTYID aPropertyId,
case UIA_AriaRolePropertyId: {
nsAutoString xmlRoles;
nsCOMPtr<nsIPersistentProperties> attributes;
mAcc->GetAttributes(getter_AddRefs(attributes));
nsCOMPtr<nsIPersistentProperties> attributes = mAcc->Attributes();
attributes->GetStringProperty(NS_LITERAL_CSTRING("xml-roles"), xmlRoles);
if(!xmlRoles.IsEmpty()) {

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

@ -60,8 +60,7 @@ nsXFormsAccessible::GetBoundChildElementValue(const nsAString& aTagName,
if (IsDefunct())
return NS_ERROR_FAILURE;
nsINodeList* nodes = mContent->GetChildNodesList();
NS_ENSURE_STATE(nodes);
nsINodeList* nodes = mContent->ChildNodes();
uint32_t length;
nsresult rv = nodes->GetLength(&length);
@ -545,7 +544,7 @@ nsXFormsSelectableItemAccessible::IsSelected()
nsresult rv;
nsINode* parent = mContent;
while ((parent = parent->GetNodeParent())) {
while ((parent = parent->GetParentNode())) {
nsCOMPtr<nsIContent> content(do_QueryInterface(parent));
if (!content)
return false;

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

@ -156,7 +156,7 @@ nsXFormsComboboxPopupWidgetAccessible::Value(nsString& aValue)
void
nsXFormsComboboxPopupWidgetAccessible::CacheChildren()
{
nsCOMPtr<nsIDOMNode> parent = do_QueryInterface(mContent->GetNodeParent());
nsCOMPtr<nsIDOMNode> parent = do_QueryInterface(mContent->GetParentNode());
// Parent node must be an xforms:select1 element.
CacheSelectChildren(parent);
}

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

@ -125,10 +125,11 @@ ENameValueFlag
XULLinkAccessible::NativeName(nsString& aName)
{
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
if (aName.IsEmpty())
nsTextEquivUtils::GetNameFromSubtree(this, aName);
if (!aName.IsEmpty())
return eNameOK;
return eNameOK;
nsTextEquivUtils::GetNameFromSubtree(this, aName);
return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
}
role

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

@ -634,8 +634,7 @@ XULListitemAccessible::NativeName(nsString& aName)
}
}
GetXULName(aName);
return eNameOK;
return GetXULName(aName);
}
role
@ -858,22 +857,20 @@ XULListCellAccessible::NativeRole()
return roles::CELL;
}
nsresult
XULListCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
already_AddRefed<nsIPersistentProperties>
XULListCellAccessible::NativeAttributes()
{
NS_ENSURE_ARG_POINTER(aAttributes);
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPersistentProperties> attributes =
HyperTextAccessibleWrap::NativeAttributes();
// "table-cell-index" attribute
TableAccessible* table = Table();
NS_ENSURE_STATE(table); // we expect to be in a listbox (table)
if (!table) // we expect to be in a listbox (table)
return attributes.forget();
nsAutoString stringIdx;
stringIdx.AppendInt(table->CellIndexAt(RowIdx(), ColIdx()));
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tableCellIndex,
stringIdx);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::tableCellIndex, stringIdx);
return NS_OK;
return attributes.forget();
}

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

@ -174,7 +174,7 @@ public:
// Accessible
virtual TableCellAccessible* AsTableCell() { return this; }
virtual void Shutdown();
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
virtual a11y::role NativeRole();
// TableCellAccessible

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

@ -727,31 +727,29 @@ XULTreeGridCellAccessible::Init()
////////////////////////////////////////////////////////////////////////////////
// XULTreeGridCellAccessible: Accessible public implementation
nsresult
XULTreeGridCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
already_AddRefed<nsIPersistentProperties>
XULTreeGridCellAccessible::NativeAttributes()
{
NS_ENSURE_ARG_POINTER(aAttributes);
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPersistentProperties> attributes =
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
// "table-cell-index" attribute
TableAccessible* table = Table();
if (!table)
return NS_ERROR_FAILURE;
return attributes.forget();
nsAutoString stringIdx;
stringIdx.AppendInt(table->CellIndexAt(mRow, ColIdx()));
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tableCellIndex, stringIdx);
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::tableCellIndex, stringIdx);
// "cycles" attribute
bool isCycler = false;
nsresult rv = mColumn->GetCycler(&isCycler);
if (NS_SUCCEEDED(rv) && isCycler)
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::cycles,
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::cycles,
NS_LITERAL_STRING("true"));
return NS_OK;
return attributes.forget();
}
role

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

@ -158,7 +158,7 @@ public:
virtual void Shutdown();
virtual ENameValueFlag Name(nsString& aName);
virtual Accessible* FocusedChild();
virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
virtual int32_t IndexInParent() const;
virtual Relation RelationByType(uint32_t aType);
virtual a11y::role NativeRole();

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

@ -24,6 +24,7 @@ DIRS = \
pivot \
relations \
role \
scroll \
selectable \
states \
table \

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

@ -38,8 +38,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
testAttrs("sortNone", {"sort" : "none"}, true);
testAttrs("sortOther", {"sort" : "other"}, true);
// inherited attributes by subdocuments
var subdoc = getAccessible("iframe").firstChild;
testAttrs(subdoc, {"busy" : "true"}, true);
// live object attribute
// HTML
testAttrs("output", {"live" : "polite"}, true);
@ -172,6 +176,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
<div id="sortNone" role="columnheader" aria-sort="none"></div>
<div id="sortOther" role="columnheader" aria-sort="other"></div>
<!-- inherited from iframe -->
<iframe id="iframe" src="data:text/html,<html><body></body></html>"
aria-busy="true"></iframe>
<!-- html -->
<output id="output"></output>

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

@ -73,6 +73,10 @@ const STATE_BUSY = nsIAccessibleStates.STATE_BUSY;
const SCROLL_TYPE_ANYWHERE = nsIAccessibleScrollType.SCROLL_TYPE_ANYWHERE;
const COORDTYPE_SCREEN_RELATIVE = nsIAccessibleCoordinateType.COORDTYPE_SCREEN_RELATIVE;
const COORDTYPE_WINDOW_RELATIVE = nsIAccessibleCoordinateType.COORDTYPE_WINDOW_RELATIVE;
const COORDTYPE_PARENT_RELATIVE = nsIAccessibleCoordinateType.COORDTYPE_PARENT_RELATIVE;
const kEmbedChar = String.fromCharCode(0xfffc);
const kDiscBulletText = String.fromCharCode(0x2022) + " ";

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

@ -26,11 +26,11 @@
var gQueue = null;
// Value change invoker
function changeValue(aNodeOrID, aValuenow, aValuetext)
function changeARIAValue(aNodeOrID, aValuenow, aValuetext)
{
this.DOMNode = getNode(aNodeOrID);
this.invoke = function changeValue_invoke() {
this.invoke = function changeARIAValue_invoke() {
// Note: this should not fire an EVENT_VALUE_CHANGE when aria-valuetext
// is not empty
@ -42,7 +42,7 @@
this.DOMNode.setAttribute("aria-valuetext", aValuetext);
}
this.check = function changeValue_check() {
this.check = function changeARIAValue_check() {
var acc = getAccessible(aNodeOrID, [nsIAccessibleValue]);
if (!acc)
return;
@ -53,32 +53,49 @@
"Wrong value of " + prettyName(aNodeOrID));
}
this.getID = function changeValue_getID() {
this.getID = function changeARIAValue_getID() {
return prettyName(aNodeOrID) + " value changed";
}
}
function changeInputValue(aID, aValue)
function changeValue(aID, aValue)
{
this.DOMNode = getNode(aID);
this.invoke = function changeInputValue_invoke()
this.invoke = function changeValue_invoke()
{
this.DOMNode.value = aValue;
}
this.check = function changeInputValue_check()
this.check = function changeValue_check()
{
var acc = getAccessible(this.DOMNode);
is(acc.value, aValue, "Wrong value for " + prettyName(aID));
}
this.getID = function changeInputValue_getID()
this.getID = function changeValue_getID()
{
return prettyName(aID) + " value changed";
}
}
function changeProcessValue(aID, aValue) {
this.DOMNode = getNode(aID);
this.invoke = function changeProcessValue_invoke() {
this.DOMNode.value = aValue;
}
this.check = function changeProcessValue_check() {
var acc = getAccessible(this.DOMNode);
is(acc.value, aValue+"%", "Wrong value for " + prettyName(aID));
}
this.getID = function changeProcessValue_getID() {
return prettyName(aID) + " value changed";
}
}
function doTests()
{
// Test initial values
@ -86,16 +103,19 @@
testValue("slider_vnvt", "plain", 0, 0, 5, 0);
testValue("slider_vt", "hi", 0, 0, 3, 0);
testValue("scrollbar", "5", 5, 0, 1000, 0);
testValue("progress", "22%", 22, 0, 100, 0);
// Test value change events
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_VALUE_CHANGE);
gQueue.push(new changeValue("slider_vn", "6", undefined));
gQueue.push(new changeValue("slider_vt", undefined, "hey!"));
gQueue.push(new changeValue("slider_vnvt", "3", "sweet"));
gQueue.push(new changeValue("scrollbar", "6", undefined));
gQueue.push(new changeARIAValue("slider_vn", "6", undefined));
gQueue.push(new changeARIAValue("slider_vt", undefined, "hey!"));
gQueue.push(new changeARIAValue("slider_vnvt", "3", "sweet"));
gQueue.push(new changeARIAValue("scrollbar", "6", undefined));
gQueue.push(new changeInputValue("combobox", "hello"));
gQueue.push(new changeValue("combobox", "hello"));
gQueue.push(new changeProcessValue("progress", "50"));
gQueue.invoke(); // Will call SimpleTest.finish();
}
@ -122,6 +142,12 @@
title="ARIA comboboxes don't fire value change events">
Mozilla Bug 703202
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=761901"
title=" HTML5 progress accessible should fire value change event">
Mozilla Bug 761901
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
@ -145,5 +171,9 @@
<!-- ARIA combobox -->
<input id="combobox" role="combobox" aria-autocomplete="inline">
<!-- progress bar -->
<progress id="progress" value="22" max="100"></progress>
</body>
</html>

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

@ -91,6 +91,19 @@ function getChildAtPoint(aIdentifier, aX, aY, aFindDeepestChild)
return null;
}
/**
* Test the accessible position.
*/
function testPos(aID, aPoint)
{
var [expectedX, expectedY] =
(aPoint != undefined) ? aPoint : getBoundsForDOMElm(aID);
var [x, y] = getBounds(aID);
is(x, expectedX, "Wrong x coordinate of " + prettyName(aID));
is(y, expectedY, "Wrong y coordinate of " + prettyName(aID));
}
/**
* Test the accessible boundaries.
*/
@ -107,7 +120,19 @@ function testBounds(aID, aRect)
}
/**
* Return the accessible coordinates and size relative to the screen.
* Return the accessible coordinates relative to the screen in device pixels.
*/
function getPos(aID)
{
var accessible = getAccessible(aID);
var x = {}, y = {};
accessible.getBounds(x, y, {}, {});
return [x.value, y.value];
}
/**
* Return the accessible coordinates and size relative to the screen in device
* pixels.
*/
function getBounds(aID)
{

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

@ -188,6 +188,11 @@ function testNameForAttrRule(aElm, aRule)
var msg = "Attribute '" + attr + "' test. ";
testName(aElm, name, msg);
if (aRule.getAttribute("explict-name") != "false")
testAttrs(aElm, {"explicit-name" : "true"}, true);
else
testAbsentAttrs(aElm, {"explicit-name" : "true"});
aElm.removeAttribute(attr);
gTestIterator.iterateNext();
@ -235,6 +240,7 @@ function testNameForElmRule(aElm, aRule)
var msg = "Element '" + tagname + "' test.";
testName(aElm, labelElm.getAttribute("a11yname"), msg);
testAttrs(aElm, {"explicit-name" : "true"}, true);
var parentNode = labelElm.parentNode;
@ -252,6 +258,7 @@ function testNameForSubtreeRule(aElm, aRule)
{
var msg = "From subtree test.";
testName(aElm, aElm.getAttribute("a11yname"), msg);
testAbsentAttrs(aElm, {"explicit-name" : "true"});
if (gDumpToConsole) {
dump("\nProcessed from subtree rule. Wait for reorder event on " +

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

@ -125,7 +125,7 @@
<!-- specific -->
<ruleset id="htmlinputbutton">
<ruleset ref="htmlelm_start"/>
<rule attr="value" type="string"/>
<rule attr="value" type="string" explict-name="false"/>
<rule attr="alt" type="string"/>
<rule attr="src" type="string"/>
<rule attr="data" type="string"/>

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

@ -13,6 +13,8 @@
src="../events.js"></script>
<script type="application/javascript"
src="../name.js"></script>
<script type="application/javascript"
src="../attributes.js"></script>
<script type="application/javascript"
src="markup.js"></script>

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

@ -0,0 +1,18 @@
#
# 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/.
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = accessible/scroll
include $(DEPTH)/config/autoconf.mk
MOCHITEST_A11Y_FILES =\
test_zoom.html \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -0,0 +1,147 @@
<!DOCTYPE html>
<html>
<head>
<title>Test scrollToPoint when page is zoomed</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../layout.js"></script>
<script type="application/javascript">
function testScrollToPoint()
{
// scrollToPoint relative screen
var anchor = getAccessible("bottom1");
var [x, y] = getPos(anchor);
var [docX, docY] = getPos(document);
anchor.scrollToPoint(COORDTYPE_SCREEN_RELATIVE, docX, docY);
testPos(anchor, [x, docY]);
// scrollToPoint relative window
anchor = getAccessible("bottom2");
var [x, y] = getPos(anchor);
var wnd = getRootAccessible().DOMDocument.defaultView;
var scrollToX = docX - wnd.screenX, scrollToY = docY - wnd.screenY;
anchor.scrollToPoint(COORDTYPE_WINDOW_RELATIVE, scrollToX, scrollToY);
testPos(anchor, [x, docY]);
// scrollToPoint relative parent
anchor = getAccessible("bottom3");
var [x, y] = getPos(anchor);
var [parentX, parentY] = getPos(anchor.parent);
var scrollToX = parentX - docX, scrollToY = parentY - docY;
anchor.scrollToPoint(COORDTYPE_PARENT_RELATIVE, scrollToX, scrollToY);
testPos(anchor, [x, docY]);
}
function doTest()
{
testScrollToPoint();
zoomDocument(document, 2.0);
testScrollToPoint(); // zoom and test again
zoomDocument(document, 1.0);
SimpleTest.finish();
}
addA11yLoadEvent(doTest);
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=727942"
title="scrollToPoint is broken when page is zoomed">
Mozilla Bug 727942
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<h1>Below there is a bunch of named anchors</h1>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
This is in the middle anchor #1<a id="bottom1"></a>
<br><br><br><br><br><br><br><br><br><br>
This is in the middle anchor #2<a id="bottom2"></a>
<br><br><br><br><br><br><br><br><br><br>
This is in the middle anchor #3<a id="bottom3"></a>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
</body>
</html>

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

@ -59,7 +59,7 @@ if [ ! "$LIBXUL_SDK" ]; then
mozglue/Makefile
mozglue/build/Makefile
"
if [ "$MOZ_JEMALLOC" ]; then
if [ "$MOZ_JEMALLOC" -a -z "$MOZ_NATIVE_JEMALLOC" ]; then
add_makefiles "
memory/jemalloc/Makefile
"

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

@ -266,10 +266,11 @@ pref("media.video-queue.default-size", 3);
pref("widget.ime.android.landscape_fullscreen", -1);
pref("widget.ime.android.fullscreen_threshold", 250); // in hundreths of inches
// optimize images memory usage
// optimize images' memory usage
pref("image.mem.decodeondraw", true);
pref("content.image.allow_locking", false);
pref("image.mem.min_discard_timeout_ms", 10000);
pref("image.mem.max_decoded_image_kb", 5120); /* 5MB */
// enable touch events interfaces
pref("dom.w3c_touch_events.enabled", true);

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

@ -66,6 +66,10 @@ function closePaymentFlowDialog(aCallback) {
content.removeEventListener("mozContentEvent",
closePaymentFlowReturn);
let glue = Cc["@mozilla.org/payment/ui-glue;1"]
.createInstance(Ci.nsIPaymentUIGlue);
glue.cleanup();
});
browser.shell.sendChromeEvent(detail);

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

@ -1,6 +1,9 @@
"use strict";
// runapp.js:
// Provide a --runapp APPNAME command-line option.
let runAppObj;
window.addEventListener('load', function() {
// Get the command line arguments that were passed to the b2g client
let args = window.arguments[0].QueryInterface(Ci.nsICommandLine);
@ -13,27 +16,52 @@ window.addEventListener('load', function() {
// it was the last argument or the next argument starts with '-').
// However, someone could still explicitly pass an empty argument!
appname = args.handleFlagWithParam('runapp', false);
}
catch(e) {
} catch(e) {
// treat a missing parameter like an empty parameter (=> show usage)
appname = '';
}
// not specified, bail.
if (appname === null)
if (appname === null) {
return;
}
runAppObj = new AppRunner(appname);
Services.obs.addObserver(runAppObj, 'webapps-registry-ready', false);
});
window.addEventListener('unload', function() {
Services.obs.removeObserver(runAppObj, 'webapps-registry-ready');
});
function AppRunner(aName) {
this._req = null;
this._appName = aName;
}
AppRunner.prototype = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == 'webapps-registry-ready') {
this.doRunApp();
}
},
doRunApp: function() {
// - Get the list of apps since the parameter was specified
this._req = navigator.mozApps.mgmt.getAll();
this._req.onsuccess = this.getAllSuccess.bind(this);
this._req.onerror = this.getAllError.bind(this);
},
getAllSuccess: function() {
let apps = this._req.result;
// - Get the list of apps since the parameter was specified
let appsReq = navigator.mozApps.mgmt.getAll();
appsReq.onsuccess = function() {
let apps = appsReq.result;
function findAppWithName(name) {
let normalizedSearchName = name.replace(/[- ]+/g, '').toLowerCase();
for (let i = 0; i < apps.length; i++) {
let app = apps[i];
let normalizedAppName =
app.manifest.name.replace(/[- ]+/g, '').toLowerCase();
app.manifest.name.replace(/[- ]+/g, '').toLowerCase();
if (normalizedSearchName === normalizedAppName) {
return app;
}
@ -59,14 +87,14 @@ window.addEventListener('load', function() {
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit);
}
if (appname === '') {
if (this._appName === '') {
usageAndDie();
return;
}
let app = findAppWithName(appname);
let app = findAppWithName(this._appName);
if (!app) {
dump('Could not find app: "' + appname + '". Maybe you meant one of:\n');
dump('Could not find app: "' + this._appName + '". Maybe you meant one of:\n');
usageAndDie(true);
return;
}
@ -74,11 +102,11 @@ window.addEventListener('load', function() {
let setReq =
navigator.mozSettings.createLock().set({'lockscreen.enabled': false});
setReq.onsuccess = function() {
// give the event loop another turn to disable the lock screen
// give the event loop 100ms to disable the lock screen
window.setTimeout(function() {
dump('--runapp launching app: ' + app.manifest.name + '\n');
app.launch();
}, 0);
}, 100);
};
setReq.onerror = function() {
dump('--runapp failed to disable lock-screen. Giving up.\n');
@ -86,8 +114,9 @@ window.addEventListener('load', function() {
dump('--runapp found app: ' + app.manifest.name +
', disabling lock screen...\n');
};
appsReq.onerror = function() {
dump('Problem getting the list of all apps!');
};
});
},
getAllError: function() {
dump('Problem getting the list of all apps!');
}
};

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

@ -498,6 +498,10 @@ Services.obs.addObserver(function(aSubject, aTopic, aData) {
fullscreenorigin: aData });
}, "fullscreen-origin-change", false);
Services.obs.addObserver(function onWebappsStart(subject, topic, data) {
shell.sendChromeEvent({ type: 'webapps-registry-start' });
}, 'webapps-registry-start', false);
Services.obs.addObserver(function onWebappsReady(subject, topic, data) {
shell.sendChromeEvent({ type: 'webapps-registry-ready' });
}, 'webapps-registry-ready', false);
@ -855,3 +859,13 @@ window.addEventListener('ContentStart', function update_onContentStart() {
});
}, 'volume-state-changed', false);
})();
Services.obs.addObserver(function(aSubject, aTopic, aData) {
let data = JSON.parse(aData);
shell.sendChromeEvent({
type: "activity-done",
success: data.success,
manifestURL: data.manifestURL,
pageURL: data.pageURL
});
}, "activity-done", false);

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

@ -17,7 +17,7 @@
<script type="application/javascript" src="chrome://browser/content/settings.js"/>
<script type="application/javascript" src="chrome://browser/content/shell.js"/>
#ifndef ANDROID
#ifndef MOZ_WIDGET_GONK
<!-- this script handles the screen argument for desktop builds -->
<script type="application/javascript" src="chrome://browser/content/screen.js"/>
<!-- this script handles the "runapp" argument for desktop builds -->

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

@ -33,10 +33,16 @@ PaymentUI.prototype = {
confirmPaymentRequest: function confirmPaymentRequest(aRequests,
aSuccessCb,
aErrorCb) {
let _error = function _error(errorMsg) {
if (aErrorCb) {
aErrorCb.onresult(errorMsg);
}
};
let browser = Services.wm.getMostRecentWindow("navigator:browser");
let content = browser.getContentWindow();
if (!content && aErrorCb) {
aErrorCb.onresult("NO_CONTENT_WINDOW");
if (!content) {
_error("NO_CONTENT_WINDOW");
return;
}
@ -56,15 +62,13 @@ PaymentUI.prototype = {
content.addEventListener("mozContentEvent", function handleSelection(evt) {
let msg = evt.detail;
if (msg.id != id) {
debug("mozContentEvent. evt.detail.id != " + id);
content.removeEventListener("mozContentEvent", handleSelection);
return;
}
if (msg.userSelection && aSuccessCb) {
aSuccessCb.onresult(msg.userSelection);
} else if (msg.errorMsg && aErrorCb) {
aErrorCb.onresult(msg.errorMsg);
} else if (msg.errorMsg) {
_error(msg.errorMsg);
}
content.removeEventListener("mozContentEvent", handleSelection);
@ -75,11 +79,18 @@ PaymentUI.prototype = {
showPaymentFlow: function showPaymentFlow(aPaymentFlowInfo, aErrorCb) {
debug("showPaymentFlow. uri " + aPaymentFlowInfo.uri);
let _error = function _error(errorMsg) {
if (aErrorCb) {
aErrorCb.onresult(errorMsg);
}
};
// We ask the UI to browse to the selected payment flow.
let browser = Services.wm.getMostRecentWindow("navigator:browser");
let content = browser.getContentWindow();
if (!content && aErrorCb) {
aErrorCb.onresult("NO_CONTENT_WINDOW");
if (!content) {
_error("NO_CONTENT_WINDOW");
return;
}
@ -95,14 +106,18 @@ PaymentUI.prototype = {
// At some point the UI would send the created iframe back so the
// callbacks for firing DOMRequest events can be loaded on its
// content.
content.addEventListener("mozContentEvent", function loadPaymentShim(evt) {
if (evt.detail.id != id || !evt.detail.frame) {
content.addEventListener("mozContentEvent", (function loadPaymentShim(evt) {
if (evt.detail.id != id) {
content.removeEventListener("mozContentEvent", loadPaymentShim);
return;
}
// Try to load the payment shim file containing the payment callbacks
// in the content script.
if (!evt.detail.frame && !evt.detail.errorMsg) {
_error("ERROR_LOADING_PAYMENT_SHIM");
return;
}
let frame = evt.detail.frame;
let frameLoader = frame.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader;
@ -111,17 +126,40 @@ PaymentUI.prototype = {
mm.loadFrameScript(kPaymentShimFile, true);
} catch (e) {
debug("Error loading " + kPaymentShimFile + " as a frame script: " + e);
if (aErrorCb) {
aErrorCb.onresult("ERROR_LOADING_PAYMENT_SHIM");
}
_error("ERROR_LOADING_PAYMENT_SHIM");
} finally {
content.removeEventListener("mozContentEvent", loadPaymentShim);
}
});
}).bind(this));
// We also listen for UI notifications about a closed payment flow. The UI
// should provide the reason of the closure within the 'errorMsg' parameter
this._notifyPayFlowClosed = function _notifyPayFlowClosed (evt) {
if (evt.detail.id != id) {
return;
}
if (evt.detail.errorMsg) {
_error(evt.detail.errorMsg);
content.removeEventListener("mozContentEvent",
this._notifyPayFlowClosed);
return;
}
};
content.addEventListener("mozContentEvent",
this._notifyPayFlowClosed.bind(this));
browser.shell.sendChromeEvent(detail);
},
cleanup: function cleanup() {
let browser = Services.wm.getMostRecentWindow("navigator:browser");
let content = browser.getContentWindow();
if (!content) {
return;
}
content.removeEventListener("mozContentEvent", this._notifyPayFlowClosed);
},
getRandomId: function getRandomId() {
return uuidgen.generateUUID().toString();
},

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

@ -26,16 +26,24 @@ const SELF_DESTRUCT_TIMEOUT =
Services.prefs.getIntPref("b2g.update.self-destruct-timeout");
const APPLY_IDLE_TIMEOUT_SECONDS = APPLY_IDLE_TIMEOUT / 1000;
const NETWORK_ERROR_OFFLINE = 111;
XPCOMUtils.defineLazyServiceGetter(Services, "aus",
"@mozilla.org/updates/update-service;1",
"nsIApplicationUpdateService");
XPCOMUtils.defineLazyServiceGetter(Services, "um",
"@mozilla.org/updates/update-manager;1",
"nsIUpdateManager");
XPCOMUtils.defineLazyServiceGetter(Services, "idle",
"@mozilla.org/widget/idleservice;1",
"nsIIdleService");
XPCOMUtils.defineLazyServiceGetter(Services, "settings",
"@mozilla.org/settingsService;1",
"nsISettingsService");
function UpdatePrompt() {
this.wrappedJSObject = this;
}
@ -43,6 +51,7 @@ function UpdatePrompt() {
UpdatePrompt.prototype = {
classID: Components.ID("{88b3eb21-d072-4e3b-886d-f89d8c49fe59}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIUpdatePrompt,
Ci.nsIUpdateCheckListener,
Ci.nsIRequestObserver,
Ci.nsIProgressEventSink,
Ci.nsIObserver]),
@ -88,14 +97,52 @@ UpdatePrompt.prototype = {
},
showUpdateError: function UP_showUpdateError(aUpdate) {
if (aUpdate.state == "failed") {
log("Failed to download update, errorCode: " + aUpdate.errorCode);
}
log("Update error, state: " + aUpdate.state + ", errorCode: " +
aUpdate.errorCode);
this.sendUpdateEvent("update-error", aUpdate);
this.setUpdateStatus(aUpdate.statusText);
},
showUpdateHistory: function UP_showUpdateHistory(aParent) { },
showUpdateInstalled: function UP_showUpdateInstalled() { },
// nsIUpdateCheckListener
onCheckComplete: function UP_onCheckComplete(request, updates, updateCount) {
if (Services.um.activeUpdate) {
return;
}
if (updateCount == 0) {
this.setUpdateStatus("no-updates");
return;
}
let update = Services.aus.selectUpdate(updates, updateCount);
if (!update) {
this.setUpdateStatus("already-latest-version");
return;
}
this.setUpdateStatus("check-complete");
this.showUpdateAvailable(update);
},
onError: function UP_onError(request, update) {
if (update.errorCode == NETWORK_ERROR_OFFLINE) {
this.setUpdateStatus("retry-when-online");
}
Services.aus.QueryInterface(Ci.nsIUpdateCheckListener);
Services.aus.onError(request, update);
},
onProgress: function UP_onProgress(request, position, totalSize) {
Services.aus.QueryInterface(Ci.nsIUpdateCheckListener);
Services.aus.onProgress(request, position, totalSize);
},
// Custom functions
waitForIdle: function UP_waitForIdle() {
@ -108,6 +155,13 @@ UpdatePrompt.prototype = {
Services.obs.addObserver(this, "quit-application", false);
},
setUpdateStatus: function UP_setUpdateStatus(aStatus) {
log("Setting gecko.updateStatus: " + aStatus);
let lock = Services.settings.createLock();
lock.set("gecko.updateStatus", aStatus, null);
},
showApplyPrompt: function UP_showApplyPrompt(aUpdate) {
if (!this.sendUpdateEvent("update-prompt-apply", aUpdate)) {
log("Unable to prompt, forcing restart");
@ -123,22 +177,26 @@ UpdatePrompt.prototype = {
sendUpdateEvent: function UP_sendUpdateEvent(aType, aUpdate) {
let detail = {
displayVersion: aUpdate.displayVersion,
detailsURL: aUpdate.detailsURL
detailsURL: aUpdate.detailsURL,
statusText: aUpdate.statusText,
state: aUpdate.state,
errorCode: aUpdate.errorCode,
isOSUpdate: aUpdate.isOSUpdate
};
let patch = aUpdate.selectedPatch;
if (!patch) {
if (!patch && aUpdate.patchCount > 0) {
// For now we just check the first patch to get size information if a
// patch hasn't been selected yet.
if (aUpdate.patchCount == 0) {
log("Warning: no patches available in update");
return false;
}
patch = aUpdate.getPatchAt(0);
}
detail.size = patch.size;
detail.updateType = patch.type;
if (patch) {
detail.size = patch.size;
detail.updateType = patch.type;
} else {
log("Warning: no patches available in update");
}
this._update = aUpdate;
return this.sendChromeEvent(aType, detail);
@ -252,11 +310,17 @@ UpdatePrompt.prototype = {
forceUpdateCheck: function UP_forceUpdateCheck() {
log("Forcing update check");
// If we already have an active update available, don't try to
// download again, just prompt for install.
if (Services.um.activeUpdate) {
this.setUpdateStatus("check-complete");
this.showApplyPrompt(Services.um.activeUpdate);
return;
}
let checker = Cc["@mozilla.org/updates/update-checker;1"]
.createInstance(Ci.nsIUpdateChecker);
Services.aus.QueryInterface(Ci.nsIUpdateCheckListener);
checker.checkForUpdates(Services.aus, true);
checker.checkForUpdates(this, true);
},
handleEvent: function UP_handleEvent(evt) {

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

@ -75,13 +75,19 @@ YoutubeProtocolHandler.prototype = {
let uri;
let mimeType;
// Recognized mime types, ordered from the less usable to the most usable.
let recognizedTypes = ["video/webm"];
// itag is an undocumented value which maps to resolution and mimetype
// see https://en.wikipedia.org/wiki/YouTube#Quality_and_codecs
// Ordered from least to most preferred
let recognizedItags = [
"17", // 144p 3GP
"36", // 240p 3GP
"43", // 360p WebM
#ifdef MOZ_WIDGET_GONK
recognizedTypes.push("video/mp4");
"18", // 360p H.264
#endif
];
let bestType = -1;
let bestItag = -1;
let extras = { }
@ -89,13 +95,14 @@ YoutubeProtocolHandler.prototype = {
let params = extractParameters(aStream);
let url = params["url"];
let type = params["type"] ? params["type"].split(";")[0] : null;
let itag = params["itag"];
let index;
if (url && type && ((index = recognizedTypes.indexOf(type)) != -1) &&
index > bestType) {
uri = url;
if (url && type && ((index = recognizedItags.indexOf(itag)) != -1) &&
index > bestItag) {
uri = url + '&signature=' + (params["sig"] ? params['sig'] : '');
mimeType = type;
bestType = index;
bestItag = index;
}
for (let param in params) {
if (["thumbnail_url", "length_seconds", "title"].indexOf(param) != -1) {

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

@ -5,7 +5,7 @@ mk_add_options MOZ_MAKE_FLAGS="-j8"
ac_add_options --enable-application=b2g
ac_add_options --enable-b2g-camera
ac_add_options --target=arm-android-eabi
ac_add_options --target=arm-linux-androideabi
ac_add_options --with-gonk="$topsrcdir/gonk-toolchain"
export TOOLCHAIN_HOST=linux-x86
export GONK_PRODUCT=generic

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

@ -7,7 +7,7 @@ mk_add_options MOZ_MAKE_FLAGS="-j8"
ac_add_options --enable-application=b2g
ac_add_options --enable-b2g-camera
ac_add_options --target=arm-android-eabi
ac_add_options --target=arm-linux-androideabi
ac_add_options --with-gonk="$topsrcdir/gonk-toolchain"
export TOOLCHAIN_HOST=linux-x86
export GONK_PRODUCT=generic

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

@ -2,7 +2,7 @@
; 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/.
; Package file for the B2G build.
; Package file for the B2G build.
;
; File format:
;
@ -380,11 +380,13 @@
@BINPATH@/components/GPSDGeolocationProvider.js
@BINPATH@/components/nsSidebar.manifest
@BINPATH@/components/nsSidebar.js
#ifndef MOZ_WIDGET_GONK
@BINPATH@/components/extensions.manifest
@BINPATH@/components/addonManager.js
@BINPATH@/components/amContentHandler.js
@BINPATH@/components/amWebInstallListener.js
@BINPATH@/components/nsBlocklistService.js
#endif
#ifdef MOZ_UPDATER
@BINPATH@/components/nsUpdateService.manifest

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

@ -203,6 +203,8 @@
<string>%MAC_BUNDLE_VERSION%</string>
<key>NSAppleScriptEnabled</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>LSMinimumSystemVersionByArchitecture</key>

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

@ -115,8 +115,10 @@ pref("app.update.cert.maxErrors", 5);
// the value for the name must be the same as the value for the attribute name
// on the certificate.
// If these conditions aren't met it will be treated the same as when there is
// no update available. This validation will not be performed when using the
// |app.update.url.override| preference for update checking.
// no update available. This validation will not be performed when the
// |app.update.url.override| user preference has been set for testing updates or
// when the |app.update.cert.checkAttributes| preference is set to false. Also,
// the |app.update.url.override| preference should ONLY be used for testing.
pref("app.update.certs.1.issuerName", "OU=Equifax Secure Certificate Authority,O=Equifax,C=US");
pref("app.update.certs.1.commonName", "aus3.mozilla.org");
@ -1170,10 +1172,10 @@ pref("pdfjs.previousHandler.alwaysAskBeforeHandling", false);
pref("image.mem.max_decoded_image_kb", 256000);
// Example social provider
pref("social.manifest.motown", "{\"origin\":\"https://motown-dev.mozillalabs.com\",\"name\":\"MoTown\",\"workerURL\":\"https://motown-dev.mozillalabs.com/social/worker.js\",\"iconURL\":\"https://motown-dev.mozillalabs.com/images/motown-icon.png\",\"sidebarURL\":\"https://motown-dev.mozillalabs.com/social/sidebar\"}");
pref("social.manifest.facebook", "{\"origin\":\"https://www.facebook.com\",\"name\":\"Facebook Messenger\",\"workerURL\":\"https://www.facebook.com/desktop/fbdesktop2/socialfox/fbworker.js.php\",\"iconURL\":\"data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAAX0lEQVQ4jWP4%2F%2F8%2FAyUYTFhHzjgDxP9JxGeQDSBVMxgTbUBCxer%2Fr999%2BQ8DJBuArJksA9A10s8AXIBoA0B%2BR%2FY%2FjD%2BEwoBoA1yT5v3PbdmCE8MAshhID%2FUMoDgzUYIBj0Cgi7ar4coAAAAASUVORK5CYII%3D\",\"sidebarURL\":\"https://www.facebook.com/desktop/fbdesktop2/?socialfox=true\"}");
// Comma-separated list of nsIURI::prePaths that are allowed to activate
// built-in social functionality.
pref("social.activation.whitelist", "https://motown-dev.mozillalabs.com");
pref("social.activation.whitelist", "https://www.facebook.com");
pref("social.sidebar.open", true);
pref("social.active", false);
pref("social.toast-notifications.enabled", true);

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

@ -100,9 +100,8 @@ window.addEventListener("load", function () {
// later and may use asynchronous getters.
window.gObserver.observe(document.documentElement, { attributes: true });
fitToWidth();
window.addEventListener("resize", fitToWidth);
});
window.addEventListener("resize", fitToWidth);
function onSearchSubmit(aEvent)
{

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

@ -178,6 +178,24 @@ let SocialUI = {
haveLoggedInUser: function SocialUI_haveLoggedInUser() {
return !!(Social.provider && Social.provider.profile && Social.provider.profile.userName);
},
closeSocialPanelForLinkTraversal: function (target, linkNode) {
// No need to close the panel if this traversal was not retargeted
if (target == "" || target == "_self")
return;
// Check to see whether this link traversal was in a social panel
let win = linkNode.ownerDocument.defaultView;
let container = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler;
let containerParent = container.parentNode;
if (containerParent.classList.contains("social-panel") &&
containerParent instanceof Ci.nsIDOMXULPopupElement) {
containerParent.hidePopup();
}
}
}
@ -627,7 +645,7 @@ var SocialToolbar = {
let tbi = document.getElementById("social-toolbar-item");
tbi.hidden = !Social.uiVisible;
if (!SocialUI.haveLoggedInUser()) {
let parent = document.getElementById("social-notification-box");
let parent = document.getElementById("social-notification-panel");
while (parent.hasChildNodes())
parent.removeChild(parent.firstChild);
@ -662,7 +680,6 @@ var SocialToolbar = {
let icons = provider.ambientNotificationIcons;
let iconNames = Object.keys(icons);
let iconBox = document.getElementById("social-toolbar-item");
let notifBox = document.getElementById("social-notification-box");
let panel = document.getElementById("social-notification-panel");
panel.hidden = false;
@ -780,7 +797,7 @@ var SocialToolbar = {
if (image.getAttribute("src") != icon.iconURL)
image.setAttribute("src", icon.iconURL);
}
notifBox.appendChild(notificationFrames);
panel.appendChild(notificationFrames);
iconBox.appendChild(iconContainers);
for (let frame of createdFrames) {
@ -797,13 +814,12 @@ var SocialToolbar = {
showAmbientPopup: function SocialToolbar_showAmbientPopup(aToolbarButtonBox) {
let panel = document.getElementById("social-notification-panel");
let notifBox = document.getElementById("social-notification-box");
let notificationFrameId = aToolbarButtonBox.getAttribute("notificationFrameId");
let notificationFrame = document.getElementById(notificationFrameId);
// Clear dimensions on all browsers so the panel size will
// only use the selected browser.
let frameIter = notifBox.firstElementChild;
let frameIter = panel.firstElementChild;
while (frameIter) {
frameIter.collapsed = (frameIter != notificationFrame);
frameIter = frameIter.nextElementSibling;

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

@ -378,7 +378,6 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
}
#full-screen-warning-container {
pointer-events: none;
position: fixed;
top: 0;
left: 0;
@ -393,10 +392,9 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
}
#full-screen-warning-message {
pointer-events: auto;
/* We must specify a max-width, otherwise word-wrap:break-word doesn't
work in descendant <description> and <label> elements. Bug 630864. */
max-width: 800px;
max-width: 800px;
}
#full-screen-domain-text,

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

@ -2553,7 +2553,7 @@ let BrowserOnClick = {
switch (elmId) {
case "exceptionDialogButton":
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_CLICK_ADD_EXCEPTION);
let params = { exceptionAdded : false, handlePrivateBrowsing : true };
let params = { exceptionAdded : false };
try {
switch (Services.prefs.getIntPref("browser.ssl_override_behavior")) {
@ -3915,6 +3915,12 @@ var XULBrowserWindow = {
// Called before links are navigated to to allow us to retarget them if needed.
onBeforeLinkTraversal: function(originalTarget, linkURI, linkNode, isAppTab) {
let target = this._onBeforeLinkTraversal(originalTarget, linkURI, linkNode, isAppTab);
SocialUI.closeSocialPanelForLinkTraversal(target, linkNode);
return target;
},
_onBeforeLinkTraversal: function(originalTarget, linkURI, linkNode, isAppTab) {
// Don't modify non-default targets or targets that aren't in top-level app
// tab docshells (isAppTab will be false for app tab subframes).
if (originalTarget != "" || !isAppTab)

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

@ -267,9 +267,7 @@
type="arrow"
hidden="true"
consumeoutsideclicks="true"
noautofocus="true">
<box id="social-notification-box" flex="1"></box>
</panel>
noautofocus="true"/>
<panel id="social-flyout-panel"
class="social-panel"
onpopupshown="SocialFlyout.onShown()"
@ -1080,7 +1078,8 @@
observes="socialSidebarBroadcaster"/>
<vbox id="social-sidebar-box"
class="chromeclass-extrachrome"
observes="socialSidebarBroadcaster">
observes="socialSidebarBroadcaster"
persist="width">
<browser id="social-sidebar-browser"
type="content"
disableglobalhistory="true"

Двоичные данные
browser/base/content/social-icon.png

Двоичный файл не отображается.

До

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

После

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

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

@ -325,7 +325,7 @@
}
cb = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "chatbox");
if (aMode == "minimized")
cb.minimized = true;
cb.setAttribute("minimized", "true");
this.selectedChat = cb;
this.insertBefore(cb, this.firstChild);
cb.init(aProvider, aURL, aCallback);

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

@ -20,6 +20,10 @@ function waitForInactive() {
}
function test() {
registerCleanupFunction(function() {
window.restore();
});
waitForExplicitFinish();
is(gBrowser.docShell.isActive, true, "Docshell should be active");
window.minimize();

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

@ -911,5 +911,66 @@ function test21e() {
ok(objLoadingContent.activated, "Test 21e, Plugin with id=" + plugin.id + " should be activated");
}
Services.prefs.setBoolPref("plugins.click_to_play", true);
prepareTest(test22, gTestRoot + "plugin_test.html");
}
// Tests that a click-to-play plugin retains its activated state upon reloading
function test22() {
ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser), "Test 22, Should have a click-to-play notification");
// Plugin should start as CTP
var pluginNode = gTestBrowser.contentDocument.getElementById("test");
ok(pluginNode, "Test 22, Found plugin in page");
var objLoadingContent = pluginNode.QueryInterface(Ci.nsIObjectLoadingContent);
is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Test 22, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
// Activate
objLoadingContent.playPlugin();
is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 22, plugin should have started");
ok(pluginNode.activated, "Test 22, plugin should be activated");
// Reload plugin
var oldVal = pluginNode.getObjectValue();
pluginNode.src = pluginNode.src;
is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 22, Plugin should have retained activated state");
ok(pluginNode.activated, "Test 22, plugin should have remained activated");
// Sanity, ensure that we actually reloaded the instance, since this behavior might change in the future.
var pluginsDiffer;
try {
pluginNode.checkObjectValue(oldVal);
} catch (e) {
pluginsDiffer = true;
}
ok(pluginsDiffer, "Test 22, plugin should have reloaded");
prepareTest(test23, gTestRoot + "plugin_test.html");
}
// Tests that a click-to-play plugin resets its activated state when changing types
function test23() {
ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser), "Test 23, Should have a click-to-play notification");
// Plugin should start as CTP
var pluginNode = gTestBrowser.contentDocument.getElementById("test");
ok(pluginNode, "Test 23, Found plugin in page");
var objLoadingContent = pluginNode.QueryInterface(Ci.nsIObjectLoadingContent);
is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Test 23, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
// Activate
objLoadingContent.playPlugin();
is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 23, plugin should have started");
ok(pluginNode.activated, "Test 23, plugin should be activated");
// Reload plugin (this may need RunSoon() in the future when plugins change state asynchronously)
pluginNode.type = null;
pluginNode.src = pluginNode.src; // We currently don't properly change state just on type change, bug 767631
is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_NULL, "Test 23, plugin should be unloaded");
pluginNode.type = "application/x-test";
pluginNode.src = pluginNode.src;
is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_NULL, "Test 23, Plugin should not have activated");
is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Test 23, Plugin should be click-to-play");
ok(!pluginNode.activated, "Test 23, plugin node should not be activated");
finishTest();
}

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

@ -104,6 +104,7 @@ var tests = {
case "got-chatbox-message":
ok(true, "got a chat window opened");
let chats = document.getElementById("pinnedchats");
ok(chats.selectedChat.minimized, "chatbox from worker opened as minimized");
while (chats.selectedChat) {
chats.selectedChat.close();
}

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

@ -78,6 +78,15 @@ var tests = {
},
testCloseSelf: function(next) {
// window.close is affected by the pref dom.allow_scripts_to_close_windows,
// which defaults to false, but is set to true by the test harness.
// so temporarily set it back.
const ALLOW_SCRIPTS_TO_CLOSE_PREF = "dom.allow_scripts_to_close_windows";
// note clearUserPref doesn't do what we expect, as the test harness itself
// changes the pref value - so clearUserPref resets it to false rather than
// the true setup by the test harness.
let oldAllowScriptsToClose = Services.prefs.getBoolPref(ALLOW_SCRIPTS_TO_CLOSE_PREF);
Services.prefs.setBoolPref(ALLOW_SCRIPTS_TO_CLOSE_PREF, false);
let panel = document.getElementById("social-flyout-panel");
let port = Social.provider.getWorkerPort();
ok(port, "provider has a port");
@ -92,6 +101,7 @@ var tests = {
iframe.contentDocument.addEventListener("SocialTest-DoneCloseSelf", function _doneHandler() {
iframe.contentDocument.removeEventListener("SocialTest-DoneCloseSelf", _doneHandler, false);
is(panel.state, "closed", "flyout should have closed itself");
Services.prefs.setBoolPref(ALLOW_SCRIPTS_TO_CLOSE_PREF, oldAllowScriptsToClose);
next();
}, false);
is(panel.state, "open", "flyout should be open");
@ -101,5 +111,40 @@ var tests = {
}
}
port.postMessage({topic: "test-init"});
},
testCloseOnLinkTraversal: function(next) {
function onTabOpen(event) {
gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
is(panel.state, "closed", "flyout should be closed");
ok(true, "Link should open a new tab");
executeSoon(function(){
gBrowser.removeTab(event.target);
next();
});
}
let panel = document.getElementById("social-flyout-panel");
let port = Social.provider.getWorkerPort();
ok(port, "provider has a port");
port.onmessage = function (e) {
let topic = e.data.topic;
switch (topic) {
case "test-init-done":
port.postMessage({topic: "test-flyout-open"});
break;
case "got-flyout-visibility":
if (e.data.result == "shown") {
// click on our test link
is(panel.state, "open", "flyout should be open");
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
let iframe = panel.firstChild;
iframe.contentDocument.getElementById('traversal').click();
}
break;
}
}
port.postMessage({topic: "test-init"});
}
}

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

@ -31,5 +31,7 @@
</head>
<body style="max-width: 250px;" onload="pingWorker();">
<p>This is a test social flyout panel.</p>
<a id="traversal" href="http://mochi.test">test link</a>
</body>
</html>

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

@ -6,8 +6,7 @@
pref("startup.homepage_override_url","");
pref("startup.homepage_welcome_url","");
// The time interval between checks for a new version (in seconds)
// nightly=8 hours, official=24 hours
pref("app.update.interval", 28800);
pref("app.update.interval", 28800); // 8 hours
// The time interval between the downloading of mar file chunks in the
// background (in seconds)
pref("app.update.download.backgroundInterval", 60);

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

@ -5,11 +5,10 @@
pref("startup.homepage_override_url","http://www.mozilla.com/%LOCALE%/%APP%/%VERSION%/whatsnew/?oldversion=%OLD_VERSION%");
pref("startup.homepage_welcome_url","http://www.mozilla.com/%LOCALE%/%APP%/%VERSION%/firstrun/");
// Interval: Time between checks for a new version (in seconds)
// nightly=6 hours, official=24 hours
pref("app.update.interval", 86400);
pref("app.update.interval", 43200); // 12 hours
// The time interval between the downloading of mar file chunks in the
// background (in seconds)
pref("app.update.download.backgroundInterval", 600);
pref("app.update.download.backgroundInterval", 60);
// Give the user x seconds to react before showing the big UI. default=24 hours
pref("app.update.promptWaitTime", 86400);
// URL user can browse to manually if for some reason all update installation

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

@ -25,9 +25,12 @@ _BROWSER_FILES = \
browser_privacypane_4.js \
browser_privacypane_5.js \
browser_privacypane_6.js \
browser_privacypane_7.js \
browser_privacypane_8.js \
$(NULL)
ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
_BROWSER_FILES += browser_privacypane_7.js
endif
libs:: $(_BROWSER_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)

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

@ -33,7 +33,7 @@ browser.jar:
content/browser/preferences/permissions.js
* content/browser/preferences/preferences.xul
content/browser/preferences/privacy.xul
content/browser/preferences/privacy.js
* content/browser/preferences/privacy.js
content/browser/preferences/sanitize.xul
content/browser/preferences/security.xul
content/browser/preferences/security.js

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше