Ejemplo n.º 1
0
void
ImageDocument::UpdateSizeFromLayout()
{
  // Pull an updated size from the content frame to account for any size
  // change due to CSS properties like |image-orientation|.
  Element* contentElement = mImageContent->AsElement();
  if (!contentElement) {
    return;
  }

  nsIFrame* contentFrame = contentElement->GetPrimaryFrame(Flush_Frames);
  if (!contentFrame) {
    return;
  }

  nsIntSize oldSize(mImageWidth, mImageHeight);
  IntrinsicSize newSize = contentFrame->GetIntrinsicSize();

  if (newSize.width.GetUnit() == eStyleUnit_Coord) {
    mImageWidth = nsPresContext::AppUnitsToFloatCSSPixels(newSize.width.GetCoordValue());
  }
  if (newSize.height.GetUnit() == eStyleUnit_Coord) {
    mImageHeight = nsPresContext::AppUnitsToFloatCSSPixels(newSize.height.GetCoordValue());
  }

  // Ensure that our information about overflow is up-to-date if needed.
  if (mImageWidth != oldSize.width || mImageHeight != oldSize.height) {
    CheckOverflowing(false);
  }
}
Ejemplo n.º 2
0
CSenElement* CMyXmlEle::XMLDocL()
{
CSenElement* ele = &AsElement();
    if(ele)
        return ele;
    else
        return NULL;
}
EXPORT_C TPtrC8 CSenWsSecurityHeader::XmlNsPrefix()
    {
    // Note that AsElement() will panic, if CSenBaseFragment::ipElement == NULL
    if(ipElement)
        {
        return AsElement().NsPrefix();
        }
    else
        {
        return KSecurityXmlNsPrefix();
        }
    }
Ejemplo n.º 4
0
void
ImageDocument::SetModeClass(eModeClasses mode)
{
  nsDOMTokenList* classList = mImageContent->AsElement()->ClassList();
  mozilla::ErrorResult rv;

  if (mode == eShrinkToFit) {
    classList->Add(NS_LITERAL_STRING("shrinkToFit"), rv);
  } else {
    classList->Remove(NS_LITERAL_STRING("shrinkToFit"), rv);
  }

  if (mode == eOverflowing) {
    classList->Add(NS_LITERAL_STRING("overflowing"), rv);
  } else {
    classList->Remove(NS_LITERAL_STRING("overflowing"), rv);
  }
}
EXPORT_C void CSenWsSecurityHeader::BaseConstructL(const TDesC8& aData, const TDesC8& aSecurityNs)
    {
    // create and push pQualifiedName
    HBufC8 *pQualifiedName = HBufC8::NewLC(XmlNsPrefix().Length()+
                                        KColon().Length() +
                                        KSecurityName().Length());

    TPtr8 qualified = pQualifiedName->Des();
    qualified.Append(XmlNsPrefix());
    qualified.Append(KColon);
    qualified.Append(KSecurityName);
    CSenBaseFragment::BaseConstructL(aSecurityNs, KSecurityName, qualified);
    CleanupStack::PopAndDestroy(); // pQualifiedName
    if (aData.Length())
        {
        AsElement().SetContentL(aData);    
        }
    }
// 2004-07-28: the ownership of the given session should be transferred in here
// note: current implementation leaves iService in NULL state, if such arg is
// given(!). But, it might be as well bad idea to preserve old iService
// (session) in case of NULL arg.
void CIdWsfCoreServiceConsumer::SetServiceSessionL( CIdWsfServiceSession* aSession )
    {
    TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel ,"CIdWsfCoreServiceConsumer::SetServiceSessionL");

	_LIT8(KTouch, "touch");
	
    const TDesC8* attrValue = aSession->AsElement().AttrValue(KTouch);
    if(attrValue != NULL)
    	{
    	AsElement().AddAttrL(KTouch, *attrValue);
    	}
    // free memory
    delete iService;
    iService = aSession;

    if(iService)
        {
        iService->AddConsumerL(*this);
        }
    }
Ejemplo n.º 7
0
NS_IMETHODIMP
ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData)
{
  if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
    nsCOMPtr<imgIContainer> image;
    aRequest->GetImage(getter_AddRefs(image));
    return OnStartContainer(aRequest, image);
  }

  nsDOMTokenList* classList = mImageContent->AsElement()->ClassList();
  mozilla::ErrorResult rv;
  if (aType == imgINotificationObserver::DECODE_COMPLETE) {
    if (mImageContent && !nsContentUtils::IsChildOfSameType(this)) {
      // Update the background-color of the image only after the
      // image has been decoded to prevent flashes of just the
      // background-color.
      classList->Add(NS_LITERAL_STRING("decoded"), rv);
      NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
    }
  }

  if (aType == imgINotificationObserver::DISCARD) {
    // mImageContent can be null if the document is already destroyed
    if (mImageContent && !nsContentUtils::IsChildOfSameType(this)) {
      // Remove any decoded-related styling when the image is unloaded.
      classList->Remove(NS_LITERAL_STRING("decoded"), rv);
      NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
    }
  }

  if (aType == imgINotificationObserver::LOAD_COMPLETE) {
    uint32_t reqStatus;
    aRequest->GetImageStatus(&reqStatus);
    nsresult status =
        reqStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK;
    return OnStopRequest(aRequest, status);
  }

  return NS_OK;
}
EXPORT_C void CSenWsSecurityHeader::BaseConstructL(const TDesC8& aData)
    {
    BaseConstructL();
    AsElement().SetContentL(aData);
    }
