Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Unified Diff: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h

Issue 2515493002: Refactor HarfBuzzShaper to not retain font data (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h
index 588170b32a2f43bb76c047bd4b7dcb3ddfcc46d3..fe949b09e831addb9efe488fcbad9c63ce2664ab 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h
@@ -32,7 +32,6 @@
#define HarfBuzzShaper_h
#include "platform/fonts/FontDescription.h"
-#include "platform/fonts/SmallCapsIterator.h"
#include "platform/fonts/shaping/ShapeResult.h"
#include "platform/geometry/FloatPoint.h"
#include "platform/geometry/FloatRect.h"
@@ -137,8 +136,8 @@ class UnicodeRangeSet;
// sub-run, and the result is inserted into ShapeResult as well.
class PLATFORM_EXPORT HarfBuzzShaper final {
public:
- HarfBuzzShaper(const Font*, const TextRun&);
- PassRefPtr<ShapeResult> shapeResult();
+ HarfBuzzShaper(const TextRun&);
+ PassRefPtr<ShapeResult> shapeResult(const Font*);
~HarfBuzzShaper() {}
enum HolesQueueItemAction { HolesQueueNextFont, HolesQueueRange };
@@ -152,49 +151,27 @@ class PLATFORM_EXPORT HarfBuzzShaper final {
: m_action(action), m_startIndex(start), m_numCharacters(num){};
};
- protected:
using FeaturesVector = Vector<hb_feature_t, 6>;
- class CapsFeatureSettingsScopedOverlay final {
- STACK_ALLOCATED()
-
- public:
- CapsFeatureSettingsScopedOverlay(FeaturesVector&,
- FontDescription::FontVariantCaps);
- CapsFeatureSettingsScopedOverlay() = delete;
- ~CapsFeatureSettingsScopedOverlay();
-
- private:
- void overlayCapsFeatures(FontDescription::FontVariantCaps);
- void prependCounting(const hb_feature_t&);
- FeaturesVector& m_features;
- size_t m_countFeatures;
- };
-
private:
- void setFontFeatures();
-
- void appendToHolesQueue(HolesQueueItemAction,
- unsigned startIndex,
- unsigned numCharacters);
- void prependHolesQueue(HolesQueueItemAction,
- unsigned startIndex,
- unsigned numCharacters);
- void splitUntilNextCaseChange(HolesQueueItem& currentQueueItem,
- SmallCapsIterator::SmallCapsBehavior&);
- inline bool shapeRange(hb_buffer_t* harfBuzzBuffer,
- const SimpleFontData* currentFont,
- PassRefPtr<UnicodeRangeSet> currentFontRangeSet,
- UScriptCode currentRunScript,
+ inline bool shapeRange(hb_buffer_t*,
+ const Font*,
+ const FeaturesVector&,
+ const SimpleFontData*,
+ PassRefPtr<UnicodeRangeSet>,
+ UScriptCode,
hb_language_t);
- bool extractShapeResults(hb_buffer_t* harfBuzzBuffer,
+ bool extractShapeResults(hb_buffer_t*,
ShapeResult*,
bool& fontCycleQueued,
- const HolesQueueItem& currentQueueItem,
- const SimpleFontData* currentFont,
- UScriptCode currentRunScript,
+ Deque<HolesQueueItem>*,
+ const HolesQueueItem&,
+ const Font*,
+ const SimpleFontData*,
+ UScriptCode,
bool isLastResort);
- bool collectFallbackHintChars(Vector<UChar32>& hint);
+ bool collectFallbackHintChars(const Deque<HolesQueueItem>&,
+ Vector<UChar32>& hint);
void insertRunIntoShapeResult(
ShapeResult*,
@@ -203,14 +180,9 @@ class PLATFORM_EXPORT HarfBuzzShaper final {
unsigned numGlyphs,
hb_buffer_t*);
- const Font* m_font;
const TextRun& m_textRun;
-
std::unique_ptr<UChar[]> m_normalizedBuffer;
unsigned m_normalizedBufferLength;
-
- FeaturesVector m_features;
- Deque<HolesQueueItem> m_holesQueue;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698