sw/qa/extras/uiwriter/data2/tdf124261.docx |binary sw/qa/extras/uiwriter/uiwriter2.cxx | 37 +++++++++++++++++++++++++++++ sw/source/core/text/frmpaint.cxx | 2 - sw/source/core/text/txtfrm.cxx | 7 +++-- 4 files changed, 42 insertions(+), 4 deletions(-)
New commits: commit e651a4f45b310f9890ffbf712b9970d4c452ecec Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Apr 1 21:34:50 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Apr 2 13:18:05 2019 +0200 tdf#124261 sw btlr writing mode render: fix invalidation rectangle SwTextFrame::SwitchHorizontalToVertical(SwRect) did not handle the non-swapped case, also the text frame took the tblr codepath when determining the invalidation rectangle of the layout frame, but that special-case is not needed for the btlr direction. Typing into the cell of the bugdoc now determines the paint rectangle correctly, so the typed letters show up right after typing. Change-Id: I48c75603963868591d72bf4d0e8dbba679f3b5e9 Reviewed-on: https://gerrit.libreoffice.org/70087 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/sw/qa/extras/uiwriter/data2/tdf124261.docx b/sw/qa/extras/uiwriter/data2/tdf124261.docx new file mode 100644 index 000000000000..1d3efa5276f4 Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf124261.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 27b4a4716586..9655d1e9b80c 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -32,6 +32,7 @@ #include <swtypes.hxx> #include <fmtornt.hxx> #include <xmloff/odffields.hxx> +#include <txtfrm.hxx> namespace { @@ -69,6 +70,7 @@ public: void testCheckboxFormFieldInsertion(); void testDropDownFormFieldInsertion(); void testMixedFormFieldInsertion(); + void testTdf124261(); CPPUNIT_TEST_SUITE(SwUiWriterTest2); CPPUNIT_TEST(testRedlineMoveInsertInDelete); @@ -97,6 +99,7 @@ public: CPPUNIT_TEST(testCheckboxFormFieldInsertion); CPPUNIT_TEST(testDropDownFormFieldInsertion); CPPUNIT_TEST(testMixedFormFieldInsertion); + CPPUNIT_TEST(testTdf124261); CPPUNIT_TEST_SUITE_END(); virtual std::unique_ptr<Resetter> preTest(const char* filename) override @@ -1121,6 +1124,40 @@ void SwUiWriterTest2::testMixedFormFieldInsertion() CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pMarkAccess->getAllMarksCount()); } +void SwUiWriterTest2::testTdf124261() +{ +#if !defined(WNT) + // Make sure that pressing a key in a btlr cell frame causes an immediate, correct repaint. + SwDoc* pDoc = createDoc("tdf124261.docx"); + SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + SwFrame* pPageFrame = pLayout->GetLower(); + CPPUNIT_ASSERT(pPageFrame->IsPageFrame()); + + SwFrame* pBodyFrame = pPageFrame->GetLower(); + CPPUNIT_ASSERT(pBodyFrame->IsBodyFrame()); + + SwFrame* pTabFrame = pBodyFrame->GetLower(); + CPPUNIT_ASSERT(pTabFrame->IsTabFrame()); + + SwFrame* pRowFrame = pTabFrame->GetLower(); + CPPUNIT_ASSERT(pRowFrame->IsRowFrame()); + + SwFrame* pCellFrame = pRowFrame->GetLower(); + CPPUNIT_ASSERT(pCellFrame->IsCellFrame()); + + SwFrame* pFrame = pCellFrame->GetLower(); + CPPUNIT_ASSERT(pFrame->IsTextFrame()); + + // Make sure that the text frame's area and the paint rectangle match. + // Without the accompanying fix in place, this test would have failed with 'Expected: 1721; + // Actual: 1547', i.e. an area other than the text frame was invalidated for a single-line + // paragraph. + SwTextFrame* pTextFrame = static_cast<SwTextFrame*>(pFrame); + SwRect aRect = pTextFrame->GetPaintSwRect(); + CPPUNIT_ASSERT_EQUAL(pTextFrame->getFrameArea().Top(), aRect.Top()); +#endif +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 5debf4061f54..99e34f9673a6 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -423,7 +423,7 @@ SwRect SwTextFrame::GetPaintSwRect() SwRepaint& rRepaint = GetPara()->GetRepaint(); long l; - if ( IsVertLR() ) // mba: the following line was added, but we don't need it for the existing directions; kept for IsVertLR(), but should be checked + if ( IsVertLR() && !IsVertLRBT()) // mba: the following line was added, but we don't need it for the existing directions; kept for IsVertLR(), but should be checked rRepaint.Chg( GetUpper()->getFrameArea().Pos() + GetUpper()->getFramePrintArea().Pos(), GetUpper()->getFramePrintArea().SSize() ); if( rRepaint.GetOfst() ) diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 5c52922b267d..f71fee6ec9d5 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -516,9 +516,10 @@ void SwTextFrame::SwitchHorizontalToVertical( SwRect& rRect ) const if (IsVertLRBT()) { - SAL_WARN_IF(!mbIsSwapped, "sw.core", - "SwTextFrame::SwitchHorizontalToVertical, IsVertLRBT, not swapped"); - rRect.Top(getFrameArea().Top() + getFrameArea().Width() - nOfstX); + if (mbIsSwapped) + rRect.Top(getFrameArea().Top() + getFrameArea().Width() - nOfstX); + else + rRect.Top(getFrameArea().Top() + getFrameArea().Height() - nOfstX); } else rRect.Top(getFrameArea().Top() + nOfstX); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits