コード例 #1
0
NS_IMETHODIMP
nsDOMCSSDeclaration::SetProperty(const nsAString& aPropertyName,
                                 const nsAString& aValue,
                                 const nsAString& aPriority)
{
  // In the common (and fast) cases we can use the property id
  nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName);
  if (propID == eCSSProperty_UNKNOWN) {
    return NS_OK;
  }

  if (aValue.IsEmpty()) {
    // If the new value of the property is an empty string we remove the
    // property.
    // XXX this ignores the priority string, should it?
    return RemoveProperty(propID);
  }

  if (aPriority.IsEmpty()) {
    return ParsePropertyValue(propID, aValue, PR_FALSE);
  }

  if (aPriority.EqualsLiteral("important")) {
    return ParsePropertyValue(propID, aValue, PR_TRUE);
  }

  // XXX silent failure?
  return NS_OK;
}
コード例 #2
0
NS_IMETHODIMP nsTreeBoxObject::SetView(nsITreeView * aView)
{
  if (!CanTrustView(aView))
    return NS_ERROR_DOM_SECURITY_ERR;
  
  nsITreeBoxObject* body = GetTreeBody();
  if (body) {
    body->SetView(aView);
  
    // only return if the body frame was able to store the view,
    // else we need to cache the property below
    nsCOMPtr<nsITreeView> view;
    body->GetView(getter_AddRefs(view));
    if (view)
      return NS_OK;
  }
  
  nsCOMPtr<nsISupports> suppView(do_QueryInterface(aView));
  if (suppView)
    SetPropertyAsSupports(NS_LITERAL_STRING("view").get(), suppView);
  else
    RemoveProperty(NS_LITERAL_STRING("view").get());

  return NS_OK;
}
コード例 #3
0
// clone properties
GError GAnimElement::CloneProperties(const GAnimElement& Source) {

	const GProperty *srcProp;
	GProperty *tmpProp;
	GBool alreadyExists;
	GUInt32 i;
	GError err;

	G_ASSERT(this != &Source);

	GDynArray<GProperty *>::const_iterator it = Source.gProperties.begin();
	
	// clone every property
	for (; it != Source.gProperties.end(); ++it) {
		srcProp = *it;
		G_ASSERT(srcProp != NULL);

		tmpProp = AddProperty(srcProp->Name(), srcProp->ClassID(), GKeyValue(), alreadyExists, i);
		if (tmpProp) {
			// lets do copy
			err = tmpProp->CopyFrom(*srcProp);
			if (err != G_NO_ERROR)
				RemoveProperty(i);
		}
		else
			G_ASSERT(tmpProp != NULL);
	}
	return G_NO_ERROR;
}
コード例 #4
0
void PropertyHolder::RemoveProperty(const string& reference, const string& prefix)
{
    IRI iri = MakePropertyIRI(reference, prefix);
    if ( iri.IsEmpty() )
        return;
    RemoveProperty(iri);
}
コード例 #5
0
// remove the specified property form internal list
GBool GAnimElement::RemoveProperty(const GString& Name) {

	if (Name.length() <= 0)
		return G_FALSE;

	GUInt32 propIndex;
	GProperty *tmpProp;

	tmpProp = FindProperty(Name, propIndex);
	return RemoveProperty(propIndex);
}
コード例 #6
0
NS_IMETHODIMP
nsDOMCSSDeclaration::SetPropertyValue(const nsCSSProperty aPropID,
                                      const nsAString& aValue)
{
  if (aValue.IsEmpty()) {
    // If the new value of the property is an empty string we remove the
    // property.
    return RemoveProperty(aPropID);
  }

  return ParsePropertyValue(aPropID, aValue, PR_FALSE);
}
コード例 #7
0
NS_IMETHODIMP
nsDOMCSSDeclaration::RemoveProperty(const nsAString& aPropertyName,
                                    nsAString& aReturn)
{
  const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName);
  if (propID == eCSSProperty_UNKNOWN) {
    aReturn.Truncate();
    return NS_OK;
  }

  nsresult rv = GetPropertyValue(propID, aReturn);
  NS_ENSURE_SUCCESS(rv, rv);

  return RemoveProperty(propID);
}
コード例 #8
0
void CameraProperties::InitProperties()
{
    Super::InitProperties();

    RemoveProperty( &mOrientation );
    RegisterProperty( CameraProperties, "FOV Angle",  mFovAngle );
    RegisterProperty( CameraProperties, "Near Plane",  mNearView );
    RegisterProperty( CameraProperties, "Far Plane",  mFarView );    

    mFovAngle.SetMinimum( 5 );
    mFovAngle.SetMaximum( 179 );
    mFovAngle.UseRangeValidation( true );
    mFovAngle.UseSlider( true );

    mNearView.SetMinimum( 0 );
    mNearView.SetMaximum( 100 );
    
    mFarView.SetMinimum( 100 );
}
コード例 #9
0
ファイル: PropertyList.cpp プロジェクト: AlexeyS/cmake
void wxPropertyList::OnDeleteCache( wxCommandEvent& event )
{
    HideControls();
  
    // convert selections to prop items
    wxArrayPtrVoid items;
    for(size_t i = 0; i < (size_t)GetNumberRows(); i++)
    {
        // if selected, query for removal
        if(IsInSelection(i, 0))
        {
            wxPropertyItem *pItem = GetPropertyItemFromRow(i);      
            if(pItem)
                items.Add((void *)pItem);
        }
    }

    // now delete all prop items in cells
    for(size_t i = 0; i < items.Count(); i++)
        RemoveProperty((wxPropertyItem *)items[i]);
}
コード例 #10
0
ファイル: BoxObject.cpp プロジェクト: Nazi-Nigger/gecko-dev
void
BoxObject::RemoveProperty(const nsAString& propertyName)
{
    RemoveProperty(PromiseFlatString(propertyName).get());
}
コード例 #11
0
ファイル: HP_Stream.cpp プロジェクト: briancline/jackosx
void	HP_Stream::Teardown()
{
	RemoveProperty(mFormatList);
	delete mFormatList;
	mFormatList = NULL;
}
コード例 #12
0
/* static */ nsresult
sbLocalDatabaseMediaListBase::GetOriginProperties(
                              sbIMediaItem *             aSourceItem,
                              sbIMutablePropertyArray *  aProperties)
{
  NS_ENSURE_ARG_POINTER(aSourceItem);
  NS_ENSURE_ARG_POINTER(aProperties);

  nsresult rv;

  // Determine whether the target list belongs to a device:
  nsCOMPtr<sbIDeviceManager2> deviceMgr =
    do_GetService("@songbirdnest.com/Songbird/DeviceManager;2", &rv);
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<sbIDevice> targetDev;
  rv = deviceMgr->GetDeviceForItem(static_cast<sbIMediaList *>(this),
                                   getter_AddRefs(targetDev));
  NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "GetDeviceForItem() failed");

  // We only set SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY where it is maintained
  // and currently there are only main library listeners in place to update the
  // property in device libraries, so set SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY
  // only if the the target list belongs to a device.
  PRBool targetIsDevice = (NS_SUCCEEDED(rv) && (targetDev != NULL));

  // Get the origin library:
  nsCOMPtr<sbILibrary> originLib;
  rv = aSourceItem->GetLibrary(getter_AddRefs(originLib));
  NS_ENSURE_SUCCESS(rv, rv);

  // Get the main library:
  nsCOMPtr<sbILibrary> mainLib;
  rv = GetMainLibrary(getter_AddRefs(mainLib));
  NS_ENSURE_SUCCESS(rv, rv);

  // Ensure there is no conflicting value for
  // SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY:
  rv = RemoveProperty(
          aProperties,
          NS_LITERAL_STRING(SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY));
  NS_ENSURE_SUCCESS(rv, rv);

  // Set SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY and remove any existing
  // origin guids if the origin library is the main library.  This will
  // force the code below to regenerate the origin guids whenever an
  // item is copied from the main library:
  if (originLib == mainLib) {
    // Remove SB_PROPERTY_ORIGINLIBRARYGUID:
    rv = RemoveProperty(aProperties,
                        NS_LITERAL_STRING(SB_PROPERTY_ORIGINLIBRARYGUID));
    NS_ENSURE_SUCCESS(rv, rv);

    // Remove SB_PROPERTY_ORIGINITEMGUID:
    rv = RemoveProperty(aProperties,
                        NS_LITERAL_STRING(SB_PROPERTY_ORIGINITEMGUID));
    NS_ENSURE_SUCCESS(rv, rv);

    // Set SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY if the target is a
    // device library:
    if (targetIsDevice) {
      rv = aProperties->AppendProperty(
        NS_LITERAL_STRING(SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY),
        NS_LITERAL_STRING("1"));
      NS_ENSURE_SUCCESS(rv, rv);
    }
  }
  else if (targetIsDevice) {
    // The source library is not the main library, but our target is a device.
    // We need to verify SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY by checking if
    // an item with a guid matching this item's originItemGuid is in the main
    // library.
    rv = sbLibraryUtils::FindOriginalsByID(aSourceItem,
                                           mainLib,
                                           nsnull);
    if (NS_SUCCEEDED(rv)) {
      // We found the original item in the main library, set the
      // SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY flag to true
      rv = aProperties->AppendProperty(
        NS_LITERAL_STRING(SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY),
        NS_LITERAL_STRING("1"));
      NS_ENSURE_SUCCESS(rv, rv);
    }
    else {
      // We could not find the original item in the main library, set the
      // SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY flag to false
      rv = aProperties->AppendProperty(
        NS_LITERAL_STRING(SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY),
        NS_LITERAL_STRING("0"));
      NS_ENSURE_SUCCESS(rv, rv);
    }
  }

  nsCOMPtr<sbILibrary> thisLibrary;
  rv = GetLibrary(getter_AddRefs(thisLibrary));
  NS_ENSURE_SUCCESS(rv, rv);

  PRBool copyingToMainLibrary;
  rv = thisLibrary->Equals(mainLib, &copyingToMainLibrary);
  NS_ENSURE_SUCCESS(rv, rv);

  // If we're not copying to the main library set the origin guids
  if (!copyingToMainLibrary) {
    // Set SB_PROPERTY_ORIGINLIBRARYGUID if it is not already set:
    nsAutoString originLibGuid;
    rv = aProperties->GetPropertyValue(
      NS_LITERAL_STRING(SB_PROPERTY_ORIGINLIBRARYGUID),
      originLibGuid);
    if (rv == NS_ERROR_NOT_AVAILABLE || originLibGuid.IsEmpty()) {
      rv = originLib->GetGuid(originLibGuid);
      NS_ENSURE_SUCCESS(rv, rv);
      rv = aProperties->AppendProperty(
        NS_LITERAL_STRING(SB_PROPERTY_ORIGINLIBRARYGUID),
        originLibGuid);
      NS_ENSURE_SUCCESS(rv, rv);
    }
    else {
      NS_ENSURE_SUCCESS(rv, rv);
    }

    // Set SB_PROPERTY_ORIGINITEMGUID if it is not already set:
    nsAutoString originItemGuid;
    rv = aProperties->GetPropertyValue(
      NS_LITERAL_STRING(SB_PROPERTY_ORIGINITEMGUID),
      originItemGuid);
    if (rv == NS_ERROR_NOT_AVAILABLE || originItemGuid.IsEmpty()) {
      rv = aSourceItem->GetGuid(originItemGuid);
      NS_ENSURE_SUCCESS(rv, rv);
      rv = aProperties->AppendProperty(
        NS_LITERAL_STRING(SB_PROPERTY_ORIGINITEMGUID),
        originItemGuid);
      NS_ENSURE_SUCCESS(rv, rv);
    }
    else {
      NS_ENSURE_SUCCESS(rv, rv);
    }
  }
  return NS_OK;
}