summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-10-10 14:10:48 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2023-10-10 16:34:11 +0200
commit9fc43f19615161d5db39db7ee4d1e214c1da8e57 (patch)
tree43085b7e39472d1a99446b59fce7c08b61b24c58 /vcl
parentc50bca0fc298973bbeda697072528e3dfc887ac5 (diff)
gtk3 a11y: Drop unnecessary check before looping
If `nTextMarkupCount` is <= 0 here, the loop condition isn't met, so the body is never entered anyway, so no need to check this explicitly. Drop the extra nesting level. (Use `git show -w` to ignore whitespace change.) Change-Id: Ib472da039d7b0a02ae3206b350c3feb6d42b914b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157759 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk3/a11y/atktext.cxx99
1 files changed, 48 insertions, 51 deletions
diff --git a/vcl/unx/gtk3/a11y/atktext.cxx b/vcl/unx/gtk3/a11y/atktext.cxx
index e8ceab3bb657..8b1ab674227d 100644
--- a/vcl/unx/gtk3/a11y/atktext.cxx
+++ b/vcl/unx/gtk3/a11y/atktext.cxx
@@ -438,68 +438,65 @@ handle_text_markup_as_run_attribute( css::uno::Reference<css::accessibility::XAc
gint *end_offset )
{
const gint nTextMarkupCount( pTextMarkup->getTextMarkupCount( nTextMarkupType ) );
- if ( nTextMarkupCount > 0 )
+ for ( gint nTextMarkupIndex = 0;
+ nTextMarkupIndex < nTextMarkupCount;
+ ++nTextMarkupIndex )
{
- for ( gint nTextMarkupIndex = 0;
- nTextMarkupIndex < nTextMarkupCount;
- ++nTextMarkupIndex )
+ accessibility::TextSegment aTextSegment =
+ pTextMarkup->getTextMarkup( nTextMarkupIndex, nTextMarkupType );
+ const gint nStartOffsetTextMarkup = aTextSegment.SegmentStart;
+ const gint nEndOffsetTextMarkup = aTextSegment.SegmentEnd;
+ if ( nStartOffsetTextMarkup <= offset )
{
- accessibility::TextSegment aTextSegment =
- pTextMarkup->getTextMarkup( nTextMarkupIndex, nTextMarkupType );
- const gint nStartOffsetTextMarkup = aTextSegment.SegmentStart;
- const gint nEndOffsetTextMarkup = aTextSegment.SegmentEnd;
- if ( nStartOffsetTextMarkup <= offset )
+ if ( offset < nEndOffsetTextMarkup )
{
- if ( offset < nEndOffsetTextMarkup )
+ // text markup at <offset>
+ *start_offset = ::std::max( *start_offset,
+ nStartOffsetTextMarkup );
+ *end_offset = ::std::min( *end_offset,
+ nEndOffsetTextMarkup );
+ switch ( nTextMarkupType )
{
- // text markup at <offset>
- *start_offset = ::std::max( *start_offset,
- nStartOffsetTextMarkup );
- *end_offset = ::std::min( *end_offset,
- nEndOffsetTextMarkup );
- switch ( nTextMarkupType )
+ case css::text::TextMarkupType::SPELLCHECK:
{
- case css::text::TextMarkupType::SPELLCHECK:
- {
- pSet = attribute_set_prepend_misspelled( pSet );
- }
- break;
- case css::text::TextMarkupType::TRACK_CHANGE_INSERTION:
- {
- pSet = attribute_set_prepend_tracked_change_insertion( pSet );
- }
- break;
- case css::text::TextMarkupType::TRACK_CHANGE_DELETION:
- {
- pSet = attribute_set_prepend_tracked_change_deletion( pSet );
- }
- break;
- case css::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
- {
- pSet = attribute_set_prepend_tracked_change_formatchange( pSet );
- }
- break;
- default:
- {
- OSL_ASSERT( false );
- }
+ pSet = attribute_set_prepend_misspelled( pSet );
+ }
+ break;
+ case css::text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ {
+ pSet = attribute_set_prepend_tracked_change_insertion( pSet );
+ }
+ break;
+ case css::text::TextMarkupType::TRACK_CHANGE_DELETION:
+ {
+ pSet = attribute_set_prepend_tracked_change_deletion( pSet );
+ }
+ break;
+ case css::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pSet = attribute_set_prepend_tracked_change_formatchange( pSet );
+ }
+ break;
+ default:
+ {
+ OSL_ASSERT( false );
}
- break; // no further iteration needed.
- }
- else
- {
- *start_offset = ::std::max( *start_offset,
- nEndOffsetTextMarkup );
- // continue iteration.
}
+ break; // no further iteration needed.
}
else
{
- *end_offset = ::std::min( *end_offset,
- nStartOffsetTextMarkup );
- break; // no further iteration.
+ *start_offset = ::std::max( *start_offset,
+ nEndOffsetTextMarkup );
+ // continue iteration.
}
- } // eof iteration over text markups
+ }
+ else
+ {
+ *end_offset = ::std::min( *end_offset,
+ nStartOffsetTextMarkup );
+ break; // no further iteration.
+ }
}
return pSet;