diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-05-31 11:42:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-05-31 14:34:54 +0100 |
commit | 1c353c91338e059de3668e15066975aa50170119 (patch) | |
tree | 8f10d81780cfc005b17d89f1a9761aea2d146023 | |
parent | 8c803ef23294288001f9f1557c9777ffa3e5586e (diff) |
make CheckCharacterBounds tests happy without forcing empty glyphs 1 unit wide
related, i#87757 and 8bafe38c569afa2e1055eb647cb7ff161ddd1230
which itself is related to ce14342c4292628a641a72d4f63d9c048e030c6a,
These character bounds are backed by what's the glyph bounding box for the ink
used for the glyph. Whitespace has no ink so its an empty Rectangle. Which
brings the awesome RECT_EMPTY into play.
It might be a bit dubious in the first place to back getCharacterBounds with
the glyph bounding box in the first place, rather than maybe the advance width
or some such. But lets assume that decision was intentional.
So, the qa test should accept that a glyph might be of 0 width anyway.
Then, tweak rectangle merging so that we can preserve the correct top-left
position of an empty glyph
So, we can determine the correct character index given the top-left position
of an empty glyph
Change-Id: I5e18460ff7cd90cd27d5eede2aa0a5494c36a5d3
-rw-r--r-- | qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java | 4 | ||||
-rw-r--r-- | vcl/generic/glyphs/gcach_layout.cxx | 5 | ||||
-rw-r--r-- | vcl/inc/generic/glyphcache.hxx | 2 | ||||
-rw-r--r-- | vcl/source/control/ctrl.cxx | 5 | ||||
-rw-r--r-- | vcl/source/gdi/sallayout.cxx | 5 |
5 files changed, 11 insertions, 10 deletions
diff --git a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java index 22626cf34c1f..8ccb6fa5093d 100644 --- a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java +++ b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java @@ -385,9 +385,9 @@ public class _XAccessibleText extends MultiMethodTest { localres = chBounds.X >= 0; localres &= (chBounds.Y >= 0); localres &= ((chBounds.X + chBounds.Width) <= bounds.Width); - localres &= ((chBounds.X + chBounds.Width) > 0); + localres &= ((chBounds.X + chBounds.Width) >= 0); localres &= ((chBounds.Y + chBounds.Height) <= bounds.Height); - localres &= ((chBounds.Y + chBounds.Height) > 0); + localres &= ((chBounds.Y + chBounds.Height) >= 0); if (!localres) { log.println("Text at this place: "+oObj.getCharacter(i)); diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx index c1b5b102e779..ef03aa302311 100644 --- a/vcl/generic/glyphs/gcach_layout.cxx +++ b/vcl/generic/glyphs/gcach_layout.cxx @@ -43,11 +43,6 @@ namespace { struct SimpleLayoutEngine : public rtl::Static< ServerFontLayoutEngine, SimpleLayoutEngine > {}; } -void GlyphMetric::SetSize(const Size& s) -{ - maSize = Size(std::max<long>(1, s.Width()), std::max<long>(1, s.Height())); -} - // ======================================================================= // layout implementation for ServerFont // ======================================================================= diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx index 8c0f3b17cacd..1ab2a74eda45 100644 --- a/vcl/inc/generic/glyphcache.hxx +++ b/vcl/inc/generic/glyphcache.hxx @@ -132,7 +132,7 @@ protected: friend class GlyphData; void SetOffset( int nX, int nY ) { maOffset = Point( nX, nY); } void SetDelta( int nX, int nY ) { maDelta = Point( nX, nY); } - void SetSize(const Size& s); + void SetSize( const Size& s ) { maSize = s; } void SetCharWidth( long nW ) { mnAdvanceWidth = nW; } private: diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 0bfe0deefc82..cd1c7df39cd5 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -172,7 +172,10 @@ long ControlLayoutData::GetIndexForPoint( const Point& rPoint ) const long nIndex = -1; for( long i = m_aUnicodeBoundRects.size()-1; i >= 0; i-- ) { - if( m_aUnicodeBoundRects[ i ].IsInside( rPoint ) ) + Point aTopLeft = m_aUnicodeBoundRects[i].TopLeft(); + Point aBottomRight = m_aUnicodeBoundRects[i].BottomRight(); + if (rPoint.X() >= aTopLeft.X() && rPoint.Y() >= aTopLeft.Y() && + rPoint.X() <= aBottomRight.X() && rPoint.Y() <= aBottomRight.Y()) { nIndex = i; break; diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index d25a4b1602a2..f6fe82026354 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -761,7 +761,10 @@ bool SalLayout::GetBoundRect( SalGraphics& rSalGraphics, Rectangle& rRect ) cons { // merge rectangle aRectangle += aPos; - rRect.Union( aRectangle ); + if (rRect.IsEmpty()) + rRect = aRectangle; + else + rRect.Union(aRectangle); bRet = true; } } |