Merge last green PGO changeset from inbound to central

This commit is contained in:
Marco Bonardo 2012-01-17 16:22:33 +01:00
commit 1d0335e9ff
57 changed files with 820 additions and 694 deletions

View File

@ -441,13 +441,9 @@ nsAccessibleWrap::CreateMaiInterfaces(void)
interfacesBits |= 1 << MAI_INTERFACE_VALUE;
}
//nsIAccessibleDocument
nsCOMPtr<nsIAccessibleDocument> accessInterfaceDocument;
QueryInterface(NS_GET_IID(nsIAccessibleDocument),
getter_AddRefs(accessInterfaceDocument));
if (accessInterfaceDocument) {
// document accessible
if (IsDoc())
interfacesBits |= 1 << MAI_INTERFACE_DOCUMENT;
}
if (IsImageAccessible())
interfacesBits |= 1 << MAI_INTERFACE_IMAGE;

View File

@ -37,12 +37,22 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessibleWrap.h"
#include "nsMaiInterfaceDocument.h"
const char *const kDocTypeName = "W3C-doctype";
const char *const kDocUrlName = "DocURL";
const char *const kMimeTypeName = "MimeType";
#include "nsAccessibleWrap.h"
#include "nsDocAccessible.h"
static const char* const kDocTypeName = "W3C-doctype";
static const char* const kDocUrlName = "DocURL";
static const char* const kMimeTypeName = "MimeType";
// below functions are vfuncs on an ATK interface so they need to be C call
extern "C" {
static const gchar* getDocumentLocaleCB(AtkDocument* aDocument);
static AtkAttributeSet* getDocumentAttributesCB(AtkDocument* aDocument);
static const gchar* getDocumentAttributeValueCB(AtkDocument* aDocument,
const gchar* aAttrName);
void
documentInterfaceInitCB(AtkDocumentIface *aIface)
@ -64,26 +74,21 @@ documentInterfaceInitCB(AtkDocumentIface *aIface)
const gchar *
getDocumentLocaleCB(AtkDocument *aDocument)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
if (!accWrap)
return nsnull;
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessNode> docAccessNode;
accWrap->QueryInterface(NS_GET_IID(nsIAccessNode),
getter_AddRefs(docAccessNode));
NS_ENSURE_TRUE(docAccessNode, nsnull);
nsAutoString locale;
docAccessNode->GetLanguage(locale);
if (locale.IsEmpty()) {
return nsnull;
}
return nsAccessibleWrap::ReturnString(locale);
nsAutoString locale;
accWrap->GetLanguage(locale);
return locale.IsEmpty() ? nsnull : nsAccessibleWrap::ReturnString(locale);
}
static inline GSList *
prependToList(GSList *aList, const char *const aName, const nsAutoString &aValue)
{
if (aValue.IsEmpty())
return aList;
// libspi will free these
AtkAttribute *atkAttr = (AtkAttribute *)g_malloc(sizeof(AtkAttribute));
atkAttr->name = g_strdup(aName);
@ -94,66 +99,52 @@ prependToList(GSList *aList, const char *const aName, const nsAutoString &aValue
AtkAttributeSet *
getDocumentAttributesCB(AtkDocument *aDocument)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
if (!accWrap)
return nsnull;
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
if (!accWrap || !accWrap->IsDoc())
return nsnull;
nsCOMPtr<nsIAccessibleDocument> accDocument;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleDocument),
getter_AddRefs(accDocument));
NS_ENSURE_TRUE(accDocument, nsnull);
// according to atkobject.h, AtkAttributeSet is a GSList
GSList* attributes = nsnull;
nsDocAccessible* document = accWrap->AsDoc();
nsAutoString aURL;
nsresult rv = document->GetURL(aURL);
if (NS_SUCCEEDED(rv))
attributes = prependToList(attributes, kDocUrlName, aURL);
// according to atkobject.h, AtkAttributeSet is a GSList
GSList *attributes = nsnull;
nsAutoString aW3CDocType;
rv = document->GetDocType(aW3CDocType);
if (NS_SUCCEEDED(rv))
attributes = prependToList(attributes, kDocTypeName, aW3CDocType);
nsAutoString aURL;
nsresult rv = accDocument->GetURL(aURL);
if (NS_SUCCEEDED(rv)) {
attributes = prependToList(attributes, kDocUrlName, aURL);
}
nsAutoString aW3CDocType;
rv = accDocument->GetDocType(aW3CDocType);
if (NS_SUCCEEDED(rv)) {
attributes = prependToList(attributes, kDocTypeName, aW3CDocType);
}
nsAutoString aMimeType;
rv = accDocument->GetMimeType(aMimeType);
if (NS_SUCCEEDED(rv)) {
attributes = prependToList(attributes, kMimeTypeName, aMimeType);
}
return attributes;
nsAutoString aMimeType;
rv = document->GetMimeType(aMimeType);
if (NS_SUCCEEDED(rv))
attributes = prependToList(attributes, kMimeTypeName, aMimeType);
return attributes;
}
const gchar *
getDocumentAttributeValueCB(AtkDocument *aDocument,
const gchar *aAttrName)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
if (!accWrap)
return nsnull;
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
if (!accWrap || !accWrap->IsDoc())
return nsnull;
nsCOMPtr<nsIAccessibleDocument> accDocument;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleDocument),
getter_AddRefs(accDocument));
NS_ENSURE_TRUE(accDocument, nsnull);
nsDocAccessible* document = accWrap->AsDoc();
nsresult rv;
nsAutoString attrValue;
if (!strcasecmp(aAttrName, kDocTypeName))
rv = document->GetDocType(attrValue);
else if (!strcasecmp(aAttrName, kDocUrlName))
rv = document->GetURL(attrValue);
else if (!strcasecmp(aAttrName, kMimeTypeName))
rv = document->GetMimeType(attrValue);
else
return nsnull;
nsresult rv;
nsAutoString attrValue;
if (!g_ascii_strcasecmp(aAttrName, kDocTypeName)) {
rv = accDocument->GetDocType(attrValue);
NS_ENSURE_SUCCESS(rv, nsnull);
}
else if (!g_ascii_strcasecmp(aAttrName, kDocUrlName)) {
rv = accDocument->GetURL(attrValue);
NS_ENSURE_SUCCESS(rv, nsnull);
}
else if (!g_ascii_strcasecmp(aAttrName, kMimeTypeName)) {
rv = accDocument->GetMimeType(attrValue);
NS_ENSURE_SUCCESS(rv, nsnull);
}
else {
return nsnull;
}
return nsAccessibleWrap::ReturnString(attrValue);
NS_ENSURE_SUCCESS(rv, nsnull);
return attrValue.IsEmpty() ? nsnull : nsAccessibleWrap::ReturnString(attrValue);
}
}

View File

@ -41,16 +41,11 @@
#define __MAI_INTERFACE_DOCUMENT_H__
#include "nsMai.h"
#include "nsIAccessibleDocument.h"
G_BEGIN_DECLS
/* document interface callbacks */
void documentInterfaceInitCB(AtkDocumentIface *aIface);
AtkAttributeSet* getDocumentAttributesCB(AtkDocument *aDocument);
const gchar* getDocumentLocaleCB(AtkDocument *aDocument);
const gchar* getDocumentAttributeValueCB(AtkDocument *aDocument,
const gchar *aAttrName);
G_END_DECLS

View File

@ -38,7 +38,6 @@
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceHypertext.h"
#include "nsIAccessibleDocument.h"
#include "nsHyperTextAccessible.h"
void

View File

