зеркало из https://github.com/mozilla/gecko-dev.git
fix problem where SetText would truncate text to 255.
This commit is contained in:
Родитель
ecb91bfb05
Коммит
901eaba192
|
@ -22,7 +22,7 @@
|
|||
#include "nsColor.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#define DBG 0
|
||||
|
||||
|
@ -449,23 +449,28 @@ LongRect macRect;
|
|||
*/
|
||||
PRUint32 nsTextAreaWidget::SetText(const nsString& aText, PRUint32& aSize)
|
||||
{
|
||||
char buffer[256];
|
||||
PRInt32 len;
|
||||
PRInt32 offx,offy;
|
||||
GrafPtr theport;
|
||||
|
||||
Size textSize = aText.Length();
|
||||
if ( aSize < textSize ) // truncate to given size
|
||||
textSize = aSize;
|
||||
const unsigned int bufferSize = textSize + 1; // add 1 for null
|
||||
|
||||
CalcOffset(offx,offy);
|
||||
::GetPort(&theport);
|
||||
::SetPort(mWindowPtr);
|
||||
//::SetOrigin(-offx,-offy);
|
||||
|
||||
this->RemoveText();
|
||||
aText.ToCString(buffer,255);
|
||||
len = strlen(buffer);
|
||||
|
||||
WEInsert(buffer,len,0,0,mTE_Data);
|
||||
|
||||
aSize = len;
|
||||
auto_ptr<char> buffer ( new char[bufferSize] );
|
||||
if ( buffer.get() ) {
|
||||
aText.ToCString(buffer.get(),bufferSize);
|
||||
WEInsert(buffer.get(),aSize,0,0,mTE_Data);
|
||||
}
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
//::SetOrigin(0,0);
|
||||
::SetPort(theport);
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче