mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-01 10:40:20 +03:00
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:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user