@ -608,15 +608,12 @@ nsAccUtils::GetLiveAttrValue(PRUint32 aRule, nsAString& aValue)
bool
nsAccUtils::IsTextInterfaceSupportCorrect(nsAccessible *aAccessible)
{
bool foundText = false;
nsCOMPtr<nsIAccessibleDocument> accDoc = do_QueryObject(aAccessible);
if (accDoc) {
// Don't test for accessible docs, it makes us create accessibles too
// early and fire mutation events before we need to
// Don't test for accessible docs, it makes us create accessibles too
// early and fire mutation events before we need to
if (aAccessible->IsDoc())
return true;
}
bool foundText = false;
PRInt32 childCount = aAccessible->GetChildCount();
for (PRint32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *child = GetChildAt(childIdx);

View File

@ -41,7 +41,6 @@
#include "nsIAccessible.h"
#include "nsIAccessNode.h"
#include "nsIAccessibleDocument.h"
#include "nsIAccessibleRole.h"
#include "nsIAccessibleText.h"
#include "nsIAccessibleTable.h"

View File

@ -47,7 +47,6 @@
#include "nsHashtable.h"
#include "nsAccessibilityService.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsIAccessibleDocument.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocument.h"

View File

@ -1006,7 +1006,7 @@ NS_IMETHODIMP nsAccessible::SetSelected(bool aSelect)
return NS_ERROR_FAILURE;
if (State() & states::SELECTABLE) {
nsCOMPtr<nsIAccessible> multiSelect =
nsAccessible* multiSelect =
nsAccUtils::GetMultiSelectableContainer(mContent);
if (!multiSelect) {
return aSelect ? TakeFocus() : NS_ERROR_FAILURE;
@ -1034,12 +1034,11 @@ NS_IMETHODIMP nsAccessible::TakeSelection()
return NS_ERROR_FAILURE;
if (State() & states::SELECTABLE) {
nsCOMPtr<nsIAccessible> multiSelect =
nsAccessible* multiSelect =
nsAccUtils::GetMultiSelectableContainer(mContent);
if (multiSelect) {
nsCOMPtr<nsIAccessibleSelectable> selectable = do_QueryInterface(multiSelect);
selectable->ClearSelection();
}
if (multiSelect)
multiSelect->ClearSelection();
return SetSelected(true);
}

View File

@ -41,7 +41,6 @@
#include "nsCaretAccessible.h"
#include "nsDocAccessibleWrap.h"
#include "nsIAccessibleDocument.h"
#ifdef MOZ_XUL
#include "nsXULTreeAccessible.h"
#endif

View File

@ -48,7 +48,6 @@
#include "ia2AccessibleRelation.h"
#include "nsIAccessibleDocument.h"
#include "nsIAccessibleEvent.h"
#include "nsIAccessibleRelation.h"
#include "nsIAccessibleWin32Object.h"

View File

@ -50,6 +50,7 @@ LIBXUL_LIBRARY = 1
CPPSRCS = \
XULSelectControlAccessible.cpp \
nsXULAlertAccessible.cpp \
nsXULColorPickerAccessible.cpp \
nsXULComboboxAccessible.cpp \

View File

@ -0,0 +1,309 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2012
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jignesh Kakadiya (jigneshhk1992@gmail.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "XULSelectControlAccessible.h"
#include "nsAccessibilityService.h"
#include "nsDocAccessible.h"
#include "nsIDOMXULContainerElement.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMElement.h"
#include "nsIDOMXULElement.h"
#include "nsIMutableArray.h"
#include "nsIServiceManager.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// XULSelectControlAccessible
////////////////////////////////////////////////////////////////////////////////
XULSelectControlAccessible::
XULSelectControlAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsAccessibleWrap(aContent, aShell)
{
mSelectControl = do_QueryInterface(aContent);
}
////////////////////////////////////////////////////////////////////////////////
// XULSelectControlAccessible: nsAccessNode
void
XULSelectControlAccessible::Shutdown()
{
mSelectControl = nsnull;
nsAccessibleWrap::Shutdown();
}
////////////////////////////////////////////////////////////////////////////////
// XULSelectControlAccessible: SelectAccessible
bool
XULSelectControlAccessible::IsSelect()
{
return !!mSelectControl;
}
// Interface methods
already_AddRefed<nsIArray>
XULSelectControlAccessible::SelectedItems()
{
nsCOMPtr<nsIMutableArray> selectedItems =
do_CreateInstance(NS_ARRAY_CONTRACTID);
if (!selectedItems)
return nsnull;
// For XUL multi-select control
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect =
do_QueryInterface(mSelectControl);
if (xulMultiSelect) {
PRInt32 length = 0;
xulMultiSelect->GetSelectedCount(&length);
for (PRInt32 index = 0; index < length; index++) {
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
xulMultiSelect->GetSelectedItem(index, getter_AddRefs(itemElm));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
nsAccessible* item =
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell);
if (item)
selectedItems->AppendElement(static_cast<nsIAccessible*>(item),
false);
}
} else { // Single select?
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
mSelectControl->GetSelectedItem(getter_AddRefs(itemElm));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
if(itemNode) {
nsAccessible* item =
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell);
if (item)
selectedItems->AppendElement(static_cast<nsIAccessible*>(item),
false);
}
}
nsIMutableArray* items = nsnull;
selectedItems.forget(&items);
return items;
}
nsAccessible*
XULSelectControlAccessible::GetSelectedItem(PRUint32 aIndex)
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
if (multiSelectControl)
multiSelectControl->GetSelectedItem(aIndex, getter_AddRefs(itemElm));
else if (aIndex == 0)
mSelectControl->GetSelectedItem(getter_AddRefs(itemElm));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
return itemNode ?
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell) : nsnull;
}
PRUint32
XULSelectControlAccessible::SelectedItemCount()
{
// For XUL multi-select control
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl) {
PRInt32 count = 0;
multiSelectControl->GetSelectedCount(&count);
return count;
}
// For XUL single-select control/menulist
PRInt32 index;
mSelectControl->GetSelectedIndex(&index);
return (index >= 0) ? 1 : 0;
}
bool
XULSelectControlAccessible::AddItemToSelection(PRUint32 aIndex)
{
nsAccessible* item = GetChildAt(aIndex);
if (!item)
return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(item->GetContent());
if (!itemElm)
return false;
bool isItemSelected = false;
itemElm->GetSelected(&isItemSelected);
if (isItemSelected)
return true;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->AddItemToSelection(itemElm);
else
mSelectControl->SetSelectedItem(itemElm);
return true;
}
bool
XULSelectControlAccessible::RemoveItemFromSelection(PRUint32 aIndex)
{
nsAccessible* item = GetChildAt(aIndex);
if (!item)
return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(item->GetContent());
if (!itemElm)
return false;
bool isItemSelected = false;
itemElm->GetSelected(&isItemSelected);
if (!isItemSelected)
return true;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->RemoveItemFromSelection(itemElm);
else
mSelectControl->SetSelectedItem(nsnull);
return true;
}
bool
XULSelectControlAccessible::IsItemSelected(PRUint32 aIndex)
{
nsAccessible* item = GetChildAt(aIndex);
if (!item)
return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(item->GetContent());
if (!itemElm)
return false;
bool isItemSelected = false;
itemElm->GetSelected(&isItemSelected);
return isItemSelected;
}
bool
XULSelectControlAccessible::UnselectAll()
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
multiSelectControl ?
multiSelectControl->ClearSelection() : mSelectControl->SetSelectedIndex(-1);
return true;
}
bool
XULSelectControlAccessible::SelectAll()
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl) {
multiSelectControl->SelectAll();
return true;
}
// otherwise, don't support this method
return false;
}
////////////////////////////////////////////////////////////////////////////////
// XULSelectControlAccessible: Widgets
nsAccessible*
XULSelectControlAccessible::CurrentItem()
{
if (!mSelectControl)
return nsnull;
nsCOMPtr<nsIDOMXULSelectControlItemElement> currentItemElm;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->GetCurrentItem(getter_AddRefs(currentItemElm));
else
mSelectControl->GetSelectedItem(getter_AddRefs(currentItemElm));
nsCOMPtr<nsINode> DOMNode;
if (currentItemElm)
DOMNode = do_QueryInterface(currentItemElm);
if (DOMNode) {
nsDocAccessible* document = GetDocAccessible();
if (document)
return document->GetAccessible(DOMNode);
}
return nsnull;
}
void
XULSelectControlAccessible::SetCurrentItem(nsAccessible* aItem)
{
if (!mSelectControl)
return;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(aItem->GetContent());
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->SetCurrentItem(itemElm);
else
mSelectControl->SetSelectedItem(itemElm);
}

View File

@ -0,0 +1,80 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2012
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jignesh Kakadiya (jigneshhk1992@gmail.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _XULSelectControlAccessible_H_
#define _XULSelectControlAccessible_H_
#include "nsAccessibleWrap.h"
#include "nsIDOMXULSelectCntrlEl.h"
/**
* The basic implementation of accessible selection for XUL select controls.
*/
class XULSelectControlAccessible : public nsAccessibleWrap
{
public:
XULSelectControlAccessible(nsIContent *aContent, nsIWeakReference *aShell);
virtual ~XULSelectControlAccessible() {}
// nsAccessNode
virtual void Shutdown();
// SelectAccessible
virtual bool IsSelect();
virtual already_AddRefed<nsIArray> SelectedItems();
virtual PRUint32 SelectedItemCount();
virtual nsAccessible* GetSelectedItem(PRUint32 aIndex);
virtual bool IsItemSelected(PRUint32 aIndex);
virtual bool AddItemToSelection(PRUint32 aIndex);
virtual bool RemoveItemFromSelection(PRUint32 aIndex);
virtual bool SelectAll();
virtual bool UnselectAll();
// Widgets
virtual nsAccessible* CurrentItem();
virtual void SetCurrentItem(nsAccessible* aItem);
protected:
// nsIDOMXULMultiSelectControlElement inherits from this, so we'll always have
// one of these if the widget is valid and not defunct
nsCOMPtr<nsIDOMXULSelectControlElement> mSelectControl;
};
#endif

View File

@ -559,7 +559,7 @@ nsXULRadioButtonAccessible::ContainerWidget() const
nsXULRadioGroupAccessible::
nsXULRadioGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsXULSelectableAccessible(aContent, aShell)
XULSelectControlAccessible(aContent, aShell)
{
}

View File

@ -43,8 +43,8 @@
// NOTE: alphabetically ordered
#include "nsAccessibleWrap.h"
#include "nsFormControlAccessible.h"
#include "nsXULMenuAccessible.h"
#include "nsHyperTextAccessibleWrap.h"
#include "XULSelectControlAccessible.h"
/**
* Used for XUL progressmeter element.
@ -173,7 +173,7 @@ public:
/**
* Used for XUL radiogroup element.
*/
class nsXULRadioGroupAccessible : public nsXULSelectableAccessible
class nsXULRadioGroupAccessible : public XULSelectControlAccessible
{
public:
nsXULRadioGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell);
@ -284,5 +284,5 @@ protected:
};
#endif
#endif

View File

@ -133,7 +133,7 @@ nsXULColumnItemAccessible::DoAction(PRUint8 aIndex)
nsXULListboxAccessible::
nsXULListboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsXULSelectableAccessible(aContent, aShell)
XULSelectControlAccessible(aContent, aShell)
{
nsIContent* parentContent = mContent->GetParent();
if (parentContent) {
@ -144,13 +144,13 @@ nsXULListboxAccessible::
}
}
NS_IMPL_ADDREF_INHERITED(nsXULListboxAccessible, nsXULSelectableAccessible)
NS_IMPL_RELEASE_INHERITED(nsXULListboxAccessible, nsXULSelectableAccessible)
NS_IMPL_ADDREF_INHERITED(nsXULListboxAccessible, XULSelectControlAccessible)
NS_IMPL_RELEASE_INHERITED(nsXULListboxAccessible, XULSelectControlAccessible)
nsresult
nsXULListboxAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
nsresult rv = nsXULSelectableAccessible::QueryInterface(aIID, aInstancePtr);
nsresult rv = XULSelectControlAccessible::QueryInterface(aIID, aInstancePtr);
if (*aInstancePtr)
return rv;

View File

