From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/rendering/SimpleLineLayout.h | 51 ++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 15 deletions(-) (limited to 'Source/WebCore/rendering/SimpleLineLayout.h') diff --git a/Source/WebCore/rendering/SimpleLineLayout.h b/Source/WebCore/rendering/SimpleLineLayout.h index 5d02fd1c4..d58729e3c 100644 --- a/Source/WebCore/rendering/SimpleLineLayout.h +++ b/Source/WebCore/rendering/SimpleLineLayout.h @@ -23,9 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SimpleLineLayout_h -#define SimpleLineLayout_h +#pragma once +#include "SimpleLineLayoutCoverage.h" +#include "TextFlags.h" #include #include @@ -41,28 +42,43 @@ class RenderBlockFlow; namespace SimpleLineLayout { bool canUseFor(const RenderBlockFlow&); +AvoidanceReasonFlags canUseForWithReason(const RenderBlockFlow&, IncludeReasons); + struct Run { +#if COMPILER(MSVC) Run() { } - Run(unsigned start, float left) - : start(start) - , end(start) - , isEndOfLine(false) - , left(left) - , right(left) +#endif + Run(unsigned start, unsigned end, float logicalLeft, float logicalRight, bool isEndOfLine, bool hasHyphen) + : end(end) + , start(start) + , isEndOfLine(isEndOfLine) + , hasHyphen(hasHyphen) + , logicalLeft(logicalLeft) + , logicalRight(logicalRight) { } - unsigned start; - unsigned end : 31; + unsigned end; + unsigned start : 30; unsigned isEndOfLine : 1; - float left; - float right; + unsigned hasHyphen : 1; + float logicalLeft; + float logicalRight; + // TODO: Move these optional items out of SimpleLineLayout::Run to a supplementary structure. + float expansion { 0 }; + ExpansionBehavior expansionBehavior { ForbidLeadingExpansion | ForbidTrailingExpansion }; +}; + +struct SimpleLineStrut { + unsigned lineBreak; + float offset; }; class Layout { WTF_MAKE_FAST_ALLOCATED; public: - typedef Vector RunVector; + using RunVector = Vector; + using SimpleLineStruts = Vector; static std::unique_ptr create(const RunVector&, unsigned lineCount); unsigned lineCount() const { return m_lineCount; } @@ -70,11 +86,18 @@ public: unsigned runCount() const { return m_runCount; } const Run& runAt(unsigned i) const { return m_runs[i]; } + void setIsPaginated() { m_isPaginated = true; } + bool isPaginated() const { return m_isPaginated; } + bool hasLineStruts() const { return !m_lineStruts.isEmpty(); } + void setLineStruts(SimpleLineStruts&& lineStruts) { m_lineStruts = lineStruts; } + const SimpleLineStruts& struts() const { return m_lineStruts; } private: Layout(const RunVector&, unsigned lineCount); unsigned m_lineCount; unsigned m_runCount; + bool m_isPaginated { false }; + SimpleLineStruts m_lineStruts; Run m_runs[0]; }; @@ -86,5 +109,3 @@ std::unique_ptr create(RenderBlockFlow&); #if COMPILER(MSVC) #pragma warning(pop) #endif - -#endif -- cgit v1.2.1