Kaydet (Commit) 5b51aa12 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#123505 svx: fix invalidation loop caused by special form control geometry

Regression from commit d464d505
(Refactor calc non-linear ViewToDevice transform, 2018-10-12), the
problem was that the opengl menu was never painted from the starved idle
handler as a paint-invalidation loop starved the main loop.

ScGridWindow::Paint() called vcl::Window::ImplPosSizeWindow() for the
form control of the bugdoc, which triggered an invalidation -> paint ->
start again.

Checking what adjustControlGeometry_throw() did, the result of the
transformed points are quite close to each other, but not equivalent:

debug:18521:18521: adjustControlGeometry_throw: aTopLeft before transformation is (1773,426)
debug:18521:18521: adjustControlGeometry_throw: aTopLeft after transformation is (64.935,16.0382)
debug:18521:18521: adjustControlGeometry_throw: aPaintRectPixel is 952x586@(64,16)

If we round, rather than truncate, then the size of the control is
always the same, so no actual resize and invalidation happens during
paint.

Change-Id: Id55fd227e3ae7fc57d5253bc28f42b9b4315450e
Reviewed-on: https://gerrit.libreoffice.org/69821Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
üst 5f8aaa09
<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
<office:styles>
</office:styles>
<office:automatic-styles>
<style:style style:name="co1" style:family="table-column">
<style:table-column-properties fo:break-before="auto" style:column-width="17.73mm"/>
</style:style>
<style:style style:name="co2" style:family="table-column">
<style:table-column-properties fo:break-before="auto" style:column-width="19.84mm"/>
</style:style>
<style:page-layout style:name="pm1">
<style:page-layout-properties fo:page-width="210.01mm" fo:page-height="297mm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="24.99mm" fo:margin-bottom="12.51mm" fo:margin-left="20mm" fo:margin-right="20mm" style:first-page-number="continue" style:scale-to="100%" style:writing-mode="lr-tb"/>
</style:page-layout>
</office:automatic-styles>
<office:master-styles>
<style:master-page style:name="PageStyle_5f_Branco" style:display-name="PageStyle_Branco" style:page-layout-name="pm1"/>
</office:master-styles>
<office:body>
<office:spreadsheet>
<table:table table:name="Branco" table:style-name="ta1">
<office:forms form:automatic-focus="false" form:apply-design-mode="false">
<form:form form:name="Standard" form:apply-filter="true" form:control-implementation="ooo:com.sun.star.form.component.Form" office:target-frame="">
<form:fixed-text form:name="Label2" form:control-implementation="ooo:com.sun.star.form.component.FixedText" xml:id="control1" form:id="control1" form:multi-line="true"/>
</form:form>
</office:forms>
<table:table-column table:style-name="co1" table:number-columns-repeated="11" table:default-cell-style-name="Default"/>
<table:table-column table:style-name="co2" table:number-columns-repeated="2" table:default-cell-style-name="Default"/>
<table:table-column table:style-name="co1" table:number-columns-repeated="1011" table:default-cell-style-name="Default"/>
<table:table-row>
<table:table-cell>
<draw:g draw:z-index="0" draw:name="Grupo 4">
<draw:control draw:name="Label2" draw:text-style-name="P1" svg:width="259.72mm" svg:height="155.83mm" svg:x="17.73mm" svg:y="4.26mm" draw:control="control1"/>
</draw:g>
</table:table-cell>
</table:table-row>
</table:table>
</office:spreadsheet>
</office:body>
</office:document>
......@@ -92,6 +92,7 @@ public:
void testIMESupport();
void testFilterDlg();
void testVbaRangeCopyPaste();
void testInvalidationLoop();
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
CPPUNIT_TEST(testRowColumnSelections);
......@@ -125,6 +126,7 @@ public:
CPPUNIT_TEST(testIMESupport);
CPPUNIT_TEST(testFilterDlg);
CPPUNIT_TEST(testVbaRangeCopyPaste);
CPPUNIT_TEST(testInvalidationLoop);
CPPUNIT_TEST_SUITE_END();
private:
......@@ -1677,6 +1679,15 @@ void ScTiledRenderingTest::testVbaRangeCopyPaste()
comphelper::LibreOfficeKit::setActive(false);
}
void ScTiledRenderingTest::testInvalidationLoop()
{
// Load the document with a form control.
createDoc("invalidation-loop.fods");
// Without the accompanying fix in place, this test would have never returned due to an infinite
// invalidation loop between ScGridWindow::Paint() and vcl::Window::ImplPosSizeWindow().
Scheduler::ProcessEventsToIdle();
}
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
......
......@@ -298,7 +298,10 @@ namespace sdr { namespace contact {
::basegfx::B2DPoint aBottomRight( _rLogicBoundingRect.Right(), _rLogicBoundingRect.Bottom() );
aBottomRight *= _rViewTransformation;
const tools::Rectangle aPaintRectPixel( static_cast<long>(aTopLeft.getX()), static_cast<long>(aTopLeft.getY()), static_cast<long>(aBottomRight.getX()), static_cast<long>(aBottomRight.getY()) );
const tools::Rectangle aPaintRectPixel(static_cast<long>(std::round(aTopLeft.getX())),
static_cast<long>(std::round(aTopLeft.getY())),
static_cast<long>(std::round(aBottomRight.getX())),
static_cast<long>(std::round(aBottomRight.getY())));
_rControl.setPosSize( aPaintRectPixel );
// determine the scale from the current view transformation, and the normalization matrix
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment