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

Unified Diff: sky/engine/core/rendering/RenderParagraph.cpp

Issue 754493002: Start splitting RenderParagraph logic out of RenderBlock (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: preland Created 6 years, 1 month 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 | « sky/engine/core/rendering/RenderParagraph.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..202db7f0d6ce8accd8cb916fa4290af29d5db7c2 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,52 @@ 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)
+{
+ return m_lineBoxes.hitTest(this, request, result, locationInContainer, accumulatedOffset, hitTestAction);
+}
+
+
} // namespace blink
« no previous file with comments | « sky/engine/core/rendering/RenderParagraph.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698