Chromium Code Reviews| Index: sky/engine/core/rendering/RenderParagraph.cpp |
| diff --git a/sky/engine/core/rendering/RenderParagraph.cpp b/sky/engine/core/rendering/RenderParagraph.cpp |
| index f8c9e0790df18417af24437c2d31c2d256a6ed53..6c670b123ae46f2b8a5fc81980273e7175c098f7 100644 |
| --- a/sky/engine/core/rendering/RenderParagraph.cpp |
| +++ b/sky/engine/core/rendering/RenderParagraph.cpp |
| @@ -5,6 +5,8 @@ |
| #include "sky/engine/config.h" |
| #include "sky/engine/core/rendering/RenderParagraph.h" |
| +#include "sky/engine/core/rendering/InlineIterator.h" |
| + |
| namespace blink { |
| RenderParagraph::RenderParagraph(ContainerNode* node) |
| @@ -23,4 +25,53 @@ RenderParagraph* RenderParagraph::createAnonymous(Document& document) |
| return renderer; |
| } |
| +void RenderParagraph::addOverflowFromChildren() |
| +{ |
| + LayoutUnit endPadding = hasOverflowClip() ? paddingEnd() : LayoutUnit(); |
| + // FIXME: Need to find another way to do this, since scrollbars could show when we don't want them to. |
| + if (hasOverflowClip() && !endPadding && node() && node()->isRootEditableElement() && style()->isLeftToRightDirection()) |
| + endPadding = 1; |
| + for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { |
| + addLayoutOverflow(curr->paddedLayoutOverflowRect(endPadding)); |
| + LayoutRect visualOverflow = curr->visualOverflowRect(curr->lineTop(), curr->lineBottom()); |
| + addContentsVisualOverflow(visualOverflow); |
| + } |
| +} |
| + |
| +void RenderParagraph::simplifiedNormalFlowLayout() |
| +{ |
| + ListHashSet<RootInlineBox*> lineBoxes; |
| + for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { |
| + RenderObject* o = walker.current(); |
| + if (!o->isOutOfFlowPositioned() && o->isReplaced()) { |
| + o->layoutIfNeeded(); |
| + if (toRenderBox(o)->inlineBoxWrapper()) { |
| + RootInlineBox& box = toRenderBox(o)->inlineBoxWrapper()->root(); |
| + lineBoxes.add(&box); |
| + } |
| + } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInline())) { |
| + o->clearNeedsLayout(); |
| + } |
| + } |
| + |
| + // FIXME: Glyph overflow will get lost in this case, but not really a big deal. |
| + GlyphOverflowAndFallbackFontsMap textBoxDataMap; |
| + for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin(); it != lineBoxes.end(); ++it) { |
| + RootInlineBox* box = *it; |
| + box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataMap); |
| + } |
| +} |
| + |
| +void RenderParagraph::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
| +{ |
| + m_lineBoxes.paint(this, paintInfo, paintOffset); |
| +} |
| + |
| +bool RenderParagraph::hitTestContents(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) |
| +{ |
| + // We have to hit-test our line boxes. |
|
ojan
2014/11/22 00:35:34
Can delete this comment now.
rafaelw
2014/11/26 19:13:00
Done.
|
| + return m_lineBoxes.hitTest(this, request, result, locationInContainer, accumulatedOffset, hitTestAction); |
| +} |
| + |
| + |
| } // namespace blink |