@ -45,6 +45,7 @@
#include "nsCOMPtr.h"
#include "nsXULMenuAccessible.h"
#include "nsBaseWidgetAccessible.h"
#include "XULSelectControlAccessible.h"
class nsIWeakReference;
@ -88,7 +89,7 @@ public:
/*
* A class the represents the XUL Listbox widget.
*/
class nsXULListboxAccessible : public nsXULSelectableAccessible,
class nsXULListboxAccessible : public XULSelectControlAccessible,
public nsIAccessibleTable
{
public:

View File

@ -66,259 +66,6 @@
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXULSelectableAccessible
////////////////////////////////////////////////////////////////////////////////
nsXULSelectableAccessible::
nsXULSelectableAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsAccessibleWrap(aContent, aShell)
{
mSelectControl = do_QueryInterface(aContent);
}
////////////////////////////////////////////////////////////////////////////////
// nsXULSelectableAccessible: nsAccessNode
void
nsXULSelectableAccessible::Shutdown()
{
mSelectControl = nsnull;
nsAccessibleWrap::Shutdown();
}
////////////////////////////////////////////////////////////////////////////////
// nsXULSelectableAccessible: SelectAccessible
bool
nsXULSelectableAccessible::IsSelect()
{
return !!mSelectControl;
}
// Interface methods
already_AddRefed<nsIArray>
nsXULSelectableAccessible::SelectedItems()
{
nsCOMPtr<nsIMutableArray> selectedItems =
do_CreateInstance(NS_ARRAY_CONTRACTID);
if (!selectedItems)
return nsnull;
// For XUL multi-select control
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect =
do_QueryInterface(mSelectControl);
if (xulMultiSelect) {
PRInt32 length = 0;
xulMultiSelect->GetSelectedCount(&length);
for (PRInt32 index = 0; index < length; index++) {
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
xulMultiSelect->GetSelectedItem(index, getter_AddRefs(itemElm));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
nsAccessible* item =
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell);
if (item)
selectedItems->AppendElement(static_cast<nsIAccessible*>(item),
false);
}
}
else { // Single select?
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
mSelectControl->GetSelectedItem(getter_AddRefs(itemElm));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
if(itemNode) {
nsAccessible* item =
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell);
if (item)
selectedItems->AppendElement(static_cast<nsIAccessible*>(item),
false);
}
}
nsIMutableArray* items = nsnull;
selectedItems.forget(&items);
return items;
}
nsAccessible*
nsXULSelectableAccessible::GetSelectedItem(PRUint32 aIndex)
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
if (multiSelectControl)
multiSelectControl->GetSelectedItem(aIndex, getter_AddRefs(itemElm));
else if (aIndex == 0)
mSelectControl->GetSelectedItem(getter_AddRefs(itemElm));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
return itemNode ?
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell) : nsnull;
}
PRUint32
nsXULSelectableAccessible::SelectedItemCount()
{
// For XUL multi-select control
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl) {
PRInt32 count = 0;
multiSelectControl->GetSelectedCount(&count);
return count;
}
// For XUL single-select control/menulist
PRInt32 index;
mSelectControl->GetSelectedIndex(&index);
return (index >= 0) ? 1 : 0;
}
bool
nsXULSelectableAccessible::AddItemToSelection(PRUint32 aIndex)
{
nsAccessible* item = GetChildAt(aIndex);
if (!item)
return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(item->GetContent());
if (!itemElm)
return false;
bool isItemSelected = false;
itemElm->GetSelected(&isItemSelected);
if (isItemSelected)
return true;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->AddItemToSelection(itemElm);
else
mSelectControl->SetSelectedItem(itemElm);
return true;
}
bool
nsXULSelectableAccessible::RemoveItemFromSelection(PRUint32 aIndex)
{
nsAccessible* item = GetChildAt(aIndex);
if (!item)
return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(item->GetContent());
if (!itemElm)
return false;
bool isItemSelected = false;
itemElm->GetSelected(&isItemSelected);
if (!isItemSelected)
return true;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->RemoveItemFromSelection(itemElm);
else
mSelectControl->SetSelectedItem(nsnull);
return true;
}
bool
nsXULSelectableAccessible::IsItemSelected(PRUint32 aIndex)
{
nsAccessible* item = GetChildAt(aIndex);
if (!item)
return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(item->GetContent());
if (!itemElm)
return false;
bool isItemSelected = false;
itemElm->GetSelected(&isItemSelected);
return isItemSelected;
}
bool
nsXULSelectableAccessible::UnselectAll()
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
multiSelectControl ?
multiSelectControl->ClearSelection() : mSelectControl->SetSelectedIndex(-1);
return true;
}
bool
nsXULSelectableAccessible::SelectAll()
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl) {
multiSelectControl->SelectAll();
return true;
}
// otherwise, don't support this method
return false;
}
////////////////////////////////////////////////////////////////////////////////
// nsXULSelectableAccessible: Widgets
nsAccessible*
nsXULSelectableAccessible::CurrentItem()
{
if (!mSelectControl)
return nsnull;
nsCOMPtr<nsIDOMXULSelectControlItemElement> currentItemElm;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->GetCurrentItem(getter_AddRefs(currentItemElm));
else
mSelectControl->GetSelectedItem(getter_AddRefs(currentItemElm));
nsCOMPtr<nsINode> DOMNode;
if (currentItemElm)
DOMNode = do_QueryInterface(currentItemElm);
if (DOMNode) {
nsDocAccessible* document = GetDocAccessible();
if (document)
return document->GetAccessible(DOMNode);
}
return nsnull;
}
void
nsXULSelectableAccessible::SetCurrentItem(nsAccessible* aItem)
{
if (!mSelectControl)
return;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(aItem->GetContent());
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->SetCurrentItem(itemElm);
else
mSelectControl->SetSelectedItem(itemElm);
}
////////////////////////////////////////////////////////////////////////////////
// nsXULMenuitemAccessible
////////////////////////////////////////////////////////////////////////////////
@ -708,7 +455,7 @@ nsXULMenuSeparatorAccessible::ActionCount()
nsXULMenupopupAccessible::
nsXULMenupopupAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsXULSelectableAccessible(aContent, aShell)
XULSelectControlAccessible(aContent, aShell)
{
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame());
if (menuPopupFrame && menuPopupFrame->IsMenu())

View File

@ -41,39 +41,7 @@
#include "nsAccessibleWrap.h"
#include "nsIDOMXULSelectCntrlEl.h"
/**
* The basic implementation of SelectAccessible for XUL select controls.
*/
class nsXULSelectableAccessible : public nsAccessibleWrap
{
public:
nsXULSelectableAccessible(nsIContent *aContent, nsIWeakReference *aShell);
virtual ~nsXULSelectableAccessible() {}
// nsAccessNode
virtual void Shutdown();
// SelectAccessible
virtual bool IsSelect();
virtual already_AddRefed<nsIArray> SelectedItems();
virtual PRUint32 SelectedItemCount();
virtual nsAccessible* GetSelectedItem(PRUint32 aIndex);
virtual bool IsItemSelected(PRUint32 aIndex);
virtual bool AddItemToSelection(PRUint32 aIndex);
virtual bool RemoveItemFromSelection(PRUint32 aIndex);
virtual bool SelectAll();
virtual bool UnselectAll();
// Widgets
virtual nsAccessible* CurrentItem();
virtual void SetCurrentItem(nsAccessible* aItem);
protected:
// nsIDOMXULMultiSelectControlElement inherits from this, so we'll always have
// one of these if the widget is valid and not defunct
nsCOMPtr<nsIDOMXULSelectControlElement> mSelectControl;
};
#include "XULSelectControlAccessible.h"
/**
* Used for XUL menu, menuitem elements.
@ -136,7 +104,7 @@ public:
/**
* Used for XUL menupopup and panel.
*/
class nsXULMenupopupAccessible : public nsXULSelectableAccessible
class nsXULMenupopupAccessible : public XULSelectControlAccessible
{
public:
nsXULMenupopupAccessible(nsIContent *aContent, nsIWeakReference *aShell);
@ -174,4 +142,4 @@ public:
virtual void SetCurrentItem(nsAccessible* aItem);
};
#endif
#endif

View File

@ -179,7 +179,7 @@ nsXULTabAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
nsXULTabsAccessible::
nsXULTabsAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsXULSelectableAccessible(aContent, aShell)
XULSelectControlAccessible(aContent, aShell)
{
}

View File

