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/SimpleLineLayoutFunctions.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/rendering/SimpleLineLayoutFunctions.h')
-rw-r--r-- | Source/WebCore/rendering/SimpleLineLayoutFunctions.h | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/Source/WebCore/rendering/SimpleLineLayoutFunctions.h b/Source/WebCore/rendering/SimpleLineLayoutFunctions.h index 8444f2ffa..ce65a29ae 100644 --- a/Source/WebCore/rendering/SimpleLineLayoutFunctions.h +++ b/Source/WebCore/rendering/SimpleLineLayoutFunctions.h @@ -23,8 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SimpleLineLayoutFunctions_h -#define SimpleLineLayoutFunctions_h +#pragma once #include "LayoutRect.h" #include "RenderBlockFlow.h" @@ -37,7 +36,6 @@ class HitTestLocation; class HitTestRequest; class HitTestResult; class RenderBlockFlow; -class RenderText; struct PaintInfo; namespace SimpleLineLayout { @@ -51,46 +49,58 @@ bool hitTestFlow(const RenderBlockFlow&, const Layout&, const HitTestRequest&, H void collectFlowOverflow(RenderBlockFlow&, const Layout&); bool isTextRendered(const RenderText&, const Layout&); -bool containsTextCaretOffset(const RenderText&, const Layout&, unsigned); -unsigned findTextCaretMinimumOffset(const RenderText&, const Layout&); -unsigned findTextCaretMaximumOffset(const RenderText&, const Layout&); -IntRect computeTextBoundingBox(const RenderText&, const Layout&); +bool containsCaretOffset(const RenderObject&, const Layout&, unsigned); +unsigned findCaretMinimumOffset(const RenderObject&, const Layout&); +unsigned findCaretMaximumOffset(const RenderObject&, const Layout&); +IntRect computeBoundingBox(const RenderObject&, const Layout&); +IntPoint computeFirstRunLocation(const RenderObject&, const Layout&); -Vector<IntRect> collectTextAbsoluteRects(const RenderText&, const Layout&, const LayoutPoint& accumulatedOffset); -Vector<FloatQuad> collectTextAbsoluteQuads(const RenderText&, const Layout&, bool* wasFixed); +Vector<IntRect> collectAbsoluteRects(const RenderObject&, const Layout&, const LayoutPoint& accumulatedOffset); +Vector<FloatQuad> collectAbsoluteQuads(const RenderObject&, const Layout&, bool* wasFixed); +unsigned textOffsetForPoint(const LayoutPoint&, const RenderText&, const Layout&); +Vector<FloatQuad> collectAbsoluteQuadsForRange(const RenderObject&, unsigned start, unsigned end, const Layout&, bool* wasFixed); LayoutUnit lineHeightFromFlow(const RenderBlockFlow&); LayoutUnit baselineFromFlow(const RenderBlockFlow&); +#if ENABLE(TREE_DEBUGGING) +void showLineLayoutForFlow(const RenderBlockFlow&, const Layout&, int depth); +#endif + } namespace SimpleLineLayout { inline LayoutUnit computeFlowHeight(const RenderBlockFlow& flow, const Layout& layout) { - return lineHeightFromFlow(flow) * layout.lineCount(); + auto flowHeight = lineHeightFromFlow(flow) * layout.lineCount(); + if (!layout.hasLineStruts()) + return flowHeight; + for (auto& strutEntry : layout.struts()) + flowHeight += strutEntry.offset; + return flowHeight; } inline LayoutUnit computeFlowFirstLineBaseline(const RenderBlockFlow& flow, const Layout& layout) { - ASSERT_UNUSED(layout, layout.runCount()); + ASSERT_UNUSED(layout, layout.lineCount()); return flow.borderAndPaddingBefore() + baselineFromFlow(flow); } inline LayoutUnit computeFlowLastLineBaseline(const RenderBlockFlow& flow, const Layout& layout) { - ASSERT(layout.runCount()); - return flow.borderAndPaddingBefore() + lineHeightFromFlow(flow) * (layout.runCount() - 1) + baselineFromFlow(flow); + ASSERT(layout.lineCount()); + return flow.borderAndPaddingBefore() + lineHeightFromFlow(flow) * (layout.lineCount() - 1) + baselineFromFlow(flow); } -inline unsigned findTextCaretMinimumOffset(const RenderText&, const Layout& layout) +inline unsigned findCaretMinimumOffset(const RenderText&, const Layout& layout) { if (!layout.runCount()) return 0; return layout.runAt(0).start; } -inline unsigned findTextCaretMaximumOffset(const RenderText& renderer, const Layout& layout) +inline unsigned findCaretMaximumOffset(const RenderText& renderer, const Layout& layout) { if (!layout.runCount()) return renderer.textLength(); @@ -98,7 +108,7 @@ inline unsigned findTextCaretMaximumOffset(const RenderText& renderer, const Lay return last.end; } -inline bool containsTextCaretOffset(const RenderText&, const Layout& layout, unsigned offset) +inline bool containsCaretOffset(const RenderText&, const Layout& layout, unsigned offset) { for (unsigned i = 0; i < layout.runCount(); ++i) { auto& run = layout.runAt(i); @@ -132,5 +142,3 @@ inline LayoutUnit baselineFromFlow(const RenderBlockFlow& flow) } } - -#endif |