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

Unified Diff: sky/engine/core/rendering/line/BreakingContextInlineHeaders.h

Issue 944073006: Remove the concept of staticly positioned absolutes. (Closed) Base URL: git@github.com:domokit/mojo.git@position
Patch Set: Created 5 years, 10 months 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
Index: sky/engine/core/rendering/line/BreakingContextInlineHeaders.h
diff --git a/sky/engine/core/rendering/line/BreakingContextInlineHeaders.h b/sky/engine/core/rendering/line/BreakingContextInlineHeaders.h
index 6a9beb4b43a81f1c5ae9e11839f60ab7ad0b2da0..196acd6d4a53ef3f04dafc5e7706559d14215000 100644
--- a/sky/engine/core/rendering/line/BreakingContextInlineHeaders.h
+++ b/sky/engine/core/rendering/line/BreakingContextInlineHeaders.h
@@ -99,8 +99,6 @@ public:
}
private:
- void skipTrailingWhitespace(InlineIterator&, const LineInfo&);
-
InlineBidiResolver& m_resolver;
InlineIterator m_current;
@@ -185,40 +183,6 @@ inline bool requiresLineBox(const InlineIterator& it, const LineInfo& lineInfo =
return notJustWhitespace || isEmptyInline(it.object());
}
-inline void setStaticPositions(RenderBlockFlow* block, RenderBox* child)
-{
- ASSERT(child->isOutOfFlowPositioned());
- // FIXME: The math here is actually not really right. It's a best-guess approximation that
- // will work for the common cases
- RenderObject* containerBlock = child->container();
- LayoutUnit blockHeight = block->logicalHeight();
- if (containerBlock->isRenderInline()) {
- // A relative positioned inline encloses us. In this case, we also have to determine our
- // position as though we were an inline. Set |staticInlinePosition| and |staticBlockPosition| on the relative positioned
- // inline so that we can obtain the value later.
- toRenderInline(containerBlock)->layer()->setStaticInlinePosition(block->startAlignedOffsetForLine(false));
- toRenderInline(containerBlock)->layer()->setStaticBlockPosition(blockHeight);
- }
- block->updateStaticInlinePositionForChild(child);
- child->layer()->setStaticBlockPosition(blockHeight);
-}
-
-// FIXME: The entire concept of the skipTrailingWhitespace function is flawed, since we really need to be building
-// line boxes even for containers that may ultimately collapse away. Otherwise we'll never get positioned
-// elements quite right. In other words, we need to build this function's work into the normal line
-// object iteration process.
-// NB. this function will insert any floating elements that would otherwise
-// be skipped but it will not position them.
-inline void BreakingContext::skipTrailingWhitespace(InlineIterator& iterator, const LineInfo& lineInfo)
-{
- while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo, TrailingWhitespace)) {
- RenderObject* object = iterator.object();
- if (object->isOutOfFlowPositioned())
- setStaticPositions(m_block, toRenderBox(object));
- iterator.increment();
- }
-}
-
inline void BreakingContext::initializeForCurrentObject()
{
m_currentStyle = m_current.object()->style();
@@ -311,18 +275,10 @@ inline void BreakingContext::handleOutOfFlowPositioned(Vector<RenderBox*>& posit
// If our original display wasn't an inline type, then we can
// go ahead and determine our static inline position now.
RenderBox* box = toRenderBox(m_current.object());
- bool isInlineType = box->style()->isOriginalDisplayInlineType();
- if (!isInlineType) {
- m_block->setStaticInlinePositionForChild(box, m_block->startOffsetForContent());
- } else {
- // If our original display was an INLINE type, then we can go ahead
- // and determine our static y position now.
- box->layer()->setStaticBlockPosition(m_block->logicalHeight());
- }
// If we're ignoring spaces, we have to stop and include this object and
// then start ignoring spaces again.
- if (isInlineType || box->container()->isRenderInline()) {
+ if (box->style()->isOriginalDisplayInlineType() || box->container()->isRenderInline()) {
if (m_ignoringSpaces)
m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(box);
m_trailingObjects.appendObjectIfNeeded(box);
@@ -591,12 +547,10 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
// Check if line is too big even without the extra space
// at the end of the line. If it is not, do nothing.
// If the line needs the extra whitespace to be too long,
- // then move the line break to the space and skip all
- // additional whitespace.
+ // then move the line break to the space.
if (!m_width.fitsOnLine(charWidth)) {
lineWasTooWide = true;
m_lineBreak.moveTo(m_current.object(), m_current.offset(), m_current.nextBreakablePosition());
- skipTrailingWhitespace(m_lineBreak, m_lineInfo);
}
}
if (lineWasTooWide || !m_width.fitsOnLine()) {

Powered by Google App Engine
This is Rietveld 408576698