@ -42,6 +42,7 @@
// NOTE: alphabetically ordered
#include "nsBaseWidgetAccessible.h"
#include "nsXULMenuAccessible.h"
#include "XULSelectControlAccessible.h"
/**
* An individual tab, xul:tab element.
@ -72,7 +73,7 @@ public:
/**
* A container of tab objects, xul:tabs element.
*/
class nsXULTabsAccessible : public nsXULSelectableAccessible
class nsXULTabsAccessible : public XULSelectControlAccessible
{
public:
nsXULTabsAccessible(nsIContent *aContent, nsIWeakReference *aShell);

View File

@ -191,7 +191,7 @@ $(RESOURCES): $(RES_DIRS) $(subst res/,$(srcdir)/resources/,$(RESOURCES))
$(NSINSTALL) $(subst res/,$(srcdir)/resources/,$@) $(dir $@)
R.java: $(MOZ_APP_ICON) $(RES_LAYOUT) $(RES_DRAWABLE) $(RES_VALUES) res/drawable/icon.png res/drawable-hdpi/icon.png res/values/strings.xml AndroidManifest.xml
R.java: $(MOZ_APP_ICON) $(RES_LAYOUT) $(RES_DRAWABLE) $(RES_VALUES) res/drawable/icon.png res/drawable-hdpi/icon.png AndroidManifest.xml chrome
$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -J . --custom-package org.mozilla.gecko
gecko.ap_: AndroidManifest.xml res/drawable/icon.png res/drawable-hdpi/icon.png $(RES_LAYOUT) $(RES_DRAWABLE) $(RES_VALUES) res/values/strings.xml FORCE

View File

@ -69,8 +69,8 @@ typedef struct _cairo_type1_font_subset {
unsigned int font_id;
char *base_font;
unsigned int num_glyphs;
long x_min, y_min, x_max, y_max;
long ascent, descent;
double x_min, y_min, x_max, y_max;
double ascent, descent;
const char *data;
unsigned long header_size;
@ -146,12 +146,12 @@ _cairo_type1_font_subset_init (cairo_type1_font_subset_t *font,
memset (font, 0, sizeof (*font));
font->base.unscaled_font = _cairo_unscaled_font_reference (unscaled_font);
font->base.num_glyphs = face->num_glyphs;
font->base.x_min = face->bbox.xMin;
font->base.y_min = face->bbox.yMin;
font->base.x_max = face->bbox.xMax;
font->base.y_max = face->bbox.yMax;
font->base.ascent = face->ascender;
font->base.descent = face->descender;
font->base.x_min = face->bbox.xMin / (double)face->units_per_EM;
font->base.y_min = face->bbox.yMin / (double)face->units_per_EM;
font->base.x_max = face->bbox.xMax / (double)face->units_per_EM;
font->base.y_max = face->bbox.yMax / (double)face->units_per_EM;
font->base.ascent = face->ascender / (double)face->units_per_EM;
font->base.descent = face->descender / (double)face->units_per_EM;
if (face->family_name) {
font->base.base_font = strdup (face->family_name);
@ -566,7 +566,7 @@ cairo_type1_font_subset_get_glyph_names_and_widths (cairo_type1_font_subset_t *f
return CAIRO_INT_STATUS_UNSUPPORTED;
}
font->glyphs[i].width = font->face->glyph->linearHoriAdvance / 65536.0; /* 16.16 format */
font->glyphs[i].width = font->face->glyph->metrics.horiAdvance / (double)font->face->units_per_EM;
error = FT_Get_Glyph_Name(font->face, i, buffer, sizeof buffer);
if (error != FT_Err_Ok) {

View File

@ -81,6 +81,92 @@ struct NS_GFX nsRect :
}
#endif
// A version of Inflate that caps the values to the nscoord range.
// x & y is capped at the minimum value nscoord_MIN and
// width & height is capped at the maximum value nscoord_MAX.
void SaturatingInflate(const nsMargin& aMargin)
{
#ifdef NS_COORD_IS_FLOAT
Inflate(aMargin);
#else
PRInt64 nx = PRInt64(x) - aMargin.left;
if (nx < nscoord_MIN) {
NS_WARNING("Underflowed nscoord_MIN in conversion to nscoord x");
nx = nscoord_MIN;
}
x = nscoord(nx);
PRInt64 ny = PRInt64(y) - aMargin.top;
if (ny < nscoord_MIN) {
NS_WARNING("Underflowed nscoord_MIN in conversion to nscoord y");
ny = nscoord_MIN;
}
y = nscoord(ny);
PRInt64 w = PRInt64(width) + PRInt64(aMargin.left) + aMargin.right;
if (w > nscoord_MAX) {
NS_WARNING("Overflowed nscoord_MAX in conversion to nscoord width");
w = nscoord_MAX;
}
width = nscoord(w);
PRInt64 h = PRInt64(height) + PRInt64(aMargin.top) + aMargin.bottom;
if (h > nscoord_MAX) {
NS_WARNING("Overflowed nscoord_MAX in conversion to nscoord height");
h = nscoord_MAX;
}
height = nscoord(h);
#endif
}
// We have saturating versions of all the Union methods. These avoid
// overflowing nscoord values in the 'width' and 'height' fields by
// clamping the width and height values to nscoord_MAX if necessary.
nsRect SaturatingUnion(const nsRect& aRect) const
{
if (IsEmpty()) {
return aRect;
} else if (aRect.IsEmpty()) {
return *static_cast<const nsRect*>(this);
} else {
return SaturatingUnionEdges(aRect);
}
}
nsRect SaturatingUnionEdges(const nsRect& aRect) const
{
#ifdef NS_COORD_IS_FLOAT
return UnionEdges(aRect);
#else
nsRect result;
result.x = NS_MIN(aRect.x, x);
result.y = NS_MIN(aRect.y, y);
PRInt64 w = NS_MAX(PRInt64(aRect.x) + aRect.width, PRInt64(x) + width) - result.x;
PRInt64 h = NS_MAX(PRInt64(aRect.y) + aRect.height, PRInt64(y) + height) - result.y;
if (w > nscoord_MAX) {
NS_WARNING("Overflowed nscoord_MAX in conversion to nscoord width");
w = nscoord_MAX;
}
if (h > nscoord_MAX) {
NS_WARNING("Overflowed nscoord_MAX in conversion to nscoord height");
h = nscoord_MAX;
}
result.width = nscoord(w);
result.height = nscoord(h);
return result;
#endif
}
void SaturatingUnionRect(const nsRect& aRect1, const nsRect& aRect2)
{
*this = aRect1.SaturatingUnion(aRect2);
}
void SaturatingUnionRectEdges(const nsRect& aRect1, const nsRect& aRect2)
{
*this = aRect1.SaturatingUnionEdges(aRect2);
}
// Converts this rect from aFromAPP, an appunits per pixel ratio, to aToAPP.
// In the RoundOut version we make the rect the smallest rect containing the
// unrounded result. In the RoundIn version we make the rect the largest rect

View File

@ -0,0 +1,2 @@
<!DOCTYPE html><html style="white-space: pre-wrap; direction: rtl; -moz-column-width: 1px;"><style style="display: none;">.fl:first-letter { }</style><body class="fl">&#xD288;&#x062A;
D</body></html>

View File

@ -42,7 +42,7 @@ load 265736-2.html
asserts(2) load 265899-1.html # bug 575011
load 265973-1.html
asserts(6-12) load 265986-1.html # Bug 512405
asserts(2-4) load 265999-1.html # bug 575011
asserts(2-6) load 265999-1.html # bug 575011
load 266222-1.html
asserts(3-7) load 266360-1.html # bug 575011 / bug 576358
asserts(4) load 266445-1.html # Bug 575011
@ -345,4 +345,5 @@ load 670226.html
asserts(2) load 675246-1.xhtml # Bug 675713
load 691118-1.html
load 695861.html
load 698335.html
load 707098.html

View File

@ -820,11 +820,11 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
frameIndex, newIndex, lineOffset);
}
} else if (runLength == fragmentLength &&
numRun + 1 < runCount) {
frame->GetNextSibling()) {
/*
* If the directional run ends at the end of the frame, and this is
* not the end of our paragraph, make sure that the next frame is a
* non-fluid continuation
* not the containing frame's last child, make sure that the next
* frame is a non-fluid continuation
*/
nsIFrame* next = frame->GetNextInFlow();
if (next) {

View File

@ -3801,22 +3801,28 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aBackgroundFrame,
return eTransparencyOpaque;
}
static bool IsPopupFrame(nsIFrame* aFrame)
{
// aFrame is a popup it's the list control frame dropdown for a combobox.
nsIAtom* frameType = aFrame->GetType();
if (frameType == nsGkAtoms::listControlFrame) {
nsListControlFrame* lcf = static_cast<nsListControlFrame*>(aFrame);
return lcf->IsInDropDownMode();
}
// ... or if it's a XUL menupopup frame.
return frameType == nsGkAtoms::menuPopupFrame;
}
/* static */ bool
nsLayoutUtils::IsPopup(nsIFrame* aFrame)
{
nsIAtom* frameType = aFrame->GetType();
// We're a popup if we're the list control frame dropdown for a combobox.
if (frameType == nsGkAtoms::listControlFrame) {
nsListControlFrame* listControlFrame = static_cast<nsListControlFrame*>(aFrame);
if (listControlFrame) {
return listControlFrame->IsInDropDownMode();
}
// Optimization: the frame can't possibly be a popup if it has no view.
if (!aFrame->HasView()) {
NS_ASSERTION(!IsPopupFrame(aFrame), "popup frame must have a view");
return false;
}
// ... or if we're a XUL menupopup frame.
return (frameType == nsGkAtoms::menuPopupFrame);
return IsPopupFrame(aFrame);
}
/* static */ nsIFrame*

View File

@ -3,7 +3,7 @@ load 25888-2.html
load 37757-1.html
load 225868-1.html
load 264937-1.html
asserts(9) load 265867-1.html # Bug 575011
asserts(13) load 265867-1.html # Bug 575011
load 265867-2.html
load 289864-1.html
load 295292-1.html
@ -14,7 +14,7 @@ load 310556-1.xhtml
load 322780-1.xul
load 323381-1.html
load 323381-2.html
asserts(2) asserts-if(gtk2Widget,8) load 323386-1.html # Bug 575011
asserts(2) asserts-if(gtk2Widget,25) load 323386-1.html # Bug 575011
load 323389-1.html
load 323389-2.html
load 323493-1.html
@ -217,7 +217,7 @@ load 431260-2.html
load 435529.html
load 436194-1.html
load 436602-1.html
load 436822-1.html
asserts(1-2) load 436822-1.html
load 436823.html
load 436969-1.html
load 437156-1.html
@ -259,8 +259,8 @@ load 465651-1.html
load 467137-1.html
load 467213-1.html
load 467487-1.html
load 467493-1.html
load 467493-2.html
asserts(11-12) load 467493-1.html
asserts(10-11) load 467493-2.html
load 467875-1.xhtml
load 467914-1.html
load 468207-1.html
@ -278,7 +278,7 @@ load 476241-1.html
load 477731-1.html
load 477928.html
load 478131-1.html
load 478170-1.html
asserts(4) load 478170-1.html
load 478185-1.html
asserts-if(!Android,1) load 479938-1.html # Bug 575011
load 480345-1.html
@ -309,7 +309,7 @@ load 512749-1.html
load 513394-1.html
load 514098-1.xhtml
load 514800-1.html
load 515811-1.html
asserts(1) load 515811-1.html
load 517968.html
load 519031.xhtml
load 520340.html
@ -321,8 +321,8 @@ load 534366-2.html
load 536692-1.xhtml
load 541277-1.html
load 541277-2.html
load 541714-1.html
load 541714-2.html
asserts(4) load 541714-1.html
asserts(5-6) load 541714-2.html
load 542136-1.html
load 545571-1.html
load 547338.xul
@ -332,7 +332,7 @@ asserts(5) load 553504-1.xhtml # nscoord_MAX assertions (bug 575011)
load 564368-1.xhtml
load 564968.xhtml
load 570160.html
load 570289-1.html
asserts(2) load 570289-1.html
load 571618-1.svg
asserts(1) load 571975-1.html # bug 574889
load 574958.xhtml
@ -372,7 +372,7 @@ load text-overflow-form-elements.html
load text-overflow-iframe.html
load text-overflow-bug666751-1.html
load text-overflow-bug666751-2.html
asserts(2) load text-overflow-bug670564.xhtml # asserts(2) for bug 436470
asserts(0-1) load text-overflow-bug670564.xhtml
load text-overflow-bug671796.xhtml
load 667025.html
asserts-if(Android,8) load 673770.html

View File

@ -1478,24 +1478,15 @@ nsBlockFrame::ComputeOverflowAreas(const nsHTMLReflowState& aReflowState,
areas.UnionAllWith(mBullet->GetRect());
}
// Factor in the bottom edge of the children. Child frames
// will be added to the overflow area as we iterate through the lines,
// but their margins won't, so we need to account for bottom margins
// here. If we're a scrolled block then we also need to account
// for the scrollframe's padding, which is logically below the
// bottom margins of the children.
nscoord bottomEdgeOfContents = aBottomEdgeOfChildren;
if (GetStyleContext()->GetPseudo() == nsCSSAnonBoxes::scrolledContent) {
// We're a scrolled frame; the scrollframe's padding should be added
// to the bottom edge of the children
bottomEdgeOfContents += aReflowState.mComputedPadding.bottom;
}
// Factor in the bottom edge of the children. Child frames will be added
// to the overflow area as we iterate through the lines, but their margins
// won't, so we need to account for bottom margins here.
// REVIEW: For now, we do this for both visual and scrollable area,
// although when we make scrollable overflow area not be a subset of
// visual, we can change this.
NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
nsRect& o = areas.Overflow(otype);
o.height = NS_MAX(o.YMost(), bottomEdgeOfContents) - o.y;
o.height = NS_MAX(o.YMost(), aBottomEdgeOfChildren) - o.y;
}
}
#ifdef NOISY_COMBINED_AREA

View File

@ -6564,9 +6564,14 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
// This is now called FinishAndStoreOverflow() instead of
// StoreOverflow() because frame-generic ways of adding overflow
// can happen here, e.g. CSS2 outline and native theme.
// If the overflow area width or height is nscoord_MAX, then a
// saturating union may have encounted an overflow, so the overflow may not
// contain the frame border-box. Don't warn in that case.
NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
DebugOnly<nsRect*> r = &aOverflowAreas.Overflow(otype);
NS_ASSERTION(aNewSize.width == 0 || aNewSize.height == 0 ||
aOverflowAreas.Overflow(otype).Contains(nsRect(nsPoint(0,0), aNewSize)),
r->width == nscoord_MAX || r->height == nscoord_MAX ||
r->Contains(nsRect(nsPoint(0,0), aNewSize)),
"Computed overflow area must contain frame bounds");
}
@ -6593,6 +6598,17 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
nsRect& o = aOverflowAreas.Overflow(otype);
o.UnionRectEdges(o, bounds);
}
if (!nsLayoutUtils::IsPopup(this)) {
// Include margin in scrollable overflow.
// XXX In theory this should consider margin collapsing
nsRect marginBounds(bounds);
nsMargin margin = GetUsedMargin();
ApplySkipSides(margin);
marginBounds.SaturatingInflate(margin);
nsRect& so = aOverflowAreas.ScrollableOverflow();
so.SaturatingUnionRectEdges(so, marginBounds);
}
}
// Note that NS_STYLE_OVERFLOW_CLIP doesn't clip the frame background,

