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

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

Issue 2740083002: Add support for shaper-driven line breaking to HarfBuzzShaper (Closed)
Patch Set: Try to fix test failures Created 3 years, 9 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 49f9502a7f964db0a698aef130d4872228b20a3d..b6bdf04a0d54a387846715b10d16e5cf2752b0ba 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h
+++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h
@@ -31,6 +31,8 @@
#ifndef ShapeResult_h
#define ShapeResult_h
+#include <memory>
+#include "platform/LayoutUnit.h"
#include "platform/PlatformExport.h"
#include "platform/geometry/FloatRect.h"
#include "platform/text/TextDirection.h"
@@ -38,7 +40,6 @@
#include "wtf/Noncopyable.h"
#include "wtf/RefCounted.h"
#include "wtf/Vector.h"
-#include <memory>
struct hb_buffer_t;
@@ -64,12 +65,14 @@ class PLATFORM_EXPORT ShapeResult : public RefCounted<ShapeResult> {
~ShapeResult();
float width() const { return m_width; }
+ LayoutUnit snappedWidth() const { return LayoutUnit::fromFloatCeil(m_width); }
const FloatRect& bounds() const { return m_glyphBoundingBox; }
unsigned numCharacters() const { return m_numCharacters; }
void fallbackFonts(HashSet<const SimpleFontData*>*) const;
- bool rtl() const {
- return static_cast<TextDirection>(m_direction) == TextDirection::kRtl;
+ TextDirection direction() const {
+ return static_cast<TextDirection>(m_direction);
}
+ bool rtl() const { return direction() == TextDirection::kRtl; }
bool hasVerticalOffsets() const { return m_hasVerticalOffsets; }
// For memory reporting.
@@ -77,10 +80,18 @@ class PLATFORM_EXPORT ShapeResult : public RefCounted<ShapeResult> {
unsigned offsetForPosition(float targetX, bool includePartialGlyphs) const;
float positionForOffset(unsigned offset) const;
+ LayoutUnit snappedStartPositionForOffset(unsigned offset) const {
+ return LayoutUnit::fromFloatFloor(positionForOffset(offset));
+ }
+ LayoutUnit snappedEndPositionForOffset(unsigned offset) const {
+ return LayoutUnit::fromFloatCeil(positionForOffset(offset));
+ }
PassRefPtr<ShapeResult> applySpacingToCopy(ShapeResultSpacing&,
const TextRun&) const;
+ void copyRange(unsigned start, unsigned end, ShapeResult*) const;
+
protected:
struct RunInfo;

Powered by Google App Engine
This is Rietveld 408576698