зеркало из https://github.com/mozilla/pjs.git
Bug 240933 - Part 11: Optimize setting the bidi flag for modifications to large DOM text nodes; r=smontagu a=dbaron
--HG-- extra : rebase_source : c16f27b75117b509cf2cbe9fb92d0d03a7868b77
This commit is contained in:
Родитель
4660e39fdd
Коммит
a6e6c99dd5
|
@ -385,7 +385,7 @@ nsGenericDOMDataNode::SetTextInternal(PRUint32 aOffset, PRUint32 aCount,
|
|||
delete [] to;
|
||||
}
|
||||
|
||||
SetBidiStatus();
|
||||
UpdateBidiStatus(aBuffer, aLength);
|
||||
|
||||
// Notify observers
|
||||
if (aNotify) {
|
||||
|
@ -1084,7 +1084,7 @@ nsGenericDOMDataNode::AppendTextTo(nsAString& aResult)
|
|||
mText.AppendTo(aResult);
|
||||
}
|
||||
|
||||
void nsGenericDOMDataNode::SetBidiStatus()
|
||||
void nsGenericDOMDataNode::UpdateBidiStatus(const PRUnichar* aBuffer, PRUint32 aLength)
|
||||
{
|
||||
nsIDocument *document = GetCurrentDoc();
|
||||
if (document && document->GetBidiEnabled()) {
|
||||
|
@ -1092,7 +1092,7 @@ void nsGenericDOMDataNode::SetBidiStatus()
|
|||
return;
|
||||
}
|
||||
|
||||
mText.SetBidiFlag();
|
||||
mText.UpdateBidiFlag(aBuffer, aLength);
|
||||
|
||||
if (document && mText.IsBidi()) {
|
||||
document->SetBidiEnabled();
|
||||
|
|
|
@ -358,7 +358,7 @@ protected:
|
|||
nsTextFragment mText;
|
||||
|
||||
private:
|
||||
void SetBidiStatus();
|
||||
void UpdateBidiStatus(const PRUnichar* aBuffer, PRUint32 aLength);
|
||||
|
||||
already_AddRefed<nsIAtom> GetCurrentValueAtom();
|
||||
};
|
||||
|
|
|
@ -372,11 +372,11 @@ nsTextFragment::Append(const PRUnichar* aBuffer, PRUint32 aLength)
|
|||
// To save time we only do this when we really want to know, not during
|
||||
// every allocation
|
||||
void
|
||||
nsTextFragment::SetBidiFlag()
|
||||
nsTextFragment::UpdateBidiFlag(const PRUnichar* aBuffer, PRUint32 aLength)
|
||||
{
|
||||
if (mState.mIs2b && !mState.mIsBidi) {
|
||||
const PRUnichar* cp = m2b;
|
||||
const PRUnichar* end = cp + mState.mLength;
|
||||
const PRUnichar* cp = aBuffer;
|
||||
const PRUnichar* end = cp + aLength;
|
||||
while (cp < end) {
|
||||
PRUnichar ch1 = *cp++;
|
||||
PRUint32 utf32Char = ch1;
|
||||
|
|
|
@ -112,7 +112,7 @@ public:
|
|||
/**
|
||||
* Return PR_TRUE if this fragment contains Bidi text
|
||||
* For performance reasons this flag is not set automatically, but
|
||||
* requires an explicit call to SetBidiFlag()
|
||||
* requires an explicit call to UpdateBidiFlag()
|
||||
*/
|
||||
PRBool IsBidi() const
|
||||
{
|
||||
|
@ -209,7 +209,7 @@ public:
|
|||
* Scan the contents of the fragment and turn on mState.mIsBidi if it
|
||||
* includes any Bidi characters.
|
||||
*/
|
||||
void SetBidiFlag();
|
||||
void UpdateBidiFlag(const PRUnichar* aBuffer, PRUint32 aLength);
|
||||
|
||||
struct FragmentBits {
|
||||
// PRUint32 to ensure that the values are unsigned, because we
|
||||
|
|
Загрузка…
Ссылка в новой задаче