From 4426a68bb6b6b6e86d1dfc637e512d7406baf846 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 15 Dec 2010 12:26:54 -0800 Subject: [PATCH] Bug 581536 - Part 2: Reconstruct the document element frames when the dir attribute is set on the document; r=bzbarsky a=blocking-betaN+ --HG-- rename : layout/reftests/forms/textarea-rtl.html => layout/reftests/forms/textarea-in-dynamic-rtl-doc.html extra : rebase_source : 444e9dfa75be1e880679c405afd90cfc4031131c --- layout/base/nsFrameManager.cpp | 4 +++- layout/base/nsPresContext.cpp | 7 +++++-- layout/reftests/forms/reftest.list | 1 + .../forms/textarea-in-dynamic-rtl-doc.html | 18 ++++++++++++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 layout/reftests/forms/textarea-in-dynamic-rtl-doc.html diff --git a/layout/base/nsFrameManager.cpp b/layout/base/nsFrameManager.cpp index eee6a3a0dbb..574836c1ca8 100644 --- a/layout/base/nsFrameManager.cpp +++ b/layout/base/nsFrameManager.cpp @@ -984,7 +984,9 @@ CaptureChange(nsStyleContext* aOldContext, nsStyleContext* aNewContext, NS_UpdateHint(ourChange, aChangeToAssume); if (NS_UpdateHint(aMinChange, ourChange)) { - aChangeList->AppendChange(aFrame, aContent, ourChange); + if (!(ourChange & nsChangeHint_ReconstructFrame) || aContent) { + aChangeList->AppendChange(aFrame, aContent, ourChange); + } } return aMinChange; } diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index a97f2edd5ad..7af8e706bb8 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -1462,8 +1462,11 @@ nsPresContext::SetBidi(PRUint32 aSource, PRBool aForceRestyle) SetVisualMode(IsVisualCharset(doc->GetDocumentCharacterSet())); } } - if (aForceRestyle) { - RebuildAllStyleData(NS_STYLE_HINT_REFLOW); + if (aForceRestyle && mShell) { + // Reconstruct the root document element's frame and its children, + // because we need to trigger frame reconstruction for direction change. + RebuildUserFontSet(); + mShell->ReconstructFrames(); } } diff --git a/layout/reftests/forms/reftest.list b/layout/reftests/forms/reftest.list index b7292b35d1b..27d565139de 100644 --- a/layout/reftests/forms/reftest.list +++ b/layout/reftests/forms/reftest.list @@ -22,6 +22,7 @@ skip-if(winWidget) == textarea-resize-background.html textarea-resize-background != textarea-rtl.html textarea-no-resize.html == textarea-rtl.html textarea-rtl-dynamic-attr.html == textarea-rtl.html textarea-rtl-dynamic-style.html +== textarea-rtl.html textarea-in-dynamic-rtl-doc.html == textarea-setvalue-framereconstruction-1.html textarea-setvalue-framereconstruction-ref.html == radio-label-dynamic.html radio-label-dynamic-ref.html diff --git a/layout/reftests/forms/textarea-in-dynamic-rtl-doc.html b/layout/reftests/forms/textarea-in-dynamic-rtl-doc.html new file mode 100644 index 00000000000..c8afa20cf26 --- /dev/null +++ b/layout/reftests/forms/textarea-in-dynamic-rtl-doc.html @@ -0,0 +1,18 @@ + + + + + + + + + + +