View File

@ -5,7 +5,7 @@
<style type="text/css">
html, body { margin: 0; padding: 0; border: none; }
div { height: 1px; background: navy; }
div { height: 1px; background: navy; margin-right: 19px; }
</style>
</head>

View File

@ -6,7 +6,7 @@
html, body { margin: 0; padding: 0; border: none; }
div { height: 1px; background: blue;
border-left: 7px solid navy; border-right: 17px solid navy; }
border-left: 7px solid navy; border-right: 17px solid navy; margin-right: 19px; }
</style>
</head>

View File

@ -9,7 +9,7 @@ td {
table {
border: 1px solid black;
background-color: red;
width: 500px;
width: 200px;
border-spacing: 0;
}
</style>

View File

@ -9,7 +9,7 @@ td {
table {
border: 1px solid black;
background-color: red;
width: 500px;
width: 200px;
border-spacing: 0;
}
</style>

View File

@ -3,7 +3,7 @@
<body>
<div style="overflow:auto; width:300px; height:300px; background:green;">
<div style="height:100px;"></div>
<div style="height:200px; margin-left:100px; width:100px; background:yellow;"></div>
<div style="height:200px; margin-left:100px; margin-right:100px; width:100px; background:yellow;"></div>
<div style="height:100px;"></div>
</div>
</body>

View File

@ -0,0 +1,9 @@
<!DOCTYPE HTML>
<html>
<body>
<div style="overflow:auto; width:300px; height:300px; background:green;">
<div style="height:100px;"></div>
<div style="height:200px; margin-left:100px; margin-right:100px; width:100px; background:yellow;"></div>
</div>
</body>
</html>

View File

@ -3,7 +3,7 @@
<body>
<div style="overflow:auto; width:300px; height:300px; background:green;">
<div style="height:100px; margin-top:100px;">
<div style="height:200px; margin-left:100px; width:100px; margin-bottom:100px; background:yellow;"></div>
<div style="height:200px; margin-left:100px; width:100px; margin-bottom:100px; margin-right:100px; background:yellow;"></div>
</div>
</div>
</body>

View File

@ -2,7 +2,7 @@
<html>
<body>
<div style="overflow:auto; width:300px; height:300px; background:green;">
<div style="height:200px; margin-left:100px; width:100px; margin-top:100px; float:left; margin-bottom:100px; background:yellow;"></div>
<div style="height:200px; margin:100px; width:100px; float:left; background:yellow;"></div>
</div>
</body>
</html>

View File

@ -13,7 +13,7 @@
background: aqua;
}
#gap {
height: 42px;
height: 35px;
}
</style>

View File

@ -0,0 +1,17 @@
<!DOCTYPE HTML>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Testcase for bug 665597</title>
<style type="text/css">
.o { width:100px; height:100px; padding:100px; background:green; }
.i { width:100px; height:200px; background:yellow; }
</style>
</head>
<body>
<div class="o" style="overflow:visible">
<div class="i"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE HTML>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Testcase for bug 665597</title>
<style type="text/css">
.o { width:100px; height:100px; padding:100px; background:green; }
.i { width:100px; height:200px; background:yellow; }
</style>
</head>
<body>
<div class="o" style="overflow:auto">
<div class="i"></div>
</div>
</body>
</html>

View File

@ -1196,7 +1196,7 @@ fails-if(cocoaWidget) == 456147.xul 456147-ref.html # bug 458047
== 456484-1.html 456484-1-ref.html
== 457398-1.html 457398-1-ref.html
== 457398-2.html 457398-2-ref.html
== 458296-1a.html 458296-1-ref.html
== 458296-1a.html 458296-1a-ref.html
== 458296-1b.html 458296-1-ref.html
== 458296-1c.html 458296-1-ref.html
== 458296-1d.html 458296-1-ref.html
@ -1567,7 +1567,7 @@ fails-if(Android) random-if(layersGPUAccelerated) fails-if(/^Windows\x20NT\x205\
== 582037-1b.html 582037-1-ref.html
== 582037-2a.html 582037-2-ref.html
== 582037-2b.html 582037-2-ref.html
asserts(0-1) == 582146-1.html about:blank
asserts(0-11) == 582146-1.html about:blank
== 582476-1.svg 582476-1-ref.svg
== 584400-dash-length.svg 584400-dash-length-ref.svg
== 584699-1.html 584699-1-ref.html
@ -1666,6 +1666,7 @@ fails-if(layersGPUAccelerated&&cocoaWidget) == 654950-1.html 654950-1-ref.html #
== 664127-1.xul 664127-1-ref.xul
== 660682-1.html 660682-1-ref.html
== 665597-1.html 665597-1-ref.html
== 665597-2.html 665597-2-ref.html
!= 669015-1.xul 669015-1-notref.xul
== 668319-1.xul about:blank
== 670442-1.html 670442-1-ref.html

View File

@ -17,9 +17,9 @@
body > div:nth-child(10) > .progress-bar { }
body > div:nth-child(11) > .progress-bar { }
/* 12 - 15 should have 100% width, no need to specify. */
body > div:nth-child(16) > .progress-bar { position: relative; top: 64px; left: 64px;
height: -moz-calc(100% - 32px);
width: -moz-calc(100% + 128px - 1em); }
body > div:nth-of-type(16) > .progress-bar { position: relative; top: 64px; left: 64px;
height: -moz-calc(100% - 32px);
width: -moz-calc(100% + 128px - 1em); }
</style>
<body>
<div class="progress-element vertical">
@ -82,7 +82,7 @@
<div class="progress-bar">
</div>
</div>
<div class="progress-element vertical">
<br><div class="progress-element vertical">
<div class="progress-bar">
</div>
</div>

View File

@ -17,10 +17,10 @@
body > div:nth-child(10) > .progress-bar { }
body > div:nth-child(11) > .progress-bar { }
/* 12 - 15 should have 100% width, no need to specify. */
body > div:nth-child(16) > .progress-bar { position: relative; top: 64px;
left: -moz-calc(100% + 128px + 32px );
height: -moz-calc(100% - 32px);
width: -moz-calc(100% + 128px - 1em); }
body > div:nth-of-type(16) > .progress-bar { position: relative; top: 64px;
left: -moz-calc(100% + 128px + 32px );
height: -moz-calc(100% - 32px);
width: -moz-calc(100% + 128px - 1em); }
</style>
<body dir='rtl'>
<div class="progress-element vertical">
@ -83,7 +83,7 @@
<div class="progress-bar">
</div>
</div>
<div class="progress-element vertical">
<br><div class="progress-element vertical">
<div class="progress-bar">
</div>
</div>

View File

@ -21,7 +21,7 @@
body > progress:nth-child(13)::-moz-progress-bar { height: 10px; }
body > progress:nth-child(14)::-moz-progress-bar { height: 10%; }
body > progress:nth-child(15)::-moz-progress-bar { height: 200%; }
body > progress:nth-child(16)::-moz-progress-bar { margin: 64px; padding: 64px; }
body > progress:nth-of-type(16)::-moz-progress-bar { margin: 64px; padding: 64px; }
</style>
<body dir='rtl'>
<!-- Those will be used to change padding/margin on ::-moz-progress-bar -->
@ -41,6 +41,6 @@
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<br><progress value='1'></progress>
</body>
</html>

View File

@ -21,7 +21,7 @@
body > progress:nth-child(13)::-moz-progress-bar { height: 10px; }
body > progress:nth-child(14)::-moz-progress-bar { height: 10%; }
body > progress:nth-child(15)::-moz-progress-bar { height: 200%; }
body > progress:nth-child(16)::-moz-progress-bar { margin: 64px; padding: 64px; }
body > progress:nth-of-type(16)::-moz-progress-bar { margin: 64px; padding: 64px; }
</style>
<body>
<!-- Those will be used to change padding/margin on ::-moz-progress-bar -->
@ -41,6 +41,6 @@
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<br><progress value='1'></progress>
</body>
</html>

View File

@ -7,15 +7,16 @@
background-color: green;
}
#b {
height: 120px;
height: 160px;
margin-top: 20px;
margin-bottom: 20px;
padding: 40px 0;
padding-top: 40px;
background-color: green;
overflow-y: scroll;
}
#c {
height: 160px;
margin-bottom: 40px;
background-color: blue;
}
</style>

