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

Unified Diff: Source/core/layout/LayoutText.h

Issue 1196213002: Remove duplicate measure hyphen string method (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Making hyphenWidth as inline and removing static nature Created 5 years, 6 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
« no previous file with comments | « Source/core/layout/LayoutBlockFlowLine.cpp ('k') | Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutText.h
diff --git a/Source/core/layout/LayoutText.h b/Source/core/layout/LayoutText.h
index de8cf9e86383f7e96f49d284af6b3a9f51a8bef3..6e66fbb7c34d5e891056005d93761413cc2fd056 100644
--- a/Source/core/layout/LayoutText.h
+++ b/Source/core/layout/LayoutText.h
@@ -26,6 +26,7 @@
#include "core/CoreExport.h"
#include "core/dom/Text.h"
#include "core/layout/LayoutObject.h"
+#include "core/layout/TextRunConstructor.h"
#include "platform/LengthFunctions.h"
#include "platform/text/TextPath.h"
#include "wtf/Forward.h"
@@ -141,6 +142,8 @@ public:
PassRefPtr<AbstractInlineTextBox> firstAbstractInlineTextBox();
+ float hyphenWidth(const Font&, TextDirection);
+
protected:
virtual void willBeDestroyed() override;
@@ -224,6 +227,12 @@ inline UChar LayoutText::characterAt(unsigned i) const
return uncheckedCharacterAt(i);
}
+inline float LayoutText::hyphenWidth(const Font& font, TextDirection direction)
+{
+ const ComputedStyle& style = styleRef();
+ return font.width(constructTextRun(this, font, style.hyphenString().string(), style, direction));
+}
+
DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutText, isText());
#if !ENABLE(ASSERT)
« no previous file with comments | « Source/core/layout/LayoutBlockFlowLine.cpp ('k') | Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698