void CIdWsfSiuHeader::StartElementL(
    const TDesC8& aNsUri,
    const TDesC8& aLocalName,
    const TDesC8& aQName,
    const RAttributeArray& aAttributes
    )
    {
    switch (iState)
        {
        case KStateParsingCredentials:
            {
             // change to even state which ignores and does not save content
            iState = KStateParsingSingleCredential;

            CSenCredential* pCredential = CSenCredential::NewL(aNsUri,
                aLocalName, aQName, aAttributes, AsElement());
            delete ipCredential;
            ipCredential = pCredential;
            if (iNotOnOrAfter != Time::NullTTime())
                {
                ipCredential->SetValidUntil(iNotOnOrAfter);
                }
            DelegateParsingL(*ipCredential);
            break;
            }
        default:
            {
            if ((aLocalName == KEndpointName) ||
                (aLocalName == KSecurityMechIdName))
                {
                DelegateParsingL(aNsUri, aLocalName, aQName, aAttributes);
                }
            else if (aLocalName == KCredentialElementLocalNameName ||
                        aLocalName == KCredentialsName)
                {
                TPtrC8 notOnOrAfter =
                        SenXmlUtils::AttrValue(aAttributes, KNotOnOrAfterName);
                if (notOnOrAfter.Length() > 0)
                    {
                    iNotOnOrAfter =
                                SenDateUtils::FromXmlDateTimeL(notOnOrAfter);
                    }
                else
                    {
                    iNotOnOrAfter = Time::NullTTime();
                    }

                // even state stops saving content
                iState = KStateParsingCredentials;
                CSenBaseFragment::StartElementL(aNsUri, aLocalName,
                                                aQName, aAttributes);
                }
            else
                {
                CSenBaseFragment::StartElementL(aNsUri, aLocalName,
                                                aQName, aAttributes);
                }
            break;
            }
        }
    }
void CIdWsfDsQueryResponse::StartElementL(
    const TDesC8& aNsUri,
    const TDesC8& aLocalName,
    const TDesC8& aQName,
    const RAttributeArray& aAttributes
    )
    {
    switch (iState)
        {
        case KStateIgnore:
            {
            SaveNamespacesL(aAttributes, EFalse);

            // we are interested in the Status element
            if (aLocalName == KStatusName)
                {
                // we should save the status code
                HBufC8* pNew =
                    SenXmlUtils::AllocAttrValueL(aAttributes, 
                                                    KStatusCodeName);
                delete ipStatus;
                ipStatus = pNew;
                }

            // we are interested in ResourceOffering
            else if (aLocalName == KResourceOfferingName)
                {
                // odd state: starts saving content
                iState = KStateParsingResourceOffering;
                ipResourceOffering = CIdWsfResourceOffering::NewL();
                }

            //or in a Credentials
            else if (aLocalName == KCredentialsName)
                {
                iState = KStateParsingCredentials;
                TPtrC8 ptr = SenXmlUtils::AttrValue(aAttributes, 
                                                    KVal_NotOnOrAfter);
                if (ptr.Length()>0)
                    {
                    iNotOnOrAfter = SenDateUtils::FromXmlDateTimeL(ptr);
                    }
                }
            break;
            }
        case KStateParsingResourceOffering:
            {
            // We clean the buffer so that we can save the element content
            // At endElement we will know what member of the resource offering
            // to set.
            ResetContentL();
            // save namespace declarations and ensure that all local prefixes
            // are noted.
            SaveNamespacesL(aAttributes, ETrue);
            if (aLocalName == KServiceInstanceName)
                {
                // if this is second RO, delete the ipServiceInstance made
                // ready
                // previous RO's possible (but not encountered) next service
                // instance.
                // bugfix 2004-11-09
                if(ipServiceInstance)
                    {
                    delete ipServiceInstance;
                    ipServiceInstance = NULL;
                    }

                ipServiceInstance = CIdWsfServiceInstance::NewL();
                }
            if (aLocalName == KEncryptedResourceIdName)
                {
                iState = KStateParsingEncryptedResourceId;
                }
            break;
            }
        case KStateParsingEncryptedResourceId:
            {
            AllocContentSaverL();
            WriteStartElementL(aNsUri, aLocalName, aQName, aAttributes);
            break;
            }
        case KStateParsingCredentials:
            {
            CSenCredential* pCredential = CSenCredential::NewL(
                aNsUri, aLocalName, aQName, aAttributes, AsElement());

            CleanupStack::PushL(pCredential);  // bugfix 2004-08-09

            if (iNotOnOrAfter != Time::NullTTime())
                {
                pCredential->SetValidUntil(iNotOnOrAfter);
                }

            delete ipCredential;
            ipCredential = pCredential;
            CleanupStack::Pop(); // class owns the pCredential now..
            DelegateParsingL(*ipCredential);
            iState = KStateParsingSingleCredential;
            break;
            }
        default:
            {
            break;
            }
        }
    }