View File

@ -7,15 +7,16 @@
background-color: green;
}
#b {
height: 120px;
height: 160px;
margin-top: 20px;
margin-bottom: 20px;
padding: 40px 0;
padding-top: 40px;
background-color: green;
overflow: auto;
}
#c {
height: 160px;
margin-bottom: 40px;
background-color: blue;
}
</style>

View File

@ -236,9 +236,7 @@ nsTableCellFrame::AttributeChanged(PRInt32 aNameSpaceID,
}
// let the table frame decide what to do
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame) {
tableFrame->AttributeChangedFor(this, mContent, aAttribute);
}
tableFrame->AttributeChangedFor(this, mContent, aAttribute);
return NS_OK;
}
@ -249,7 +247,6 @@ nsTableCellFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
return;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame->IsBorderCollapse() &&
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
PRInt32 colIndex, rowIndex;
@ -443,7 +440,6 @@ nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
DO_GLOBAL_REFLOW_COUNT_DSP("nsTableCellFrame");
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
PRInt32 emptyCellStyle = GetContentEmpty() && !tableFrame->IsBorderCollapse() ?
GetStyleTableBorder()->mEmptyCells
: NS_STYLE_TABLE_EMPTY_CELLS_SHOW;
@ -824,11 +820,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight);
/* It's the 'border-collapse' on the table that matters */
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
ABORT1(NS_ERROR_NULL_POINTER);
nsMargin borderPadding = aReflowState.mComputedPadding;
nsMargin border;
GetBorderWidth(border);
@ -854,6 +845,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
SetPriorAvailWidth(aReflowState.availableWidth);
nsIFrame* firstKid = mFrames.FirstChild();
NS_ASSERTION(firstKid, "Frame construction error, a table cell always has an inner cell frame");
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (aReflowState.mFlags.mSpecialHeightReflow) {
const_cast<nsHTMLReflowState&>(aReflowState).SetComputedHeight(mRect.height - topInset - bottomInset);

View File

@ -90,13 +90,11 @@ nsTableColFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
return;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame->IsBorderCollapse() &&
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
nsRect damageArea = nsRect(GetColIndex(), 0, 1, tableFrame->GetRowCount());
tableFrame->AddBCDamageArea(damageArea);
}
return;
}
void nsTableColFrame::SetContinuousBCBorderWidth(PRUint8 aForSide,
@ -130,9 +128,7 @@ NS_METHOD nsTableColFrame::Reflow(nsPresContext* aPresContext,
bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
if (collapseCol) {
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame) {
tableFrame->SetNeedToCollapse(true);
}
tableFrame->SetNeedToCollapse(true);
}
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);

View File

@ -102,10 +102,7 @@ nsTableColGroupFrame::AddColsToTable(PRInt32 aFirstColIndex,
bool aResetSubsequentColIndices,
const nsFrameList::Slice& aCols)
{
nsresult rv = NS_OK;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
return NS_ERROR_NULL_POINTER;
// set the col indices of the col frames and and add col info to the table
PRInt32 colIndex = aFirstColIndex;
@ -132,7 +129,7 @@ nsTableColGroupFrame::AddColsToTable(PRInt32 aFirstColIndex,
ResetColIndices(GetNextSibling(), colIndex);
}
return rv;
return NS_OK;
}
@ -177,9 +174,6 @@ nsTableColGroupFrame::SetInitialChildList(ChildListID aListID,
return NS_ERROR_INVALID_ARG;
}
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
return NS_ERROR_NULL_POINTER;
if (aChildList.IsEmpty()) {
tableFrame->AppendAnonymousColFrames(this, GetSpan(), eColAnonymousColGroup,
false);
@ -197,7 +191,6 @@ nsTableColGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
return;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame->IsBorderCollapse() &&
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
PRInt32 colCount = GetColCount();
@ -207,7 +200,6 @@ nsTableColGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
tableFrame->GetRowCount());
tableFrame->AddBCDamageArea(damageArea);
}
return;
}
NS_IMETHODIMP
@ -359,9 +351,6 @@ nsTableColGroupFrame::RemoveFrame(ChildListID aListID,
RemoveChild(*colFrame, true);
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
return NS_ERROR_NULL_POINTER;
tableFrame->RemoveCol(this, colIndex, true, true);
if (mFrames.IsEmpty() && contentRemoval &&
GetColType() == eColGroupContent) {
@ -403,9 +392,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsPresContext* aPresContext,
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
if (collapseGroup) {
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame) {
tableFrame->SetNeedToCollapse(true);;
}
tableFrame->SetNeedToCollapse(true);
}
// for every content child that (is a column thingy and does not already have a frame)
// create a frame and adjust it's style
@ -487,7 +474,6 @@ void nsTableColGroupFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
mTopContBorderWidth);
aBorder.bottom = BC_BORDER_TOP_HALF_COORD(aPixelsToTwips,
mBottomContBorderWidth);
return;
}
/* ----- global methods ----- */

View File

