perf: keep common text selections in inline storage

- migrate TextRanges to SmallVector with capacity for two selections
  - preserve vector, initializer-list, and single-range construction
  - add coverage for inline storage, copying, and heap fallback
  - export UIStyle::PropertyResolution for Windows shared builds
This commit is contained in:
Martín Lucas Golini
2026-08-09 22:09:29 -03:00
parent 23cf9084ce
commit 357f00c8ed
4 changed files with 31 additions and 5 deletions
+6 -2
View File
@@ -2,8 +2,10 @@
#define EE_UI_DOC_TEXTRANGE_HPP
#include <algorithm>
#include <eepp/core/small_vector.hpp>
#include <eepp/graphics/textselectionrange.hpp>
#include <eepp/ui/doc/textposition.hpp>
#include <vector>
using namespace EE::Graphics;
@@ -146,13 +148,15 @@ class EE_API TextRange {
static TextSelectionRange convertToOffset( const StringType& text, const TextRange& range );
};
class EE_API TextRanges : public std::vector<TextRange> {
class EE_API TextRanges : public SmallVector<TextRange, 2> {
public:
TextRanges();
TextRanges( const std::vector<TextRange>& ranges );
TextRanges( const TextRange& ranges );
TextRanges( std::initializer_list<TextRange> ranges );
TextRanges( const TextRange& range );
bool isSorted() const;
+1 -1
View File
@@ -101,7 +101,7 @@ class EE_API UIStyle : public UIState {
void applyVarValues( CSS::StyleSheetProperty* style );
protected:
class PropertyResolution {
class EE_API PropertyResolution {
public:
PropertyResolution( const PropertyResolution& ) = delete;
PropertyResolution& operator=( const PropertyResolution& ) = delete;