Merge last PGO-green inbound changeset to m-c.
|
@ -258,45 +258,36 @@ nsCoreUtils::IsAncestorOf(nsINode *aPossibleAncestorNode,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame,
|
||||
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
|
||||
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
|
||||
nsCoreUtils::ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
|
||||
PRUint32 aScrollType)
|
||||
{
|
||||
nsIPresShell::ScrollAxis vertical, horizontal;
|
||||
ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal);
|
||||
|
||||
return ScrollSubstringTo(aFrame, aStartNode, aStartIndex, aEndNode, aEndIndex,
|
||||
vertical, horizontal);
|
||||
return ScrollSubstringTo(aFrame, aRange, vertical, horizontal);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame,
|
||||
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
|
||||
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
|
||||
nsCoreUtils::ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
|
||||
nsIPresShell::ScrollAxis aVertical,
|
||||
nsIPresShell::ScrollAxis aHorizontal)
|
||||
{
|
||||
if (!aFrame || !aStartNode || !aEndNode)
|
||||
if (!aFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsPresContext *presContext = aFrame->PresContext();
|
||||
|
||||
nsRefPtr<nsIDOMRange> scrollToRange = new nsRange();
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
aFrame->GetSelectionController(presContext, getter_AddRefs(selCon));
|
||||
NS_ENSURE_TRUE(selCon, NS_ERROR_FAILURE);
|
||||
|
||||
scrollToRange->SetStart(aStartNode, aStartIndex);
|
||||
scrollToRange->SetEnd(aEndNode, aEndIndex);
|
||||
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_ACCESSIBILITY,
|
||||
getter_AddRefs(selection));
|
||||
|
||||
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(selection));
|
||||
selection->RemoveAllRanges();
|
||||
selection->AddRange(scrollToRange);
|
||||
selection->AddRange(aRange);
|
||||
|
||||
privSel->ScrollIntoViewInternal(
|
||||
nsISelectionController::SELECTION_ANCHOR_REGION,
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "nsPoint.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsRange;
|
||||
|
||||
/**
|
||||
* Core utils.
|
||||
*/
|
||||
|
@ -129,31 +131,21 @@ public:
|
|||
* nsIAccessibleText::scrollSubstringTo().
|
||||
*
|
||||
* @param aFrame the frame for accessible the range belongs to.
|
||||
* @param aStartNode start node of a range
|
||||
* @param aStartOffset an offset inside the start node
|
||||
* @param aEndNode end node of a range
|
||||
* @param aEndOffset an offset inside the end node
|
||||
* @param aRange the range to scroll to
|
||||
* @param aScrollType the place a range should be scrolled to
|
||||
*/
|
||||
static nsresult ScrollSubstringTo(nsIFrame *aFrame,
|
||||
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
|
||||
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
|
||||
static nsresult ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
|
||||
PRUint32 aScrollType);
|
||||
|
||||
/** Helper method to scroll range into view, used for implementation of
|
||||
* nsIAccessibleText::scrollSubstringTo[Point]().
|
||||
*
|
||||
* @param aFrame the frame for accessible the range belongs to.
|
||||
* @param aStartNode start node of a range
|
||||
* @param aStartOffset an offset inside the start node
|
||||
* @param aEndNode end node of a range
|
||||
* @param aEndOffset an offset inside the end node
|
||||
* @param aRange the range to scroll to
|
||||
* @param aVertical how to align vertically, specified in percents, and when.
|
||||
* @param aHorizontal how to align horizontally, specified in percents, and when.
|
||||
*/
|
||||
static nsresult ScrollSubstringTo(nsIFrame *aFrame,
|
||||
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
|
||||
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
|
||||
static nsresult ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
|
||||
nsIPresShell::ScrollAxis aVertical,
|
||||
nsIPresShell::ScrollAxis aHorizontal);
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsTextFragment.h"
|
||||
#include "mozilla/Selection.h"
|
||||
#include "gfxSkipChars.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -519,9 +519,7 @@ HyperTextAccessible::DOMPointToHypertextOffset(nsINode* aNode,
|
|||
// For text nodes, aNodeOffset comes in as a character offset
|
||||
// Text offset will be added at the end, if we find the offset in this hypertext
|
||||
// We want the "skipped" offset into the text (rendered text without the extra whitespace)
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
NS_ASSERTION(content, "No nsIContent for dom node");
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
nsIFrame *frame = aNode->AsContent()->GetPrimaryFrame();
|
||||
NS_ENSURE_TRUE(frame, nsnull);
|
||||
nsresult rv = ContentToRenderedOffset(frame, aNodeOffset, &addTextOffset);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
@ -631,38 +629,11 @@ HyperTextAccessible::DOMPointToHypertextOffset(nsINode* aNode,
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
HyperTextAccessible::HypertextOffsetToDOMPoint(PRInt32 aHTOffset,
|
||||
nsIDOMNode** aNode,
|
||||
PRInt32* aOffset)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> endNode;
|
||||
PRInt32 endOffset;
|
||||
|
||||
return HypertextOffsetsToDOMRange(aHTOffset, aHTOffset, aNode, aOffset,
|
||||
getter_AddRefs(endNode), &endOffset);
|
||||
}
|
||||
|
||||
nsresult
|
||||
HyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
|
||||
PRInt32 aEndHTOffset,
|
||||
nsIDOMNode** aStartNode,
|
||||
PRInt32* aStartOffset,
|
||||
nsIDOMNode** aEndNode,
|
||||
PRInt32* aEndOffset)
|
||||
nsRange* aRange)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStartNode);
|
||||
*aStartNode = nsnull;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aStartOffset);
|
||||
*aStartOffset = -1;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aEndNode);
|
||||
*aEndNode = nsnull;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aEndOffset);
|
||||
*aEndOffset = -1;
|
||||
|
||||
// If the given offsets are 0 and associated editor is empty then return
|
||||
// collapsed range with editor root element as range container.
|
||||
if (aStartHTOffset == 0 && aEndHTOffset == 0) {
|
||||
|
@ -674,11 +645,10 @@ HyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
|
|||
nsCOMPtr<nsIDOMElement> editorRootElm;
|
||||
editor->GetRootElement(getter_AddRefs(editorRootElm));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> editorRoot(do_QueryInterface(editorRootElm));
|
||||
nsCOMPtr<nsINode> editorRoot(do_QueryInterface(editorRootElm));
|
||||
if (editorRoot) {
|
||||
*aStartOffset = *aEndOffset = 0;
|
||||
NS_ADDREF(*aStartNode = editorRoot);
|
||||
NS_ADDREF(*aEndNode = editorRoot);
|
||||
aRange->SetStart(editorRoot, 0);
|
||||
aRange->SetEnd(editorRoot, 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -695,28 +665,21 @@ HyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
|
|||
if (!startAcc || !endAcc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> startNode, endNode;
|
||||
DOMPoint startPoint, endPoint;
|
||||
nsresult rv = GetDOMPointByFrameOffset(startFrame, startOffset, startAcc,
|
||||
getter_AddRefs(startNode),
|
||||
&startOffset);
|
||||
&startPoint);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aStartHTOffset != aEndHTOffset) {
|
||||
rv = GetDOMPointByFrameOffset(endFrame, endOffset, endAcc,
|
||||
getter_AddRefs(endNode), &endOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
endNode = startNode;
|
||||
endOffset = startOffset;
|
||||
}
|
||||
rv = aRange->SetStart(startPoint.node, startPoint.idx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ADDREF(*aStartNode = startNode);
|
||||
*aStartOffset = startOffset;
|
||||
if (aStartHTOffset == aEndHTOffset)
|
||||
return aRange->SetEnd(startPoint.node, startPoint.idx);
|
||||
|
||||
NS_ADDREF(*aEndNode = endNode);
|
||||
*aEndOffset = endOffset;
|
||||
rv = GetDOMPointByFrameOffset(endFrame, endOffset, endAcc, &endPoint);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
return aRange->SetEnd(endPoint.node, endPoint.idx);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
@ -1552,18 +1515,12 @@ HyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
|
|||
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
|
||||
NS_ENSURE_STATE(frameSelection);
|
||||
|
||||
nsCOMPtr<nsISelection> domSel =
|
||||
Selection* 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<nsIDOMRange> range;
|
||||
domSel->GetRangeAt(1, getter_AddRefs(range));
|
||||
domSel->RemoveRange(range);
|
||||
}
|
||||
for (PRInt32 idx = domSel->GetRangeCount() - 1; idx > 0; idx--)
|
||||
domSel->RemoveRange(domSel->GetRangeAt(idx));
|
||||
|
||||
// When selection is done, move the focus to the selection if accessible is
|
||||
// not focusable. That happens when selection is set within hypertext
|
||||
|
@ -1622,21 +1579,15 @@ HyperTextAccessible::GetCaretOffset(PRInt32* aCaretOffset)
|
|||
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
|
||||
NS_ENSURE_STATE(frameSelection);
|
||||
|
||||
nsISelection* domSel =
|
||||
Selection* domSel =
|
||||
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
NS_ENSURE_STATE(domSel);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> focusDOMNode;
|
||||
nsresult rv = domSel->GetFocusNode(getter_AddRefs(focusDOMNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 focusOffset;
|
||||
rv = domSel->GetFocusOffset(&focusOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsINode* focusNode = domSel->GetFocusNode();
|
||||
PRInt32 focusOffset = domSel->GetFocusOffset();
|
||||
|
||||
// No caret if this DOM node is inside of focused node but the selection's
|
||||
// focus point is not inside of this DOM node.
|
||||
nsCOMPtr<nsINode> focusNode(do_QueryInterface(focusDOMNode));
|
||||
if (focusDisp == FocusManager::eContainedByFocus) {
|
||||
nsINode *resultNode =
|
||||
nsCoreUtils::GetDOMNodeFromDOMPoint(focusNode, focusOffset);
|
||||
|
@ -1660,19 +1611,21 @@ HyperTextAccessible::CaretLineNumber()
|
|||
if (!frameSelection)
|
||||
return -1;
|
||||
|
||||
nsISelection* domSel =
|
||||
Selection* domSel =
|
||||
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
if (!domSel)
|
||||
return - 1;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> caretNode;
|
||||
domSel->GetFocusNode(getter_AddRefs(caretNode));
|
||||
nsCOMPtr<nsIContent> caretContent = do_QueryInterface(caretNode);
|
||||
if (!caretContent || !nsCoreUtils::IsAncestorOf(GetNode(), caretContent))
|
||||
nsINode* caretNode = domSel->GetFocusNode();
|
||||
if (!caretNode || !caretNode->IsContent())
|
||||
return -1;
|
||||
|
||||
PRInt32 caretOffset, returnOffsetUnused;
|
||||
domSel->GetFocusOffset(&caretOffset);
|
||||
nsIContent* caretContent = caretNode->AsContent();
|
||||
if (!nsCoreUtils::IsAncestorOf(GetNode(), caretContent))
|
||||
return -1;
|
||||
|
||||
PRInt32 returnOffsetUnused;
|
||||
PRInt32 caretOffset = domSel->GetFocusOffset();
|
||||
nsFrameSelection::HINT hint = frameSelection->GetHint();
|
||||
nsIFrame *caretFrame = frameSelection->GetFrameForNodeOffset(caretContent, caretOffset,
|
||||
hint, &returnOffsetUnused);
|
||||
|
@ -1733,7 +1686,7 @@ HyperTextAccessible::GetSelectionDOMRanges(PRInt16 aType,
|
|||
if (!frameSelection)
|
||||
return;
|
||||
|
||||
nsISelection* domSel = frameSelection->GetSelection(aType);
|
||||
Selection* domSel = frameSelection->GetSelection(aType);
|
||||
if (!domSel)
|
||||
return;
|
||||
|
||||
|
@ -1750,8 +1703,7 @@ HyperTextAccessible::GetSelectionDOMRanges(PRInt16 aType,
|
|||
return;
|
||||
|
||||
PRUint32 childCount = startNode->GetChildCount();
|
||||
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(domSel));
|
||||
nsresult rv = privSel->
|
||||
nsresult rv = domSel->
|
||||
GetRangesForIntervalArray(startNode, 0, startNode, childCount, true, aRanges);
|
||||
NS_ENSURE_SUCCESS(rv,);
|
||||
|
||||
|
@ -1839,43 +1791,32 @@ HyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
|
|||
PRInt32 aStartOffset,
|
||||
PRInt32 aEndOffset)
|
||||
{
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aSelectionNum < 0)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
|
||||
NS_ENSURE_STATE(frameSelection);
|
||||
|
||||
nsCOMPtr<nsISelection> domSel =
|
||||
Selection* domSel =
|
||||
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
NS_ENSURE_STATE(domSel);
|
||||
|
||||
PRUint32 rangeCount = domSel->GetRangeCount();
|
||||
if (rangeCount < static_cast<PRUint32>(aSelectionNum))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// Caret is a collapsed selection
|
||||
bool isOnlyCaret = (aStartOffset == aEndOffset);
|
||||
|
||||
PRInt32 rangeCount = 0;
|
||||
domSel->GetRangeCount(&rangeCount);
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
if (aSelectionNum == rangeCount) { // Add a range
|
||||
nsRefPtr<nsRange> range;
|
||||
if (aSelectionNum == rangeCount)
|
||||
range = new nsRange();
|
||||
}
|
||||
else if (aSelectionNum < 0 || aSelectionNum > rangeCount) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
else {
|
||||
domSel->GetRangeAt(aSelectionNum, getter_AddRefs(range));
|
||||
NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
|
||||
}
|
||||
else
|
||||
range = domSel->GetRangeAt(aSelectionNum);
|
||||
|
||||
PRInt32 startOffset = 0, endOffset = 0;
|
||||
nsCOMPtr<nsIDOMNode> startNode, endNode;
|
||||
|
||||
nsresult rv = HypertextOffsetsToDOMRange(aStartOffset, aEndOffset,
|
||||
getter_AddRefs(startNode), &startOffset,
|
||||
getter_AddRefs(endNode), &endOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = range->SetStart(startNode, startOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = isOnlyCaret ? range->Collapse(true) :
|
||||
range->SetEnd(endNode, endOffset);
|
||||
nsresult rv = HypertextOffsetsToDOMRange(aStartOffset, aEndOffset, range);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// If new range was created then add it, otherwise notify selection listeners
|
||||
|
@ -1897,14 +1838,11 @@ HyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
|
|||
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
|
||||
NS_ENSURE_STATE(frameSelection);
|
||||
|
||||
nsCOMPtr<nsISelection> domSel =
|
||||
Selection* domSel =
|
||||
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
NS_ENSURE_STATE(domSel);
|
||||
|
||||
PRInt32 rangeCount = 0;
|
||||
domSel->GetRangeCount(&rangeCount);
|
||||
|
||||
return SetSelectionBounds(rangeCount, aStartOffset, aEndOffset);
|
||||
return SetSelectionBounds(domSel->GetRangeCount(), aStartOffset, aEndOffset);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1916,18 +1854,14 @@ HyperTextAccessible::RemoveSelection(PRInt32 aSelectionNum)
|
|||
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
|
||||
NS_ENSURE_STATE(frameSelection);
|
||||
|
||||
nsCOMPtr<nsISelection> domSel =
|
||||
Selection* domSel =
|
||||
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
NS_ENSURE_STATE(domSel);
|
||||
|
||||
PRInt32 rangeCount;
|
||||
domSel->GetRangeCount(&rangeCount);
|
||||
if (aSelectionNum < 0 || aSelectionNum >= rangeCount)
|
||||
if (aSelectionNum < 0 || aSelectionNum >= domSel->GetRangeCount())
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
domSel->GetRangeAt(aSelectionNum, getter_AddRefs(range));
|
||||
return domSel->RemoveRange(range);
|
||||
return domSel->RemoveRange(domSel->GetRangeAt(aSelectionNum));
|
||||
}
|
||||
|
||||
// void nsIAccessibleText::
|
||||
|
@ -1937,18 +1871,14 @@ NS_IMETHODIMP
|
|||
HyperTextAccessible::ScrollSubstringTo(PRInt32 aStartIndex, PRInt32 aEndIndex,
|
||||
PRUint32 aScrollType)
|
||||
{
|
||||
PRInt32 startOffset, endOffset;
|
||||
nsCOMPtr<nsIDOMNode> startNode, endNode;
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex,
|
||||
getter_AddRefs(startNode),
|
||||
&startOffset,
|
||||
getter_AddRefs(endNode),
|
||||
&endOffset);
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
nsresult rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex, range);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return nsCoreUtils::ScrollSubstringTo(GetFrame(), startNode, startOffset,
|
||||
endNode, endOffset, aScrollType);
|
||||
return nsCoreUtils::ScrollSubstringTo(GetFrame(), range, aScrollType);
|
||||
}
|
||||
|
||||
// void nsIAccessibleText::
|
||||
|
@ -1970,12 +1900,8 @@ HyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
|
|||
this, &coords);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 startOffset, endOffset;
|
||||
nsCOMPtr<nsIDOMNode> startNode, endNode;
|
||||
|
||||
rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex,
|
||||
getter_AddRefs(startNode), &startOffset,
|
||||
getter_AddRefs(endNode), &endOffset);
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex, range);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsPresContext *presContext = frame->PresContext();
|
||||
|
@ -2004,9 +1930,7 @@ HyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
|
|||
PRInt16 hPercent = offsetPoint.x * 100 / size.width;
|
||||
PRInt16 vPercent = offsetPoint.y * 100 / size.height;
|
||||
|
||||
rv = nsCoreUtils::ScrollSubstringTo(GetFrame(), startNode, startOffset,
|
||||
endNode, endOffset,
|
||||
vPercent, hPercent);
|
||||
rv = nsCoreUtils::ScrollSubstringTo(frame, range, vPercent, hPercent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
initialScrolled = true;
|
||||
|
@ -2226,16 +2150,12 @@ HyperTextAccessible::GetChildIndexAtOffset(PRUint32 aOffset)
|
|||
// HyperTextAccessible protected
|
||||
|
||||
nsresult
|
||||
HyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame,
|
||||
PRInt32 aOffset,
|
||||
HyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame, PRInt32 aOffset,
|
||||
Accessible* aAccessible,
|
||||
nsIDOMNode** aNode,
|
||||
PRInt32* aNodeOffset)
|
||||
DOMPoint* aPoint)
|
||||
{
|
||||
NS_ENSURE_ARG(aAccessible);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
|
||||
if (!aFrame) {
|
||||
// If the given frame is null then set offset after the DOM node of the
|
||||
// given accessible.
|
||||
|
@ -2247,31 +2167,30 @@ HyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame,
|
|||
|
||||
nsIContent* parent = content->GetParent();
|
||||
|
||||
*aNodeOffset = parent->IndexOf(content) + 1;
|
||||
node = do_QueryInterface(parent);
|
||||
aPoint->idx = parent->IndexOf(content) + 1;
|
||||
aPoint->node = parent;
|
||||
|
||||
} else if (aFrame->GetType() == nsGkAtoms::textFrame) {
|
||||
nsCOMPtr<nsIContent> content(aFrame->GetContent());
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
NS_ENSURE_STATE(content);
|
||||
|
||||
nsIFrame *primaryFrame = content->GetPrimaryFrame();
|
||||
nsresult rv = RenderedToContentOffset(primaryFrame, aOffset, aNodeOffset);
|
||||
nsresult rv = RenderedToContentOffset(primaryFrame, aOffset, &(aPoint->idx));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
node = do_QueryInterface(content);
|
||||
aPoint->node = content;
|
||||
|
||||
} else {
|
||||
nsCOMPtr<nsIContent> content(aFrame->GetContent());
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
NS_ENSURE_STATE(content);
|
||||
|
||||
nsCOMPtr<nsIContent> parent(content->GetParent());
|
||||
nsIContent* parent = content->GetParent();
|
||||
NS_ENSURE_STATE(parent);
|
||||
|
||||
*aNodeOffset = parent->IndexOf(content);
|
||||
node = do_QueryInterface(parent);
|
||||
aPoint->idx = parent->IndexOf(content);
|
||||
aPoint->node = parent;
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aNode = node);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,15 @@
|
|||
#include "nsFrameSelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
struct DOMPoint {
|
||||
nsINode* node;
|
||||
PRInt32 idx;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
enum EGetTextType { eGetBefore=-1, eGetAt=0, eGetAfter=1 };
|
||||
|
||||
// This character marks where in the text returned via nsIAccessibleText(),
|
||||
|
@ -130,33 +139,16 @@ public:
|
|||
PRInt32* aHypertextOffset,
|
||||
bool aIsEndOffset = false);
|
||||
|
||||
/**
|
||||
* Turn a hypertext offsets into DOM point.
|
||||
*
|
||||
* @param aHTOffset [in] the given start hypertext offset
|
||||
* @param aNode [out] start node
|
||||
* @param aOffset [out] offset inside the start node
|
||||
*/
|
||||
nsresult HypertextOffsetToDOMPoint(PRInt32 aHTOffset,
|
||||
nsIDOMNode **aNode,
|
||||
PRInt32 *aOffset);
|
||||
|
||||
/**
|
||||
* Turn a start and end hypertext offsets into DOM range.
|
||||
*
|
||||
* @param aStartHTOffset [in] the given start hypertext offset
|
||||
* @param aEndHTOffset [in] the given end hypertext offset
|
||||
* @param aStartNode [out] start node of the range
|
||||
* @param aStartOffset [out] start offset of the range
|
||||
* @param aEndNode [out] end node of the range
|
||||
* @param aEndOffset [out] end offset of the range
|
||||
* @param aRange [out] the range whose bounds to set
|
||||
*/
|
||||
nsresult HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
|
||||
PRInt32 aEndHTOffset,
|
||||
nsIDOMNode **aStartNode,
|
||||
PRInt32 *aStartOffset,
|
||||
nsIDOMNode **aEndNode,
|
||||
PRInt32 *aEndOffset);
|
||||
nsRange* aRange);
|
||||
|
||||
/**
|
||||
* Return true if the used ARIA role (if any) allows the hypertext accessible
|
||||
|
@ -355,7 +347,7 @@ protected:
|
|||
// Helpers
|
||||
nsresult GetDOMPointByFrameOffset(nsIFrame* aFrame, PRInt32 aOffset,
|
||||
Accessible* aAccessible,
|
||||
nsIDOMNode** aNode, PRInt32* aNodeOffset);
|
||||
mozilla::a11y::DOMPoint* aPoint);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "nsEventListenerManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
|
|
|
@ -155,10 +155,15 @@ __try {
|
|||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
if (NS_FAILED(range->SetStart(mContent, aStartIndex)))
|
||||
return E_FAIL;
|
||||
|
||||
if (NS_FAILED(range->SetEnd(mContent, aEndIndex)))
|
||||
return E_FAIL;
|
||||
|
||||
nsresult rv =
|
||||
nsCoreUtils::ScrollSubstringTo(GetFrame(), DOMNode, aStartIndex,
|
||||
DOMNode, aEndIndex,
|
||||
nsCoreUtils::ScrollSubstringTo(GetFrame(), range,
|
||||
nsIAccessibleScrollType::SCROLL_TYPE_ANYWHERE);
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
|
|
@ -354,22 +354,17 @@
|
|||
<label class="permissionLabel" id="permIndexedDBLabel"
|
||||
value="&permIndexedDB;" control="indexedDBRadioGroup"/>
|
||||
<hbox role="group" aria-labelledby="permIndexedDBLabel">
|
||||
<checkbox id="indexedDBDef" command="cmd_indexedDBDef" label="&permUseDefault;"/>
|
||||
<spacer flex="1"/>
|
||||
<radiogroup id="indexedDBRadioGroup" orient="horizontal">
|
||||
<!-- Ask and Allow are purposefully reversed here! -->
|
||||
<radio id="indexedDB#1" command="cmd_indexedDBToggle" label="&permAskAlways;"/>
|
||||
<radio id="indexedDB#0" command="cmd_indexedDBToggle" label="&permAllow;"/>
|
||||
<radio id="indexedDB#2" command="cmd_indexedDBToggle" label="&permBlock;"/>
|
||||
</radiogroup>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<checkbox id="indexedDBDef" command="cmd_indexedDBDef" label="&permAskAlways;"/>
|
||||
<spacer flex="1"/>
|
||||
<vbox pack="center">
|
||||
<label id="indexedDBStatus" control="indexedDBClear" hidden="true"/>
|
||||
<label id="indexedDBStatus" control="indexedDBClear"/>
|
||||
</vbox>
|
||||
<button id="indexedDBClear" label="&permClearStorage;" hidden="true"
|
||||
<button id="indexedDBClear" label="&permClearStorage;"
|
||||
accesskey="&permClearStorage.accesskey;" onclick="onIndexedDBClear();"/>
|
||||
<radiogroup id="indexedDBRadioGroup" orient="horizontal">
|
||||
<radio id="indexedDB#1" command="cmd_indexedDBToggle" label="&permAllow;"/>
|
||||
<radio id="indexedDB#2" command="cmd_indexedDBToggle" label="&permBlock;"/>
|
||||
</radiogroup>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox class="permission" id="permPluginsRow">
|
||||
|
|
|
@ -51,7 +51,7 @@ var gPermObj = {
|
|||
},
|
||||
indexedDB: function getIndexedDBDefaultPermissions()
|
||||
{
|
||||
return UNKNOWN;
|
||||
return BLOCK;
|
||||
},
|
||||
plugins: function getPluginsDefaultPermissions()
|
||||
{
|
||||
|
@ -149,6 +149,9 @@ function onCheckboxClick(aPartId)
|
|||
var checkbox = document.getElementById(aPartId + "Def");
|
||||
if (checkbox.checked) {
|
||||
permissionManager.remove(gPermURI.host, aPartId);
|
||||
if (aPartId == "indexedDB") {
|
||||
permissionManager.remove(gPermURI.host, "indexedDB-unlimited");
|
||||
}
|
||||
command.setAttribute("disabled", "true");
|
||||
var perm = gPermObj[aPartId]();
|
||||
setRadioState(aPartId, perm);
|
||||
|
@ -168,8 +171,7 @@ function onRadioClick(aPartId)
|
|||
var id = radioGroup.selectedItem.id;
|
||||
var permission = id.split('#')[1];
|
||||
permissionManager.add(gPermURI, aPartId, permission);
|
||||
if (aPartId == "indexedDB" &&
|
||||
(permission == ALLOW || permission == BLOCK)) {
|
||||
if (aPartId == "indexedDB" && permission == BLOCK) {
|
||||
permissionManager.remove(gPermURI.host, "indexedDB-unlimited");
|
||||
}
|
||||
if (aPartId == "fullscreen" && permission == UNKNOWN) {
|
||||
|
@ -205,6 +207,7 @@ function onIndexedDBClear()
|
|||
|
||||
var permissionManager = Components.classes[PERMISSION_CONTRACTID]
|
||||
.getService(nsIPermissionManager);
|
||||
permissionManager.remove(gPermURI.host, "indexedDB");
|
||||
permissionManager.remove(gPermURI.host, "indexedDB-unlimited");
|
||||
initIndexedDBRow();
|
||||
}
|
||||
|
|
|
@ -512,6 +512,14 @@ BrowserElementChild.prototype = {
|
|||
|
||||
if (stateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
|
||||
sendAsyncMsg('loadend');
|
||||
|
||||
if (status == Cr.NS_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO See nsDocShell::DisplayLoadError for a list of all the error
|
||||
// codes (the status param) we should eventually handle here.
|
||||
sendAsyncMsg('error', {type: 'other'});
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -148,6 +148,7 @@ function BrowserElementParent(frameLoader) {
|
|||
addMessageListener("iconchange", this._fireEventFromMsg);
|
||||
addMessageListener("close", this._fireEventFromMsg);
|
||||
addMessageListener("securitychange", this._fireEventFromMsg);
|
||||
addMessageListener("error", this._fireEventFromMsg);
|
||||
addMessageListener("get-mozapp-manifest-url", this._sendMozAppManifestURL);
|
||||
addMessageListener("keyevent", this._fireKeyEvent);
|
||||
addMessageListener("showmodalprompt", this._handleShowModalPrompt);
|
||||
|
|
|
@ -28,6 +28,8 @@ _TEST_FILES = \
|
|||
test_browserElement_inproc_LoadEvents.html \
|
||||
browserElement_DataURI.js \
|
||||
test_browserElement_inproc_DataURI.html \
|
||||
browserElement_ErrorSecurity.js \
|
||||
test_browserElement_inproc_ErrorSecurity.html \
|
||||
browserElement_Titlechange.js \
|
||||
test_browserElement_inproc_Titlechange.html \
|
||||
browserElement_TopBarrier.js \
|
||||
|
@ -77,6 +79,7 @@ ifneq ($(OS_ARCH),WINNT)
|
|||
_TEST_FILES += \
|
||||
test_browserElement_oop_LoadEvents.html \
|
||||
test_browserElement_oop_DataURI.html \
|
||||
test_browserElement_oop_ErrorSecurity.html \
|
||||
test_browserElement_oop_Titlechange.html \
|
||||
test_browserElement_oop_TopBarrier.html \
|
||||
test_browserElement_oop_Iconchange.html \
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/* Any copyright is dedicated to the public domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Bug 764718 - Test that mozbrowsererror works for a security error.
|
||||
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTest() {
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addToWhitelist();
|
||||
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.mozbrowser = true;
|
||||
|
||||
iframe.addEventListener("mozbrowsererror", function(e) {
|
||||
ok(true, "Got mozbrowsererror event.");
|
||||
ok(e.detail.type, "Event's detail has a |type| param.");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
iframe.src = "https://expired.example.com";
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
runTest();
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for mozbrowser</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7" src="browserElement_ErrorSecurity.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for mozbrowser</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7" src="browserElement_ErrorSecurity.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -17,6 +17,7 @@ var testGenerator = testSteps();
|
|||
|
||||
function runTest()
|
||||
{
|
||||
allowIndexedDB();
|
||||
allowUnlimitedQuota();
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -26,6 +27,7 @@ function runTest()
|
|||
function finishTest()
|
||||
{
|
||||
resetUnlimitedQuota();
|
||||
resetIndexedDB();
|
||||
|
||||
SimpleTest.executeSoon(function() {
|
||||
testGenerator.close();
|
||||
|
@ -88,6 +90,16 @@ function removePermission(type, url)
|
|||
SpecialPowers.removePermission(type, url);
|
||||
}
|
||||
|
||||
function allowIndexedDB(url)
|
||||
{
|
||||
addPermission("indexedDB", true, url);
|
||||
}
|
||||
|
||||
function resetIndexedDB(url)
|
||||
{
|
||||
removePermission("indexedDB", url);
|
||||
}
|
||||
|
||||
function allowUnlimitedQuota(url)
|
||||
{
|
||||
addPermission("indexedDB-unlimited", true, url);
|
||||
|
|
|
@ -29,14 +29,6 @@
|
|||
#define TOPIC_PERMISSIONS_PROMPT "indexedDB-permissions-prompt"
|
||||
#define TOPIC_PERMISSIONS_RESPONSE "indexedDB-permissions-response"
|
||||
|
||||
// This is a little confusing, but our default behavior (UNKNOWN_ACTION) is to
|
||||
// allow access without a prompt. If the "indexedDB" permission is set to
|
||||
// ALLOW_ACTION then we will issue a prompt before allowing access. Otherwise
|
||||
// (DENY_ACTION) we deny access.
|
||||
#define PERMISSION_ALLOWED nsIPermissionManager::UNKNOWN_ACTION
|
||||
#define PERMISSION_DENIED nsIPermissionManager::DENY_ACTION
|
||||
#define PERMISSION_PROMPT nsIPermissionManager::ALLOW_ACTION
|
||||
|
||||
using namespace mozilla;
|
||||
USING_INDEXEDDB_NAMESPACE
|
||||
using namespace mozilla::services;
|
||||
|
@ -51,41 +43,40 @@ GetIndexedDBPermissions(const nsACString& aASCIIOrigin,
|
|||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
if (!Preferences::GetBool(PREF_INDEXEDDB_ENABLED)) {
|
||||
return PERMISSION_DENIED;
|
||||
return nsIPermissionManager::DENY_ACTION;
|
||||
}
|
||||
|
||||
// No window here means chrome access.
|
||||
// No window here means chrome access
|
||||
if (!aWindow) {
|
||||
return PERMISSION_ALLOWED;
|
||||
return nsIPermissionManager::ALLOW_ACTION;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> sop(do_QueryInterface(aWindow));
|
||||
NS_ENSURE_TRUE(sop, nsIPermissionManager::DENY_ACTION);
|
||||
|
||||
if (nsContentUtils::IsSystemPrincipal(sop->GetPrincipal())) {
|
||||
return PERMISSION_ALLOWED;
|
||||
return nsIPermissionManager::ALLOW_ACTION;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(aWindow);
|
||||
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(webNav);
|
||||
if (loadContext && loadContext->UsePrivateBrowsing()) {
|
||||
// TODO Support private browsing indexedDB?
|
||||
NS_WARNING("IndexedDB may not be used while in private browsing mode!");
|
||||
return PERMISSION_DENIED;
|
||||
return nsIPermissionManager::DENY_ACTION;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aASCIIOrigin);
|
||||
NS_ENSURE_SUCCESS(rv, PERMISSION_DENIED);
|
||||
NS_ENSURE_SUCCESS(rv, nsIPermissionManager::DENY_ACTION);
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(permissionManager, PERMISSION_DENIED);
|
||||
NS_ENSURE_TRUE(permissionManager, nsIPermissionManager::DENY_ACTION);
|
||||
|
||||
PRUint32 permission;
|
||||
rv = permissionManager->TestPermission(uri, PERMISSION_INDEXEDDB,
|
||||
&permission);
|
||||
NS_ENSURE_SUCCESS(rv, PERMISSION_DENIED);
|
||||
NS_ENSURE_SUCCESS(rv, nsIPermissionManager::DENY_ACTION);
|
||||
|
||||
return permission;
|
||||
}
|
||||
|
@ -111,22 +102,23 @@ CheckPermissionsHelper::Run()
|
|||
// process (if we are in the child process, we have already
|
||||
// set the permission when the prompt was shown in the parent, as
|
||||
// we cannot set the permission from the child).
|
||||
if (permission != PERMISSION_PROMPT &&
|
||||
IndexedDatabaseManager::IsMainProcess()) {
|
||||
if (permission != nsIPermissionManager::UNKNOWN_ACTION &&
|
||||
XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), mASCIIOrigin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
NS_ENSURE_STATE(permissionManager);
|
||||
|
||||
|
||||
rv = permissionManager->Add(uri, PERMISSION_INDEXEDDB, permission,
|
||||
nsIPermissionManager::EXPIRE_NEVER, 0);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
else if (permission == PERMISSION_PROMPT && mPromptAllowed) {
|
||||
else if (permission == nsIPermissionManager::UNKNOWN_ACTION &&
|
||||
mPromptAllowed) {
|
||||
nsCOMPtr<nsIObserverService> obs = GetObserverService();
|
||||
rv = obs->NotifyObservers(static_cast<nsIRunnable*>(this),
|
||||
TOPIC_PERMISSIONS_PROMPT, nsnull);
|
||||
|
@ -141,15 +133,15 @@ CheckPermissionsHelper::Run()
|
|||
nsCOMPtr<nsIDOMWindow> window;
|
||||
window.swap(mWindow);
|
||||
|
||||
if (permission == PERMISSION_ALLOWED) {
|
||||
if (permission == nsIPermissionManager::ALLOW_ACTION) {
|
||||
IndexedDatabaseManager* mgr = IndexedDatabaseManager::Get();
|
||||
NS_ASSERTION(mgr, "This should never be null!");
|
||||
|
||||
return helper->Dispatch(mgr->IOThread());
|
||||
}
|
||||
|
||||
NS_ASSERTION(permission == PERMISSION_PROMPT ||
|
||||
permission == PERMISSION_DENIED,
|
||||
NS_ASSERTION(permission == nsIPermissionManager::UNKNOWN_ACTION ||
|
||||
permission == nsIPermissionManager::DENY_ACTION,
|
||||
"Unknown permission!");
|
||||
|
||||
helper->SetError(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
|
@ -186,27 +178,9 @@ CheckPermissionsHelper::Observe(nsISupports* aSubject,
|
|||
mHasPrompted = true;
|
||||
|
||||
nsresult rv;
|
||||
PRUint32 promptResult = nsDependentString(aData).ToInteger(&rv);
|
||||
mPromptResult = nsDependentString(aData).ToInteger(&rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Have to convert the permission we got from the user to our weird reversed
|
||||
// permission type.
|
||||
switch (promptResult) {
|
||||
case nsIPermissionManager::ALLOW_ACTION:
|
||||
mPromptResult = PERMISSION_ALLOWED;
|
||||
break;
|
||||
case nsIPermissionManager::DENY_ACTION:
|
||||
mPromptResult = PERMISSION_DENIED;
|
||||
break;
|
||||
case nsIPermissionManager::UNKNOWN_ACTION:
|
||||
mPromptResult = PERMISSION_PROMPT;
|
||||
break;
|
||||
|
||||
default:
|
||||
NS_NOTREACHED("Unknown permission type!");
|
||||
mPromptResult = PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
rv = NS_DispatchToCurrentThread(this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ function test()
|
|||
{
|
||||
waitForExplicitFinish();
|
||||
// Avoids the prompt
|
||||
setPermission(testPageURL1, "indexedDB", "unknown");
|
||||
setPermission(testPageURL2, "indexedDB", "unknown");
|
||||
setPermission(testPageURL1, "indexedDB");
|
||||
setPermission(testPageURL2, "indexedDB");
|
||||
executeSoon(test1);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ function test3()
|
|||
Components.classes["@mozilla.org/privatebrowsing;1"]
|
||||
.getService(Components.interfaces.nsIPrivateBrowsingService)
|
||||
.removeDataFromDomain(domains[1]);
|
||||
setPermission(testPageURL4, "indexedDB", "unknown");
|
||||
setPermission(testPageURL4, "indexedDB");
|
||||
executeSoon(test4);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@ const notificationID = "indexedDB-permissions-prompt";
|
|||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
// We want a prompt.
|
||||
setPermission(testPageURL, "indexedDB", "allow");
|
||||
removePermission(testPageURL, "indexedDB");
|
||||
executeSoon(test1);
|
||||
}
|
||||
|
||||
|
@ -28,7 +27,7 @@ function test1()
|
|||
"First database creation was successful");
|
||||
ok(!exception, "No exception");
|
||||
is(getPermission(testPageURL, "indexedDB"),
|
||||
Components.interfaces.nsIPermissionManager.UNKNOWN_ACTION,
|
||||
Components.interfaces.nsIPermissionManager.ALLOW_ACTION,
|
||||
"Correct permission set");
|
||||
gBrowser.removeCurrentTab();
|
||||
executeSoon(test2);
|
||||
|
@ -64,7 +63,7 @@ function test2()
|
|||
"First database creation was successful");
|
||||
ok(!exception, "No exception");
|
||||
is(getPermission(testPageURL, "indexedDB"),
|
||||
Components.interfaces.nsIPermissionManager.UNKNOWN_ACTION,
|
||||
Components.interfaces.nsIPermissionManager.ALLOW_ACTION,
|
||||
"Correct permission set");
|
||||
gBrowser.removeCurrentTab();
|
||||
unregisterAllPopupEventHandlers();
|
||||
|
|
|
@ -10,8 +10,7 @@ const notificationID = "indexedDB-permissions-prompt";
|
|||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
// We want the prompt.
|
||||
setPermission(testPageURL, "indexedDB", "allow");
|
||||
removePermission(testPageURL, "indexedDB");
|
||||
executeSoon(test1);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ const notificationID = "indexedDB-permissions-prompt";
|
|||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
// Avoids the actual prompt
|
||||
setPermission(testPageURL, "indexedDB");
|
||||
executeSoon(test1);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ function test()
|
|||
{
|
||||
waitForExplicitFinish();
|
||||
requestLongerTimeout(10);
|
||||
setPermission(testPageURL, "indexedDB");
|
||||
removePermission(testPageURL, "indexedDB-unlimited");
|
||||
Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
|
||||
executeSoon(test1);
|
||||
|
@ -42,7 +43,7 @@ function test1()
|
|||
"Correct permission set");
|
||||
gBrowser.removeCurrentTab();
|
||||
unregisterAllPopupEventHandlers();
|
||||
executeSoon(finish);
|
||||
executeSoon(test2);
|
||||
});
|
||||
executeSoon(function() { dispatchEvent("indexedDB-done"); });
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ function test()
|
|||
{
|
||||
waitForExplicitFinish();
|
||||
requestLongerTimeout(10);
|
||||
setPermission(testPageURL, "indexedDB");
|
||||
removePermission(testPageURL, "indexedDB-unlimited");
|
||||
Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
|
||||
executeSoon(test1);
|
||||
|
|
|
@ -12,6 +12,7 @@ function test()
|
|||
{
|
||||
waitForExplicitFinish();
|
||||
requestLongerTimeout(10);
|
||||
setPermission(testPageURL, "indexedDB");
|
||||
removePermission(testPageURL, "indexedDB-unlimited");
|
||||
Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
|
||||
executeSoon(test1);
|
||||
|
|
|
@ -12,6 +12,7 @@ function test()
|
|||
{
|
||||
waitForExplicitFinish();
|
||||
requestLongerTimeout(10);
|
||||
setPermission(testPageURL, "indexedDB");
|
||||
removePermission(testPageURL, "indexedDB-unlimited");
|
||||
Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
|
||||
executeSoon(test1);
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
};
|
||||
|
||||
function testSteps() {
|
||||
window.parent.SpecialPowers.addPermission("indexedDB", true, document);
|
||||
|
||||
let request = indexedDB.open(window.location.pathname, 1);
|
||||
request.onsuccess = unexpectedSuccessHandler;
|
||||
request.onerror = grabEventAndContinueHandler;
|
||||
|
|
|
@ -87,6 +87,8 @@
|
|||
}
|
||||
|
||||
function testSteps() {
|
||||
window.parent.SpecialPowers.addPermission("indexedDB", true, document);
|
||||
|
||||
let request = indexedDB.open(window.location.pathname, 1);
|
||||
request.onerror = errorHandler;
|
||||
request.onupgradeneeded = grabEventAndContinueHandler;
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
};
|
||||
|
||||
function testSteps() {
|
||||
window.parent.SpecialPowers.addPermission("indexedDB", true, document);
|
||||
|
||||
// Test 1: Throwing an exception in an upgradeneeded handler should
|
||||
// abort the versionchange transaction and fire an error at the request.
|
||||
let request = indexedDB.open(window.location.pathname, 1);
|
||||
|
|
|
@ -102,30 +102,15 @@ function dispatchEvent(eventName)
|
|||
gBrowser.selectedBrowser.contentWindow.dispatchEvent(event);
|
||||
}
|
||||
|
||||
function setPermission(url, permission, value)
|
||||
function setPermission(url, permission)
|
||||
{
|
||||
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
|
||||
|
||||
switch (value) {
|
||||
case "allow":
|
||||
value = nsIPermissionManager.ALLOW_ACTION;
|
||||
break;
|
||||
case "deny":
|
||||
value = nsIPermissionManager.DENY_ACTION;
|
||||
break;
|
||||
case "unknown":
|
||||
value = nsIPermissionManager.UNKNOWN_ACTION;
|
||||
break;
|
||||
default:
|
||||
throw new Error("No idea what to set here!");
|
||||
}
|
||||
|
||||
let uri = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService)
|
||||
.newURI(url, null, null);
|
||||
Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Components.interfaces.nsIPermissionManager)
|
||||
.add(uri, permission, value);
|
||||
.add(uri, permission,
|
||||
Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
|
||||
}
|
||||
|
||||
function removePermission(url, permission)
|
||||
|
|
|
@ -53,6 +53,7 @@ if (!window.runTest) {
|
|||
{
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
allowIndexedDB();
|
||||
if (limitedQuota) {
|
||||
denyUnlimitedQuota();
|
||||
}
|
||||
|
@ -67,6 +68,7 @@ if (!window.runTest) {
|
|||
function finishTest()
|
||||
{
|
||||
resetUnlimitedQuota();
|
||||
resetIndexedDB();
|
||||
|
||||
SimpleTest.executeSoon(function() {
|
||||
testGenerator.close();
|
||||
|
@ -188,6 +190,16 @@ function setQuota(quota)
|
|||
SpecialPowers.setIntPref("dom.indexedDB.warningQuota", quota);
|
||||
}
|
||||
|
||||
function allowIndexedDB(url)
|
||||
{
|
||||
addPermission("indexedDB", true, url);
|
||||
}
|
||||
|
||||
function resetIndexedDB(url)
|
||||
{
|
||||
removePermission("indexedDB", url);
|
||||
}
|
||||
|
||||
function allowUnlimitedQuota(url)
|
||||
{
|
||||
addPermission("indexedDB-unlimited", true, url);
|
||||
|
|
|
@ -62,6 +62,9 @@
|
|||
|
||||
function runTest() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.addPermission("indexedDB", true, document);
|
||||
|
||||
window.addEventListener("message", messageListener, false);
|
||||
setiframe();
|
||||
}
|
||||
|
|
|
@ -185,6 +185,8 @@ NS_IMETHODIMP nsDelayedPopupsEnabledEvent::Run()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/**
|
||||
* New plugin window procedure
|
||||
*/
|
||||
|
@ -313,10 +315,15 @@ static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg, WPARAM wParam
|
|||
}
|
||||
|
||||
sInMessageDispatch = true;
|
||||
|
||||
LRESULT res = CallWindowProc((WNDPROC)win->GetWindowProc(),
|
||||
hWnd, msg, wParam, lParam);
|
||||
|
||||
LRESULT res;
|
||||
WNDPROC proc = (WNDPROC)win->GetWindowProc();
|
||||
if (PluginWndProc == proc) {
|
||||
NS_WARNING("Previous plugin window procedure references PluginWndProc! "
|
||||
"Report this bug!");
|
||||
res = CallWindowProc(DefWindowProc, hWnd, msg, wParam, lParam);
|
||||
} else {
|
||||
res = CallWindowProc(proc, hWnd, msg, wParam, lParam);
|
||||
}
|
||||
sInMessageDispatch = false;
|
||||
|
||||
if (inst) {
|
||||
|
@ -417,9 +424,9 @@ SetWindowLongAHook(HWND hWnd,
|
|||
nsPluginNativeWindowWin * win =
|
||||
(nsPluginNativeWindowWin *)GetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||
|
||||
// Hook our subclass back up, just like we do on setwindow.
|
||||
// Hook our subclass back up, just like we do on setwindow.
|
||||
win->SetPrevWindowProc(
|
||||
reinterpret_cast<WNDPROC>(sUser32SetWindowLongAHookStub(hWnd, nIndex,
|
||||
reinterpret_cast<WNDPROC>(sUser32SetWindowLongWHookStub(hWnd, nIndex,
|
||||
reinterpret_cast<LONG_PTR>(PluginWndProc))));
|
||||
return proc;
|
||||
}
|
||||
|
|
|
@ -4260,8 +4260,6 @@ JS::CheckStackRoots(JSContext *cx)
|
|||
// could happen.)
|
||||
JS_ASSERT(!cx->rootingUnnecessary);
|
||||
|
||||
return;
|
||||
|
||||
AutoCopyFreeListToArenas copy(rt);
|
||||
|
||||
JSTracer checker;
|
||||
|
|
|
@ -1266,28 +1266,4 @@ MOZ_NORETURN void TypeFailure(JSContext *cx, const char *fmt, ...);
|
|||
} /* namespace types */
|
||||
} /* namespace js */
|
||||
|
||||
namespace JS {
|
||||
template<> class AnchorPermitted<js::types::TypeObject *> { };
|
||||
|
||||
template <> struct RootMethods<const js::types::Type>
|
||||
{
|
||||
static js::types::Type initial() { return js::types::Type::UnknownType(); }
|
||||
static ThingRootKind kind() { return THING_ROOT_TYPE; }
|
||||
static bool poisoned(const js::types::Type &v) {
|
||||
return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
|
||||
|| (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct RootMethods<js::types::Type>
|
||||
{
|
||||
static js::types::Type initial() { return js::types::Type::UnknownType(); }
|
||||
static ThingRootKind kind() { return THING_ROOT_TYPE; }
|
||||
static bool poisoned(const js::types::Type &v) {
|
||||
return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
|
||||
|| (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // jsinfer_h___
|
||||
|
|
|
@ -1522,4 +1522,32 @@ JSCompartment::getEmptyType(JSContext *cx)
|
|||
return emptyTypeObject;
|
||||
}
|
||||
|
||||
namespace JS {
|
||||
|
||||
template<> class AnchorPermitted<js::types::TypeObject *> { };
|
||||
|
||||
template <>
|
||||
struct RootMethods<const js::types::Type>
|
||||
{
|
||||
static js::types::Type initial() { return js::types::Type::UnknownType(); }
|
||||
static ThingRootKind kind() { return THING_ROOT_TYPE; }
|
||||
static bool poisoned(const js::types::Type &v) {
|
||||
return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
|
||||
|| (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RootMethods<js::types::Type>
|
||||
{
|
||||
static js::types::Type initial() { return js::types::Type::UnknownType(); }
|
||||
static ThingRootKind kind() { return THING_ROOT_TYPE; }
|
||||
static bool poisoned(const js::types::Type &v) {
|
||||
return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
|
||||
|| (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace JS
|
||||
|
||||
#endif // jsinferinlines_h___
|
||||
|
|
|
@ -50,74 +50,88 @@ class AndroidImport implements Runnable {
|
|||
}
|
||||
|
||||
public void mergeBookmarks() {
|
||||
Cursor cursor = mCr.query(Browser.BOOKMARKS_URI,
|
||||
null,
|
||||
Browser.BookmarkColumns.BOOKMARK + " = 1",
|
||||
null,
|
||||
null);
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = mCr.query(Browser.BOOKMARKS_URI,
|
||||
null,
|
||||
Browser.BookmarkColumns.BOOKMARK + " = 1",
|
||||
null,
|
||||
null);
|
||||
|
||||
final int faviconCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.FAVICON);
|
||||
final int titleCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.TITLE);
|
||||
final int urlCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.URL);
|
||||
// http://code.google.com/p/android/issues/detail?id=17969
|
||||
final int createCol = cursor.getColumnIndex(Browser.BookmarkColumns.CREATED);
|
||||
if (cursor != null) {
|
||||
final int faviconCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.FAVICON);
|
||||
final int titleCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.TITLE);
|
||||
final int urlCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.URL);
|
||||
// http://code.google.com/p/android/issues/detail?id=17969
|
||||
final int createCol = cursor.getColumnIndex(Browser.BookmarkColumns.CREATED);
|
||||
|
||||
cursor.moveToFirst();
|
||||
while (!cursor.isAfterLast()) {
|
||||
String url = cursor.getString(urlCol);
|
||||
String title = cursor.getString(titleCol);
|
||||
long created;
|
||||
if (createCol >= 0) {
|
||||
created = cursor.getLong(createCol);
|
||||
} else {
|
||||
created = System.currentTimeMillis();
|
||||
cursor.moveToFirst();
|
||||
while (!cursor.isAfterLast()) {
|
||||
String url = cursor.getString(urlCol);
|
||||
String title = cursor.getString(titleCol);
|
||||
long created;
|
||||
if (createCol >= 0) {
|
||||
created = cursor.getLong(createCol);
|
||||
} else {
|
||||
created = System.currentTimeMillis();
|
||||
}
|
||||
// Need to set it to the current time so Sync picks it up.
|
||||
long modified = System.currentTimeMillis();
|
||||
byte[] data = cursor.getBlob(faviconCol);
|
||||
mDB.updateBookmarkInBatch(mCr, mOperations,
|
||||
url, title, null, -1,
|
||||
created, modified,
|
||||
BrowserContract.Bookmarks.DEFAULT_POSITION,
|
||||
null, Bookmarks.TYPE_BOOKMARK);
|
||||
if (data != null) {
|
||||
mDB.updateFaviconInBatch(mCr, mOperations, url, null, null, data);
|
||||
}
|
||||
cursor.moveToNext();
|
||||
}
|
||||
}
|
||||
// Need to set it to the current time so Sync picks it up.
|
||||
long modified = System.currentTimeMillis();
|
||||
byte[] data = cursor.getBlob(faviconCol);
|
||||
mDB.updateBookmarkInBatch(mCr, mOperations,
|
||||
url, title, null, -1,
|
||||
created, modified,
|
||||
BrowserContract.Bookmarks.DEFAULT_POSITION,
|
||||
null, Bookmarks.TYPE_BOOKMARK);
|
||||
if (data != null) {
|
||||
mDB.updateFaviconInBatch(mCr, mOperations, url, null, null, data);
|
||||
}
|
||||
cursor.moveToNext();
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
cursor.close();
|
||||
|
||||
flushBatchOperations();
|
||||
}
|
||||
|
||||
public void mergeHistory() {
|
||||
Cursor cursor = mCr.query(Browser.BOOKMARKS_URI,
|
||||
null,
|
||||
Browser.BookmarkColumns.BOOKMARK + " = 0 AND " +
|
||||
Browser.BookmarkColumns.VISITS + " > 0",
|
||||
null,
|
||||
null);
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = mCr.query(Browser.BOOKMARKS_URI,
|
||||
null,
|
||||
Browser.BookmarkColumns.BOOKMARK + " = 0 AND " +
|
||||
Browser.BookmarkColumns.VISITS + " > 0",
|
||||
null,
|
||||
null);
|
||||
|
||||
final int dateCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.DATE);
|
||||
final int faviconCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.FAVICON);
|
||||
final int titleCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.TITLE);
|
||||
final int urlCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.URL);
|
||||
final int visitsCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.VISITS);
|
||||
if (cursor != null) {
|
||||
final int dateCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.DATE);
|
||||
final int faviconCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.FAVICON);
|
||||
final int titleCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.TITLE);
|
||||
final int urlCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.URL);
|
||||
final int visitsCol = cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.VISITS);
|
||||
|
||||
cursor.moveToFirst();
|
||||
while (!cursor.isAfterLast()) {
|
||||
String url = cursor.getString(urlCol);
|
||||
String title = cursor.getString(titleCol);
|
||||
long date = cursor.getLong(dateCol);
|
||||
int visits = cursor.getInt(visitsCol);
|
||||
byte[] data = cursor.getBlob(faviconCol);
|
||||
mDB.updateHistoryInBatch(mCr, mOperations, url, title, date, visits);
|
||||
if (data != null) {
|
||||
mDB.updateFaviconInBatch(mCr, mOperations, url, null, null, data);
|
||||
cursor.moveToFirst();
|
||||
while (!cursor.isAfterLast()) {
|
||||
String url = cursor.getString(urlCol);
|
||||
String title = cursor.getString(titleCol);
|
||||
long date = cursor.getLong(dateCol);
|
||||
int visits = cursor.getInt(visitsCol);
|
||||
byte[] data = cursor.getBlob(faviconCol);
|
||||
mDB.updateHistoryInBatch(mCr, mOperations, url, title, date, visits);
|
||||
if (data != null) {
|
||||
mDB.updateFaviconInBatch(mCr, mOperations, url, null, null, data);
|
||||
}
|
||||
cursor.moveToNext();
|
||||
}
|
||||
}
|
||||
cursor.moveToNext();
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
cursor.close();
|
||||
|
||||
flushBatchOperations();
|
||||
}
|
||||
|
|
|
@ -5,35 +5,17 @@
|
|||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.LightingColorFilter;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
import android.widget.SimpleExpandableListAdapter;
|
||||
import android.widget.TabHost;
|
||||
import android.widget.TabWidget;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -143,10 +125,45 @@ public class AwesomeBarTabs extends TabHost {
|
|||
addAwesomeTab(tab);
|
||||
}
|
||||
|
||||
styleSelectedTab();
|
||||
|
||||
setOnTabChangedListener(new TabHost.OnTabChangeListener() {
|
||||
public void onTabChanged(String tabId) {
|
||||
styleSelectedTab();
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize "App Pages" list with no filter
|
||||
filter("");
|
||||
}
|
||||
|
||||
private void styleSelectedTab() {
|
||||
int selIndex = getCurrentTab();
|
||||
TabWidget tabWidget = getTabWidget();
|
||||
for (int i = 0; i < tabWidget.getTabCount(); i++) {
|
||||
if (i == selIndex)
|
||||
continue;
|
||||
|
||||
if (i == (selIndex - 1))
|
||||
tabWidget.getChildTabViewAt(i).getBackground().setLevel(1);
|
||||
else if (i == (selIndex + 1))
|
||||
tabWidget.getChildTabViewAt(i).getBackground().setLevel(2);
|
||||
else
|
||||
tabWidget.getChildTabViewAt(i).getBackground().setLevel(0);
|
||||
}
|
||||
|
||||
if (selIndex == 0)
|
||||
findViewById(R.id.tab_widget_left).getBackground().setLevel(1);
|
||||
else
|
||||
findViewById(R.id.tab_widget_left).getBackground().setLevel(0);
|
||||
|
||||
if (selIndex == (tabWidget.getTabCount() - 1))
|
||||
findViewById(R.id.tab_widget_right).getBackground().setLevel(2);
|
||||
else
|
||||
findViewById(R.id.tab_widget_right).getBackground().setLevel(0);
|
||||
}
|
||||
|
||||
|
||||
private void addAwesomeTab(AwesomeBarTab tab) {
|
||||
TabSpec tabspec = getTabSpec(tab.getTag(), tab.getTitleStringId());
|
||||
tabspec.setContent(tab.getFactory());
|
||||
|
@ -159,15 +176,8 @@ public class AwesomeBarTabs extends TabHost {
|
|||
private TabSpec getTabSpec(String id, int titleId) {
|
||||
TabSpec tab = newTabSpec(id);
|
||||
|
||||
View indicatorView = mInflater.inflate(R.layout.awesomebar_tab_indicator, null);
|
||||
Drawable background = indicatorView.getBackground();
|
||||
try {
|
||||
background.setColorFilter(new LightingColorFilter(Color.WHITE, 0xFFFF9500));
|
||||
} catch (Exception e) {
|
||||
Log.d(LOGTAG, "background.setColorFilter failed " + e);
|
||||
}
|
||||
TextView title = (TextView) indicatorView.findViewById(R.id.title);
|
||||
title.setText(titleId);
|
||||
TextView indicatorView = (TextView) mInflater.inflate(R.layout.awesomebar_tab_indicator, null);
|
||||
indicatorView.setText(titleId);
|
||||
|
||||
tab.setIndicator(indicatorView);
|
||||
return tab;
|
||||
|
@ -224,7 +234,7 @@ public class AwesomeBarTabs extends TabHost {
|
|||
|
||||
// The tabs should only be visible if there's no on-going search
|
||||
int tabsVisibility = (searchTerm.length() == 0 ? View.VISIBLE : View.GONE);
|
||||
getTabWidget().setVisibility(tabsVisibility);
|
||||
findViewById(R.id.tab_widget_container).setVisibility(tabsVisibility);
|
||||
|
||||
// Perform the actual search
|
||||
allPages.filter(searchTerm);
|
||||
|
|
|
@ -11,8 +11,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
public class FlowLayout extends ViewGroup {
|
||||
private static final int DEFAULT_SPACING = 5;
|
||||
private int mSpacing = DEFAULT_SPACING;
|
||||
private int mSpacing;
|
||||
|
||||
public FlowLayout(Context context) {
|
||||
super(context);
|
||||
|
@ -21,7 +20,7 @@ public class FlowLayout extends ViewGroup {
|
|||
public FlowLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, org.mozilla.gecko.R.styleable.FlowLayout);
|
||||
mSpacing = a.getDimensionPixelSize(R.styleable.FlowLayout_spacing, DEFAULT_SPACING);
|
||||
mSpacing = a.getDimensionPixelSize(R.styleable.FlowLayout_spacing, (int) context.getResources().getDimension(R.dimen.flow_layout_spacing));
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
|
|
|
@ -295,6 +295,8 @@ RES_LAYOUT_LAND_V14 = \
|
|||
$(NULL)
|
||||
|
||||
RES_LAYOUT_XLARGE = \
|
||||
res/layout-xlarge/awesomebar_search.xml \
|
||||
res/layout-xlarge/awesomebar_tab_indicator.xml \
|
||||
res/layout-xlarge/browser_toolbar.xml \
|
||||
res/layout-xlarge/doorhangerpopup.xml \
|
||||
res/layout-xlarge/gecko_app.xml \
|
||||
|
@ -305,6 +307,8 @@ RES_LAYOUT_XLARGE = \
|
|||
$(NULL)
|
||||
|
||||
RES_LAYOUT_SW600DP = \
|
||||
res/layout-sw600dp/awesomebar_search.xml \
|
||||
res/layout-sw600dp/awesomebar_tab_indicator.xml \
|
||||
res/layout-sw600dp/browser_toolbar.xml \
|
||||
res/layout-sw600dp/doorhangerpopup.xml \
|
||||
res/layout-sw600dp/gecko_app.xml \
|
||||
|
@ -332,10 +336,12 @@ RES_VALUES_V11 = \
|
|||
|
||||
RES_VALUES_XLARGE = \
|
||||
res/values-xlarge/dimens.xml \
|
||||
res/values-xlarge/styles.xml \
|
||||
$(NULL)
|
||||
|
||||
RES_VALUES_SW600DP = \
|
||||
res/values-sw600dp/dimens.xml \
|
||||
res/values-sw600dp/styles.xml \
|
||||
$(NULL)
|
||||
|
||||
RES_VALUES_LAND_V14 = \
|
||||
|
@ -376,8 +382,9 @@ RES_DRAWABLE_BASE = \
|
|||
res/drawable/alert_addon.png \
|
||||
res/drawable/alert_app.png \
|
||||
res/drawable/alert_download.png \
|
||||
res/drawable/awesomebar_tab.9.png \
|
||||
res/drawable/awesomebar_tab_pressed.9.png \
|
||||
res/drawable/awesomebar_tab_center.9.png \
|
||||
res/drawable/awesomebar_tab_left.9.png \
|
||||
res/drawable/awesomebar_tab_right.9.png \
|
||||
res/drawable/ic_addons_empty.png \
|
||||
res/drawable/ic_awesomebar_go.png \
|
||||
res/drawable/ic_awesomebar_reader.png \
|
||||
|
@ -459,8 +466,9 @@ RES_DRAWABLE_HDPI = \
|
|||
res/drawable-hdpi/alert_addon.png \
|
||||
res/drawable-hdpi/alert_app.png \
|
||||
res/drawable-hdpi/alert_download.png \
|
||||
res/drawable-hdpi/awesomebar_tab.9.png \
|
||||
res/drawable-hdpi/awesomebar_tab_pressed.9.png \
|
||||
res/drawable-hdpi/awesomebar_tab_center.9.png \
|
||||
res/drawable-hdpi/awesomebar_tab_left.9.png \
|
||||
res/drawable-hdpi/awesomebar_tab_right.9.png \
|
||||
res/drawable-hdpi/ic_addons_empty.png \
|
||||
res/drawable-hdpi/ic_awesomebar_go.png \
|
||||
res/drawable-hdpi/ic_awesomebar_reader.png \
|
||||
|
@ -572,8 +580,9 @@ RES_DRAWABLE_XHDPI_V11 = \
|
|||
res/drawable-xhdpi-v11/alert_addon.png \
|
||||
res/drawable-xhdpi-v11/alert_app.png \
|
||||
res/drawable-xhdpi-v11/alert_download.png \
|
||||
res/drawable-xhdpi-v11/awesomebar_tab.9.png \
|
||||
res/drawable-xhdpi-v11/awesomebar_tab_pressed.9.png \
|
||||
res/drawable-xhdpi-v11/awesomebar_tab_center.9.png \
|
||||
res/drawable-xhdpi-v11/awesomebar_tab_left.9.png \
|
||||
res/drawable-xhdpi-v11/awesomebar_tab_right.9.png \
|
||||
res/drawable-xhdpi-v11/ic_addons_empty.png \
|
||||
res/drawable-xhdpi-v11/ic_awesomebar_go.png \
|
||||
res/drawable-xhdpi-v11/ic_awesomebar_reader.png \
|
||||
|
@ -704,6 +713,9 @@ RES_DRAWABLE_XLARGE_MDPI = \
|
|||
res/drawable-xlarge-mdpi/address_bar_back_button_pressed_bg.png \
|
||||
res/drawable-xlarge-mdpi/address_bar_url_default.9.png \
|
||||
res/drawable-xlarge-mdpi/address_bar_url_pressed.9.png \
|
||||
res/drawable-xlarge-mdpi/awesomebar_tab_center.9.png \
|
||||
res/drawable-xlarge-mdpi/awesomebar_tab_left.9.png \
|
||||
res/drawable-xlarge-mdpi/awesomebar_tab_right.9.png \
|
||||
res/drawable-xlarge-mdpi/menu.png \
|
||||
res/drawable-xlarge-mdpi/ic_awesomebar_go.png \
|
||||
res/drawable-xlarge-mdpi/ic_awesomebar_search.png \
|
||||
|
@ -732,6 +744,9 @@ RES_DRAWABLE_XLARGE_HDPI = \
|
|||
res/drawable-xlarge-hdpi/address_bar_back_button_pressed_bg.png \
|
||||
res/drawable-xlarge-hdpi/address_bar_url_default.9.png \
|
||||
res/drawable-xlarge-hdpi/address_bar_url_pressed.9.png \
|
||||
res/drawable-xlarge-hdpi/awesomebar_tab_center.9.png \
|
||||
res/drawable-xlarge-hdpi/awesomebar_tab_left.9.png \
|
||||
res/drawable-xlarge-hdpi/awesomebar_tab_right.9.png \
|
||||
res/drawable-xlarge-hdpi/menu.png \
|
||||
res/drawable-xlarge-hdpi/ic_awesomebar_go.png \
|
||||
res/drawable-xlarge-hdpi/ic_awesomebar_search.png \
|
||||
|
@ -760,6 +775,9 @@ RES_DRAWABLE_XLARGE_XHDPI = \
|
|||
res/drawable-xlarge-xhdpi/address_bar_back_button_pressed_bg.png \
|
||||
res/drawable-xlarge-xhdpi/address_bar_url_default.9.png \
|
||||
res/drawable-xlarge-xhdpi/address_bar_url_pressed.9.png \
|
||||
res/drawable-xlarge-xhdpi/awesomebar_tab_center.9.png \
|
||||
res/drawable-xlarge-xhdpi/awesomebar_tab_left.9.png \
|
||||
res/drawable-xlarge-xhdpi/awesomebar_tab_right.9.png \
|
||||
res/drawable-xlarge-xhdpi/menu.png \
|
||||
res/drawable-xlarge-xhdpi/ic_awesomebar_go.png \
|
||||
res/drawable-xlarge-xhdpi/ic_awesomebar_search.png \
|
||||
|
@ -789,6 +807,9 @@ RES_DRAWABLE_SW600DP_MDPI = \
|
|||
res/drawable-sw600dp-mdpi/address_bar_back_button_pressed_bg.png \
|
||||
res/drawable-sw600dp-mdpi/address_bar_url_default.9.png \
|
||||
res/drawable-sw600dp-mdpi/address_bar_url_pressed.9.png \
|
||||
res/drawable-sw600dp-mdpi/awesomebar_tab_center.9.png \
|
||||
res/drawable-sw600dp-mdpi/awesomebar_tab_left.9.png \
|
||||
res/drawable-sw600dp-mdpi/awesomebar_tab_right.9.png \
|
||||
res/drawable-sw600dp-mdpi/menu.png \
|
||||
res/drawable-sw600dp-mdpi/ic_awesomebar_go.png \
|
||||
res/drawable-sw600dp-mdpi/ic_awesomebar_search.png \
|
||||
|
@ -817,6 +838,9 @@ RES_DRAWABLE_SW600DP_HDPI = \
|
|||
res/drawable-sw600dp-hdpi/address_bar_back_button_pressed_bg.png \
|
||||
res/drawable-sw600dp-hdpi/address_bar_url_default.9.png \
|
||||
res/drawable-sw600dp-hdpi/address_bar_url_pressed.9.png \
|
||||
res/drawable-sw600dp-hdpi/awesomebar_tab_center.9.png \
|
||||
res/drawable-sw600dp-hdpi/awesomebar_tab_left.9.png \
|
||||
res/drawable-sw600dp-hdpi/awesomebar_tab_right.9.png \
|
||||
res/drawable-sw600dp-hdpi/menu.png \
|
||||
res/drawable-sw600dp-hdpi/ic_awesomebar_go.png \
|
||||
res/drawable-sw600dp-hdpi/ic_awesomebar_search.png \
|
||||
|
@ -845,6 +869,9 @@ RES_DRAWABLE_SW600DP_XHDPI = \
|
|||
res/drawable-sw600dp-xhdpi/address_bar_back_button_pressed_bg.png \
|
||||
res/drawable-sw600dp-xhdpi/address_bar_url_default.9.png \
|
||||
res/drawable-sw600dp-xhdpi/address_bar_url_pressed.9.png \
|
||||
res/drawable-sw600dp-xhdpi/awesomebar_tab_center.9.png \
|
||||
res/drawable-sw600dp-xhdpi/awesomebar_tab_left.9.png \
|
||||
res/drawable-sw600dp-xhdpi/awesomebar_tab_right.9.png \
|
||||
res/drawable-sw600dp-xhdpi/menu.png \
|
||||
res/drawable-sw600dp-xhdpi/ic_awesomebar_go.png \
|
||||
res/drawable-sw600dp-xhdpi/ic_awesomebar_search.png \
|
||||
|
@ -868,7 +895,6 @@ RES_DRAWABLE_SW600DP_XHDPI = \
|
|||
$(NULL)
|
||||
|
||||
RES_COLOR = \
|
||||
res/color/awesomebar_tab_text.xml \
|
||||
res/color/menu_item_title.xml \
|
||||
$(NULL)
|
||||
|
||||
|
@ -900,8 +926,6 @@ MOZ_ANDROID_DRAWABLES += \
|
|||
mobile/android/base/resources/drawable/address_bar_bg_shadow_repeat.xml \
|
||||
mobile/android/base/resources/drawable/autocomplete_list_bg.9.png \
|
||||
mobile/android/base/resources/drawable/awesomebar_tab_indicator.xml \
|
||||
mobile/android/base/resources/drawable/awesomebar_tab_press.xml \
|
||||
mobile/android/base/resources/drawable/awesomebar_tab_press_selected.xml \
|
||||
mobile/android/base/resources/drawable/awesomebar_tab_selected.xml \
|
||||
mobile/android/base/resources/drawable/awesomebar_tab_unselected.xml \
|
||||
mobile/android/base/resources/drawable/desktop_notification.png \
|
||||
|
|
|
@ -126,9 +126,9 @@ public class BookmarksTab extends AwesomeBarTab {
|
|||
return mCursorAdapter;
|
||||
}
|
||||
|
||||
LinearLayout headerView = mCursorAdapter.getHeaderView();
|
||||
TextView headerView = mCursorAdapter.getHeaderView();
|
||||
if (headerView == null) {
|
||||
headerView = (LinearLayout) getInflater().inflate(R.layout.awesomebar_header_row, null);
|
||||
headerView = (TextView) getInflater().inflate(R.layout.awesomebar_header_row, null);
|
||||
mCursorAdapter.setHeaderView(headerView);
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class BookmarksTab extends AwesomeBarTab {
|
|||
if (mView.getHeaderViewsCount() == 0) {
|
||||
mView.addHeaderView(headerView, null, true);
|
||||
}
|
||||
((TextView) headerView.findViewById(R.id.title)).setText(mFolderTitle);
|
||||
headerView.setText(mFolderTitle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ public class BookmarksTab extends AwesomeBarTab {
|
|||
private static final int VIEW_TYPE_COUNT = 2;
|
||||
|
||||
private LinkedList<Pair<Integer, String>> mParentStack;
|
||||
private LinearLayout mBookmarksTitleView;
|
||||
private TextView mBookmarksTitleView;
|
||||
|
||||
public BookmarksListAdapter(Context context, Cursor c) {
|
||||
super(context, -1, c, new String[] {}, new int[] {});
|
||||
|
@ -330,11 +330,11 @@ public class BookmarksTab extends AwesomeBarTab {
|
|||
return convertView;
|
||||
}
|
||||
|
||||
public LinearLayout getHeaderView() {
|
||||
public TextView getHeaderView() {
|
||||
return mBookmarksTitleView;
|
||||
}
|
||||
|
||||
public void setHeaderView(LinearLayout titleView) {
|
||||
public void setHeaderView(TextView titleView) {
|
||||
mBookmarksTitleView = titleView;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- Non focused state -->
|
||||
<item android:state_focused="false"
|
||||
android:state_selected="false"
|
||||
android:state_pressed="false"
|
||||
android:color="#aaaaaa"/>
|
||||
|
||||
<!-- Default text color -->
|
||||
<item android:color="#ffffff"/>
|
||||
|
||||
</selector>
|
Двоичные данные
mobile/android/base/resources/drawable-hdpi/awesomebar_tab.9.png
До Ширина: | Высота: | Размер: 337 B |
После Ширина: | Высота: | Размер: 599 B |
После Ширина: | Высота: | Размер: 372 B |
До Ширина: | Высота: | Размер: 400 B |
После Ширина: | Высота: | Размер: 347 B |
Двоичные данные
mobile/android/base/resources/drawable-sw600dp-hdpi/awesomebar_tab_center.9.png
Normal file
После Ширина: | Высота: | Размер: 841 B |
Двоичные данные
mobile/android/base/resources/drawable-sw600dp-hdpi/awesomebar_tab_left.9.png
Normal file
После Ширина: | Высота: | Размер: 504 B |
Двоичные данные
mobile/android/base/resources/drawable-sw600dp-hdpi/awesomebar_tab_right.9.png
Normal file
После Ширина: | Высота: | Размер: 445 B |
Двоичные данные
mobile/android/base/resources/drawable-sw600dp-mdpi/awesomebar_tab_center.9.png
Normal file
После Ширина: | Высота: | Размер: 589 B |
Двоичные данные
mobile/android/base/resources/drawable-sw600dp-mdpi/awesomebar_tab_left.9.png
Normal file
После Ширина: | Высота: | Размер: 351 B |
Двоичные данные
mobile/android/base/resources/drawable-sw600dp-mdpi/awesomebar_tab_right.9.png
Normal file
После Ширина: | Высота: | Размер: 320 B |
Двоичные данные
mobile/android/base/resources/drawable-sw600dp-xhdpi/awesomebar_tab_center.9.png
Normal file
После Ширина: | Высота: | Размер: 1.1 KiB |
Двоичные данные
mobile/android/base/resources/drawable-sw600dp-xhdpi/awesomebar_tab_left.9.png
Normal file
После Ширина: | Высота: | Размер: 638 B |
Двоичные данные
mobile/android/base/resources/drawable-sw600dp-xhdpi/awesomebar_tab_right.9.png
Normal file
После Ширина: | Высота: | Размер: 561 B |
До Ширина: | Высота: | Размер: 413 B |
Двоичные данные
mobile/android/base/resources/drawable-xhdpi-v11/awesomebar_tab_center.9.png
Normal file
После Ширина: | Высота: | Размер: 794 B |
Двоичные данные
mobile/android/base/resources/drawable-xhdpi-v11/awesomebar_tab_left.9.png
Normal file
После Ширина: | Высота: | Размер: 462 B |
До Ширина: | Высота: | Размер: 492 B |
Двоичные данные
mobile/android/base/resources/drawable-xhdpi-v11/awesomebar_tab_right.9.png
Normal file
После Ширина: | Высота: | Размер: 432 B |
Двоичные данные
mobile/android/base/resources/drawable-xlarge-hdpi/awesomebar_tab_center.9.png
Normal file
После Ширина: | Высота: | Размер: 841 B |
Двоичные данные
mobile/android/base/resources/drawable-xlarge-hdpi/awesomebar_tab_left.9.png
Normal file
После Ширина: | Высота: | Размер: 504 B |
Двоичные данные
mobile/android/base/resources/drawable-xlarge-hdpi/awesomebar_tab_right.9.png
Normal file
После Ширина: | Высота: | Размер: 445 B |
Двоичные данные
mobile/android/base/resources/drawable-xlarge-mdpi/awesomebar_tab_center.9.png
Normal file
После Ширина: | Высота: | Размер: 589 B |
Двоичные данные
mobile/android/base/resources/drawable-xlarge-mdpi/awesomebar_tab_left.9.png
Normal file
После Ширина: | Высота: | Размер: 351 B |
Двоичные данные
mobile/android/base/resources/drawable-xlarge-mdpi/awesomebar_tab_right.9.png
Normal file
После Ширина: | Высота: | Размер: 320 B |
Двоичные данные
mobile/android/base/resources/drawable-xlarge-xhdpi/awesomebar_tab_center.9.png
Normal file
После Ширина: | Высота: | Размер: 1.1 KiB |
Двоичные данные
mobile/android/base/resources/drawable-xlarge-xhdpi/awesomebar_tab_left.9.png
Normal file
После Ширина: | Высота: | Размер: 638 B |
Двоичные данные
mobile/android/base/resources/drawable-xlarge-xhdpi/awesomebar_tab_right.9.png
Normal file
После Ширина: | Высота: | Размер: 561 B |
Двоичные данные
mobile/android/base/resources/drawable/awesomebar_tab.9.png
До Ширина: | Высота: | Размер: 241 B |
После Ширина: | Высота: | Размер: 442 B |
|
@ -5,22 +5,10 @@
|
|||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- Pressed -->
|
||||
<item android:state_pressed="true"
|
||||
android:state_selected="false"
|
||||
android:drawable="@drawable/awesomebar_tab_press"/>
|
||||
|
||||
<item android:state_pressed="true"
|
||||
android:state_selected="true"
|
||||
android:drawable="@drawable/awesomebar_tab_press_selected"/>
|
||||
|
||||
<!-- Default states -->
|
||||
<item android:state_selected="false"
|
||||
android:state_pressed="false"
|
||||
android:drawable="@drawable/awesomebar_tab_unselected"/>
|
||||
|
||||
<item android:state_selected="true"
|
||||
android:state_pressed="false"
|
||||
android:drawable="@drawable/awesomebar_tab_selected"/>
|
||||
|
||||
</selector>
|
||||
|
|
После Ширина: | Высота: | Размер: 278 B |
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:top="46dip">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#111111"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:bottom="2dip"
|
||||
android:drawable="@drawable/awesomebar_tab_pressed"/>
|
||||
|
||||
<item android:top="46dip">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#111111"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
До Ширина: | Высота: | Размер: 279 B |
После Ширина: | Высота: | Размер: 261 B |
|
@ -5,13 +5,13 @@
|
|||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:bottom="2dip"
|
||||
android:drawable="@drawable/awesomebar_tab"/>
|
||||
|
||||
<item android:top="46dip">
|
||||
<item android:top="@dimen/awesomebar_tab_transparency_height">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#000000"/>
|
||||
<solid android:color="#EEF1F5"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:bottom="2dip"
|
||||
android:drawable="@drawable/awesomebar_tab_center"/>
|
||||
|
||||
</layer-list>
|
||||
|
|
|
@ -3,12 +3,42 @@
|
|||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:top="46dip">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#000000"/>
|
||||
</shape>
|
||||
<item android:maxLevel="0">
|
||||
<layer-list>
|
||||
<item android:top="@dimen/awesomebar_tab_transparency_height">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#EEF1F5"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
<item android:maxLevel="1">
|
||||
<layer-list>
|
||||
<item android:top="@dimen/awesomebar_tab_transparency_height">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#EEF1F5"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:bottom="2dip"
|
||||
android:drawable="@drawable/awesomebar_tab_left"/>
|
||||
</layer-list>
|
||||
</item>
|
||||
|
||||
<item android:maxLevel="2">
|
||||
<layer-list>
|
||||
<item android:top="@dimen/awesomebar_tab_transparency_height">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#EEF1F5"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:bottom="2dip"
|
||||
android:drawable="@drawable/awesomebar_tab_right"/>
|
||||
</layer-list>
|
||||
</item>
|
||||
|
||||
</level-list>
|
||||
|
|
|
@ -3,33 +3,23 @@
|
|||
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<solid android:color="@color/suggestion_pressed" />
|
||||
<gradient android:angle="90"
|
||||
android:startColor="#E66000"
|
||||
android:endColor="#FF9500"
|
||||
android:type="linear"/>
|
||||
|
||||
<padding android:left="7dp"
|
||||
android:top="7dp"
|
||||
android:right="7dp"
|
||||
android:bottom="7dp" />
|
||||
|
||||
<corners android:bottomRightRadius="4dp"
|
||||
android:bottomLeftRadius="4dp"
|
||||
android:topLeftRadius="4dp"
|
||||
android:topRightRadius="4dp"/>
|
||||
<corners android:radius="4dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_enabled="true">
|
||||
<shape>
|
||||
<solid android:color="@color/suggestion_primary" />
|
||||
<gradient android:angle="90"
|
||||
android:startColor="#D2DAE2"
|
||||
android:endColor="#E3E8ED"
|
||||
android:type="linear"/>
|
||||
|
||||
<padding android:left="7dp"
|
||||
android:top="7dp"
|
||||
android:right="7dp"
|
||||
android:bottom="7dp" />
|
||||
|
||||
<corners android:bottomRightRadius="4dp"
|
||||
android:bottomLeftRadius="4dp"
|
||||
android:topLeftRadius="4dp"
|
||||
android:topRightRadius="4dp"/>
|
||||
<corners android:radius="4dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
|
|
|
@ -89,31 +89,27 @@
|
|||
|
||||
<LinearLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignRight="@id/awesome_bar"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton android:id="@+id/reader"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="10dip"
|
||||
android:src="@drawable/reader"
|
||||
android:contentDescription="@string/reader_mode"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageButton android:id="@+id/site_security"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="10dip"
|
||||
android:src="@drawable/site_security_level"
|
||||
android:contentDescription="@string/site_security"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageButton android:id="@+id/stop"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="10dip"
|
||||
android:src="@drawable/urlbar_stop"
|
||||
android:contentDescription="@string/stop"
|
||||
android:visibility="gone"/>
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/AwesomeBar"
|
||||
android:background="@drawable/address_bar_bg">
|
||||
|
||||
<ImageView android:id="@+id/dummy_tab"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="84dip"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@drawable/tabs_normal"
|
||||
android:gravity="center_vertical"/>
|
||||
|
||||
<view class="org.mozilla.gecko.AwesomeBar$AwesomeBarEditText"
|
||||
android:id="@+id/awesomebar_text"
|
||||
style="@style/AddressBar.Button"
|
||||
android:background="@drawable/address_bar_url"
|
||||
android:layout_marginLeft="0dip"
|
||||
android:layout_marginRight="168dip"
|
||||
android:layout_marginTop="6dip"
|
||||
android:layout_marginBottom="6dip"
|
||||
android:layout_toRightOf="@id/dummy_tab"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="15dip"
|
||||
android:paddingRight="40dip"
|
||||
android:hint="@string/awesomebar_default_text"
|
||||
android:textColorHighlight="@color/url_bar_text_highlight"
|
||||
android:inputType="textUri|textNoSuggestions"
|
||||
android:imeOptions="actionSearch"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:gravity="center_vertical|left">
|
||||
<requestFocus/>
|
||||
</view>
|
||||
|
||||
<LinearLayout android:layout_width="4dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentRight="true"/>
|
||||
|
||||
<ImageButton android:id="@+id/awesomebar_button"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="14dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignRight="@id/awesomebar_text"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/ic_awesomebar_go"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/awesomebar_tab_indicator"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textSize="13sp"
|
||||
android:textColor="#222222"/>
|
|
@ -99,31 +99,27 @@
|
|||
|
||||
<LinearLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignRight="@id/awesome_bar"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton android:id="@+id/reader"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="14dip"
|
||||
android:src="@drawable/reader"
|
||||
android:contentDescription="@string/reader_mode"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageButton android:id="@+id/site_security"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="14dip"
|
||||
android:src="@drawable/site_security_level"
|
||||
android:contentDescription="@string/site_security"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageButton android:id="@+id/stop"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="14dip"
|
||||
android:src="@drawable/urlbar_stop"
|
||||
android:contentDescription="@string/stop"
|
||||
android:visibility="gone"/>
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/AwesomeBar"
|
||||
android:background="@drawable/address_bar_bg">
|
||||
|
||||
<ImageView android:id="@+id/dummy_tab"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="84dip"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@drawable/tabs_normal"
|
||||
android:gravity="center_vertical"/>
|
||||
|
||||
<view class="org.mozilla.gecko.AwesomeBar$AwesomeBarEditText"
|
||||
android:id="@+id/awesomebar_text"
|
||||
style="@style/AddressBar.Button"
|
||||
android:background="@drawable/address_bar_url"
|
||||
android:layout_marginLeft="0dip"
|
||||
android:layout_marginRight="168dip"
|
||||
android:layout_marginTop="6dip"
|
||||
android:layout_marginBottom="6dip"
|
||||
android:layout_toRightOf="@id/dummy_tab"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="15dip"
|
||||
android:paddingRight="40dip"
|
||||
android:hint="@string/awesomebar_default_text"
|
||||
android:textColorHighlight="@color/url_bar_text_highlight"
|
||||
android:inputType="textUri|textNoSuggestions"
|
||||
android:imeOptions="actionSearch"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:gravity="center_vertical|left">
|
||||
<requestFocus/>
|
||||
</view>
|
||||
|
||||
<LinearLayout android:layout_width="4dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentRight="true"/>
|
||||
|
||||
<ImageButton android:id="@+id/awesomebar_button"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="14dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignRight="@id/awesomebar_text"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/ic_awesomebar_go"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/awesomebar_tab_indicator"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textSize="13sp"
|
||||
android:textColor="#222222"/>
|
|
@ -99,31 +99,27 @@
|
|||
|
||||
<LinearLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignRight="@id/awesome_bar"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton android:id="@+id/reader"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="14dip"
|
||||
android:src="@drawable/reader"
|
||||
android:contentDescription="@string/reader_mode"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageButton android:id="@+id/site_security"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="14dip"
|
||||
android:src="@drawable/site_security_level"
|
||||
android:contentDescription="@string/site_security"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageButton android:id="@+id/stop"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="14dip"
|
||||
android:src="@drawable/urlbar_stop"
|
||||
android:contentDescription="@string/stop"
|
||||
android:visibility="gone"/>
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/awesomebar_row_height"
|
||||
android:padding="6dip">
|
||||
|
||||
<ImageView android:id="@+id/favicon"
|
||||
android:src="@drawable/folder"
|
||||
android:layout_width="32dip"
|
||||
android:layout_height="32dip"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:minWidth="32dip"
|
||||
android:minHeight="32dip"
|
||||
|
@ -21,9 +21,11 @@
|
|||
<TextView android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textColor="#222222"
|
||||
android:textSize="18sp"
|
||||
android:layout_toRightOf="@id/favicon"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="middle"/>
|
||||
|
|
|
@ -3,24 +3,15 @@
|
|||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="2dp"
|
||||
android:background="#E5E5E5">
|
||||
|
||||
<TextView android:id="@+id/title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#FFFFFF"
|
||||
android:textColor="#222222"
|
||||
android:textStyle="bold"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:paddingTop="2dip"
|
||||
android:paddingBottom="2dip"
|
||||
android:paddingLeft="5dip"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="middle"/>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/awesomebar_header_row_height"
|
||||
android:background="#D2DAE2"
|
||||
android:textColor="#222222"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="6dip"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="middle"/>
|
||||
|
|
|
@ -5,13 +5,14 @@
|
|||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/awesomebar_row_height"
|
||||
android:padding="6dip">
|
||||
|
||||
<ImageView android:id="@+id/favicon"
|
||||
android:layout_width="32dip"
|
||||
android:layout_height="32dip"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_marginLeft="6dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:minWidth="32dip"
|
||||
android:minHeight="32dip"
|
||||
|
@ -20,7 +21,6 @@
|
|||
<ImageView android:id="@+id/bookmark_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:visibility="gone"
|
||||
|
@ -30,8 +30,10 @@
|
|||
<TextView android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_marginLeft="6dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:textColor="#222222"
|
||||
android:textSize="18sp"
|
||||
android:layout_toRightOf="@id/favicon"
|
||||
android:layout_toLeftOf="@id/bookmark_icon"
|
||||
android:singleLine="true"
|
||||
|
@ -40,12 +42,11 @@
|
|||
<TextView android:id="@+id/url"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:layout_marginTop="2dip"
|
||||
android:textColor="#9198A1"
|
||||
android:textSize="13sp"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_alignLeft="@id/title"
|
||||
android:layout_toLeftOf="@id/bookmark_icon"
|
||||
android:layout_alignRight="@id/title"
|
||||
android:includeFontPadding="false"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="middle"/>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/AwesomeBar"
|
||||
android:background="@drawable/tabs_tray_bg_repeat">
|
||||
android:background="@drawable/address_bar_bg">
|
||||
|
||||
<view class="org.mozilla.gecko.AwesomeBar$AwesomeBarEditText"
|
||||
android:id="@+id/awesomebar_text"
|
||||
|
@ -32,10 +32,8 @@
|
|||
android:layout_alignParentRight="true"/>
|
||||
|
||||
<ImageButton android:id="@+id/awesomebar_button"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="15dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="12dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignRight="@id/awesomebar_text"
|
||||
android:visibility="gone"
|
||||
|
|
|
@ -1,22 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/awesomebar_suggestion_item_height"
|
||||
android:minHeight="@dimen/awesomebar_suggestion_item_height"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/suggestion_selector"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
android:padding="7dp">
|
||||
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/suggestion_magnifier"
|
||||
<ImageView android:id="@+id/suggestion_magnifier"
|
||||
android:src="@drawable/ic_awesomebar_search"
|
||||
android:layout_marginRight="3dip"
|
||||
android:layout_width="16dip"
|
||||
android:layout_height="16dip" />
|
||||
android:layout_height="16dip"/>
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/suggestion_text"
|
||||
<TextView android:id="@+id/suggestion_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"/>
|
||||
android:textColor="#222222"
|
||||
android:textSize="13sp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/awesomebar_row_height"
|
||||
android:padding="6dip">
|
||||
|
||||
<ImageView android:id="@+id/suggestion_icon"
|
||||
android:layout_width="32dip"
|
||||
android:layout_height="32dip"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_marginLeft="6dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:minWidth="32dip"
|
||||
android:minHeight="32dip"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
|
|
@ -3,19 +3,14 @@
|
|||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="10sp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/awesomebar_tab_indicator">
|
||||
|
||||
<TextView android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:layout_marginBottom="3dip"
|
||||
android:textColor="@color/awesomebar_tab_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.0"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/awesomebar_tab_indicator"
|
||||
android:padding="10dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textSize="13sp"
|
||||
android:textColor="#222222"/>
|
||||
|
|
|
@ -6,14 +6,27 @@
|
|||
<org.mozilla.gecko.AwesomeBarTabs xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/awesomebar_tabs"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/abouthome_bg_repeat">
|
||||
|
||||
<TabWidget android:id="@android:id/tabs"
|
||||
style="@style/TabWidget"/>
|
||||
<LinearLayout android:id="@+id/tab_widget_container"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View android:id="@+id/tab_widget_left"
|
||||
style="@style/AwesomeBarTabIndicatorCurve.Left"/>
|
||||
|
||||
<TabWidget android:id="@android:id/tabs"
|
||||
style="@style/TabWidget"/>
|
||||
|
||||
<View android:id="@+id/tab_widget_right"
|
||||
style="@style/AwesomeBarTabIndicatorCurve.Right"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout android:id="@android:id/tabcontent"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -89,31 +89,27 @@
|
|||
|
||||
<LinearLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignRight="@id/awesome_bar"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton android:id="@+id/reader"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="12dip"
|
||||
android:src="@drawable/reader"
|
||||
android:contentDescription="@string/reader_mode"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageButton android:id="@+id/site_security"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="12dip"
|
||||
android:src="@drawable/site_security_level"
|
||||
android:contentDescription="@string/site_security"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageButton android:id="@+id/stop"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
style="@style/AddressBar.ImageButton.Icon"
|
||||
android:padding="12dip"
|
||||
android:src="@drawable/urlbar_stop"
|
||||
android:contentDescription="@string/stop"
|
||||
android:visibility="gone"/>
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
|
||||
<resources>
|
||||
|
||||
<dimen name="awesomebar_header_row_height">24dp</dimen>
|
||||
<dimen name="awesomebar_row_height">66dp</dimen>
|
||||
<dimen name="awesomebar_suggestion_item_height">32dp</dimen>
|
||||
<dimen name="awesomebar_tab_transparency_height">46dp</dimen>
|
||||
<dimen name="browser_toolbar_height">56dp</dimen>
|
||||
<dimen name="tabs_counter_size">26sp</dimen>
|
||||
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Only overriden styles for Honeycomb/Ice cream sandwich tablets are specified here.
|
||||
Please refer to values/styles.xml for default styles.
|
||||
-->
|
||||
|
||||
<!-- AwesomeBar -->
|
||||
<style name="AwesomeBar">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">@dimen/browser_toolbar_height</item>
|
||||
<item name="android:orientation">horizontal</item>
|
||||
</style>
|
||||
|
||||
<!-- Lists in AwesomeBar -->
|
||||
<style name="AwesomeBarList" parent="android:style/Widget.Holo.ListView">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">fill_parent</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:paddingLeft">52dp</item>
|
||||
<item name="android:paddingRight">52dp</item>
|
||||
<item name="android:background">#EEF1F5</item>
|
||||
<item name="android:divider">#D1D5DA</item>
|
||||
<item name="android:dividerHeight">1dp</item>
|
||||
<item name="android:cacheColorHint">#EEF1F5</item>
|
||||
<item name="android:listSelector">@drawable/action_bar_button</item>
|
||||
</style>
|
||||
|
||||
<!-- AwesomeBar Tab Indicator Curve Left -->
|
||||
<style name="AwesomeBarTabIndicatorCurve.Left">
|
||||
<item name="android:layout_width">86dp</item>
|
||||
</style>
|
||||
|
||||
<!-- AwesomeBar Tab Indicator Curve Right -->
|
||||
<style name="AwesomeBarTabIndicatorCurve.Right">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
</style>
|
||||
|
||||
<!-- TabWidget -->
|
||||
<style name="TabWidget">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">48dip</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -15,8 +15,11 @@
|
|||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">fill_parent</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:divider">#E5E5E5</item>
|
||||
<item name="android:background">#EEF1F5</item>
|
||||
<item name="android:divider">#D1D5DA</item>
|
||||
<item name="android:dividerHeight">1dp</item>
|
||||
<item name="android:cacheColorHint">#EEF1F5</item>
|
||||
<item name="android:listSelector">@drawable/action_bar_button</item>
|
||||
</style>
|
||||
|
||||
<!-- ActionBar -->
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
|
||||
<resources>
|
||||
|
||||
<dimen name="awesomebar_header_row_height">24dp</dimen>
|
||||
<dimen name="awesomebar_row_height">66dp</dimen>
|
||||
<dimen name="awesomebar_suggestion_item_height">32dp</dimen>
|
||||
<dimen name="awesomebar_tab_transparency_height">46dp</dimen>
|
||||
<dimen name="browser_toolbar_height">56dp</dimen>
|
||||
<dimen name="local_tab_row_height">150dp</dimen>
|
||||
<dimen name="remote_tab_child_row_height">48dp</dimen>
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Only overriden styles for Honeycomb/Ice cream sandwich tablets are specified here.
|
||||
Please refer to values/styles.xml for default styles.
|
||||
-->
|
||||
|
||||
<!-- AwesomeBar -->
|
||||
<style name="AwesomeBar">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">@dimen/browser_toolbar_height</item>
|
||||
<item name="android:orientation">horizontal</item>
|
||||
</style>
|
||||
|
||||
<!-- Lists in AwesomeBar -->
|
||||
<style name="AwesomeBarList" parent="android:style/Widget.Holo.ListView">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">fill_parent</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:paddingLeft">52dp</item>
|
||||
<item name="android:paddingRight">52dp</item>
|
||||
<item name="android:background">#EEF1F5</item>
|
||||
<item name="android:divider">#D1D5DA</item>
|
||||
<item name="android:dividerHeight">1dp</item>
|
||||
<item name="android:cacheColorHint">#EEF1F5</item>
|
||||
<item name="android:listSelector">@drawable/action_bar_button</item>
|
||||
</style>
|
||||
|
||||
<!-- AwesomeBar Tab Indicator Curve Left -->
|
||||
<style name="AwesomeBarTabIndicatorCurve.Left">
|
||||
<item name="android:layout_width">86dp</item>
|
||||
</style>
|
||||
|
||||
<!-- AwesomeBar Tab Indicator Curve Right -->
|
||||
<style name="AwesomeBarTabIndicatorCurve.Right">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
</style>
|
||||
|
||||
<!-- TabWidget -->
|
||||
<style name="TabWidget">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">48dip</item>
|
||||
</style>
|
||||
|
||||
</resources>
|