@ -188,12 +188,7 @@ nsTableFrame::nsTableFrame(nsStyleContext* aContext)
mCellMap(nsnull),
mTableLayoutStrategy(nsnull)
{
mBits.mHaveReflowedColGroups = false;
mBits.mCellSpansPctCol = false;
mBits.mNeedToCalcBCBorders = false;
mBits.mIsBorderCollapse = false;
mBits.mResizedColumns = false; // only really matters if splitting
mBits.mGeometryDirty = false;
memset(&mBits, 0, sizeof(mBits));
}
NS_QUERYFRAME_HEAD(nsTableFrame)
@ -205,22 +200,23 @@ nsTableFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
nsresult rv;
NS_PRECONDITION(!mCellMap, "Init called twice");
NS_PRECONDITION(!aPrevInFlow ||
aPrevInFlow->GetType() == nsGkAtoms::tableFrame,
"prev-in-flow must be of same type");
// Let the base class do its processing
rv = nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
nsresult rv = nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
// see if border collapse is on, if so set it
const nsStyleTableBorder* tableStyle = GetStyleTableBorder();
bool borderCollapse = (NS_STYLE_BORDER_COLLAPSE == tableStyle->mBorderCollapse);
SetBorderCollapse(borderCollapse);
// Create the cell map
// Create the cell map if this frame is the first-in-flow.
if (!aPrevInFlow) {
mCellMap = new nsTableCellMap(*this, borderCollapse);
if (!mCellMap)
return NS_ERROR_OUT_OF_MEMORY;
} else {
mCellMap = nsnull;
}
if (aPrevInFlow) {
@ -242,18 +238,10 @@ nsTableFrame::Init(nsIContent* aContent,
return rv;
}
nsTableFrame::~nsTableFrame()
{
if (nsnull!=mCellMap) {
delete mCellMap;
mCellMap = nsnull;
}
if (nsnull!=mTableLayoutStrategy) {
delete mTableLayoutStrategy;
mTableLayoutStrategy = nsnull;
}
delete mCellMap;
delete mTableLayoutStrategy;
}
void
@ -2041,30 +2029,30 @@ nsTableFrame::GetCollapsedWidth(nsMargin aBorderPadding)
/* virtual */ void
nsTableFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
{
if (!aOldStyleContext) //avoid this on init
return;
if (!aOldStyleContext) //avoid this on init
return;
if (IsBorderCollapse() &&
BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
SetFullBCDamageArea();
}
if (IsBorderCollapse() &&
BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
SetFullBCDamageArea();
}
//avoid this on init or nextinflow
if (!mTableLayoutStrategy || GetPrevInFlow())
return;
//avoid this on init or nextinflow
if (!mTableLayoutStrategy || GetPrevInFlow())
return;
bool isAuto = IsAutoLayout();
if (isAuto != (LayoutStrategy()->GetType() == nsITableLayoutStrategy::Auto)) {
nsITableLayoutStrategy* temp;
if (isAuto)
temp = new BasicTableLayoutStrategy(this);
else
temp = new FixedTableLayoutStrategy(this);
bool isAuto = IsAutoLayout();
if (isAuto != (LayoutStrategy()->GetType() == nsITableLayoutStrategy::Auto)) {
nsITableLayoutStrategy* temp;
if (isAuto)
temp = new BasicTableLayoutStrategy(this);
else
temp = new FixedTableLayoutStrategy(this);
if (temp) {
delete mTableLayoutStrategy;
mTableLayoutStrategy = temp;
}
if (temp) {
delete mTableLayoutStrategy;
mTableLayoutStrategy = temp;
}
}
}
@ -3307,20 +3295,12 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
PRInt32 nsTableFrame::GetColumnWidth(PRInt32 aColIndex)
{
nsTableFrame * firstInFlow = (nsTableFrame *)GetFirstInFlow();
NS_ASSERTION(firstInFlow, "illegal state -- no first in flow");
PRInt32 result = 0;
nsTableFrame* firstInFlow = static_cast<nsTableFrame*>(GetFirstInFlow());
if (this == firstInFlow) {
nsTableColFrame* colFrame = GetColFrame(aColIndex);
if (colFrame) {
result = colFrame->GetFinalWidth();
}
return colFrame ? colFrame->GetFinalWidth() : 0;
}
else {
result = firstInFlow->GetColumnWidth(aColIndex);
}
return result;
return firstInFlow->GetColumnWidth(aColIndex);
}
// XXX: could cache this. But be sure to check style changes if you do!
@ -3372,18 +3352,15 @@ NS_NewTableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
NS_IMPL_FRAMEARENA_HELPERS(nsTableFrame)
nsTableFrame*
nsTableFrame::GetTableFrame(nsIFrame* aSourceFrame)
nsTableFrame::GetTableFrame(nsIFrame* aFrame)
{
if (aSourceFrame) {
// "result" is the result of intermediate calls, not the result we return from this method
for (nsIFrame* parentFrame = aSourceFrame->GetParent(); parentFrame;
parentFrame = parentFrame->GetParent()) {
if (nsGkAtoms::tableFrame == parentFrame->GetType()) {
return (nsTableFrame*)parentFrame;
}
for (nsIFrame* ancestor = aFrame->GetParent(); ancestor;
ancestor = ancestor->GetParent()) {
if (nsGkAtoms::tableFrame == ancestor->GetType()) {
return static_cast<nsTableFrame*>(ancestor);
}
}
NS_NOTREACHED("unable to find table parent");
NS_RUNTIMEABORT("unable to find table parent");
return nsnull;
}
@ -3589,14 +3566,8 @@ void nsTableIterator::Init(nsIFrame* aFirstChild)
}
nsTableFrame* table = nsTableFrame::GetTableFrame(mFirstChild);
if (table) {
mLeftToRight = (NS_STYLE_DIRECTION_LTR ==
table->GetStyleVisibility()->mDirection);
}
else {
NS_NOTREACHED("source of table iterator is not part of a table");
return;
}
mLeftToRight = (NS_STYLE_DIRECTION_LTR ==
table->GetStyleVisibility()->mDirection);
if (!mLeftToRight) {
mCount = 0;
@ -6233,8 +6204,7 @@ BCPaintBorderIterator::SetDamageArea(nsRect aDirtyRect)
if (haveIntersect) {
if (aDirtyRect.YMost() >= (rowY - topBorderHalf)) {
nsTableRowFrame* fifRow =
(nsTableRowFrame*)rowFrame->GetFirstInFlow();
if (!fifRow) ABORT1(false);
static_cast<nsTableRowFrame*>(rowFrame->GetFirstInFlow());
endRowIndex = fifRow->GetRowIndex();
}
else done = true;
@ -6244,8 +6214,7 @@ BCPaintBorderIterator::SetDamageArea(nsRect aDirtyRect)
mStartRg = rgFrame;
mStartRow = rowFrame;
nsTableRowFrame* fifRow =
(nsTableRowFrame*)rowFrame->GetFirstInFlow();
if (!fifRow) ABORT1(false);
static_cast<nsTableRowFrame*>(rowFrame->GetFirstInFlow());
startRowIndex = endRowIndex = fifRow->GetRowIndex();
haveIntersect = true;
}

View File

@ -191,13 +191,11 @@ nsTableRowFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
return;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame->IsBorderCollapse() &&
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
nsRect damageArea(0, GetRowIndex(), tableFrame->GetColCount(), 1);
tableFrame->AddBCDamageArea(damageArea);
}
return;
}
NS_IMETHODIMP
@ -209,7 +207,7 @@ nsTableRowFrame::AppendFrames(ChildListID aListID,
const nsFrameList::Slice& newCells = mFrames.AppendFrames(nsnull, aFrameList);
// Add the new cell frames to the table
nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
for (nsFrameList::Enumerator e(newCells) ; !e.AtEnd(); e.Next()) {
nsIFrame *childFrame = e.get();
NS_ASSERTION(IS_TABLE_CELL(childFrame->GetType()),"Not a table cell frame/pseudo frame construction failure");
@ -237,8 +235,7 @@ nsTableRowFrame::InsertFrames(ChildListID aListID,
// Get the table frame
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
nsIAtom* cellFrameType = (tableFrame->IsBorderCollapse()) ? nsGkAtoms::bcTableCellFrame : nsGkAtoms::tableCellFrame;
nsIAtom* cellFrameType = tableFrame->IsBorderCollapse() ? nsGkAtoms::bcTableCellFrame : nsGkAtoms::tableCellFrame;
nsTableCellFrame* prevCellFrame = (nsTableCellFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, cellFrameType);
nsTArray<nsTableCellFrame*> cellChildren;
for (nsFrameList::Enumerator e(newCells); !e.AtEnd(); e.Next()) {
@ -267,26 +264,24 @@ nsTableRowFrame::RemoveFrame(ChildListID aListID,
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame) {
nsTableCellFrame *cellFrame = do_QueryFrame(aOldFrame);
if (cellFrame) {
PRInt32 colIndex;
cellFrame->GetColIndex(colIndex);
// remove the cell from the cell map
tableFrame->RemoveCell(cellFrame, GetRowIndex());
nsTableCellFrame *cellFrame = do_QueryFrame(aOldFrame);
if (cellFrame) {
PRInt32 colIndex;
cellFrame->GetColIndex(colIndex);
// remove the cell from the cell map
tableFrame->RemoveCell(cellFrame, GetRowIndex());
// Remove the frame and destroy it
mFrames.DestroyFrame(aOldFrame);
// Remove the frame and destroy it
mFrames.DestroyFrame(aOldFrame);
PresContext()->PresShell()->
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
NS_FRAME_HAS_DIRTY_CHILDREN);
tableFrame->SetGeometryDirty();
}
else {
NS_ERROR("unexpected frame type");
return NS_ERROR_INVALID_ARG;
}
PresContext()->PresShell()->
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
NS_FRAME_HAS_DIRTY_CHILDREN);
tableFrame->SetGeometryDirty();
}
else {
NS_ERROR("unexpected frame type");
return NS_ERROR_INVALID_ARG;
}
return NS_OK;
@ -352,9 +347,6 @@ nsTableRowFrame::DidResize()
{
// Resize and re-align the cell frames based on our row height
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
return;
nsTableIterator iter(*this);
nsIFrame* childFrame = iter.First();
@ -521,9 +513,6 @@ nscoord
nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState)
{
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
return 0;
nscoord computedHeight = (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedHeight())
? 0 : aReflowState.ComputedHeight();
ResetHeight(computedHeight);
@ -584,9 +573,9 @@ public:
void
nsDisplayTableRowBackground::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx) {
nsRenderingContext* aCtx)
{
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(mFrame);
TableBackgroundPainter painter(tableFrame,
TableBackgroundPainter::eOrigin_TableRow,
mFrame->PresContext(), *aCtx,
@ -646,9 +635,6 @@ nsTableRowFrame::CalculateCellActualHeight(nsTableCellFrame* aCellFrame,
const nsStylePosition* position = aCellFrame->GetStylePosition();
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
return NS_ERROR_NULL_POINTER;
PRInt32 rowSpan = tableFrame->GetEffectiveRowSpan(*aCellFrame);
switch (position->mHeight.GetUnit()) {
@ -765,8 +751,8 @@ nscoord CalcHeightFromUnpaginatedHeight(nsPresContext* aPresContext,
nsTableRowFrame& aRow)
{
nscoord height = 0;
nsTableRowFrame* firstInFlow = (nsTableRowFrame*)aRow.GetFirstInFlow();
if (!firstInFlow) ABORT1(0);
nsTableRowFrame* firstInFlow =
static_cast<nsTableRowFrame*>(aRow.GetFirstInFlow());
if (firstInFlow->HasUnpaginatedHeight()) {
height = firstInFlow->GetUnpaginatedHeight(aPresContext);
for (nsIFrame* prevInFlow = aRow.GetPrevInFlow(); prevInFlow;
@ -786,13 +772,10 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
{
aStatus = NS_FRAME_COMPLETE;
bool borderCollapse = (((nsTableFrame*)aTableFrame.GetFirstInFlow())->IsBorderCollapse());
// XXXldb Should we be checking constrained height instead?
bool isPaginated = aPresContext->IsPaginated();
const bool isPaginated = aPresContext->IsPaginated();
const bool borderCollapse = aTableFrame.IsBorderCollapse();
nsresult rv = NS_OK;
nscoord cellSpacingX = aTableFrame.GetCellSpacingX();
PRInt32 cellColSpan = 1; // must be defined here so it's set properly for non-cell kids
@ -1032,9 +1015,6 @@ nsTableRowFrame::Reflow(nsPresContext* aPresContext,
nsresult rv = NS_OK;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
return NS_ERROR_NULL_POINTER;
const nsStyleVisibility* rowVis = GetStyleVisibility();
bool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
if (collapseRow) {
@ -1076,16 +1056,13 @@ nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
nscoord aAvailableHeight,
nsReflowStatus& aStatus)
{
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
ABORT1(NS_ERROR_NULL_POINTER);
// Reflow the cell frame with the specified height. Use the existing width
nsRect cellRect = aCellFrame->GetRect();
nsRect cellVisualOverflow = aCellFrame->GetVisualOverflowRect();
nsSize availSize(cellRect.width, aAvailableHeight);
bool borderCollapse = ((nsTableFrame*)tableFrame->GetFirstInFlow())->IsBorderCollapse();
nsSize availSize(cellRect.width, aAvailableHeight);
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
bool borderCollapse = tableFrame->IsBorderCollapse();
nsTableCellReflowState cellReflowState(aPresContext, aReflowState,
aCellFrame, availSize, false);
InitChildReflowState(*aPresContext, availSize, borderCollapse, cellReflowState);
@ -1126,9 +1103,8 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
{
const nsStyleVisibility* rowVis = GetStyleVisibility();
bool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
nsTableFrame* tableFrame = static_cast<nsTableFrame*>(nsTableFrame::GetTableFrame(this)->GetFirstInFlow());
if (!tableFrame)
return 0;
nsTableFrame* tableFrame = static_cast<nsTableFrame*>(
nsTableFrame::GetTableFrame(this)->GetFirstInFlow());
if (collapseRow) {
tableFrame->SetNeedToCollapse(true);
}

View File

@ -96,9 +96,7 @@ PRInt32 nsTableRowGroupFrame::GetStartRowIndex()
// if the row group doesn't have any children, get it the hard way
if (-1 == result) {
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame) {
return tableFrame->GetStartRowIndex(this);
}
return tableFrame->GetStartRowIndex(this);
}
return result;
@ -178,9 +176,9 @@ public:
void
nsDisplayTableRowGroupBackground::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx) {
nsRenderingContext* aCtx)
{
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(mFrame);
TableBackgroundPainter painter(tableFrame,
TableBackgroundPainter::eOrigin_TableRowGroup,
mFrame->PresContext(), *aCtx,
@ -350,13 +348,8 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
*aPageBreakBeforeEnd = false;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
ABORT1(NS_ERROR_NULL_POINTER);
nsresult rv = NS_OK;
bool borderCollapse = tableFrame->IsBorderCollapse();
const bool borderCollapse = tableFrame->IsBorderCollapse();
nscoord cellSpacingY = tableFrame->GetCellSpacingY();
// XXXldb Should we really be checking this rather than available height?
@ -564,9 +557,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState)
{
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame) return;
bool isPaginated = aPresContext->IsPaginated();
const bool isPaginated = aPresContext->IsPaginated();
// all table cells have the same top and bottom margins, namely cellSpacingY
nscoord cellSpacingY = tableFrame->GetCellSpacingY();
@ -844,7 +835,6 @@ nsTableRowGroupFrame::CollapseRowGroupIfNecessary(nscoord aYTotalOffset,
nscoord aWidth)
{
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
const nsStyleVisibility* groupVis = GetStyleVisibility();
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
if (collapseGroup) {
@ -951,8 +941,7 @@ nsTableRowGroupFrame::SplitSpanningCells(nsPresContext& aPresContext,
aFirstTruncatedRow = nsnull;
aDesiredHeight = 0;
bool borderCollapse =
static_cast<nsTableFrame*>(aTable.GetFirstInFlow())->IsBorderCollapse();
const bool borderCollapse = aTable.IsBorderCollapse();
PRInt32 lastRowIndex = aLastRow.GetRowIndex();
bool wasLast = false;
bool haveRowSpan = false;
@ -1086,8 +1075,8 @@ nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext,
nscoord availWidth = aReflowState.availableWidth;
nscoord availHeight = aReflowState.availableHeight;
bool borderCollapse = ((nsTableFrame*)aTableFrame->GetFirstInFlow())->IsBorderCollapse();
nscoord cellSpacingY = aTableFrame->GetCellSpacingY();
const bool borderCollapse = aTableFrame->IsBorderCollapse();
nscoord cellSpacingY = aTableFrame->GetCellSpacingY();
// get the page height
nscoord pageHeight = aPresContext->GetPageSize().height;
@ -1317,9 +1306,6 @@ nsTableRowGroupFrame::Reflow(nsPresContext* aPresContext,
nsresult rv = NS_OK;
aStatus = NS_FRAME_COMPLETE;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame) return NS_ERROR_NULL_POINTER;
// Row geometry may be going to change so we need to invalidate any row cursor.
ClearRowCursor();
@ -1327,6 +1313,7 @@ nsTableRowGroupFrame::Reflow(nsPresContext* aPresContext,
// see if a special height reflow needs to occur due to having a pct height
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
nsRowGroupReflowState state(aReflowState, tableFrame);
const nsStyleVisibility* groupVis = GetStyleVisibility();
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
@ -1389,14 +1376,12 @@ nsTableRowGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
return;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame->IsBorderCollapse() &&
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
nsRect damageArea(0, GetStartRowIndex(), tableFrame->GetColCount(),
GetRowCount());
tableFrame->AddBCDamageArea(damageArea);
}
return;
}
NS_IMETHODIMP
@ -1427,13 +1412,11 @@ nsTableRowGroupFrame::AppendFrames(ChildListID aListID,
if (rows.Length() > 0) {
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame) {
tableFrame->AppendRows(this, rowIndex, rows);
PresContext()->PresShell()->
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
NS_FRAME_HAS_DIRTY_CHILDREN);
tableFrame->SetGeometryDirty();
}
tableFrame->AppendRows(this, rowIndex, rows);
PresContext()->PresShell()->
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
NS_FRAME_HAS_DIRTY_CHILDREN);
tableFrame->SetGeometryDirty();
}
return NS_OK;
@ -1450,12 +1433,9 @@ nsTableRowGroupFrame::InsertFrames(ChildListID aListID,
ClearRowCursor();
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
return NS_ERROR_NULL_POINTER;
// collect the new row frames in an array
// XXXbz why are we doing the QI stuff? There shouldn't be any non-rows here.
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
nsTArray<nsTableRowFrame*> rows;
bool gotFirstRow = false;
for (nsFrameList::Enumerator e(aFrameList); !e.AtEnd(); e.Next()) {
@ -1501,17 +1481,16 @@ nsTableRowGroupFrame::RemoveFrame(ChildListID aListID,
ClearRowCursor();
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame) {
nsTableRowFrame *rowFrame = do_QueryFrame(aOldFrame);
if (rowFrame) {
// remove the rows from the table (and flag a rebalance)
tableFrame->RemoveRows(*rowFrame, 1, true);
// XXX why are we doing the QI stuff? There shouldn't be any non-rows here.
nsTableRowFrame* rowFrame = do_QueryFrame(aOldFrame);
if (rowFrame) {
// remove the rows from the table (and flag a rebalance)
tableFrame->RemoveRows(*rowFrame, 1, true);
PresContext()->PresShell()->
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
NS_FRAME_HAS_DIRTY_CHILDREN);
tableFrame->SetGeometryDirty();
}
PresContext()->PresShell()->
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
NS_FRAME_HAS_DIRTY_CHILDREN);
tableFrame->SetGeometryDirty();
}
mFrames.DestroyFrame(aOldFrame);
@ -1541,21 +1520,19 @@ nsTableRowGroupFrame::GetHeightBasis(const nsHTMLReflowState& aReflowState)
{
nscoord result = 0;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame) {
if ((aReflowState.ComputedHeight() > 0) && (aReflowState.ComputedHeight() < NS_UNCONSTRAINEDSIZE)) {
nscoord cellSpacing = NS_MAX(0, GetRowCount() - 1) * tableFrame->GetCellSpacingY();
result = aReflowState.ComputedHeight() - cellSpacing;
if ((aReflowState.ComputedHeight() > 0) && (aReflowState.ComputedHeight() < NS_UNCONSTRAINEDSIZE)) {
nscoord cellSpacing = NS_MAX(0, GetRowCount() - 1) * tableFrame->GetCellSpacingY();
result = aReflowState.ComputedHeight() - cellSpacing;
}
else {
const nsHTMLReflowState* parentRS = aReflowState.parentReflowState;
if (parentRS && (tableFrame != parentRS->frame)) {
parentRS = parentRS->parentReflowState;
}
else {
const nsHTMLReflowState* parentRS = aReflowState.parentReflowState;
if (parentRS && (tableFrame != parentRS->frame)) {
parentRS = parentRS->parentReflowState;
}
if (parentRS && (tableFrame == parentRS->frame) &&
(parentRS->ComputedHeight() > 0) && (parentRS->ComputedHeight() < NS_UNCONSTRAINEDSIZE)) {
nscoord cellSpacing = NS_MAX(0, tableFrame->GetRowCount() + 1) * tableFrame->GetCellSpacingY();
result = parentRS->ComputedHeight() - cellSpacing;
}
if (parentRS && (tableFrame == parentRS->frame) &&
(parentRS->ComputedHeight() > 0) && (parentRS->ComputedHeight() < NS_UNCONSTRAINEDSIZE)) {
nscoord cellSpacing = NS_MAX(0, tableFrame->GetRowCount() + 1) * tableFrame->GetCellSpacingY();
result = parentRS->ComputedHeight() - cellSpacing;
}
}

View File

@ -956,7 +956,9 @@ abstract public class GeckoApp
mMainHandler.post(new Runnable() {
public void run() {
// Don't show autocomplete popup when using fullscreen VKB
if (!GeckoInputConnection.mIMELandscapeFS)
InputMethodManager imm =
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (!imm.isFullscreenMode())
mAutoCompletePopup.show(suggestions, rect, zoom);
}
});

View File

@ -80,7 +80,7 @@ function test()
<select id="f" style="width: 100px; height: 100px;"><option>a</option><option>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</option><option>a</option>\
<option>a</option><option>a</option><option>a</option><option>a</option><option>a</option><option>a</option><option>a</option>\
<option>a</option><option>a</option><option>a</option><option>a</option><option>a</option><option>a</option><option>a</option></select>\
<div id="g" style="width: 99px; height: 99px; padding: 10px; border: 10px solid black; margin: 10px; overflow: auto;"><div style="width: 100px; height: 100px;"></div></div>\
<div id="g" style="width: 99px; height: 99px; padding: 10px; border: 10px solid black; margin: 10px; overflow: auto;"><div style="width: 100px; height: 100px; margin: 10px;"></div></div>\
<div id="h" style="width: 100px; height: 100px; overflow: -moz-hidden-unscrollable;"><div style="width: 200px; height: 200px;"></div></div>\
<iframe id="iframe" style="display: none;"></iframe>\
</body>';