diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/SimpleLineLayout.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/rendering/SimpleLineLayout.h')
-rw-r--r-- | Source/WebCore/rendering/SimpleLineLayout.h | 51 |
1 files changed, 36 insertions, 15 deletions
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 <wtf/Vector.h> #include <wtf/text/WTFString.h> @@ -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<Run, 10> RunVector; + using RunVector = Vector<Run, 10>; + using SimpleLineStruts = Vector<SimpleLineStrut, 4>; static std::unique_ptr<Layout> 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<Layout> create(RenderBlockFlow&); #if COMPILER(MSVC) #pragma warning(pop) #endif - -#endif |