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

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

Issue 1561633002: Relocate ShapeResult's GlyphBuffer helpers to ShapeResultBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 11 months 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/ShapeResult.h
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h
index 5146cd18d820f67925fcb643553aff003518f5e4..ffd7cf3b9fce773555a37f0d65a8bd1d56196ec2 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h
+++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h
@@ -31,21 +31,20 @@
#ifndef ShapeResult_h
#define ShapeResult_h
-#include "platform/geometry/FloatPoint.h"
+#include "platform/PlatformExport.h"
#include "platform/geometry/FloatRect.h"
-#include "platform/text/TextRun.h"
+#include "platform/text/TextDirection.h"
#include "wtf/HashSet.h"
#include "wtf/Noncopyable.h"
#include "wtf/OwnPtr.h"
+#include "wtf/RefCounted.h"
#include "wtf/Vector.h"
namespace blink {
class Font;
-class GlyphBuffer;
-class ShapeResultBuffer;
class SimpleFontData;
-class HarfBuzzShaper;
+class TextRun;
struct GlyphData;
class PLATFORM_EXPORT ShapeResult : public RefCounted<ShapeResult> {
@@ -60,27 +59,17 @@ public:
const TextRun&, float positionOffset, unsigned count);
~ShapeResult();
- float width() { return m_width; }
- FloatRect bounds() { return m_glyphBoundingBox; }
+ float width() const { return m_width; }
+ const FloatRect& bounds() const { return m_glyphBoundingBox; }
unsigned numCharacters() const { return m_numCharacters; }
void fallbackFonts(HashSet<const SimpleFontData*>*) const;
bool hasVerticalOffsets() const { return m_hasVerticalOffsets; }
- // TODO(fmalita): relocate these to ShapeResultBuffer
- static int offsetForPosition(const ShapeResultBuffer&,
- const TextRun&, float targetX);
- static float fillGlyphBuffer(const ShapeResultBuffer&,
- GlyphBuffer*, const TextRun&, unsigned from, unsigned to);
- static float fillGlyphBufferForTextEmphasis(const ShapeResultBuffer&,
- GlyphBuffer*, const TextRun&, const GlyphData* emphasisData,
- unsigned from, unsigned to);
- static FloatRect selectionRect(const ShapeResultBuffer&,
- TextDirection, float totalWidth, const FloatPoint&, int height,
- unsigned from, unsigned to);
-
// For memory reporting.
size_t byteSize();
+ int offsetForPosition(float targetX) const;
+
protected:
struct RunInfo;
#if COMPILER(MSVC)
@@ -89,19 +78,6 @@ protected:
ShapeResult(const Font*, unsigned numCharacters, TextDirection);
- // TODO(fmalita): relocate these to ShapeResultBuffer
- int offsetForPosition(float targetX);
- template<TextDirection>
- static float fillGlyphBufferForRun(GlyphBuffer*, const RunInfo*,
- float initialAdvance, unsigned from, unsigned to, unsigned runOffset);
-
- static float fillGlyphBufferForTextEmphasisRun(GlyphBuffer*, const RunInfo*,
- const TextRun&, const GlyphData*, float initialAdvance,
- unsigned from, unsigned to, unsigned runOffset);
-
- static float fillFastHorizontalGlyphBuffer(const ShapeResultBuffer&,
- GlyphBuffer*, TextDirection);
-
float m_width;
FloatRect m_glyphBoundingBox;
Vector<OwnPtr<RunInfo>> m_runs;
@@ -119,30 +95,7 @@ protected:
unsigned m_hasVerticalOffsets : 1;
friend class HarfBuzzShaper;
-};
-
-class ShapeResultBuffer {
- WTF_MAKE_NONCOPYABLE(ShapeResultBuffer);
- STACK_ALLOCATED();
-public:
- ShapeResultBuffer()
- : m_hasVerticalOffsets(false) { }
-
- void appendResult(PassRefPtr<ShapeResult> result)
- {
- m_hasVerticalOffsets |= result->hasVerticalOffsets();
- m_results.append(result);
- }
-
- bool hasVerticalOffsets() const { return m_hasVerticalOffsets; }
-
- // Empirically, cases where we get more than 50 ShapeResults are extremely rare.
- typedef Vector<RefPtr<ShapeResult>, 64> ShapeResultVector;
- const ShapeResultVector& results() const { return m_results; }
-
-private:
- ShapeResultVector m_results;
- bool m_hasVerticalOffsets;
+ friend class ShapeResultBuffer;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698