+2015-03-27 David Hyatt <hyatt@apple.com>
+
+ [New Block-Inside-Inline Model] Create anonymous inline blocks to hold blocks-inside-inlines.
+ https://bugs.webkit.org/show_bug.cgi?id=143145
+
+ Reviewed by Dean Jackson.
+
+ * fast/block/inside-inlines: Added.
+ * fast/block/inside-inlines/empty-block-expected.html: Added.
+ * fast/block/inside-inlines/empty-block.html: Added.
+ * fast/block/inside-inlines/new-model: Added.
+ * fast/block/inside-inlines/new-model/empty-block-expected.html: Added.
+ * fast/block/inside-inlines/new-model/empty-block.html: Added.
+
2015-03-30 Chris Dumez <cdumez@apple.com>
[WK2][NetworkCache] Add support for "Cache-Control: max-stale" request header
+2015-03-27 David Hyatt <hyatt@apple.com>
+
+ [New Block-Inside-Inline Model] Create anonymous inline blocks to hold blocks-inside-inlines.
+ https://bugs.webkit.org/show_bug.cgi?id=143145
+
+ Reviewed by Dean Jackson.
+
+ Added fast/block/inside-inlines/ tests.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::renderName):
+ Add support for labeling anonymous inline-blocks when dumped by the render tree.
+
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::addChildIgnoringContinuation):
+ When the pref is set to use the new block-inside-inline model, create an anonymous inline block to
+ hold block children of RenderInlines instead of splitting flows or creating continuations.
+
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::isAnonymousInlineBlock):
+ Add the definition of isAnonymousInlineBlock (note the exclusion of Ruby, since Ruby creates anonymous
+ inline-blocks also).
+
2015-03-30 Chris Dumez <cdumez@apple.com>
[WK2][NetworkCache] Add support for "Cache-Control: max-stale" request header
#include "RenderNamedFlowThread.h"
#include "RenderTheme.h"
#include "RenderView.h"
+#include "Settings.h"
#include "StyleInheritedData.h"
#include "TransformState.h"
#include "VisiblePosition.h"
// Make sure we don't append things after :after-generated content if we have it.
if (!beforeChild && isAfterContent(lastChild()))
beforeChild = lastChild();
-
- if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned()) {
+
+ bool useNewBlockInsideInlineModel = document().settings()->newBlockInsideInlineModelEnabled();
+
+ // This code is for the old block-inside-inline model that uses continuations.
+ if (!useNewBlockInsideInlineModel && !newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned()) {
// We are placing a block inside an inline. We have to perform a split of this
// inline into continuations. This involves creating an anonymous block box to hold
// |newChild|. We then make that block box a continuation of this inline. We take all of
splitFlow(beforeChild, newBox, newChild, oldContinuation);
return;
}
+
+ if (!useNewBlockInsideInlineModel) {
+ RenderBoxModelObject::addChild(newChild, beforeChild);
+ newChild->setNeedsLayoutAndPrefWidthsRecalc();
+ return;
+ }
+
+ // This code is for the new block-inside-inline model that uses anonymous inline blocks.
+ // If the requested beforeChild is not one of our children, then this is most likely because
+ // there is an anonymous inline-block box within this object that contains the beforeChild.
+ // Insert the child into the anonymous inline-block box instead of here.
+ // A second possibility is that the beforeChild is an anonymous block inside the anonymous inline block.
+ // This can happen if inlines are inserted in between two of the anonymous inline block's block-level
+ // children after it has been created.
+ if (beforeChild && beforeChild->parent() != this) {
+ ASSERT(beforeChild->parent());
+ ASSERT(beforeChild->parent()->isAnonymousInlineBlock() || beforeChild->parent()->isAnonymousBlock());
+ if (beforeChild->parent()->isAnonymousInlineBlock()) {
+ if (!newChild->isInline() || (newChild->isInline() && beforeChild->parent()->firstChild() != beforeChild))
+ beforeChild->parent()->addChild(newChild, beforeChild);
+ else
+ addChild(newChild, beforeChild->parent());
+ } else if (beforeChild->parent()->isAnonymousBlock()) {
+ ASSERT(!beforeChild->parent()->parent() || beforeChild->parent()->parent()->isAnonymousInlineBlock());
+ ASSERT(beforeChild->isInline());
+ if (newChild->isInline() || (!newChild->isInline() && beforeChild->parent()->firstChild() != beforeChild))
+ beforeChild->parent()->addChild(newChild, beforeChild);
+ else
+ addChild(newChild, beforeChild->parent());
+ }
+ return;
+ }
+
+ if (!newChild->isInline()) {
+ // We are placing a block inside an inline. We have to place the block inside an anonymous inline-block.
+ // This inline-block can house a sequence of contiguous block-level children, and they will all sit on the
+ // same "line" together. We try to reuse an existing inline-block if possible.
+ if (beforeChild) {
+ if (beforeChild->previousSibling() && beforeChild->previousSibling()->isAnonymousInlineBlock()) {
+ downcast<RenderBlockFlow>(beforeChild->previousSibling())->addChild(newChild);
+ return;
+ }
+ } else {
+ if (lastChild() && lastChild()->isAnonymousInlineBlock()) {
+ downcast<RenderBlockFlow>(lastChild())->addChild(newChild);
+ return;
+ }
+ }
+
+ if (!newChild->isFloatingOrOutOfFlowPositioned()) {
+ // There was no suitable existing anonymous inline-block. Create a new one.
+ RenderBlockFlow* anonymousInlineBlock = new RenderBlockFlow(document(), RenderStyle::createAnonymousStyleWithDisplay(&style(), INLINE_BLOCK));
+ anonymousInlineBlock->initializeStyle();
+
+ RenderBoxModelObject::addChild(anonymousInlineBlock, beforeChild);
+ anonymousInlineBlock->addChild(newChild);
+ return;
+ }
+ }
RenderBoxModelObject::addChild(newChild, beforeChild);