diff --git a/accessible/src/atk/nsAccessibleWrap.cpp b/accessible/src/atk/nsAccessibleWrap.cpp index 50e5095ce280..7d6d90696e0f 100644 --- a/accessible/src/atk/nsAccessibleWrap.cpp +++ b/accessible/src/atk/nsAccessibleWrap.cpp @@ -38,6 +38,8 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/Util.h" + #include "nsAccessible.h" #include "nsAccessibleWrap.h" @@ -69,6 +71,7 @@ #include "nsMaiInterfaceDocument.h" #include "nsMaiInterfaceImage.h" +using namespace mozilla; using namespace mozilla::a11y; nsAccessibleWrap::EAvailableAtkSignals nsAccessibleWrap::gAvailableAtkSignals = @@ -522,7 +525,7 @@ GetMaiAtkType(PRUint16 interfacesBits) atkTypeName, &tinfo, GTypeFlags(0)); - for (PRUint32 index = 0; index < NS_ARRAY_LENGTH(atk_if_infos); index++) { + for (PRUint32 index = 0; index < ArrayLength(atk_if_infos); index++) { if (interfacesBits & (1 << index)) { g_type_add_interface_static(type, GetAtkTypeForMai((MaiInterfaceType)index), @@ -963,7 +966,7 @@ refRelationSetCB(AtkObject *aAtkObj) nsIAccessibleRelation::RELATION_DESCRIPTION_FOR, }; - for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(relationTypes); i++) { + for (PRUint32 i = 0; i < ArrayLength(relationTypes); i++) { AtkRelationType atkType = static_cast(relationTypes[i]); AtkRelation* atkRelation = atk_relation_set_get_relation_by_type(relation_set, atkType); diff --git a/accessible/src/base/NotificationController.cpp b/accessible/src/base/NotificationController.cpp index e7ce1b9cf483..fdd82653baf0 100644 --- a/accessible/src/base/NotificationController.cpp +++ b/accessible/src/base/NotificationController.cpp @@ -210,8 +210,10 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime) if (!mDocument->HasLoadState(nsDocAccessible::eTreeConstructed)) { // If document is not bound to parent at this point then the document is not // ready yet (process notifications later). - if (!mDocument->IsBoundToParent()) + if (!mDocument->IsBoundToParent()) { + mObservingState = eRefreshObserving; return; + } #ifdef DEBUG_NOTIFICATIONS printf("\ninitial tree created, document: %p, document node: %p\n", diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index 03de99586c0d..206264c66176 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -36,6 +36,8 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/Util.h" + // NOTE: alphabetically ordered #include "nsAccessibilityService.h" #include "nsCoreUtils.h" @@ -111,6 +113,7 @@ #include "mozilla/FunctionTimer.h" #include "mozilla/dom/Element.h" +using namespace mozilla; using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// @@ -654,7 +657,7 @@ nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode, NS_IMETHODIMP nsAccessibilityService::GetStringRole(PRUint32 aRole, nsAString& aString) { - if ( aRole >= NS_ARRAY_LENGTH(kRoleNames)) { + if ( aRole >= ArrayLength(kRoleNames)) { aString.AssignLiteral("unknown"); return NS_OK; } @@ -785,10 +788,10 @@ NS_IMETHODIMP nsAccessibilityService::GetStringEventType(PRUint32 aEventType, nsAString& aString) { - NS_ASSERTION(nsIAccessibleEvent::EVENT_LAST_ENTRY == NS_ARRAY_LENGTH(kEventTypeNames), + NS_ASSERTION(nsIAccessibleEvent::EVENT_LAST_ENTRY == ArrayLength(kEventTypeNames), "nsIAccessibleEvent constants are out of sync to kEventTypeNames"); - if (aEventType >= NS_ARRAY_LENGTH(kEventTypeNames)) { + if (aEventType >= ArrayLength(kEventTypeNames)) { aString.AssignLiteral("unknown"); return NS_OK; } @@ -802,7 +805,7 @@ NS_IMETHODIMP nsAccessibilityService::GetStringRelationType(PRUint32 aRelationType, nsAString& aString) { - if (aRelationType >= NS_ARRAY_LENGTH(kRelationTypeNames)) { + if (aRelationType >= ArrayLength(kRelationTypeNames)) { aString.AssignLiteral("unknown"); return NS_OK; } diff --git a/accessible/src/base/nsCaretAccessible.cpp b/accessible/src/base/nsCaretAccessible.cpp index fad26368fbc7..91ff97d6369f 100644 --- a/accessible/src/base/nsCaretAccessible.cpp +++ b/accessible/src/base/nsCaretAccessible.cpp @@ -226,6 +226,10 @@ nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument* aDOMDocument, printf("\nSelection changed, selection type: %s, notification %s\n", (isNormalSelection ? "normal" : "spellcheck"), (isIgnored ? "ignored" : "pending")); + } else { + bool isIgnored = !document || !document->IsContentLoaded(); + printf("\nSelection changed, selection type: unknown, notification %s\n", + (isIgnored ? "ignored" : "pending")); } #endif diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index ed5ddf787e34..3a5ae64947bc 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -77,7 +77,7 @@ #include "nsIXULDocument.h" #endif -namespace dom = mozilla::dom; +using namespace mozilla; using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp index 36dc3ff2f96b..8aac6f03d767 100644 --- a/accessible/src/base/nsRootAccessible.cpp +++ b/accessible/src/base/nsRootAccessible.cpp @@ -35,6 +35,8 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/Util.h" + #define CreateEvent CreateEventA #include "nsIDOMDocument.h" @@ -83,7 +85,7 @@ #include "nsIXULWindow.h" #endif -namespace dom = mozilla::dom; +using namespace mozilla; using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// @@ -255,7 +257,7 @@ nsresult nsRootAccessible::AddEventListeners() if (nstarget) { for (const char* const* e = docEvents, - * const* e_end = docEvents + NS_ARRAY_LENGTH(docEvents); + * const* e_end = ArrayEnd(docEvents); e < e_end; ++e) { nsresult rv = nstarget->AddEventListener(NS_ConvertASCIItoUTF16(*e), this, PR_TRUE, PR_TRUE, 2); @@ -275,7 +277,7 @@ nsresult nsRootAccessible::RemoveEventListeners() nsCOMPtr target(do_QueryInterface(mDocument)); if (target) { for (const char* const* e = docEvents, - * const* e_end = docEvents + NS_ARRAY_LENGTH(docEvents); + * const* e_end = ArrayEnd(docEvents); e < e_end; ++e) { nsresult rv = target->RemoveEventListener(NS_ConvertASCIItoUTF16(*e), this, PR_TRUE); NS_ENSURE_SUCCESS(rv, rv); diff --git a/accessible/src/html/nsHyperTextAccessible.cpp b/accessible/src/html/nsHyperTextAccessible.cpp index 1881230a7ab6..54a1a7bc2097 100644 --- a/accessible/src/html/nsHyperTextAccessible.cpp +++ b/accessible/src/html/nsHyperTextAccessible.cpp @@ -46,6 +46,7 @@ #include "nsIClipboard.h" #include "nsContentCID.h" +#include "nsFocusManager.h" #include "nsIDOMCharacterData.h" #include "nsIDOMDocument.h" #include "nsIDOMRange.h" @@ -908,17 +909,9 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe // or the start of a new line. Getting text at the line should provide the line with the visual caret, // otherwise screen readers will announce the wrong line as the user presses up or down arrow and land // at the end of a line. - nsCOMPtr domSel; - nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL, - nsnull, getter_AddRefs(domSel)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr privateSelection(do_QueryInterface(domSel)); - nsRefPtr frameSelection; - rv = privateSelection->GetFrameSelection(getter_AddRefs(frameSelection)); - NS_ENSURE_SUCCESS(rv, rv); - - if (frameSelection->GetHint() == nsFrameSelection::HINTLEFT) { + nsRefPtr frameSelection = FrameSelection(); + if (frameSelection && + frameSelection->GetHint() == nsFrameSelection::HINTLEFT) { -- aOffset; // We are at the start of a line } } @@ -1587,26 +1580,33 @@ nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos) // If range 0 was successfully set, clear any additional selection // ranges remaining from previous selection - nsCOMPtr domSel; - nsCOMPtr selCon; - GetSelections(nsISelectionController::SELECTION_NORMAL, - getter_AddRefs(selCon), getter_AddRefs(domSel)); - if (domSel) { - PRInt32 numRanges; - domSel->GetRangeCount(&numRanges); + nsRefPtr frameSelection = FrameSelection(); + NS_ENSURE_STATE(frameSelection); - for (PRInt32 count = 0; count < numRanges - 1; count ++) { - nsCOMPtr range; - domSel->GetRangeAt(1, getter_AddRefs(range)); - domSel->RemoveRange(range); - } + nsCOMPtr domSel = + frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL); + NS_ENSURE_STATE(domSel); + + PRInt32 numRanges = 0; + domSel->GetRangeCount(&numRanges); + + for (PRInt32 count = 0; count < numRanges - 1; count ++) { + nsCOMPtr range; + domSel->GetRangeAt(1, getter_AddRefs(range)); + domSel->RemoveRange(range); } - - if (selCon) { - // XXX I'm not sure this can do synchronous scrolling. If the last param is - // set to true, this calling might flush the pending reflow. See bug 418470. - selCon->ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL, - nsISelectionController::SELECTION_FOCUS_REGION, 0); + + // Now that selection is done, move the focus to the selection. + nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager(); + if (DOMFocusManager) { + nsCOMPtr shell = GetPresShell(); + NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); + nsCOMPtr doc = shell->GetDocument(); + NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); + nsCOMPtr window = doc->GetWindow(); + nsCOMPtr result; + DOMFocusManager->MoveFocus(window, nsnull, nsIFocusManager::MOVEFOCUS_CARET, + nsIFocusManager::FLAG_BYMOVEFOCUS, getter_AddRefs(result)); } return NS_OK; @@ -1635,13 +1635,15 @@ nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset) // Turn the focus node and offset of the selection into caret hypretext // offset. - nsCOMPtr domSel; - nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL, - nsnull, getter_AddRefs(domSel)); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr frameSelection = FrameSelection(); + NS_ENSURE_STATE(frameSelection); + + nsISelection* domSel = + frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL); + NS_ENSURE_STATE(domSel); nsCOMPtr focusDOMNode; - rv = domSel->GetFocusNode(getter_AddRefs(focusDOMNode)); + nsresult rv = domSel->GetFocusNode(getter_AddRefs(focusDOMNode)); NS_ENSURE_SUCCESS(rv, rv); PRInt32 focusOffset; @@ -1665,18 +1667,19 @@ nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset) return NS_OK; } -PRInt32 nsHyperTextAccessible::GetCaretLineNumber() +PRInt32 +nsHyperTextAccessible::GetCaretLineNumber() { // Provide the line number for the caret, relative to the // currently focused node. Use a 1-based index - nsCOMPtr domSel; - GetSelections(nsISelectionController::SELECTION_NORMAL, nsnull, - getter_AddRefs(domSel)); - nsCOMPtr privateSelection(do_QueryInterface(domSel)); - NS_ENSURE_TRUE(privateSelection, -1); - nsRefPtr frameSelection; - privateSelection->GetFrameSelection(getter_AddRefs(frameSelection)); - NS_ENSURE_TRUE(frameSelection, -1); + nsRefPtr frameSelection = FrameSelection(); + if (!frameSelection) + return -1; + + nsISelection* domSel = + frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL); + if (!domSel) + return - 1; nsCOMPtr caretNode; domSel->GetFocusNode(getter_AddRefs(caretNode)); @@ -1731,104 +1734,70 @@ PRInt32 nsHyperTextAccessible::GetCaretLineNumber() return lineNumber; } -nsresult -nsHyperTextAccessible::GetSelections(PRInt16 aType, - nsISelectionController **aSelCon, - nsISelection **aDomSel, - nsCOMArray* aRanges) +already_AddRefed +nsHyperTextAccessible::FrameSelection() { - if (IsDefunct()) - return NS_ERROR_FAILURE; + nsIFrame* frame = GetFrame(); + return frame->GetFrameSelection(); +} - if (aSelCon) { - *aSelCon = nsnull; - } - if (aDomSel) { - *aDomSel = nsnull; - } - if (aRanges) { - aRanges->Clear(); - } - - nsCOMPtr domSel; - nsCOMPtr selCon; +void +nsHyperTextAccessible::GetSelectionDOMRanges(PRInt16 aType, + nsCOMArray* aRanges) +{ + nsRefPtr frameSelection = FrameSelection(); + if (!frameSelection) + return; + + nsISelection* domSel = frameSelection->GetSelection(aType); + if (!domSel) + return; + + nsCOMPtr startNode = GetNode(); nsCOMPtr editor; GetAssociatedEditor(getter_AddRefs(editor)); - nsCOMPtr peditor(do_QueryInterface(editor)); - if (peditor) { - // Case 1: plain text editor - // This is for form controls which have their own - // selection controller separate from the document, for example - // HTML:input, HTML:textarea, XUL:textbox, etc. - editor->GetSelectionController(getter_AddRefs(selCon)); - } - else { - // Case 2: rich content subtree (can be rich editor) - // This uses the selection controller from the entire document - nsIFrame *frame = GetFrame(); - NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); - - // Get the selection and selection controller - frame->GetSelectionController(GetPresContext(), - getter_AddRefs(selCon)); - } - NS_ENSURE_TRUE(selCon, NS_ERROR_FAILURE); - - selCon->GetSelection(aType, getter_AddRefs(domSel)); - NS_ENSURE_TRUE(domSel, NS_ERROR_FAILURE); - - if (aSelCon) { - NS_ADDREF(*aSelCon = selCon); - } - if (aDomSel) { - NS_ADDREF(*aDomSel = domSel); + if (editor) { + nsCOMPtr editorRoot; + editor->GetRootElement(getter_AddRefs(editorRoot)); + startNode = do_QueryInterface(editorRoot); } - if (aRanges) { - nsCOMPtr privSel(do_QueryInterface(domSel)); + if (!startNode) + return; - nsCOMPtr startNode = GetNode(); - if (peditor) { - nsCOMPtr editorRoot; - editor->GetRootElement(getter_AddRefs(editorRoot)); - startNode = do_QueryInterface(editorRoot); - } - NS_ENSURE_STATE(startNode); + PRUint32 childCount = startNode->GetChildCount(); + nsCOMPtr startDOMNode(do_QueryInterface(startNode)); + nsCOMPtr privSel(do_QueryInterface(domSel)); + nsresult rv = privSel-> + GetRangesForIntervalCOMArray(startDOMNode, 0, startDOMNode, childCount, + true, aRanges); + NS_ENSURE_SUCCESS(rv,); - PRUint32 childCount = startNode->GetChildCount(); - nsCOMPtr startDOMNode(do_QueryInterface(startNode)); - nsresult rv = privSel-> - GetRangesForIntervalCOMArray(startDOMNode, 0, startDOMNode, childCount, - PR_TRUE, aRanges); - NS_ENSURE_SUCCESS(rv, rv); - // Remove collapsed ranges - PRInt32 numRanges = aRanges->Count(); - for (PRInt32 count = 0; count < numRanges; count ++) { - bool isCollapsed; - (*aRanges)[count]->GetCollapsed(&isCollapsed); - if (isCollapsed) { - aRanges->RemoveObjectAt(count); - -- numRanges; - -- count; - } + // Remove collapsed ranges + PRInt32 numRanges = aRanges->Count(); + for (PRInt32 count = 0; count < numRanges; count ++) { + bool isCollapsed = false; + (*aRanges)[count]->GetCollapsed(&isCollapsed); + if (isCollapsed) { + aRanges->RemoveObjectAt(count); + --numRanges; + --count; } } - - return NS_OK; } /* * Gets the number of selected regions. */ -NS_IMETHODIMP nsHyperTextAccessible::GetSelectionCount(PRInt32 *aSelectionCount) +NS_IMETHODIMP +nsHyperTextAccessible::GetSelectionCount(PRInt32* aSelectionCount) { - nsCOMPtr domSel; - nsCOMArray ranges; - nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL, - nsnull, nsnull, &ranges); - NS_ENSURE_SUCCESS(rv, rv); + NS_ENSURE_ARG_POINTER(aSelectionCount); + *aSelectionCount = 0; + nsCOMArray ranges; + GetSelectionDOMRanges(nsISelectionController::SELECTION_NORMAL, &ranges); *aSelectionCount = ranges.Count(); return NS_OK; @@ -1837,15 +1806,17 @@ NS_IMETHODIMP nsHyperTextAccessible::GetSelectionCount(PRInt32 *aSelectionCount) /* * Gets the start and end offset of the specified selection. */ -NS_IMETHODIMP nsHyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum, PRInt32 *aStartOffset, PRInt32 *aEndOffset) +NS_IMETHODIMP +nsHyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum, + PRInt32* aStartOffset, + PRInt32* aEndOffset) { + NS_ENSURE_ARG_POINTER(aStartOffset); + NS_ENSURE_ARG_POINTER(aEndOffset); *aStartOffset = *aEndOffset = 0; - nsCOMPtr domSel; nsCOMArray ranges; - nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL, - nsnull, getter_AddRefs(domSel), &ranges); - NS_ENSURE_SUCCESS(rv, rv); + GetSelectionDOMRanges(nsISelectionController::SELECTION_NORMAL, &ranges); PRInt32 rangeCount = ranges.Count(); if (aSelectionNum < 0 || aSelectionNum >= rangeCount) @@ -1857,18 +1828,19 @@ NS_IMETHODIMP nsHyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum, P nsCOMPtr startDOMNode; range->GetStartContainer(getter_AddRefs(startDOMNode)); nsCOMPtr startNode(do_QueryInterface(startDOMNode)); - PRInt32 startOffset; + PRInt32 startOffset = 0; range->GetStartOffset(&startOffset); // Get end point nsCOMPtr endDOMNode; range->GetEndContainer(getter_AddRefs(endDOMNode)); nsCOMPtr endNode(do_QueryInterface(endDOMNode)); - PRInt32 endOffset; + PRInt32 endOffset = 0; range->GetEndOffset(&endOffset); - PRInt16 rangeCompareResult; - rv = range->CompareBoundaryPoints(nsIDOMRange::START_TO_END, range, &rangeCompareResult); + PRInt16 rangeCompareResult = 0; + nsresult rv = range->CompareBoundaryPoints(nsIDOMRange::START_TO_END, range, + &rangeCompareResult); NS_ENSURE_SUCCESS(rv, rv); if (rangeCompareResult < 0) { @@ -1898,15 +1870,17 @@ nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum, PRInt32 aStartOffset, PRInt32 aEndOffset) { - nsCOMPtr domSel; - nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL, - nsnull, getter_AddRefs(domSel)); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr frameSelection = FrameSelection(); + NS_ENSURE_STATE(frameSelection); + + nsCOMPtr domSel = + frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL); + NS_ENSURE_STATE(domSel); // Caret is a collapsed selection bool isOnlyCaret = (aStartOffset == aEndOffset); - PRInt32 rangeCount; + PRInt32 rangeCount = 0; domSel->GetRangeCount(&rangeCount); nsCOMPtr range; if (aSelectionNum == rangeCount) { // Add a range @@ -1921,12 +1895,12 @@ nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum, NS_ENSURE_TRUE(range, NS_ERROR_FAILURE); } - PRInt32 startOffset, endOffset; + PRInt32 startOffset = 0, endOffset = 0; nsCOMPtr startNode, endNode; - rv = HypertextOffsetsToDOMRange(aStartOffset, aEndOffset, - getter_AddRefs(startNode), &startOffset, - getter_AddRefs(endNode), &endOffset); + nsresult rv = HypertextOffsetsToDOMRange(aStartOffset, aEndOffset, + getter_AddRefs(startNode), &startOffset, + getter_AddRefs(endNode), &endOffset); NS_ENSURE_SUCCESS(rv, rv); rv = range->SetStart(startNode, startOffset); @@ -1936,23 +1910,30 @@ nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum, range->SetEnd(endNode, endOffset); NS_ENSURE_SUCCESS(rv, rv); - if (aSelectionNum == rangeCount) { // Add successfully created new range + // If new range was created then add it, otherwise notify selection listeners + // that existing selection range was changed. + if (aSelectionNum == rangeCount) return domSel->AddRange(range); - } + + domSel->RemoveRange(range); + domSel->AddRange(range); return NS_OK; } /* * Adds a selection bounded by the specified offsets. */ -NS_IMETHODIMP nsHyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset) +NS_IMETHODIMP +nsHyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset) { - nsCOMPtr domSel; - nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL, - nsnull, getter_AddRefs(domSel)); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr frameSelection = FrameSelection(); + NS_ENSURE_STATE(frameSelection); - PRInt32 rangeCount; + nsCOMPtr domSel = + frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL); + NS_ENSURE_STATE(domSel); + + PRInt32 rangeCount = 0; domSel->GetRangeCount(&rangeCount); return SetSelectionBounds(rangeCount, aStartOffset, aEndOffset); @@ -1961,12 +1942,15 @@ NS_IMETHODIMP nsHyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32 /* * Removes the specified selection. */ -NS_IMETHODIMP nsHyperTextAccessible::RemoveSelection(PRInt32 aSelectionNum) +NS_IMETHODIMP +nsHyperTextAccessible::RemoveSelection(PRInt32 aSelectionNum) { - nsCOMPtr domSel; - nsresult rv = GetSelections(nsISelectionController::SELECTION_NORMAL, - nsnull, getter_AddRefs(domSel)); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr frameSelection = FrameSelection(); + NS_ENSURE_STATE(frameSelection); + + nsCOMPtr domSel = + frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL); + NS_ENSURE_STATE(domSel); PRInt32 rangeCount; domSel->GetRangeCount(&rangeCount); @@ -2348,9 +2332,7 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode, nsIPersistentProperties *aAttributes) { nsCOMArray ranges; - nsresult rv = GetSelections(nsISelectionController::SELECTION_SPELLCHECK, - nsnull, nsnull, &ranges); - NS_ENSURE_SUCCESS(rv, rv); + GetSelectionDOMRanges(nsISelectionController::SELECTION_SPELLCHECK, &ranges); PRInt32 rangeCount = ranges.Count(); if (!rangeCount) @@ -2362,7 +2344,7 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode, NS_ENSURE_STATE(nsrange); PRInt16 result; - rv = nsrange->ComparePoint(aNode, aNodeOffset, &result); + nsresult rv = nsrange->ComparePoint(aNode, aNodeOffset, &result); NS_ENSURE_SUCCESS(rv, rv); // ComparePoint checks boundary points, but we need to check that // text at aNodeOffset is inside the range. @@ -2381,8 +2363,8 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode, if (result == 1) { // range is before point PRInt32 startHTOffset = 0; - rv = DOMRangeBoundToHypertextOffset(range, PR_FALSE, PR_TRUE, - &startHTOffset); + nsresult rv = DOMRangeBoundToHypertextOffset(range, PR_FALSE, PR_TRUE, + &startHTOffset); NS_ENSURE_SUCCESS(rv, rv); if (startHTOffset > *aHTStartOffset) @@ -2390,8 +2372,8 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode, } else if (result == -1) { // range is after point PRInt32 endHTOffset = 0; - rv = DOMRangeBoundToHypertextOffset(range, PR_TRUE, PR_FALSE, - &endHTOffset); + nsresult rv = DOMRangeBoundToHypertextOffset(range, PR_TRUE, PR_FALSE, + &endHTOffset); NS_ENSURE_SUCCESS(rv, rv); if (endHTOffset < *aHTEndOffset) @@ -2399,8 +2381,8 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode, } else { // point is in range PRInt32 startHTOffset = 0; - rv = DOMRangeBoundToHypertextOffset(range, PR_TRUE, PR_TRUE, - &startHTOffset); + nsresult rv = DOMRangeBoundToHypertextOffset(range, PR_TRUE, PR_TRUE, + &startHTOffset); NS_ENSURE_SUCCESS(rv, rv); PRInt32 endHTOffset = 0; diff --git a/accessible/src/html/nsHyperTextAccessible.h b/accessible/src/html/nsHyperTextAccessible.h index 5b396b00407b..45ad50e890d2 100644 --- a/accessible/src/html/nsHyperTextAccessible.h +++ b/accessible/src/html/nsHyperTextAccessible.h @@ -351,22 +351,15 @@ protected: // Selection helpers - /** - * Get the relevant selection interfaces and ranges for the current hyper - * text. - * - * @param aType [in] the selection type - * @param aSelCon [out, optional] the selection controller for the current - * hyper text - * @param aDomSel [out, optional] the selection interface for the current - * hyper text - * @param aRanges [out, optional] the selected ranges within the current - * subtree + /** + * Return frame selection object for the accessible. */ - nsresult GetSelections(PRInt16 aType, - nsISelectionController **aSelCon, - nsISelection **aDomSel = nsnull, - nsCOMArray* aRanges = nsnull); + virtual already_AddRefed FrameSelection(); + + /** + * Return selection ranges within the accessible subtree. + */ + void GetSelectionDOMRanges(PRInt16 aType, nsCOMArray* aRanges); nsresult SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos); diff --git a/accessible/src/xul/nsXULFormControlAccessible.cpp b/accessible/src/xul/nsXULFormControlAccessible.cpp index 28a041962160..ce460adf0fe2 100644 --- a/accessible/src/xul/nsXULFormControlAccessible.cpp +++ b/accessible/src/xul/nsXULFormControlAccessible.cpp @@ -882,6 +882,17 @@ nsXULTextFieldAccessible::CacheChildren() while ((child = walker.NextChild()) && AppendChild(child)); } +//////////////////////////////////////////////////////////////////////////////// +// nsXULTextFieldAccessible: nsHyperTextAccessible protected + +already_AddRefed +nsXULTextFieldAccessible::FrameSelection() +{ + nsCOMPtr inputContent(GetInputField()); + nsIFrame* frame = inputContent->GetPrimaryFrame(); + return frame->GetFrameSelection(); +} + //////////////////////////////////////////////////////////////////////////////// // nsXULTextFieldAccessible protected diff --git a/accessible/src/xul/nsXULFormControlAccessible.h b/accessible/src/xul/nsXULFormControlAccessible.h index 49ac22c6b11a..726a78993abb 100644 --- a/accessible/src/xul/nsXULFormControlAccessible.h +++ b/accessible/src/xul/nsXULFormControlAccessible.h @@ -276,6 +276,9 @@ protected: // nsAccessible virtual void CacheChildren(); + // nsHyperTextAccessible + virtual already_AddRefed FrameSelection(); + // nsXULTextFieldAccessible already_AddRefed GetInputField() const; }; diff --git a/accessible/src/xul/nsXULTreeAccessible.cpp b/accessible/src/xul/nsXULTreeAccessible.cpp index c2baa601a011..92512166543e 100644 --- a/accessible/src/xul/nsXULTreeAccessible.cpp +++ b/accessible/src/xul/nsXULTreeAccessible.cpp @@ -883,12 +883,7 @@ nsXULTreeItemAccessibleBase::DoAction(PRUint8 aIndex) bool nsXULTreeItemAccessibleBase::IsDefunct() const { - if (nsAccessibleWrap::IsDefunct() || !mTree || !mTreeView || mRow < 0) - return PR_TRUE; - - PRInt32 rowCount = 0; - nsresult rv = mTreeView->GetRowCount(&rowCount); - return NS_FAILED(rv) || mRow >= rowCount; + return nsAccessibleWrap::IsDefunct() || !mTree || !mTreeView || mRow < 0; } void diff --git a/accessible/tests/mochitest/Makefile.in b/accessible/tests/mochitest/Makefile.in index ac5954b8533c..b019906c397b 100644 --- a/accessible/tests/mochitest/Makefile.in +++ b/accessible/tests/mochitest/Makefile.in @@ -56,6 +56,7 @@ DIRS = \ states \ table \ text \ + textselection \ tree \ treeupdate \ value \ diff --git a/accessible/tests/mochitest/events.js b/accessible/tests/mochitest/events.js index 00fc7653c99f..789ebba89681 100644 --- a/accessible/tests/mochitest/events.js +++ b/accessible/tests/mochitest/events.js @@ -23,6 +23,7 @@ const EVENT_TEXT_ATTRIBUTE_CHANGED = nsIAccessibleEvent.EVENT_TEXT_ATTRIBUTE_CHA const EVENT_TEXT_CARET_MOVED = nsIAccessibleEvent.EVENT_TEXT_CARET_MOVED; const EVENT_TEXT_INSERTED = nsIAccessibleEvent.EVENT_TEXT_INSERTED; const EVENT_TEXT_REMOVED = nsIAccessibleEvent.EVENT_TEXT_REMOVED; +const EVENT_TEXT_SELECTION_CHANGED = nsIAccessibleEvent.EVENT_TEXT_SELECTION_CHANGED; const EVENT_VALUE_CHANGE = nsIAccessibleEvent.EVENT_VALUE_CHANGE; //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/tests/mochitest/test_text_caret.html b/accessible/tests/mochitest/test_text_caret.html index 3cf49b408838..a6e4d32f4e41 100644 --- a/accessible/tests/mochitest/test_text_caret.html +++ b/accessible/tests/mochitest/test_text_caret.html @@ -34,9 +34,11 @@ /** * Invokers. */ - function setCaretOffsetInvoker(aID, aOffset) + function setCaretOffsetInvoker(aID, aOffset, aFocusableContainerID) { this.target = getAccessible(aID, [nsIAccessibleText]); + this.focus = aFocusableContainerID ? + getAccessible(aFocusableContainerID) : this.target; this.invoke = function setCaretOffsetInvoker_invoke() { @@ -45,29 +47,47 @@ this.getID = function setCaretOffsetInvoker_getID() { - return "nsIAccessibleText::caretOffset test"; + return "Set caretOffset on " + prettyName(aID) + " at " + aOffset; } this.eventSeq = [ - new invokerChecker(EVENT_FOCUS, this.target), - new caretMovedChecker(this.target, aOffset) + new caretMovedChecker(this.target, aOffset), + new asyncInvokerChecker(EVENT_FOCUS, this.focus) ]; } + /** + * Turn on/off the caret browsing mode. + */ + function turnCaretBrowsing(aIsOn) + { + var prefs = Components.classes["@mozilla.org/preferences-service;1"]. + getService(Components.interfaces.nsIPrefBranch); + prefs.setBoolPref("accessibility.browsewithcaret", aIsOn); + } + /** * Do tests. */ var gQueue = null; - // gA11yEventDumpID = "eventdump"; // debug stuff + //gA11yEventDumpID = "eventdump"; // debug stuff + //gA11yEventDumpToConsole = true; function doTests() { + turnCaretBrowsing(true); + // test caret move events and caret offsets gQueue = new eventQueue(); gQueue.push(new setCaretOffsetInvoker("textbox", 1)); gQueue.push(new setCaretOffsetInvoker("link", 1)); + gQueue.push(new setCaretOffsetInvoker("heading", 1, document)); + gQueue.onFinish = function() + { + turnCaretBrowsing(false); + } gQueue.invoke(); // Will call SimpleTest.finish(); } @@ -84,6 +104,11 @@ title="HyperText accessible should get focus when the caret is positioned inside of it, text is changed or copied into clipboard by ATs"> Mozilla Bug 524115 + + Mozilla Bug 546068 +

