void CharacterData::DeleteData(uint32_t aOffset, uint32_t aCount, ErrorResult& aRv) { nsresult rv = SetTextInternal(aOffset, aCount, nullptr, 0, true); if (NS_FAILED(rv)) { aRv.Throw(rv); } }
void TextResource::SetText(const QString &text) { // We need to delay updating the QTextDocument if SetText has // been called from something other than the main GUI thread. Why? // Because a CodeView is probably connected to the text document, // and if we update it from a non-GUI thread, it will notify the // CodeView base class to update as well and that will crash us since // the base class derives from QWidget (and those can only be updated // in the GUI thread). // So we cache the text update into m_Cache and update the QTextDocument // when we return to the GUI thread. The single-shot timer makes sure // of that. if (QThread::currentThread() == QApplication::instance()->thread()) { SetTextInternal(text); } else { QMutexLocker locker(&m_CacheAccessMutex); m_Cache = text; // We want to make sure we schedule only one delayed update if (!m_CacheInUse) { m_CacheInUse = true; QTimer::singleShot(0, this, SLOT(DelayedUpdateToTextDocument())); } } }
void CharacterData::SetData(const nsAString& aData, ErrorResult& aRv) { nsresult rv = SetTextInternal(0, mText.GetLength(), aData.BeginReading(), aData.Length(), true); if (NS_FAILED(rv)) { aRv.Throw(rv); } }
nsresult CharacterData::AppendText(const char16_t* aBuffer, uint32_t aLength, bool aNotify) { return SetTextInternal(mText.GetLength(), 0, aBuffer, aLength, aNotify); }
void CharacterData::ReplaceData(uint32_t aOffset, uint32_t aCount, const nsAString& aData, ErrorResult& aRv) { nsresult rv = SetTextInternal(aOffset, aCount, aData.BeginReading(), aData.Length(), true); if (NS_FAILED(rv)) { aRv.Throw(rv); } }
void BitmapText::SetWrapWidthPixels( int iWrapWidthPixels ) { ASSERT( m_pFont != NULL ); // always load a font first if( m_iWrapWidthPixels == iWrapWidthPixels ) return; m_iWrapWidthPixels = iWrapWidthPixels; SetTextInternal(); }
void TextResource::DelayedUpdateToTextDocument() { QMutexLocker locker(&m_CacheAccessMutex); if (!m_CacheInUse) { return; } SetTextInternal(m_Cache); }
nsXMLProcessingInstruction::nsXMLProcessingInstruction(nsINodeInfo *aNodeInfo, const nsAString& aTarget, const nsAString& aData) : nsGenericDOMDataNode(aNodeInfo), mTarget(aTarget) { SetTextInternal(0, mText.GetLength(), aData.BeginReading(), aData.Length(), PR_FALSE); // Don't notify (bug 420429). }
nsXMLProcessingInstruction::nsXMLProcessingInstruction(already_AddRefed<nsINodeInfo> aNodeInfo, const nsAString& aData) : nsGenericDOMDataNode(aNodeInfo) { NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::PROCESSING_INSTRUCTION_NODE, "Bad NodeType in aNodeInfo"); SetTextInternal(0, mText.GetLength(), aData.BeginReading(), aData.Length(), PR_FALSE); // Don't notify (bug 420429). }
/* sText is UTF-8. If not all of the characters in sText are available in the * font, sAlternateText will be used instead. If there are unavailable characters * in sAlternateText, too, just use sText. */ void BitmapText::SetText( const RString& _sText, const RString& _sAlternateText, int iWrapWidthPixels ) { ASSERT( m_pFont != NULL ); RString sNewText = StringWillUseAlternate(_sText,_sAlternateText) ? _sAlternateText : _sText; if( m_bUppercase ) sNewText.MakeUpper(); if( iWrapWidthPixels == -1 ) // wrap not specified iWrapWidthPixels = m_iWrapWidthPixels; if( m_sText == sNewText && iWrapWidthPixels==m_iWrapWidthPixels ) return; m_sText = sNewText; m_iWrapWidthPixels = iWrapWidthPixels; ClearAttributes(); SetTextInternal(); }