コード例 #1
0
ファイル: YWidget.cpp プロジェクト: jwk000/YSLib
void
InvalidateChildren(IWidget& wgt, const Rect& bounds)
{
	Rect r(wgt.GetRenderer().CommitInvalidation(bounds));

	for(auto pr(wgt.GetChildren()); pr.first != pr.second; ++pr.first)
	{
		auto& child(*pr.first);

		InvalidateChildren(child, Rect(r - GetLocationOf(child)));
	}
}
コード例 #2
0
void nsOuterDocAccessible::CacheChildren()
{  
  // An outer doc accessible usually has 1 nsDocAccessible child,
  // but could have none if we can't get to the inner documnet
  if (!mWeakShell) {
    mAccChildCount = eChildCountUninitialized;
    return;   // This outer doc node has been shut down
  }
  if (mAccChildCount != eChildCountUninitialized) {
    return;
  }

  InvalidateChildren();
  mAccChildCount = 0;

  // In these variable names, "outer" relates to the nsOuterDocAccessible
  // as opposed to the nsDocAccessibleWrap which is "inner".
  // The outer node is a something like a <browser>, <frame>, <iframe>, <page> or
  // <editor> tag, whereas the inner node corresponds to the inner document root.

  nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
  NS_ASSERTION(content, "No nsIContent for <browser>/<iframe>/<editor> dom node");

  nsCOMPtr<nsIDocument> outerDoc = content->GetDocument();
  if (!outerDoc) {
    return;
  }

  nsIDocument *innerDoc = outerDoc->GetSubDocumentFor(content);
  nsCOMPtr<nsIDOMNode> innerNode(do_QueryInterface(innerDoc));
  if (!innerNode) {
    return;
  }

  nsCOMPtr<nsIAccessible> innerAccessible;
  nsCOMPtr<nsIAccessibilityService> accService = 
    do_GetService("@mozilla.org/accessibilityService;1");
  accService->GetAccessibleFor(innerNode, getter_AddRefs(innerAccessible));
  nsRefPtr<nsAccessible> innerAcc(nsAccUtils::QueryAccessible(innerAccessible));
  if (!innerAcc)
    return;

  // Success getting inner document as first child -- now we cache it.
  mAccChildCount = 1;
  SetFirstChild(innerAccessible); // weak ref
  innerAcc->SetParent(this);
  innerAcc->SetNextSibling(nsnull);
}
コード例 #3
0
nsresult
nsApplicationAccessibleWrap::RemoveRootAccessible(nsIAccessible *aRootAccWrap)
{
    NS_ENSURE_ARG_POINTER(aRootAccWrap);

    PRUint32 index = 0;
    nsresult rv = NS_ERROR_FAILURE;

    // we must use weak ref to get the index
    nsCOMPtr<nsIWeakReference> weakPtr = do_GetWeakReference(aRootAccWrap);
    rv = mChildren->IndexOf(0, weakPtr, &index);

    AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aRootAccWrap);
    atk_object_set_parent(atkAccessible, NULL);
    g_signal_emit_by_name(mAtkObject, "children_changed::remove", index,
                          atkAccessible, NULL);

#ifdef MAI_LOGGING
    PRUint32 count = 0;
    mChildren->GetLength(&count);

    if (NS_SUCCEEDED(rv)) {
        rv = mChildren->RemoveElementAt(index);
        MAI_LOG_DEBUG(("\nRemove RootAcc=%p, count=%d\n",
                       (void*)aRootAccWrap, (count-1)));
    }
    else
        MAI_LOG_DEBUG(("\nFail to Remove RootAcc=%p, count=%d\n",
                       (void*)aRootAccWrap, count));
#else
    NS_ENSURE_SUCCESS(rv, rv);
    rv = mChildren->RemoveElementAt(index);

#endif
    InvalidateChildren();
    return rv;
}
コード例 #4
0
ファイル: YWidget.cpp プロジェクト: jwk000/YSLib
void
InvalidateAll(IWidget& wgt, const Rect& bounds)
{
	InvalidateChildren(wgt, bounds);
	Invalidate(wgt, bounds);
}