@@ -91,6 +116,7 @@
 
   
   about mozilla
+  
heading
diff --git a/accessible/tests/mochitest/textselection/Makefile.in b/accessible/tests/mochitest/textselection/Makefile.in new file mode 100644 index 000000000000..d4a8eacef243 --- /dev/null +++ b/accessible/tests/mochitest/textselection/Makefile.in @@ -0,0 +1,53 @@ +# +# ***** 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) 2011 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Alexander Surkov (original author) +# +# 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 ***** + +DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ +relativesrcdir = accessible/textselection + +include $(DEPTH)/config/autoconf.mk +include $(topsrcdir)/config/rules.mk + +_TEST_FILES = \ + test_general.html \ + $(NULL) + +libs:: $(_TEST_FILES) + $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir) diff --git a/accessible/tests/mochitest/textselection/test_general.html b/accessible/tests/mochitest/textselection/test_general.html new file mode 100644 index 000000000000..2cb1fb60676d --- /dev/null +++ b/accessible/tests/mochitest/textselection/test_general.html @@ -0,0 +1,170 @@ + + + + Text selection testing + + + + + + + + + + + + + + + Mozilla Bug 688126 + +

+ +
+  
+ +

hello

+ + + + + diff --git a/browser/app/blocklist.xml b/browser/app/blocklist.xml index 3fc9aec9ec6b..3080eac6b9df 100644 --- a/browser/app/blocklist.xml +++ b/browser/app/blocklist.xml @@ -1,5 +1,5 @@ - + @@ -9,6 +9,8 @@ + + @@ -86,6 +88,8 @@ + + diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index dedddead898b..1bf374a6b7ec 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1010,6 +1010,9 @@ pref("devtools.scratchpad.enabled", true); // Enable tools for Chrome development. pref("devtools.chrome.enabled", false); +// Disable the GCLI enhanced command line. +pref("devtools.gcli.enable", false); + // The last Web Console height. This is initially 0 which means that the Web // Console will use the default height next time it shows. // Change to -1 if you do not want the Web Console to remember its last height. diff --git a/browser/base/content/tabview/items.js b/browser/base/content/tabview/items.js index 156ab3e8d735..17cb279fc38b 100644 --- a/browser/base/content/tabview/items.js +++ b/browser/base/content/tabview/items.js @@ -867,7 +867,7 @@ let Items = { getTopLevelItems: function Items_getTopLevelItems() { var items = []; - iQ('.tab, .groupItem, .info-item').each(function(elem) { + iQ('.tab, .groupItem').each(function(elem) { var $this = iQ(elem); var item = $this.data('item'); if (item && !item.parent && !$this.hasClass('phantom')) diff --git a/browser/base/content/tabview/tabview.css b/browser/base/content/tabview/tabview.css index 77480287ab8a..f61b6c9c124d 100644 --- a/browser/base/content/tabview/tabview.css +++ b/browser/base/content/tabview/tabview.css @@ -132,10 +132,6 @@ input.name:focus { position: absolute; } -.info-item { - position: absolute; -} - /* Trenches ----------------------------------*/ diff --git a/browser/base/content/test/test_contextmenu.html b/browser/base/content/test/test_contextmenu.html index dfda96b0806a..23f986f427b4 100644 --- a/browser/base/content/test/test_contextmenu.html +++ b/browser/base/content/test/test_contextmenu.html @@ -23,16 +23,33 @@ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); const Cc = Components.classes; const Ci = Components.interfaces; -function openContextMenuFor(element, shiftkey) { +function openContextMenuFor(element, shiftkey, shouldWaitForFocus) { // Context menu should be closed before we open it again. is(contextMenu.state, "closed", "checking if popup is closed"); - if (lastElement) - lastElement.blur(); - element.focus(); - lastElement = element; - var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey }; - synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView); + //Some elements need time to focus and spellcheck before any tests are + //run on them. + if(shouldWaitForFocus) + { + if (lastElement) + lastElement.blur(); + element.focus(); + + SimpleTest.executeSoon(function() { + lastElement = element; + var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey }; + synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView); + }); + } + else + { + if (lastElement) + lastElement.blur(); + element.focus(); + lastElement = element; + var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey }; + synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView); + } } function closeContextMenu() { @@ -421,7 +438,7 @@ function runTest(testNum) { "---", null, "context-inspect", true]); closeContextMenu(); - openContextMenuFor(textarea); // Invoke context menu for next test. + openContextMenuFor(textarea, false, true); // Invoke context menu for next test, but wait for the spellcheck. break; case 12: diff --git a/browser/branding/official/pref/firefox-branding.js b/browser/branding/official/pref/firefox-branding.js index 194ccc337e87..63c5a31d313f 100644 --- a/browser/branding/official/pref/firefox-branding.js +++ b/browser/branding/official/pref/firefox-branding.js @@ -1,5 +1,4 @@ -// Fight update fatigue by suppressing whatsnew tab opening after update (bug 685727) -pref("startup.homepage_override_url",""); +pref("startup.homepage_override_url","http://www.mozilla.com/%LOCALE%/%APP%/%VERSION%/whatsnew/"); 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 diff --git a/browser/components/migration/src/nsIEProfileMigrator.cpp b/browser/components/migration/src/nsIEProfileMigrator.cpp index e21a749f8645..d7531b7a7056 100644 --- a/browser/components/migration/src/nsIEProfileMigrator.cpp +++ b/browser/components/migration/src/nsIEProfileMigrator.cpp @@ -39,6 +39,8 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/Util.h" + #include #include #include @@ -109,6 +111,8 @@ #define REGISTRY_IE_SEARCHURL_KEY \ NS_LITERAL_STRING("Software\\Microsoft\\Internet Explorer\\SearchUrl") +using namespace mozilla; + const int sInitialCookieBufferSize = 1024; // but it can grow const int sUsernameLengthLimit = 80; const int sHostnameLengthLimit = 255; @@ -1673,7 +1677,7 @@ nsIEProfileMigrator::CopyPreferences(bool aReplace) { bool regKeyOpen = false; const regEntry *entry, - *endEntry = gRegEntries + NS_ARRAY_LENGTH(gRegEntries); + *endEntry = ArrayEnd(gRegEntries); nsCOMPtr prefs; @@ -2168,7 +2172,7 @@ nsIEProfileMigrator::CopyProxyPreferences(nsIPrefBranch* aPrefs) PRInt32 startIndex = 0, count = 0; bool foundSpecificProxy = false; - for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(data); ++i) { + for (PRUint32 i = 0; i < ArrayLength(data); ++i) { PRInt32 offset = buf.Find(NS_ConvertASCIItoUTF16(data[i].prefix)); if (offset >= 0) { foundSpecificProxy = PR_TRUE; @@ -2191,7 +2195,7 @@ nsIEProfileMigrator::CopyProxyPreferences(nsIPrefBranch* aPrefs) // No proxy config for any specific type was found, assume // the ProxyServer value is of the form host:port and that // it applies to all protocols. - for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(data); ++i) + for (PRUint32 i = 0; i < ArrayLength(data); ++i) SetProxyPref(buf, data[i].hostPref, data[i].portPref, aPrefs); aPrefs->SetBoolPref("network.proxy.share_proxy_settings", PR_TRUE); } diff --git a/browser/components/migration/src/nsOperaProfileMigrator.cpp b/browser/components/migration/src/nsOperaProfileMigrator.cpp index 16c19da84bde..63ee583ec1f4 100644 --- a/browser/components/migration/src/nsOperaProfileMigrator.cpp +++ b/browser/components/migration/src/nsOperaProfileMigrator.cpp @@ -35,6 +35,8 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/Util.h" + #include "nsAppDirectoryServiceDefs.h" #include "nsBrowserProfileMigratorUtils.h" #include "nsDirectoryServiceDefs.h" @@ -68,6 +70,8 @@ #include #endif +using namespace mozilla; + #define MIGRATION_BUNDLE "chrome://browser/locale/migration/migration.properties" #ifdef XP_WIN @@ -482,7 +486,7 @@ nsOperaProfileMigrator::CopyProxySettings(nsINIParser &aParser, char toggleBuf[15], serverBuf[20], serverPrefBuf[20], serverPortPrefBuf[25]; PRInt32 enabled; - for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(protocols); ++i) { + for (PRUint32 i = 0; i < ArrayLength(protocols); ++i) { sprintf(toggleBuf, "Use %s", protocols[i]); GetInteger(aParser, "Proxy", toggleBuf, &enabled); if (enabled) { diff --git a/browser/components/preferences/aboutPermissions.js b/browser/components/preferences/aboutPermissions.js index 1b4ade90ca1c..fbe76b30374b 100644 --- a/browser/components/preferences/aboutPermissions.js +++ b/browser/components/preferences/aboutPermissions.js @@ -630,7 +630,7 @@ let AboutPermissions = { let filterValue = document.getElementById("sites-filter").value.toLowerCase(); item.collapsed = aSite.host.toLowerCase().indexOf(filterValue) == -1; - this.sitesList.appendChild(item); + (this._listFragment || this.sitesList).appendChild(item); }, startSitesListBatch: function () { diff --git a/browser/components/preferences/advanced-scripts.xul b/browser/components/preferences/advanced-scripts.xul index 1d123d55bc7f..90918751c606 100644 --- a/browser/components/preferences/advanced-scripts.xul +++ b/browser/components/preferences/advanced-scripts.xul @@ -65,8 +65,8 @@ - # Jeff Walden +# Steffen Wilberg # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or @@ -61,9 +62,7 @@ var gAdvancedPane = { } #ifdef MOZ_UPDATER - this.updateAppUpdateItems(); - this.updateAutoItems(); - this.updateModeItems(); + this.updateReadPrefs(); #endif this.updateOfflineApps(); #ifdef MOZ_CRASHREPORTER @@ -459,82 +458,90 @@ var gAdvancedPane = { * update is a major update */ +#ifdef MOZ_UPDATER /** - * Enables and disables various UI preferences as necessary to reflect locked, - * disabled, and checked/unchecked states. + * Selects the item of the radiogroup, and sets the warnIncompatible checkbox + * based on the pref values and locked states. * * UI state matrix for update preference conditions * - * UI Components: Preferences - * 1 = Firefox checkbox i = app.update.enabled - * 2 = When updates for Firefox are found label ii = app.update.auto - * 3 = Automatic Radiogroup (Ask vs. Automatically) iii = app.update.mode - * 4 = Warn before disabling extensions checkbox - * - * States: - * Element p val locked Disabled - * 1 i t/f f false - * i t/f t true - * ii t/f t/f false - * iii 0/1/2 t/f false - * 2,3 i t t/f false - * i f t/f true - * ii t/f f false - * ii t/f t true - * iii 0/1/2 t/f false - * 4 i t t/f false - * i f t/f true - * ii t t/f false - * ii f t/f true - * iii 0/1/2 f false - * iii 0/1/2 t true - * + * UI Components: Preferences + * Radiogroup i = app.update.enabled + * Warn before disabling extensions checkbox ii = app.update.auto + * iii = app.update.mode + * + * Disabled states: + * Element pref value locked disabled + * radiogroup i t/f f false + * i t/f *t* *true* + * ii t/f f false + * ii t/f *t* *true* + * iii 0/1/2 t/f false + * warnIncompatible i t f false + * i t *t* *true* + * i *f* t/f *true* + * ii t f false + * ii t *t* *true* + * ii *f* t/f *true* + * iii 0/1/2 f false + * iii 0/1/2 *t* *true* */ -#ifdef MOZ_UPDATER - updateAppUpdateItems: function () - { - var aus = - Components.classes["@mozilla.org/updates/update-service;1"]. - getService(Components.interfaces.nsIApplicationUpdateService); - - var enabledPref = document.getElementById("app.update.enabled"); - var enableAppUpdate = document.getElementById("enableAppUpdate"); - - enableAppUpdate.disabled = !aus.canCheckForUpdates || enabledPref.locked; - }, - - /** - * Enables/disables UI for "when updates are found" based on the values, - * and "locked" states of associated preferences. - */ - updateAutoItems: function () + updateReadPrefs: function () { var enabledPref = document.getElementById("app.update.enabled"); var autoPref = document.getElementById("app.update.auto"); - - var updateModeLabel = document.getElementById("updateModeLabel"); - var updateMode = document.getElementById("updateMode"); - - var disable = enabledPref.locked || !enabledPref.value || - autoPref.locked; - updateModeLabel.disabled = updateMode.disabled = disable; - }, + var radiogroup = document.getElementById("updateRadioGroup"); + + if (!enabledPref.value) // Don't care for autoPref.value in this case. + radiogroup.value="manual" // 3. Never check for updates. + else if (autoPref.value) // enabledPref.value && autoPref.value + radiogroup.value="auto"; // 1. Automatically install updates + else // enabledPref.value && !autoPref.value + radiogroup.value="checkOnly"; // 2. Check, but let me choose + + var canCheck = Components.classes["@mozilla.org/updates/update-service;1"]. + getService(Components.interfaces.nsIApplicationUpdateService). + canCheckForUpdates; + // canCheck is false if the enabledPref is false and locked, + // or the binary platform or OS version is not known. + // A locked pref is sufficient to disable the radiogroup. + radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked; - /** - * Enables/disables the "warn if incompatible extensions/themes exist" UI - * based on the values and "locked" states of various preferences. - */ - updateModeItems: function () - { - var enabledPref = document.getElementById("app.update.enabled"); - var autoPref = document.getElementById("app.update.auto"); var modePref = document.getElementById("app.update.mode"); - var warnIncompatible = document.getElementById("warnIncompatible"); - - var disable = enabledPref.locked || !enabledPref.value || autoPref.locked || - !autoPref.value || modePref.locked; - warnIncompatible.disabled = disable; + // the warnIncompatible checkbox value is set by readAddonWarn + warnIncompatible.disabled = radiogroup.disabled || modePref.locked || + !enabledPref.value || !autoPref.value; + }, + + /** + * Sets the pref values based on the selected item of the radiogroup, + * and sets the disabled state of the warnIncompatible checkbox accordingly. + */ + updateWritePrefs: function () + { + var enabledPref = document.getElementById("app.update.enabled"); + var autoPref = document.getElementById("app.update.auto"); + var radiogroup = document.getElementById("updateRadioGroup"); + switch (radiogroup.value) { + case "auto": // 1. Automatically install updates + enabledPref.value = true; + autoPref.value = true; + break; + case "checkOnly": // 2. Check, but let me choose + enabledPref.value = true; + autoPref.value = false; + break; + case "manual": // 3. Never check for updates. + enabledPref.value = false; + autoPref.value = false; + } + + var warnIncompatible = document.getElementById("warnIncompatible"); + var modePref = document.getElementById("app.update.mode"); + warnIncompatible.disabled = enabledPref.locked || !enabledPref.value || + autoPref.locked || !autoPref.value || + modePref.locked; }, /** @@ -553,7 +560,7 @@ var gAdvancedPane = { * of the preference so that the preference value can be properly restored if * the user's preferences cannot adequately be expressed by a single checkbox. * - * app.update.modee Checkbox State Meaning + * app.update.mode Checkbox State Meaning * 0 Unchecked Do not warn * 1 Checked Warn if there are incompatibilities * 2 Checked Warn if there are incompatibilities, @@ -562,9 +569,9 @@ var gAdvancedPane = { readAddonWarn: function () { var preference = document.getElementById("app.update.mode"); - var doNotWarn = preference.value != 0; - gAdvancedPane._modePreference = doNotWarn ? preference.value : 1; - return doNotWarn; + var warn = preference.value != 0; + gAdvancedPane._modePreference = warn ? preference.value : 1; + return warn; }, /** @@ -591,7 +598,7 @@ var gAdvancedPane = { /** * The Extensions checkbox and button are disabled only if the enable Addon - * update preference is locked. + * update preference is locked. */ updateAddonUpdateUI: function () { @@ -599,8 +606,8 @@ var gAdvancedPane = { var enableAddonUpdate = document.getElementById("enableAddonUpdate"); enableAddonUpdate.disabled = enabledPref.locked; - }, - + }, + // ENCRYPTION TAB /* diff --git a/browser/components/preferences/advanced.xul b/browser/components/preferences/advanced.xul index 3df88613487a..ffe5b9b6cb5f 100644 --- a/browser/components/preferences/advanced.xul +++ b/browser/components/preferences/advanced.xul @@ -25,6 +25,7 @@ # Ben Goodger # Jeff Walden # Ehsan Akhgari +# Steffen Wilberg # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or @@ -100,15 +101,9 @@ #ifdef MOZ_UPDATER - - - + + + - - - + #ifdef MOZ_UPDATER - + + + + + + + + + + + + +
diff --git a/js/src/xpconnect/tests/mochitest/test_bug636097.html b/js/xpconnect/tests/mochitest/test_bug636097.html similarity index 100% rename from js/src/xpconnect/tests/mochitest/test_bug636097.html rename to js/xpconnect/tests/mochitest/test_bug636097.html diff --git a/js/src/xpconnect/tests/mochitest/test_bug650273.html b/js/xpconnect/tests/mochitest/test_bug650273.html similarity index 100% rename from js/src/xpconnect/tests/mochitest/test_bug650273.html rename to js/xpconnect/tests/mochitest/test_bug650273.html diff --git a/js/src/xpconnect/tests/mochitest/test_bug655297.html b/js/xpconnect/tests/mochitest/test_bug655297.html similarity index 100% rename from js/src/xpconnect/tests/mochitest/test_bug655297.html rename to js/xpconnect/tests/mochitest/test_bug655297.html diff --git a/js/src/xpconnect/tests/mochitest/test_bug657267.html b/js/xpconnect/tests/mochitest/test_bug657267.html similarity index 89% rename from js/src/xpconnect/tests/mochitest/test_bug657267.html rename to js/xpconnect/tests/mochitest/test_bug657267.html index 472c3e2605bb..b0a7e60f8a77 100644 --- a/js/src/xpconnect/tests/mochitest/test_bug657267.html +++ b/js/xpconnect/tests/mochitest/test_bug657267.html @@ -36,7 +36,7 @@ function go() { - diff --git a/js/src/xpconnect/tests/mochitest/test_bug661980.html b/js/xpconnect/tests/mochitest/test_bug661980.html similarity index 100% rename from js/src/xpconnect/tests/mochitest/test_bug661980.html rename to js/xpconnect/tests/mochitest/test_bug661980.html diff --git a/js/src/xpconnect/tests/mochitest/test_bug691059.html b/js/xpconnect/tests/mochitest/test_bug691059.html similarity index 100% rename from js/src/xpconnect/tests/mochitest/test_bug691059.html rename to js/xpconnect/tests/mochitest/test_bug691059.html diff --git a/js/src/xpconnect/tests/mochitest/test_bug92773.html b/js/xpconnect/tests/mochitest/test_bug92773.html similarity index 90% rename from js/src/xpconnect/tests/mochitest/test_bug92773.html rename to js/xpconnect/tests/mochitest/test_bug92773.html index 8213bf70201c..4cec5eae6f47 100644 --- a/js/src/xpconnect/tests/mochitest/test_bug92773.html +++ b/js/xpconnect/tests/mochitest/test_bug92773.html @@ -35,7 +35,7 @@ SimpleTest.waitForExplicitFinish(); diff --git a/js/src/xpconnect/tests/mochitest/test_frameWrapping.html b/js/xpconnect/tests/mochitest/test_frameWrapping.html similarity index 100% rename from js/src/xpconnect/tests/mochitest/test_frameWrapping.html rename to js/xpconnect/tests/mochitest/test_frameWrapping.html diff --git a/js/src/xpconnect/tests/unit/CatRegistrationComponents.manifest b/js/xpconnect/tests/unit/CatRegistrationComponents.manifest similarity index 100% rename from js/src/xpconnect/tests/unit/CatRegistrationComponents.manifest rename to js/xpconnect/tests/unit/CatRegistrationComponents.manifest diff --git a/js/src/xpconnect/tests/unit/bogus_element_type.jsm b/js/xpconnect/tests/unit/bogus_element_type.jsm similarity index 100% rename from js/src/xpconnect/tests/unit/bogus_element_type.jsm rename to js/xpconnect/tests/unit/bogus_element_type.jsm diff --git a/js/src/xpconnect/tests/unit/bogus_exports_type.jsm b/js/xpconnect/tests/unit/bogus_exports_type.jsm similarity index 100% rename from js/src/xpconnect/tests/unit/bogus_exports_type.jsm rename to js/xpconnect/tests/unit/bogus_exports_type.jsm diff --git a/js/src/xpconnect/tests/unit/bug451678_subscript.js b/js/xpconnect/tests/unit/bug451678_subscript.js similarity index 100% rename from js/src/xpconnect/tests/unit/bug451678_subscript.js rename to js/xpconnect/tests/unit/bug451678_subscript.js diff --git a/js/src/xpconnect/tests/unit/bug596580_versioned.js b/js/xpconnect/tests/unit/bug596580_versioned.js similarity index 100% rename from js/src/xpconnect/tests/unit/bug596580_versioned.js rename to js/xpconnect/tests/unit/bug596580_versioned.js diff --git a/js/src/xpconnect/tests/unit/component-file.js b/js/xpconnect/tests/unit/component-file.js similarity index 100% rename from js/src/xpconnect/tests/unit/component-file.js rename to js/xpconnect/tests/unit/component-file.js diff --git a/js/src/xpconnect/tests/unit/component-file.manifest b/js/xpconnect/tests/unit/component-file.manifest similarity index 100% rename from js/src/xpconnect/tests/unit/component-file.manifest rename to js/xpconnect/tests/unit/component-file.manifest diff --git a/js/src/xpconnect/tests/unit/component_import.js b/js/xpconnect/tests/unit/component_import.js similarity index 100% rename from js/src/xpconnect/tests/unit/component_import.js rename to js/xpconnect/tests/unit/component_import.js diff --git a/js/src/xpconnect/tests/unit/component_import.manifest b/js/xpconnect/tests/unit/component_import.manifest similarity index 100% rename from js/src/xpconnect/tests/unit/component_import.manifest rename to js/xpconnect/tests/unit/component_import.manifest diff --git a/js/src/xpconnect/tests/unit/recursive_importA.jsm b/js/xpconnect/tests/unit/recursive_importA.jsm similarity index 100% rename from js/src/xpconnect/tests/unit/recursive_importA.jsm rename to js/xpconnect/tests/unit/recursive_importA.jsm diff --git a/js/src/xpconnect/tests/unit/recursive_importB.jsm b/js/xpconnect/tests/unit/recursive_importB.jsm similarity index 100% rename from js/src/xpconnect/tests/unit/recursive_importB.jsm rename to js/xpconnect/tests/unit/recursive_importB.jsm diff --git a/js/src/xpconnect/tests/unit/syntax_error.jsm b/js/xpconnect/tests/unit/syntax_error.jsm similarity index 100% rename from js/src/xpconnect/tests/unit/syntax_error.jsm rename to js/xpconnect/tests/unit/syntax_error.jsm diff --git a/js/src/xpconnect/tests/unit/test_attributes.js b/js/xpconnect/tests/unit/test_attributes.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_attributes.js rename to js/xpconnect/tests/unit/test_attributes.js diff --git a/js/src/xpconnect/tests/unit/test_bogus_files.js b/js/xpconnect/tests/unit/test_bogus_files.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_bogus_files.js rename to js/xpconnect/tests/unit/test_bogus_files.js diff --git a/js/src/xpconnect/tests/unit/test_bug408412.js b/js/xpconnect/tests/unit/test_bug408412.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_bug408412.js rename to js/xpconnect/tests/unit/test_bug408412.js diff --git a/js/src/xpconnect/tests/unit/test_bug451678.js b/js/xpconnect/tests/unit/test_bug451678.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_bug451678.js rename to js/xpconnect/tests/unit/test_bug451678.js diff --git a/js/src/xpconnect/tests/unit/test_bug596580.js b/js/xpconnect/tests/unit/test_bug596580.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_bug596580.js rename to js/xpconnect/tests/unit/test_bug596580.js diff --git a/js/src/xpconnect/tests/unit/test_bug604362.js b/js/xpconnect/tests/unit/test_bug604362.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_bug604362.js rename to js/xpconnect/tests/unit/test_bug604362.js diff --git a/js/src/xpconnect/tests/unit/test_bug608142.js b/js/xpconnect/tests/unit/test_bug608142.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_bug608142.js rename to js/xpconnect/tests/unit/test_bug608142.js diff --git a/js/src/xpconnect/tests/unit/test_bug641378.js b/js/xpconnect/tests/unit/test_bug641378.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_bug641378.js rename to js/xpconnect/tests/unit/test_bug641378.js diff --git a/js/src/xpconnect/tests/unit/test_bug677864.js b/js/xpconnect/tests/unit/test_bug677864.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_bug677864.js rename to js/xpconnect/tests/unit/test_bug677864.js diff --git a/js/src/xpconnect/tests/unit/test_bug_442086.js b/js/xpconnect/tests/unit/test_bug_442086.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_bug_442086.js rename to js/xpconnect/tests/unit/test_bug_442086.js diff --git a/js/src/xpconnect/tests/unit/test_file.js b/js/xpconnect/tests/unit/test_file.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_file.js rename to js/xpconnect/tests/unit/test_file.js diff --git a/js/src/xpconnect/tests/unit/test_import.js b/js/xpconnect/tests/unit/test_import.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_import.js rename to js/xpconnect/tests/unit/test_import.js diff --git a/js/src/xpconnect/tests/unit/test_js_weak_references.js b/js/xpconnect/tests/unit/test_js_weak_references.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_js_weak_references.js rename to js/xpconnect/tests/unit/test_js_weak_references.js diff --git a/js/src/xpconnect/tests/unit/test_localeCompare.js b/js/xpconnect/tests/unit/test_localeCompare.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_localeCompare.js rename to js/xpconnect/tests/unit/test_localeCompare.js diff --git a/js/src/xpconnect/tests/unit/test_params.js b/js/xpconnect/tests/unit/test_params.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_params.js rename to js/xpconnect/tests/unit/test_params.js diff --git a/js/src/xpconnect/tests/unit/test_recursive_import.js b/js/xpconnect/tests/unit/test_recursive_import.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_recursive_import.js rename to js/xpconnect/tests/unit/test_recursive_import.js diff --git a/js/src/xpconnect/tests/unit/test_reflect_parse.js b/js/xpconnect/tests/unit/test_reflect_parse.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_reflect_parse.js rename to js/xpconnect/tests/unit/test_reflect_parse.js diff --git a/js/src/xpconnect/tests/unit/test_unload.js b/js/xpconnect/tests/unit/test_unload.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_unload.js rename to js/xpconnect/tests/unit/test_unload.js diff --git a/js/src/xpconnect/tests/unit/test_xpcomutils.js b/js/xpconnect/tests/unit/test_xpcomutils.js similarity index 100% rename from js/src/xpconnect/tests/unit/test_xpcomutils.js rename to js/xpconnect/tests/unit/test_xpcomutils.js diff --git a/js/src/xpconnect/tests/unit/xpcshell.ini b/js/xpconnect/tests/unit/xpcshell.ini similarity index 100% rename from js/src/xpconnect/tests/unit/xpcshell.ini rename to js/xpconnect/tests/unit/xpcshell.ini diff --git a/js/src/xpconnect/wrappers/AccessCheck.cpp b/js/xpconnect/wrappers/AccessCheck.cpp similarity index 98% rename from js/src/xpconnect/wrappers/AccessCheck.cpp rename to js/xpconnect/wrappers/AccessCheck.cpp index 27e43ec8f6a8..dfafa3355577 100644 --- a/js/src/xpconnect/wrappers/AccessCheck.cpp +++ b/js/xpconnect/wrappers/AccessCheck.cpp @@ -37,6 +37,8 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/Util.h" + #include "AccessCheck.h" #include "nsJSPrincipals.h" @@ -51,6 +53,7 @@ #include "jsfriendapi.h" +using namespace mozilla; using namespace js; namespace xpc { @@ -135,7 +138,7 @@ IsPermitted(const char *name, JSFlatString *prop, bool set) const jschar *propChars = JS_GetInternedStringCharsAndLength(prop, &propLength); if (!propLength) return false; - switch(name[0]) { + switch (name[0]) { NAME('D', "DOMException", PROP('c', RW("code")) PROP('m', RW("message")) @@ -359,7 +362,7 @@ AccessCheck::isSystemOnlyAccessPermitted(JSContext *cx) const char *filename; if (fp && (filename = JS_GetScriptFilename(cx, JS_GetFrameScript(cx, fp))) && - !strncmp(filename, prefix, NS_ARRAY_LENGTH(prefix) - 1)) { + !strncmp(filename, prefix, ArrayLength(prefix) - 1)) { return true; } @@ -405,7 +408,7 @@ AccessCheck::isScriptAccessOnly(JSContext *cx, JSObject *wrapper) // In addition, chrome objects can explicitly opt-in by setting .scriptOnly to true. if (js::GetProxyHandler(wrapper) == &FilteringWrapper::singleton) { + CrossOriginAccessiblePropertiesOnly>::singleton) { jsid scriptOnlyId = GetRTIdByIndex(cx, XPCJSRuntime::IDX_SCRIPTONLY); jsval scriptOnly; if (JS_LookupPropertyById(cx, obj, scriptOnlyId, &scriptOnly) && diff --git a/js/src/xpconnect/wrappers/AccessCheck.h b/js/xpconnect/wrappers/AccessCheck.h similarity index 100% rename from js/src/xpconnect/wrappers/AccessCheck.h rename to js/xpconnect/wrappers/AccessCheck.h diff --git a/js/src/xpconnect/wrappers/CrossOriginWrapper.cpp b/js/xpconnect/wrappers/CrossOriginWrapper.cpp similarity index 98% rename from js/src/xpconnect/wrappers/CrossOriginWrapper.cpp rename to js/xpconnect/wrappers/CrossOriginWrapper.cpp index ab2e5718ca98..55dce66305f6 100644 --- a/js/src/xpconnect/wrappers/CrossOriginWrapper.cpp +++ b/js/xpconnect/wrappers/CrossOriginWrapper.cpp @@ -73,7 +73,7 @@ CrossOriginWrapper::getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid bool CrossOriginWrapper::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id, - bool set, js::PropertyDescriptor *desc) + bool set, js::PropertyDescriptor *desc) { return CrossCompartmentWrapper::getOwnPropertyDescriptor(cx, wrapper, id, set, desc) && WrapperFactory::WaiveXrayAndWrap(cx, &desc->value); diff --git a/js/src/xpconnect/wrappers/CrossOriginWrapper.h b/js/xpconnect/wrappers/CrossOriginWrapper.h similarity index 100% rename from js/src/xpconnect/wrappers/CrossOriginWrapper.h rename to js/xpconnect/wrappers/CrossOriginWrapper.h diff --git a/js/src/xpconnect/wrappers/FilteringWrapper.cpp b/js/xpconnect/wrappers/FilteringWrapper.cpp similarity index 100% rename from js/src/xpconnect/wrappers/FilteringWrapper.cpp rename to js/xpconnect/wrappers/FilteringWrapper.cpp diff --git a/js/src/xpconnect/wrappers/FilteringWrapper.h b/js/xpconnect/wrappers/FilteringWrapper.h similarity index 100% rename from js/src/xpconnect/wrappers/FilteringWrapper.h rename to js/xpconnect/wrappers/FilteringWrapper.h diff --git a/js/src/xpconnect/wrappers/Makefile.in b/js/xpconnect/wrappers/Makefile.in similarity index 98% rename from js/src/xpconnect/wrappers/Makefile.in rename to js/xpconnect/wrappers/Makefile.in index 5bd7854c2ca8..0a5be31c1e43 100644 --- a/js/src/xpconnect/wrappers/Makefile.in +++ b/js/xpconnect/wrappers/Makefile.in @@ -35,7 +35,7 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../../.. +DEPTH = ../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ diff --git a/js/src/xpconnect/wrappers/WrapperFactory.cpp b/js/xpconnect/wrappers/WrapperFactory.cpp similarity index 99% rename from js/src/xpconnect/wrappers/WrapperFactory.cpp rename to js/xpconnect/wrappers/WrapperFactory.cpp index c4695d767909..94d5457d9658 100644 --- a/js/src/xpconnect/wrappers/WrapperFactory.cpp +++ b/js/xpconnect/wrappers/WrapperFactory.cpp @@ -46,7 +46,7 @@ #include "xpcprivate.h" #include "dombindings.h" -#include "xpcmaps.h" +#include "XPCMaps.h" using namespace js; @@ -458,7 +458,7 @@ WrapperFactory::WrapSOWObject(JSContext *cx, JSObject *obj) JSObject *wrapperObj = Wrapper::New(cx, obj, JS_GetPrototype(cx, obj), JS_GetGlobalForObject(cx, obj), &FilteringWrapper::singleton); + OnlyIfSubjectIsSystem>::singleton); return wrapperObj; } diff --git a/js/src/xpconnect/wrappers/WrapperFactory.h b/js/xpconnect/wrappers/WrapperFactory.h similarity index 100% rename from js/src/xpconnect/wrappers/WrapperFactory.h rename to js/xpconnect/wrappers/WrapperFactory.h diff --git a/js/src/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp similarity index 99% rename from js/src/xpconnect/wrappers/XrayWrapper.cpp rename to js/xpconnect/wrappers/XrayWrapper.cpp index a721aa461a55..38fd8fd0472a 100644 --- a/js/src/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -465,8 +465,7 @@ XrayToString(JSContext *cx, uintN argc, jsval *vp) return false; } result.Append(chars, length); - } - else { + } else { JSObject *holder = GetHolder(wrapper); XPCWrappedNative *wn = GetWrappedNativeFromHolder(holder); JSObject *wrappednative = wn->GetFlatJSObject(); diff --git a/js/src/xpconnect/wrappers/XrayWrapper.h b/js/xpconnect/wrappers/XrayWrapper.h similarity index 100% rename from js/src/xpconnect/wrappers/XrayWrapper.h rename to js/xpconnect/wrappers/XrayWrapper.h diff --git a/layout/base/Makefile.in b/layout/base/Makefile.in index 6fb3d12e4193..5534ecceb45a 100644 --- a/layout/base/Makefile.in +++ b/layout/base/Makefile.in @@ -74,7 +74,6 @@ EXPORTS = \ nsFrameManager.h \ nsFrameManagerBase.h \ nsFrameTraversal.h \ - nsIDocumentViewer.h \ nsIFrameTraversal.h \ nsILayoutDebugger.h \ nsILayoutHistoryState.h \ diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 8e41888efeef..63ef72be7026 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -43,6 +43,8 @@ * tree and updating of that tree in response to dynamic changes */ +#include "mozilla/Util.h" + #include "nsCSSFrameConstructor.h" #include "nsCRT.h" #include "nsIAtom.h" @@ -3527,7 +3529,7 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement, }; return FindDataByTag(aTag, aElement, aStyleContext, sHTMLData, - NS_ARRAY_LENGTH(sHTMLData)); + ArrayLength(sHTMLData)); } /* static */ @@ -3588,7 +3590,7 @@ nsCSSFrameConstructor::FindInputData(Element* aElement, NS_ASSERTION(control, "input doesn't implement nsIFormControl?"); return FindDataByInt(control->GetType(), aElement, aStyleContext, - sInputData, NS_ARRAY_LENGTH(sInputData)); + sInputData, ArrayLength(sInputData)); } /* static */ @@ -3626,7 +3628,7 @@ nsCSSFrameConstructor::FindObjectData(Element* aElement, }; return FindDataByInt((PRInt32)type, aElement, aStyleContext, - sObjectData, NS_ARRAY_LENGTH(sObjectData)); + sObjectData, ArrayLength(sObjectData)); } nsresult @@ -4019,7 +4021,7 @@ nsCSSFrameConstructor::FindXULTagData(Element* aElement, }; return FindDataByTag(aTag, aElement, aStyleContext, sXULTagData, - NS_ARRAY_LENGTH(sXULTagData)); + ArrayLength(sXULTagData)); } #ifdef MOZ_XUL @@ -4170,7 +4172,7 @@ nsCSSFrameConstructor::FindXULDisplayData(const nsStyleDisplay* aDisplay, // Processing by display here: return FindDataByInt(aDisplay->mDisplay, aElement, aStyleContext, - sXULDisplayData, NS_ARRAY_LENGTH(sXULDisplayData)); + sXULDisplayData, ArrayLength(sXULDisplayData)); } already_AddRefed @@ -4398,7 +4400,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay, }; return FindDataByInt(aDisplay->mDisplay, aElement, aStyleContext, - sDisplayData, NS_ARRAY_LENGTH(sDisplayData)); + sDisplayData, ArrayLength(sDisplayData)); } nsresult @@ -4676,7 +4678,7 @@ nsCSSFrameConstructor::FindMathMLData(Element* aElement, }; return FindDataByTag(aTag, aElement, aStyleContext, sMathMLData, - NS_ARRAY_LENGTH(sMathMLData)); + ArrayLength(sMathMLData)); } // Only outer elements can be floated or positioned. All other SVG @@ -4851,7 +4853,7 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement, const FrameConstructionData* data = FindDataByTag(aTag, aElement, aStyleContext, sSVGData, - NS_ARRAY_LENGTH(sSVGData)); + ArrayLength(sSVGData)); if (!data) { data = &sContainerData; @@ -9621,7 +9623,7 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState, ? "NeededToWrapXULInlineBox" : "NeededToWrapXUL"; nsContentUtils::ReportToConsole(nsContentUtils::eXUL_PROPERTIES, message, - params, NS_ARRAY_LENGTH(params), + params, ArrayLength(params), nsnull, EmptyString(), 0, 0, // not useful nsIScriptError::warningFlag, diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 0b8b22bbc730..f7525a6f3690 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -49,7 +49,7 @@ #include "nsISupports.h" #include "nsIContent.h" #include "nsIContentViewerContainer.h" -#include "nsIDocumentViewer.h" +#include "nsIContentViewer.h" #include "mozilla/FunctionTimer.h" #include "nsIDocumentViewerPrint.h" #include "nsIPrivateDOMEvent.h" @@ -282,7 +282,7 @@ private: //------------------------------------------------------------- -class DocumentViewerImpl : public nsIDocumentViewer, +class DocumentViewerImpl : public nsIContentViewer, public nsIContentViewerEdit, public nsIContentViewerFile, public nsIMarkupDocumentViewer, @@ -308,24 +308,6 @@ public: // nsIContentViewer interface... NS_DECL_NSICONTENTVIEWER - // nsIDocumentViewer interface... - NS_IMETHOD GetPresShell(nsIPresShell** aResult); - NS_IMETHOD GetPresContext(nsPresContext** aResult); - NS_IMETHOD SetDocumentInternal(nsIDocument* aDocument, - bool aForceReuseInnerWindow); - /** - * Find the view to use as the container view for MakeWindow. Returns - * null if this will be the root of a view manager hierarchy. In that - * case, if mParentWidget is null then this document should not even - * be displayed. - */ - virtual nsIView* FindContainerView(); - - /** - * Set collector for navigation timing data (load, unload events). - */ - virtual void SetNavigationTiming(nsDOMNavigationTiming* timing); - // nsIContentViewerEdit NS_DECL_NSICONTENTVIEWEREDIT @@ -536,7 +518,7 @@ static NS_DEFINE_CID(kViewManagerCID, NS_VIEW_MANAGER_CID); //------------------------------------------------------------------ nsresult -NS_NewDocumentViewer(nsIDocumentViewer** aResult) +NS_NewContentViewer(nsIContentViewer** aResult) { *aResult = new DocumentViewerImpl(); @@ -593,7 +575,6 @@ NS_IMPL_RELEASE(DocumentViewerImpl) NS_INTERFACE_MAP_BEGIN(DocumentViewerImpl) NS_INTERFACE_MAP_ENTRY(nsIContentViewer) - NS_INTERFACE_MAP_ENTRY(nsIDocumentViewer) NS_INTERFACE_MAP_ENTRY(nsIMarkupDocumentViewer) NS_INTERFACE_MAP_ENTRY(nsIContentViewerFile) NS_INTERFACE_MAP_ENTRY(nsIContentViewerEdit) @@ -1015,7 +996,7 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus) http://bugzilla.mozilla.org/show_bug.cgi?id=78445 for more explanation. */ - nsCOMPtr kungFuDeathGrip(this); + nsRefPtr kungFuDeathGrip(this); // Flush out layout so it's up-to-date by the time onload is called. // Note that this could destroy the window, so do this before @@ -1333,20 +1314,19 @@ AttachContainerRecurse(nsIDocShell* aShell) { nsCOMPtr viewer; aShell->GetContentViewer(getter_AddRefs(viewer)); - nsCOMPtr docViewer = do_QueryInterface(viewer); - if (docViewer) { - nsIDocument* doc = docViewer->GetDocument(); + if (viewer) { + nsIDocument* doc = viewer->GetDocument(); if (doc) { doc->SetContainer(aShell); } nsRefPtr pc; - docViewer->GetPresContext(getter_AddRefs(pc)); + viewer->GetPresContext(getter_AddRefs(pc)); if (pc) { pc->SetContainer(aShell); pc->SetLinkHandler(nsCOMPtr(do_QueryInterface(aShell))); } nsCOMPtr presShell; - docViewer->GetPresShell(getter_AddRefs(presShell)); + viewer->GetPresShell(getter_AddRefs(presShell)); if (presShell) { presShell->SetForwardingContainer(nsnull); } @@ -1491,20 +1471,19 @@ DetachContainerRecurse(nsIDocShell *aShell) // Unhook this docshell's presentation nsCOMPtr viewer; aShell->GetContentViewer(getter_AddRefs(viewer)); - nsCOMPtr docViewer = do_QueryInterface(viewer); - if (docViewer) { - nsIDocument* doc = docViewer->GetDocument(); + if (viewer) { + nsIDocument* doc = viewer->GetDocument(); if (doc) { doc->SetContainer(nsnull); } nsRefPtr pc; - docViewer->GetPresContext(getter_AddRefs(pc)); + viewer->GetPresContext(getter_AddRefs(pc)); if (pc) { pc->SetContainer(nsnull); pc->SetLinkHandler(nsnull); } nsCOMPtr presShell; - docViewer->GetPresShell(getter_AddRefs(presShell)); + viewer->GetPresShell(getter_AddRefs(presShell)); if (presShell) { presShell->SetForwardingContainer(nsWeakPtr(do_GetWeakReference(aShell))); } diff --git a/layout/base/nsIDocumentViewer.h b/layout/base/nsIDocumentViewer.h deleted file mode 100644 index d034b07c65b9..000000000000 --- a/layout/base/nsIDocumentViewer.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either 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 ***** */ - -/* container for a document and its presentation */ - -#ifndef nsIDocumentViewer_h___ -#define nsIDocumentViewer_h___ - -#include "nsIContentViewer.h" - -class nsIDocument; -class nsPresContext; -class nsIPresShell; -class nsIStyleSheet; -class nsIView; - -class nsDOMNavigationTiming; - -#define NS_IDOCUMENT_VIEWER_IID \ - { 0x5a5c9a1d, 0x49c4, 0x4f3f, \ - { 0x80, 0xcd, 0x12, 0x09, 0x5b, 0x1e, 0x1f, 0x61 } } - -/** - * A document viewer is a kind of content viewer that uses NGLayout - * to manage the presentation of the content. - */ -class nsIDocumentViewer : public nsIContentViewer -{ -public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_VIEWER_IID) - - NS_IMETHOD GetPresShell(nsIPresShell** aResult) = 0; - - NS_IMETHOD GetPresContext(nsPresContext** aResult) = 0; - - NS_IMETHOD SetDocumentInternal(nsIDocument* aDocument, - bool aForceReuseInnerWindow) = 0; - - virtual nsIView* FindContainerView() = 0; - - virtual void SetNavigationTiming(nsDOMNavigationTiming* timing) = 0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentViewer, NS_IDOCUMENT_VIEWER_IID) - -#endif /* nsIDocumentViewer_h___ */ diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 7b1e08c27b2c..94e82eb5ac2f 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -38,6 +38,8 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/Util.h" + #include "nsLayoutUtils.h" #include "nsIFormControlFrame.h" #include "nsPresContext.h" @@ -114,9 +116,9 @@ #include "nsXULPopupManager.h" #endif +using namespace mozilla; using namespace mozilla::layers; using namespace mozilla::dom; -namespace css = mozilla::css; #ifdef DEBUG // TODO: remove, see bug 598468. @@ -4225,7 +4227,7 @@ nsLayoutUtils::GetFontFacesForFrames(nsIFrame* aFrame, while (aFrame) { nsIFrame::ChildListID childLists[] = { nsIFrame::kPrincipalList, nsIFrame::kPopupList }; - for (int i = 0; i < NS_ARRAY_LENGTH(childLists); ++i) { + for (int i = 0; i < ArrayLength(childLists); ++i) { nsFrameList children(aFrame->GetChildList(childLists[i])); for (nsFrameList::Enumerator e(children); !e.AtEnd(); e.Next()) { nsIFrame* child = e.get(); @@ -4282,6 +4284,39 @@ nsLayoutUtils::GetFontFacesForText(nsIFrame* aFrame, return NS_OK; } +/* static */ +nsresult +nsLayoutUtils::GetTextRunMemoryForFrames(nsIFrame* aFrame, PRUint64* aTotal) +{ + NS_PRECONDITION(aFrame, "NULL frame pointer"); + + if (aFrame->GetType() == nsGkAtoms::textFrame) { + nsTextFrame* textFrame = static_cast(aFrame); + gfxTextRun *run = textFrame->GetTextRun(); + if (run) { + if (aTotal) { + run->AccountForSize(aTotal); + } else { + run->ClearSizeAccounted(); + } + } + return NS_OK; + } + + nsAutoTArray childListArray; + aFrame->GetChildLists(&childListArray); + + for (nsIFrame::ChildListArrayIterator childLists(childListArray); + !childLists.IsDone(); childLists.Next()) { + for (nsFrameList::Enumerator e(childLists.CurrentList()); + !e.AtEnd(); e.Next()) { + GetTextRunMemoryForFrames(e.get(), aTotal); + } + } + + return NS_OK; +} + /* static */ void nsLayoutUtils::Shutdown() diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 53a47ddd0279..8de82fc9fdc8 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -1433,6 +1433,20 @@ public: bool aFollowContinuations, nsFontFaceList* aFontFaceList); + /** + * Walks the frame tree starting at aFrame looking for textRuns. + * If aTotal is NULL, just clears the TEXT_RUN_MEMORY_ACCOUNTED flag + * on each textRun found. + * If aTotal is non-NULL, adds the storage used for each textRun to the + * total, and sets the TEXT_RUN_MEMORY_ACCOUNTED flag to avoid double- + * accounting. (Runs with this flag already set will be skipped.) + * Expected usage pattern is therefore to call twice: + * rv = GetTextRunMemoryForFrames(rootFrame, NULL); + * rv = GetTextRunMemoryForFrames(rootFrame, &total); + */ + static nsresult GetTextRunMemoryForFrames(nsIFrame* aFrame, + PRUint64* aTotal); + /** * Checks if CSS 3D transforms are currently enabled. */ diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index a5f8605aef51..5bfc1d342f53 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -46,7 +46,6 @@ #include "nsIDocShellTreeItem.h" #include "nsIDocShell.h" #include "nsIContentViewer.h" -#include "nsIDocumentViewer.h" #include "nsPIDOMWindow.h" #include "nsStyleSet.h" #include "nsImageLoader.h" @@ -1735,10 +1734,9 @@ nsPresContext::EnsureVisible() nsCOMPtr cv; docShell->GetContentViewer(getter_AddRefs(cv)); // Make sure this is the content viewer we belong with - nsCOMPtr docV(do_QueryInterface(cv)); - if (docV) { + if (cv) { nsRefPtr currentPresContext; - docV->GetPresContext(getter_AddRefs(currentPresContext)); + cv->GetPresContext(getter_AddRefs(currentPresContext)); if (currentPresContext == this) { // OK, this is us. We want to call Show() on the content viewer. cv->Show(); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 9a996934d2b5..d012ab72adfe 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -56,6 +56,8 @@ /* a presentation of a document, part 2 */ +#include "mozilla/Util.h" + #include "nsPresShell.h" #include "nsPresContext.h" #include "nsIContent.h" @@ -220,6 +222,8 @@ static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID); /* for NS_MEMORY_REPORTER_IMPLEMENT */ #include "nsIMemoryReporter.h" +#include "gfxTextRunWordCache.h" + using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::layers; @@ -641,9 +645,11 @@ PresShell::MemoryReporter::SizeEnumerator(PresShellPtrKey *aEntry, NS_NAMED_LITERAL_CSTRING(kArenaDesc, "Memory used by layout PresShell, PresContext, and other related areas."); NS_NAMED_LITERAL_CSTRING(kStyleDesc, "Memory used by the style system."); + NS_NAMED_LITERAL_CSTRING(kTextRunsDesc, "Memory used for text-runs (glyph layout) in the PresShell's frame tree."); nsCAutoString arenaPath = str + NS_LITERAL_CSTRING("/arenas"); nsCAutoString stylePath = str + NS_LITERAL_CSTRING("/styledata"); + nsCAutoString textRunsPath = str + NS_LITERAL_CSTRING("/textruns"); PRUint32 arenasSize; arenasSize = aShell->EstimateMemoryUsed(); @@ -652,6 +658,9 @@ PresShell::MemoryReporter::SizeEnumerator(PresShellPtrKey *aEntry, PRUint32 styleSize; styleSize = aShell->StyleSet()->SizeOf(); + PRUint64 textRunsSize; + textRunsSize = aShell->ComputeTextRunMemoryUsed(); + data->callback-> Callback(EmptyCString(), arenaPath, nsIMemoryReporter::KIND_HEAP, nsIMemoryReporter::UNITS_BYTES, arenasSize, kArenaDesc, @@ -662,6 +671,13 @@ PresShell::MemoryReporter::SizeEnumerator(PresShellPtrKey *aEntry, nsIMemoryReporter::UNITS_BYTES, styleSize, kStyleDesc, data->closure); + if (textRunsSize) { + data->callback-> + Callback(EmptyCString(), textRunsPath, nsIMemoryReporter::KIND_HEAP, + nsIMemoryReporter::UNITS_BYTES, textRunsSize, kTextRunsDesc, + data->closure); + } + return PL_DHASH_NEXT; } @@ -673,8 +689,25 @@ PresShell::MemoryReporter::CollectReports(nsIMemoryMultiReporterCallback* aCb, data.callback = aCb; data.closure = aClosure; + // clear TEXT_RUN_SIZE_ACCOUNTED flag on cached runs + gfxTextRunWordCache::ComputeStorage(nsnull); + sLiveShells->EnumerateEntries(SizeEnumerator, &data); + NS_NAMED_LITERAL_CSTRING(kTextRunWordCachePath, + "explicit/gfx/textrun-word-cache"); + NS_NAMED_LITERAL_CSTRING(kTextRunWordCacheDesc, + "Memory used by cached text-runs that are " + "not owned by a PresShell's frame tree."); + + // now total up cached runs that aren't otherwise accounted for + PRUint64 textRunWordCacheSize = 0; + gfxTextRunWordCache::ComputeStorage(&textRunWordCacheSize); + + aCb->Callback(EmptyCString(), kTextRunWordCachePath, + nsIMemoryReporter::KIND_HEAP, nsIMemoryReporter::UNITS_BYTES, + textRunWordCacheSize, kTextRunWordCacheDesc, aClosure); + return NS_OK; } @@ -6266,10 +6299,10 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView, if (IsFullScreenAndRestrictedKeyEvent(mCurrentEventContent, aEvent) && aEvent->message == NS_KEY_DOWN) { // We're in DOM full-screen mode, and a key with a restricted key - // code has been pressed. Exit full-screen mode. + // code has been pressed. Exit full-screen mode. NS_DispatchToCurrentThread( - NS_NewRunnableMethod(mCurrentEventContent->GetOwnerDoc(), - &nsIDocument::CancelFullScreen)); + NS_NewRunnableMethod(mCurrentEventContent->GetOwnerDoc(), + &nsIDocument::CancelFullScreen)); } // Else not full-screen mode or key code is unrestricted, fall // through to normal handling. @@ -8448,7 +8481,7 @@ void ReflowCountMgr::DoGrandHTMLTotals() static const char * title[] = {"Class", "Reflows"}; fprintf(mFD, "
"); - for (PRUint32 i=0; i < NS_ARRAY_LENGTH(title); i++) { + for (PRUint32 i=0; i < ArrayLength(title); i++) { fprintf(mFD, "
%s
", title[i]); } fprintf(mFD, "\n"); @@ -8710,3 +8743,22 @@ PresShell::GetRootPresShell() } return nsnull; } + +PRUint64 +PresShell::ComputeTextRunMemoryUsed() +{ + nsIFrame* rootFrame = FrameManager()->GetRootFrame(); + if (!rootFrame) { + return 0; + } + + // clear the TEXT_RUN_MEMORY_ACCOUNTED flags + nsLayoutUtils::GetTextRunMemoryForFrames(rootFrame, nsnull); + + // collect the total memory in use for textruns + PRUint64 total = 0; + nsLayoutUtils::GetTextRunMemoryForFrames(rootFrame, &total); + + return total; +} + diff --git a/layout/base/nsPresShell.h b/layout/base/nsPresShell.h index 5f6c7771f065..5c85b79d96e8 100644 --- a/layout/base/nsPresShell.h +++ b/layout/base/nsPresShell.h @@ -898,6 +898,8 @@ public: return result; } + PRUint64 ComputeTextRunMemoryUsed(); + class MemoryReporter : public nsIMemoryMultiReporter { public: diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index bdaecd557943..f16635987685 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -41,6 +41,8 @@ * refresh rate. (Perhaps temporary, until replaced by compositor.) */ +#include "mozilla/Util.h" + #include "nsRefreshDriver.h" #include "nsPresContext.h" #include "nsComponentManagerUtils.h" @@ -233,7 +235,7 @@ PRUint32 nsRefreshDriver::ObserverCount() const { PRUint32 sum = 0; - for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(mObservers); ++i) { + for (PRUint32 i = 0; i < ArrayLength(mObservers); ++i) { sum += mObservers[i].Length(); } // Even while throttled, we need to process layout and style changes. Style @@ -319,7 +321,7 @@ nsRefreshDriver::Notify(nsITimer *aTimer) * the pres context, which will cause our |mPresContext| to become * null. If this happens, we must stop notifying observers. */ - for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(mObservers); ++i) { + for (PRUint32 i = 0; i < ArrayLength(mObservers); ++i) { ObserverArray::EndLimitedIterator etor(mObservers[i]); while (etor.HasMore()) { nsRefPtr obs = etor.GetNext(); diff --git a/layout/base/tests/chrome/chrome_content_integration_window.xul b/layout/base/tests/chrome/chrome_content_integration_window.xul index 2ba9e9024245..d53efac084fb 100644 --- a/layout/base/tests/chrome/chrome_content_integration_window.xul +++ b/layout/base/tests/chrome/chrome_content_integration_window.xul @@ -20,7 +20,7 @@ +
b
+ diff --git a/layout/generic/crashtests/688996-2.html b/layout/generic/crashtests/688996-2.html new file mode 100644 index 000000000000..d4132d91fbe9 --- /dev/null +++ b/layout/generic/crashtests/688996-2.html @@ -0,0 +1,15 @@ + +
b
+ diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list index 54ccc19a632d..7be438ed9341 100644 --- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -379,3 +379,5 @@ asserts(14) asserts-if(Android,8) load 673770.html # bug 569193 and bug 459597 load 679933-1.html load 682649-1.html load 683702-1.xhtml +load 688996-1.html +load 688996-2.html diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 477cc1859cb2..90b45f867998 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -42,6 +42,8 @@ /* base class of all rendering objects */ +#include "mozilla/Util.h" + #include "nsCOMPtr.h" #include "nsFrame.h" #include "nsFrameList.h" @@ -6493,6 +6495,19 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas, nsSize aNewSize) { nsRect bounds(nsPoint(0, 0), aNewSize); + // Store the passed in overflow area if we are a preserve-3d frame, + // and it's not just the frame bounds. + if (Preserves3D() && (!aOverflowAreas.VisualOverflow().IsEqualEdges(bounds) || + !aOverflowAreas.ScrollableOverflow().IsEqualEdges(bounds))) { + nsOverflowAreas* initial = + static_cast(Properties().Get(nsIFrame::InitialOverflowProperty())); + if (!initial) { + Properties().Set(nsIFrame::InitialOverflowProperty(), + new nsOverflowAreas(aOverflowAreas)); + } else if (initial != &aOverflowAreas) { + *initial = aOverflowAreas; + } + } // This is now called FinishAndStoreOverflow() instead of // StoreOverflow() because frame-generic ways of adding overflow @@ -6636,12 +6651,75 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas, } } +/* The overflow rects for leaf nodes in a preserve-3d hierarchy depends on + * the mRect value for their parents (since we use their transform, and transform + * depends on this for transform-origin etc). These weren't necessarily correct + * when we reflowed initially, so walk over all preserve-3d children and repeat the + * overflow calculation. + */ +static void +RecomputePreserve3DChildrenOverflow(nsIFrame* aFrame, const nsRect* aBounds) +{ + // Children may check our size when getting our transform, make sure it's valid. + nsSize oldSize = aFrame->GetSize(); + if (aBounds) { + aFrame->SetSize(aBounds->Size()); + } + nsIFrame::ChildListIterator lists(aFrame); + for (; !lists.IsDone(); lists.Next()) { + nsFrameList::Enumerator childFrames(lists.CurrentList()); + for (; !childFrames.AtEnd(); childFrames.Next()) { + nsIFrame* child = childFrames.get(); + if (child->Preserves3DChildren()) { + RecomputePreserve3DChildrenOverflow(child, NULL); + } else if (child->Preserves3D()) { + nsOverflowAreas* overflow = + static_cast(child->Properties().Get(nsIFrame::InitialOverflowProperty())); + nsRect bounds(nsPoint(0, 0), child->GetSize()); + if (overflow) { + child->FinishAndStoreOverflow(*overflow, bounds.Size()); + } else { + nsOverflowAreas boundsOverflow; + boundsOverflow.SetAllTo(bounds); + child->FinishAndStoreOverflow(boundsOverflow, bounds.Size()); + } + } + } + } + // Restore our old size just in case something depends on this elesewhere. + aFrame->SetSize(oldSize); + + // Only repeat computing our overflow in recursive calls since the initial caller is still + // in the middle of doing this and we don't want an infinite loop. + if (!aBounds) { + nsOverflowAreas* overflow = + static_cast(aFrame->Properties().Get(nsIFrame::InitialOverflowProperty())); + nsRect bounds(nsPoint(0, 0), aFrame->GetSize()); + if (overflow) { + overflow->UnionAllWith(bounds); + aFrame->FinishAndStoreOverflow(*overflow, bounds.Size()); + } else { + nsOverflowAreas boundsOverflow; + boundsOverflow.SetAllTo(bounds); + aFrame->FinishAndStoreOverflow(boundsOverflow, bounds.Size()); + } + } +} + void nsIFrame::ComputePreserve3DChildrenOverflow(nsOverflowAreas& aOverflowAreas, const nsRect& aBounds) { // When we are preserving 3d we need to iterate over all children separately. // If the child also preserves 3d then their overflow will already been in our // coordinate space, otherwise we need to transform. + + // If we're the top frame in a preserve 3d chain then we need to recalculate the overflow + // areas of all our children since they will have used our size/offset which was invalid at + // the time. + if (!Preserves3D()) { + RecomputePreserve3DChildrenOverflow(this, &aBounds); + } + nsRect childVisual; nsRect childScrollable; nsIFrame::ChildListIterator lists(this); @@ -6649,15 +6727,20 @@ nsIFrame::ComputePreserve3DChildrenOverflow(nsOverflowAreas& aOverflowAreas, con nsFrameList::Enumerator childFrames(lists.CurrentList()); for (; !childFrames.AtEnd(); childFrames.Next()) { nsIFrame* child = childFrames.get(); + nsPoint offset = child->GetPosition(); + nsRect visual = child->GetVisualOverflowRect(); + nsRect scrollable = child->GetScrollableOverflowRect(); + visual.MoveBy(offset); + scrollable.MoveBy(offset); if (child->Preserves3D()) { - childVisual = childVisual.Union(child->GetVisualOverflowRect()); - childScrollable = childScrollable.Union(child->GetScrollableOverflowRect()); + childVisual = childVisual.Union(visual); + childScrollable = childScrollable.Union(scrollable); } else { childVisual = - childVisual.Union(nsDisplayTransform::TransformRect(child->GetVisualOverflowRect(), + childVisual.Union(nsDisplayTransform::TransformRect(visual, this, nsPoint(0,0), &aBounds)); childScrollable = - childScrollable.Union(nsDisplayTransform::TransformRect(child->GetScrollableOverflowRect(), + childScrollable.Union(nsDisplayTransform::TransformRect(scrollable, this, nsPoint(0,0), &aBounds)); } } @@ -8847,7 +8930,7 @@ nsHTMLReflowState::DisplayInitFrameTypeExit(nsIFrame* aFrame, "inline-stack", "deck", "popup", "groupbox", #endif }; - if (disp->mDisplay >= NS_ARRAY_LENGTH(displayTypes)) + if (disp->mDisplay >= ArrayLength(displayTypes)) printf(" display=%u", disp->mDisplay); else printf(" display=%s", displayTypes[disp->mDisplay]); @@ -8860,7 +8943,7 @@ nsHTMLReflowState::DisplayInitFrameTypeExit(nsIFrame* aFrame, bool repNoBlock = NS_FRAME_IS_REPLACED_NOBLOCK(aState->mFrameType); bool repBlock = NS_FRAME_IS_REPLACED_CONTAINS_BLOCK(aState->mFrameType); - if (bareType >= NS_ARRAY_LENGTH(cssFrameTypes)) { + if (bareType >= ArrayLength(cssFrameTypes)) { printf(" result=type %u", bareType); } else { printf(" result=%s", cssFrameTypes[bareType]); diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 62e1ee243f30..609bca8f3de2 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -898,6 +898,11 @@ public: NS_DECLARE_FRAME_PROPERTY(PreEffectsBBoxProperty, DestroyRect) NS_DECLARE_FRAME_PROPERTY(PreTransformBBoxProperty, DestroyRect) + // The initial overflow area passed to FinishAndStoreOverflow. This is only set + // on frames that Preserve3D(), and when at least one of the overflow areas + // differs from the frame bound rect. + NS_DECLARE_FRAME_PROPERTY(InitialOverflowProperty, DestroyOverflowAreas); + NS_DECLARE_FRAME_PROPERTY(UsedMarginProperty, DestroyMargin) NS_DECLARE_FRAME_PROPERTY(UsedPaddingProperty, DestroyMargin) NS_DECLARE_FRAME_PROPERTY(UsedBorderProperty, DestroyMargin) diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index bfd51eca2ecc..d15295e72f30 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -38,6 +38,8 @@ /* rendering object for replaced elements with bitmap image data */ +#include "mozilla/Util.h" + #include "nsHTMLParts.h" #include "nsCOMPtr.h" #include "nsImageFrame.h" @@ -1905,7 +1907,7 @@ nsImageFrame::IconLoad::Observe(nsISupports *aSubject, const char* aTopic, "wrong topic"); #ifdef DEBUG // assert |aData| is one of our prefs. - for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(kIconLoadPrefs) || + for (PRUint32 i = 0; i < ArrayLength(kIconLoadPrefs) || (NS_NOTREACHED("wrong pref"), PR_FALSE); ++i) if (NS_ConvertASCIItoUTF16(kIconLoadPrefs[i]) == nsDependentString(aData)) break; diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index a60270bcc6d3..af1160049add 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -468,7 +468,7 @@ nsObjectFrame::CreateWidget(nscoord aWidth, // mWidget isn't the view's designated widget. EVENT_CALLBACK eventHandler = mInnerView->AttachWidgetEventHandler(mWidget); rv = mWidget->Create(parentWidget, nsnull, nsIntRect(0,0,0,0), - eventHandler, dx, nsnull, nsnull, &initData); + eventHandler, dx, nsnull, &initData); if (NS_FAILED(rv)) { mWidget->Destroy(); mWidget = nsnull; diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 66649d4242ea..1bed6208d0ec 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -55,7 +55,6 @@ #include "nsIDocShellTreeOwner.h" #include "nsIBaseWindow.h" #include "nsIContentViewer.h" -#include "nsIDocumentViewer.h" #include "nsPresContext.h" #include "nsIPresShell.h" #include "nsIComponentManager.h" @@ -964,15 +963,12 @@ EndSwapDocShellsForDocument(nsIDocument* aDocument, void*) nsCOMPtr cv; ds->GetContentViewer(getter_AddRefs(cv)); while (cv) { - nsCOMPtr dv = do_QueryInterface(cv); - if (dv) { - nsCOMPtr pc; - dv->GetPresContext(getter_AddRefs(pc)); - nsDeviceContext* dc = pc ? pc->DeviceContext() : nsnull; - if (dc) { - nsIView* v = dv->FindContainerView(); - dc->Init(v ? v->GetNearestWidget(nsnull) : nsnull); - } + nsCOMPtr pc; + cv->GetPresContext(getter_AddRefs(pc)); + nsDeviceContext* dc = pc ? pc->DeviceContext() : nsnull; + if (dc) { + nsIView* v = cv->FindContainerView(); + dc->Init(v ? v->GetNearestWidget(nsnull) : nsnull); } nsCOMPtr prev; cv->GetPreviousViewer(getter_AddRefs(prev)); diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index 4b2ecb499fb4..664acfbeecc5 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -51,6 +51,8 @@ /* rendering object for textual content of elements */ +#include "mozilla/Util.h" + #include "nsCOMPtr.h" #include "nsHTMLParts.h" #include "nsCRT.h" @@ -3213,7 +3215,7 @@ nsTextPaintStyle::nsTextPaintStyle(nsTextFrame* aFrame) mInitCommonColors(PR_FALSE), mInitSelectionColors(PR_FALSE) { - for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(mSelectionStyle); i++) + for (PRUint32 i = 0; i < ArrayLength(mSelectionStyle); i++) mSelectionStyle[i].mInit = PR_FALSE; } @@ -7606,6 +7608,11 @@ nsresult nsTextFrame::GetRenderedText(nsAString* aAppendToString, textFrame = static_cast(textFrame->GetNextContinuation())) { // For each text frame continuation in this block ... + if (textFrame->GetStateBits() & NS_FRAME_IS_DIRTY) { + // We don't trust dirty frames, expecially when computing rendered text. + break; + } + // Ensure the text run and grab the gfxSkipCharsIterator for it gfxSkipCharsIterator iter = textFrame->EnsureTextRun(); if (!textFrame->mTextRun) diff --git a/layout/generic/nsTextRunTransformations.cpp b/layout/generic/nsTextRunTransformations.cpp index 05d76359e5e7..d9bf31939642 100644 --- a/layout/generic/nsTextRunTransformations.cpp +++ b/layout/generic/nsTextRunTransformations.cpp @@ -99,6 +99,28 @@ nsTransformedTextRun::SetPotentialLineBreaks(PRUint32 aStart, PRUint32 aLength, return changed; } +PRUint64 +nsTransformedTextRun::ComputeSize() +{ + PRUint32 total = gfxTextRun::ComputeSize(); + if (moz_malloc_usable_size(this) == 0) { + total += sizeof(nsTransformedTextRun) - sizeof(gfxTextRun); + } + total += mStyles.SizeOf(); + total += mCapitalize.SizeOf(); + if (mOwnsFactory) { + PRUint32 factorySize = moz_malloc_usable_size(mFactory); + if (factorySize == 0) { + // this may not quite account for everything + // (e.g. nsCaseTransformTextRunFactory adds a couple of members) + // but I'm not sure it's worth the effort to track more precisely + factorySize = sizeof(nsTransformingTextRunFactory); + } + total += factorySize; + } + return total; +} + nsTransformedTextRun* nsTransformingTextRunFactory::MakeTextRun(const PRUnichar* aString, PRUint32 aLength, const gfxTextRunFactory::Parameters* aParams, diff --git a/layout/generic/nsTextRunTransformations.h b/layout/generic/nsTextRunTransformations.h index 54b59d0ce6f7..50c051cd0c3a 100644 --- a/layout/generic/nsTextRunTransformations.h +++ b/layout/generic/nsTextRunTransformations.h @@ -132,6 +132,9 @@ public: } } + // override the gfxTextRun impl to account for additional members here + virtual PRUint64 ComputeSize(); + nsTransformingTextRunFactory *mFactory; nsTArray > mStyles; nsTArray mCapitalize; diff --git a/layout/inspector/src/inDOMView.cpp b/layout/inspector/src/inDOMView.cpp index 02f2e27fd5d6..6bb8e7cf16d3 100644 --- a/layout/inspector/src/inDOMView.cpp +++ b/layout/inspector/src/inDOMView.cpp @@ -36,6 +36,8 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/Util.h" + #include "inDOMView.h" #include "inIDOMUtils.h" @@ -64,7 +66,7 @@ #include "nsIAccessibilityService.h" #endif -namespace dom = mozilla::dom; +using namespace mozilla; //////////////////////////////////////////////////////////////////////// // inDOMViewNode @@ -140,7 +142,7 @@ inDOMView::~inDOMView() /* static */ void inDOMView::InitAtoms() { - NS_RegisterStaticAtoms(Atoms_info, NS_ARRAY_LENGTH(Atoms_info)); + NS_RegisterStaticAtoms(Atoms_info, ArrayLength(Atoms_info)); } //////////////////////////////////////////////////////////////////////// diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index 0c616cf9c1a1..245a203379bc 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -154,7 +154,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro #include "nsIDOMHTMLImageElement.h" #include "nsIContentViewerContainer.h" #include "nsIContentViewer.h" -#include "nsIDocumentViewer.h" #include "nsIDocumentViewerPrint.h" #include "nsPIDOMWindow.h" @@ -1914,9 +1913,9 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO) documentIsTopLevel = PR_TRUE; if (mIsCreatingPrintPreview) { - nsCOMPtr dv = do_QueryInterface(mDocViewerPrint); - if (dv) { - parentView = dv->FindContainerView(); + nsCOMPtr cv = do_QueryInterface(mDocViewerPrint); + if (cv) { + parentView = cv->FindContainerView(); } } } diff --git a/layout/reftests/canvas/693610-1-notref.html b/layout/reftests/canvas/693610-1-notref.html new file mode 100644 index 000000000000..6f2642da1e13 --- /dev/null +++ b/layout/reftests/canvas/693610-1-notref.html @@ -0,0 +1,18 @@ + + + + + + +

+ + + diff --git a/layout/reftests/canvas/693610-1.html b/layout/reftests/canvas/693610-1.html new file mode 100644 index 000000000000..77745ae5f587 --- /dev/null +++ b/layout/reftests/canvas/693610-1.html @@ -0,0 +1,16 @@ + + + + + + +

+ + + diff --git a/layout/reftests/canvas/reftest.list b/layout/reftests/canvas/reftest.list index 9298988b6d41..6c44daf407fc 100644 --- a/layout/reftests/canvas/reftest.list +++ b/layout/reftests/canvas/reftest.list @@ -67,3 +67,6 @@ fails == ctm-singular-sanity.html data:text/html,Pass # Bug 612033 fails-if(cocoaWidget) == 672646-alpha-radial-gradient.html 672646-alpha-radial-gradient-ref.html # Bug 673333 == 674003-alpha-radial-gradient-superlum.html 674003-alpha-radial-gradient-superlum-ref.html + +!= 693610-1.html 693610-1-notref.html # bug 693610: multiple glyph runs should not be overprinted + diff --git a/layout/reftests/editor/reftest.list b/layout/reftests/editor/reftest.list index 951c1f347dc9..e534f46c9c93 100644 --- a/layout/reftests/editor/reftest.list +++ b/layout/reftests/editor/reftest.list @@ -18,18 +18,32 @@ needs-focus == passwd-4.html passwd-ref.html == emptypasswd-2.html emptypasswd-ref.html == caret_on_positioned.html caret_on_positioned-ref.html fails-if(Android) != spellcheck-input-disabled.html spellcheck-input-ref.html -== spellcheck-input-attr-before.html spellcheck-input-ref.html -== spellcheck-input-attr-after.html spellcheck-input-ref.html -== spellcheck-input-attr-inherit.html spellcheck-input-ref.html -== spellcheck-input-attr-dynamic.html spellcheck-input-ref.html -== spellcheck-input-attr-dynamic-inherit.html spellcheck-input-ref.html -== spellcheck-input-property-dynamic.html spellcheck-input-ref.html -== spellcheck-input-property-dynamic-inherit.html spellcheck-input-ref.html -== spellcheck-input-attr-dynamic-override.html spellcheck-input-ref.html -== spellcheck-input-attr-dynamic-override-inherit.html spellcheck-input-ref.html -== spellcheck-input-property-dynamic-override.html spellcheck-input-ref.html -== spellcheck-input-property-dynamic-override-inherit.html spellcheck-input-ref.html -== spellcheck-textarea-attr.html spellcheck-textarea-ref.html +== spellcheck-input-attr-before.html spellcheck-input-nofocus-ref.html +!= spellcheck-input-attr-before.html spellcheck-input-ref.html +== spellcheck-input-attr-after.html spellcheck-input-nofocus-ref.html +!= spellcheck-input-attr-after.html spellcheck-input-ref.html +== spellcheck-input-attr-inherit.html spellcheck-input-nofocus-ref.html +!= spellcheck-input-attr-inherit.html spellcheck-input-ref.html +== spellcheck-input-attr-dynamic.html spellcheck-input-nofocus-ref.html +!= spellcheck-input-attr-dynamic.html spellcheck-input-ref.html +== spellcheck-input-attr-dynamic-inherit.html spellcheck-input-nofocus-ref.html +!= spellcheck-input-attr-dynamic-inherit.html spellcheck-input-ref.html +== spellcheck-input-property-dynamic.html spellcheck-input-nofocus-ref.html +!= spellcheck-input-property-dynamic.html spellcheck-input-ref.html +== spellcheck-input-property-dynamic-inherit.html spellcheck-input-nofocus-ref.html +!= spellcheck-input-property-dynamic-inherit.html spellcheck-input-ref.html +== spellcheck-input-attr-dynamic-override.html spellcheck-input-nofocus-ref.html +!= spellcheck-input-attr-dynamic-override.html spellcheck-input-ref.html +== spellcheck-input-attr-dynamic-override-inherit.html spellcheck-input-nofocus-ref.html +!= spellcheck-input-attr-dynamic-override-inherit.html spellcheck-input-ref.html +== spellcheck-input-property-dynamic-override.html spellcheck-input-nofocus-ref.html +!= spellcheck-input-property-dynamic-override.html spellcheck-input-ref.html +== spellcheck-input-property-dynamic-override-inherit.html spellcheck-input-nofocus-ref.html +!= spellcheck-input-property-dynamic-override-inherit.html spellcheck-input-ref.html +== spellcheck-textarea-attr.html spellcheck-textarea-nofocus-ref.html +!= spellcheck-textarea-attr.html spellcheck-textarea-ref.html +== spellcheck-textarea-focused.html spellcheck-textarea-ref.html +!= spellcheck-textarea-nofocus.html spellcheck-textarea-ref.html fails-if(Android) != spellcheck-textarea-disabled.html spellcheck-textarea-ref.html fails-if(Android) != spellcheck-textarea-attr-inherit.html spellcheck-textarea-ref.html fails-if(Android) != spellcheck-textarea-attr-dynamic.html spellcheck-textarea-ref.html diff --git a/layout/reftests/editor/spellcheck-input-nofocus-ref.html b/layout/reftests/editor/spellcheck-input-nofocus-ref.html new file mode 100644 index 000000000000..1e878b5d151f --- /dev/null +++ b/layout/reftests/editor/spellcheck-input-nofocus-ref.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/layout/reftests/editor/spellcheck-textarea-focused.html b/layout/reftests/editor/spellcheck-textarea-focused.html new file mode 100644 index 000000000000..ab0741a1289b --- /dev/null +++ b/layout/reftests/editor/spellcheck-textarea-focused.html @@ -0,0 +1,12 @@ + + + + + + + + + \ No newline at end of file diff --git a/layout/reftests/editor/spellcheck-textarea-nofocus-ref.html b/layout/reftests/editor/spellcheck-textarea-nofocus-ref.html new file mode 100644 index 000000000000..8d993983eba7 --- /dev/null +++ b/layout/reftests/editor/spellcheck-textarea-nofocus-ref.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/layout/reftests/editor/spellcheck-textarea-nofocus.html b/layout/reftests/editor/spellcheck-textarea-nofocus.html new file mode 100644 index 000000000000..a1ce1a0a98a3 --- /dev/null +++ b/layout/reftests/editor/spellcheck-textarea-nofocus.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/layout/reftests/editor/spellcheck-textarea-ref.html b/layout/reftests/editor/spellcheck-textarea-ref.html index 8d993983eba7..5e492c953b1d 100644 --- a/layout/reftests/editor/spellcheck-textarea-ref.html +++ b/layout/reftests/editor/spellcheck-textarea-ref.html @@ -2,5 +2,9 @@ + diff --git a/layout/reftests/selection/splitText-normalize.js b/layout/reftests/selection/splitText-normalize.js index c0b1e976e339..820c2bd2112d 100644 --- a/layout/reftests/selection/splitText-normalize.js +++ b/layout/reftests/selection/splitText-normalize.js @@ -16,6 +16,7 @@ var tests = [ [ {endNode:1}, [0,4], "012345678", "" ], [ {endNode:1}, [0,4], "01234567", "8" ], [ {endNode:1}, [1,4], "0", "12345678" ], + [ {startOffset:1,endNode:1}, [0,0], "0", "12345678" ], [ {endNode:2}, [1,4], "0", "12345", "678" ], ] diff --git a/layout/reftests/svg/dynamic-text-05.svg b/layout/reftests/svg/dynamic-text-05.svg new file mode 100644 index 000000000000..5c4e679fce5c --- /dev/null +++ b/layout/reftests/svg/dynamic-text-05.svg @@ -0,0 +1,21 @@ + + + + Testcase for text removal + + + + SHOULD NOT SEE ME + diff --git a/layout/reftests/svg/filter-extref-differentOrigin-01.svg b/layout/reftests/svg/filter-extref-differentOrigin-01.svg new file mode 100644 index 000000000000..c10d5b89fdde --- /dev/null +++ b/layout/reftests/svg/filter-extref-differentOrigin-01.svg @@ -0,0 +1,12 @@ + + + + + + + diff --git a/layout/reftests/svg/mask-extref-dataURI-01.svg b/layout/reftests/svg/mask-extref-dataURI-01.svg new file mode 100644 index 000000000000..b79258fb1763 --- /dev/null +++ b/layout/reftests/svg/mask-extref-dataURI-01.svg @@ -0,0 +1,38 @@ + + + +]> + + + Testcase for bug 686013: CSS mask targeting a fragment in a data URI + + + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index ce2ec1c6a2e7..e61793b183a9 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -93,6 +93,7 @@ fails-if(Android) == dynamic-switch-01.svg pass.svg # bug 652050 == dynamic-text-02.svg dynamic-text-02-ref.svg == dynamic-text-03.svg dynamic-text-03-ref.svg fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == dynamic-text-04.svg dynamic-text-04-ref.svg # bug 421587 for WinXP +== dynamic-text-05.svg pass.svg == dynamic-textPath-01.svg dynamic-textPath-01-ref.svg == dynamic-use-01.svg pass.svg == dynamic-use-02.svg pass.svg @@ -105,6 +106,7 @@ random == dynamic-use-nested-01.svg dynamic-use-nested-01-ref.svg # bug 467498 == use-01.svg pass.svg == use-01-extref.svg pass.svg == use-02-extref.svg use-02-extref-ref.svg +== use-extref-dataURI-01.svg pass.svg == use-children.svg pass.svg == fallback-color-01a.svg pass.svg == fallback-color-01b.svg pass.svg @@ -116,6 +118,7 @@ random == dynamic-use-nested-01.svg dynamic-use-nested-01-ref.svg # bug 467498 == filter-basic-03.svg pass.svg == filter-bounds-01.svg pass.svg == filter-bounds-02.svg pass.svg +== filter-extref-differentOrigin-01.svg pass.svg == filter-foreignObject-01.svg pass.svg == filter-invalidation-01.svg pass.svg == filter-scaled-01.svg pass.svg @@ -146,6 +149,7 @@ fails == inline-in-xul-basic-01.xul pass.svg == marker-viewBox-01.svg marker-viewBox-01-ref.svg == mask-basic-01.svg pass.svg == mask-basic-02.svg mask-basic-02-ref.svg +== mask-extref-dataURI-01.svg pass.svg == mask-containing-masked-content-01.svg pass.svg == mask-transformed-01.svg mask-transformed-01-ref.svg == nested-viewBox-01.svg pass.svg @@ -195,6 +199,7 @@ fails-if(Android&&layersOpenGL) == path-04.svg pass.svg == rect-with-rx-and-ry-01.svg pass.svg == rect-with-rx-or-ry-01.svg rect-with-rx-or-ry-01-ref.svg == rootElement-null-01.svg pass.svg +== script-empty-01.svg pass.svg == selector-01.svg pass.svg == stroke-width-percentage-01.svg pass.svg == style-property-not-on-script-element-01.svg pass.svg diff --git a/layout/reftests/svg/script-empty-01.svg b/layout/reftests/svg/script-empty-01.svg new file mode 100644 index 000000000000..528f6a8aadf2 --- /dev/null +++ b/layout/reftests/svg/script-empty-01.svg @@ -0,0 +1,14 @@ + + + + Testcase for that xlink:href attribute overrides script content + + + + + diff --git a/layout/reftests/svg/use-extref-dataURI-01.svg b/layout/reftests/svg/use-extref-dataURI-01.svg new file mode 100644 index 000000000000..3274a21264c4 --- /dev/null +++ b/layout/reftests/svg/use-extref-dataURI-01.svg @@ -0,0 +1,12 @@ + + + + Testcase for bug 686013: <use> targeting a fragment in a data URI + + + + diff --git a/layout/reftests/text-overflow/bidi-simple-scrolled.html b/layout/reftests/text-overflow/bidi-simple-scrolled.html index 5036958687c8..489535ab83f3 100644 --- a/layout/reftests/text-overflow/bidi-simple-scrolled.html +++ b/layout/reftests/text-overflow/bidi-simple-scrolled.html @@ -17,7 +17,7 @@ html,body { } .test { overflow:auto; - text-overflow:ellipsis; + text-overflow:ellipsis ellipsis; white-space:nowrap; width: 4.4em; margin-bottom:1em; diff --git a/layout/reftests/text-overflow/ellipsis-font-fallback.html b/layout/reftests/text-overflow/ellipsis-font-fallback.html index 4e4c32e4864c..f02d569d0a6c 100644 --- a/layout/reftests/text-overflow/ellipsis-font-fallback.html +++ b/layout/reftests/text-overflow/ellipsis-font-fallback.html @@ -31,7 +31,7 @@ html,body { } .o { - text-overflow: ellipsis; + text-overflow: ellipsis ellipsis; color:blue; } .o span { diff --git a/layout/reftests/text-overflow/false-marker-overlap.html b/layout/reftests/text-overflow/false-marker-overlap.html index 55ead4533cf7..28720226c093 100644 --- a/layout/reftests/text-overflow/false-marker-overlap.html +++ b/layout/reftests/text-overflow/false-marker-overlap.html @@ -19,7 +19,7 @@ html,body { .test { overflow: hidden; white-space: nowrap; - text-overflow: ellipsis; + text-overflow: ellipsis ellipsis; color: black; height: 6em; width: 32.5em; diff --git a/layout/reftests/text-overflow/marker-basic-ref.html b/layout/reftests/text-overflow/marker-basic-ref.html index 42736eee178e..6f10b17a6323 100644 --- a/layout/reftests/text-overflow/marker-basic-ref.html +++ b/layout/reftests/text-overflow/marker-basic-ref.html @@ -134,6 +134,8 @@ x1 m { position:absolute; right:0; font-size:16px; } #test9b { top:320px; left:100px; position:absolute; border:1px solid black; } #test9c { top:320px; left:200px; position:absolute; border:1px solid black; } #test9d { top:320px; left:300px; position:absolute; border:1px solid black; } +#test10a { top:360px; left:0; position:absolute; } +#test10b { top:360px; left:100px; position:absolute; } @@ -299,6 +301,9 @@ x1 m { position:absolute; right:0; font-size:16px; }
    
    
+ +
||||||
+
||||||
diff --git a/layout/reftests/text-overflow/marker-basic.html b/layout/reftests/text-overflow/marker-basic.html index 9f67d0260852..4f4afb667cf0 100644 --- a/layout/reftests/text-overflow/marker-basic.html +++ b/layout/reftests/text-overflow/marker-basic.html @@ -30,7 +30,7 @@ html,body { } .o { - text-overflow: ellipsis; + text-overflow: ellipsis ellipsis; } .rel { @@ -50,6 +50,9 @@ html,body { white-space:nowrap; font-size:16px; } +.auto { + overflow: auto; +} .r { text-align:right; } @@ -131,6 +134,8 @@ i { #test9b { top:320px; left:100px; position:absolute; border:1px solid black; } #test9c { top:320px; left:200px; position:absolute; border:1px solid black; } #test9d { top:320px; left:300px; position:absolute; border:1px solid black; } +#test10a { top:360px; left:0; position:absolute; } +#test10b { top:360px; left:100px; position:absolute; } @@ -191,7 +196,10 @@ i {
    |||
    |||
- + +
||||||
+
||||||
+ diff --git a/layout/reftests/text-overflow/marker-string.html b/layout/reftests/text-overflow/marker-string.html index 3cfee6e7fda9..356ae14c2f2f 100644 --- a/layout/reftests/text-overflow/marker-string.html +++ b/layout/reftests/text-overflow/marker-string.html @@ -44,9 +44,9 @@ s { direction:ltr; } -.t1 { text-overflow:""; } -.t2 { text-overflow:"Hello World"; } -.t3 { text-overflow:"X"; } +.t1 { text-overflow:"" ""; } +.t2 { text-overflow:"Hello World" "Hello World"; } +.t3 { text-overflow:"X" "X"; } diff --git a/layout/reftests/text-overflow/reftest.list b/layout/reftests/text-overflow/reftest.list index 1b72f667f5e9..bc2573f54f06 100644 --- a/layout/reftests/text-overflow/reftest.list +++ b/layout/reftests/text-overflow/reftest.list @@ -19,3 +19,4 @@ skip-if(Android) == clipped-elements.html clipped-elements-ref.html == theme-overflow.html theme-overflow-ref.html HTTP(..) == table-cell.html table-cell-ref.html HTTP(..) == two-value-syntax.html two-value-syntax-ref.html +HTTP(..) == single-value.html single-value-ref.html diff --git a/layout/reftests/text-overflow/selection.html b/layout/reftests/text-overflow/selection.html index 4115e31f4a3c..7cba2c6652fb 100644 --- a/layout/reftests/text-overflow/selection.html +++ b/layout/reftests/text-overflow/selection.html @@ -23,7 +23,7 @@ html,body { .test { overflow:auto; - text-overflow:ellipsis; + text-overflow:ellipsis ellipsis; white-space:nowrap; width: 5em; position:relative; diff --git a/layout/reftests/text-overflow/single-value-ref.html b/layout/reftests/text-overflow/single-value-ref.html new file mode 100644 index 000000000000..85a751741121 --- /dev/null +++ b/layout/reftests/text-overflow/single-value-ref.html @@ -0,0 +1,105 @@ + + + +text-overflow: <single value>, scrolled and non-scrolled tests, (bug 684266) + + + + + + + +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ + +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ +
+ +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ + +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+
+ + + + diff --git a/layout/reftests/text-overflow/single-value.html b/layout/reftests/text-overflow/single-value.html new file mode 100644 index 000000000000..d2e35baccb52 --- /dev/null +++ b/layout/reftests/text-overflow/single-value.html @@ -0,0 +1,98 @@ + + + +text-overflow: <single value>, scrolled and non-scrolled tests, (bug 684266) + + + + + + + +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ + +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ +
+ +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ + +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+ +
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:auto)
+
A long line that does not break (overflow:scroll)
+
+ + + + diff --git a/layout/reftests/text-overflow/theme-overflow.html b/layout/reftests/text-overflow/theme-overflow.html index 80dcb3abbd9c..77f9019f5907 100644 --- a/layout/reftests/text-overflow/theme-overflow.html +++ b/layout/reftests/text-overflow/theme-overflow.html @@ -7,7 +7,7 @@ + + +
+The spaces should not have shadows! +
+ + diff --git a/layout/reftests/text-shadow/text-shadow-on-space-1.html b/layout/reftests/text-shadow/text-shadow-on-space-1.html new file mode 100644 index 000000000000..7433dad35ee6 --- /dev/null +++ b/layout/reftests/text-shadow/text-shadow-on-space-1.html @@ -0,0 +1,17 @@ + + + + + + +
+The spaces should not have shadows! +       +
+ + diff --git a/layout/reftests/transform-3d/preserve3d-2-ref.html b/layout/reftests/transform-3d/preserve3d-2-ref.html new file mode 100644 index 000000000000..1a396bcc8077 --- /dev/null +++ b/layout/reftests/transform-3d/preserve3d-2-ref.html @@ -0,0 +1,27 @@ + + + + + +
+
+
+
+
+ + diff --git a/layout/reftests/transform-3d/preserve3d-2a.html b/layout/reftests/transform-3d/preserve3d-2a.html new file mode 100644 index 000000000000..3bdd7ab8d2cd --- /dev/null +++ b/layout/reftests/transform-3d/preserve3d-2a.html @@ -0,0 +1,28 @@ + + + + + +
+
+
+
+
+ + diff --git a/layout/reftests/transform-3d/preserve3d-2b.html b/layout/reftests/transform-3d/preserve3d-2b.html new file mode 100644 index 000000000000..36d1827dee8d --- /dev/null +++ b/layout/reftests/transform-3d/preserve3d-2b.html @@ -0,0 +1,28 @@ + + + + + +
+
+
+
+
+ + diff --git a/layout/reftests/transform-3d/preserve3d-2c.html b/layout/reftests/transform-3d/preserve3d-2c.html new file mode 100644 index 000000000000..cc8ff8a0a436 --- /dev/null +++ b/layout/reftests/transform-3d/preserve3d-2c.html @@ -0,0 +1,28 @@ + + + + + +
+
+
+
+
+ + diff --git a/layout/reftests/transform-3d/preserve3d-2d.html b/layout/reftests/transform-3d/preserve3d-2d.html new file mode 100644 index 000000000000..6cfe1e3bde2d --- /dev/null +++ b/layout/reftests/transform-3d/preserve3d-2d.html @@ -0,0 +1,30 @@ + + + + + +
+
+
+
+
+ + diff --git a/layout/reftests/transform-3d/reftest.list b/layout/reftests/transform-3d/reftest.list index 6992a9095e67..dc6df100f28c 100644 --- a/layout/reftests/transform-3d/reftest.list +++ b/layout/reftests/transform-3d/reftest.list @@ -12,6 +12,10 @@ fails == preserve3d-1a.html preserve3d-1-ref.html == preserve3d-1b.html about:blank == preserve3d-clipped.html about:blank +== preserve3d-2a.html preserve3d-2-ref.html +== preserve3d-2b.html preserve3d-2-ref.html +== preserve3d-2c.html preserve3d-2-ref.html +== preserve3d-2d.html preserve3d-2-ref.html == scale3d-z.html scalez-1-ref.html == scale3d-all.html scale3d-1-ref.html == scale3d-xz.html scale3d-2-ref.html diff --git a/layout/reftests/webm-video/bug686957-ref.html b/layout/reftests/webm-video/bug686957-ref.html new file mode 100644 index 000000000000..bf305f39fd89 --- /dev/null +++ b/layout/reftests/webm-video/bug686957-ref.html @@ -0,0 +1,12 @@ + + + + +