示例#1
0
nsresult
nsImageMap::UpdateAreas()
{
  // Get rid of old area data
  FreeAreas();

  PRBool foundArea = PR_FALSE;
  PRBool foundAnchor = PR_FALSE;
  mContainsBlockContents = PR_FALSE;

  return SearchForAreas(mMap, foundArea, foundAnchor);
}
示例#2
0
nsresult
nsImageMap::UpdateAreas()
{
  // Get rid of old area data
  FreeAreas();

  bool foundArea = false;
  bool foundAnchor = false;
  mContainsBlockContents = false;

  return SearchForAreas(mMap, foundArea, foundAnchor);
}
示例#3
0
nsresult
nsImageMap::SearchForAreas(nsIContent* aParent, PRBool& aFoundArea,
                           PRBool& aFoundAnchor)
{
  nsresult rv = NS_OK;
  PRUint32 i, n = aParent->GetChildCount();

  // Look for <area> or <a> elements. We'll use whichever type we find first.
  for (i = 0; i < n; i++) {
    nsIContent *child = aParent->GetChildAt(i);

    if (child->IsHTML()) {
      // If we haven't determined that the map element contains an
      // <a> element yet, then look for <area>.
      if (!aFoundAnchor && child->Tag() == nsGkAtoms::area) {
        aFoundArea = PR_TRUE;
        rv = AddArea(child);
        NS_ENSURE_SUCCESS(rv, rv);

        // Continue to next child. This stops mContainsBlockContents from
        // getting set. It also makes us ignore children of <area>s which
        // is consistent with how we react to dynamic insertion of such
        // children.
        continue;
      }
      // If we haven't determined that the map element contains an
      // <area> element yet, then look for <a>.
      if (!aFoundArea && child->Tag() == nsGkAtoms::a) {
        aFoundAnchor = PR_TRUE;
        rv = AddArea(child);
        NS_ENSURE_SUCCESS(rv, rv);
      }
    }

    if (child->IsElement()) {
      mContainsBlockContents = PR_TRUE;
      rv = SearchForAreas(child, aFoundArea, aFoundAnchor);
      NS_ENSURE_SUCCESS(rv, rv);
    }
  }

  return NS_OK;
}
示例#4
0
nsresult
nsImageMap::UpdateAreas()
{
  // Get rid of old area data
  FreeAreas();

  bool foundArea = false;
  bool foundAnchor = false;
  mContainsBlockContents = false;

  nsresult rv = SearchForAreas(mMap, foundArea, foundAnchor);
#ifdef ACCESSIBILITY
  if (NS_SUCCEEDED(rv)) {
    nsAccessibilityService* accService = GetAccService();
    if (accService) {
      accService->UpdateImageMap(mImageFrame);
    }
  }
#endif
  return rv;
}