Commit d0301a5e authored by hyatt@apple.com's avatar hyatt@apple.com

2009-01-26 David Hyatt <hyatt@apple.com>

        Drop support for display:compact.

        (1) display:compact is no longer part of CSS2.1.
        (2) Shipping Safari has completely broken compact support with severely broken rendering
        (all of the compact text just piles on top of the text in the inserted block and on top of itself as well).
        (3) This has been broken in WebKit for years (ever since blocks converted to painting lines directly) without
        anyone even noticing.

        Reviewed by Eric Seidel

        * rendering/InlineFlowBox.cpp:
        (WebCore::InlineFlowBox::placeBoxesHorizontally):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::handleSpecialChild):
        (WebCore::RenderBlock::handleRunInChild):
        (WebCore::RenderBlock::layoutBlockChildren):
        (WebCore::RenderBlock::paint):
        (WebCore::RenderBlock::paintObject):
        (WebCore::RenderBlock::nodeAtPoint):
        (WebCore::RenderBlock::positionForCoordinates):
        (WebCore::shouldCheckLines):
        (WebCore::getHeightForLineCount):
        (WebCore::RenderBlock::renderName):
        * rendering/RenderBlock.h:
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::sizesToIntrinsicWidth):
        * rendering/RenderBox.h:
        (WebCore::RenderBox::width):
        (WebCore::RenderBox::height):
        (WebCore::RenderBox::size):
        (WebCore::RenderBox::frameRect):
        * rendering/RenderFlow.cpp:
        (WebCore::RenderFlow::paintLines):
        (WebCore::RenderFlow::hitTestLines):
        (WebCore::RenderFlow::absoluteClippedOverflowRect):
        (WebCore::RenderFlow::linesBoundingBox):
        * rendering/RenderObject.h:
        (WebCore::RenderObject::isInline):
        * rendering/bidi.cpp:
        (WebCore::RenderBlock::computeHorizontalPositionsForLine):
        (WebCore::RenderBlock::layoutInlineChildren):
        * rendering/bidi.h:
        (WebCore::BidiRun::BidiRun):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40258 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 66fc1a42
2009-01-26 David Hyatt <hyatt@apple.com>
Drop support for display:compact.
(1) display:compact is no longer part of CSS2.1.
(2) Shipping Safari has completely broken compact support with severely broken rendering
(all of the compact text just piles on top of the text in the inserted block and on top of itself as well).
(3) This has been broken in WebKit for years (ever since blocks converted to painting lines directly) without
anyone even noticing.
Reviewed by Eric Seidel
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::placeBoxesHorizontally):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::handleSpecialChild):
(WebCore::RenderBlock::handleRunInChild):
(WebCore::RenderBlock::layoutBlockChildren):
(WebCore::RenderBlock::paint):
(WebCore::RenderBlock::paintObject):
(WebCore::RenderBlock::nodeAtPoint):
(WebCore::RenderBlock::positionForCoordinates):
(WebCore::shouldCheckLines):
(WebCore::getHeightForLineCount):
(WebCore::RenderBlock::renderName):
* rendering/RenderBlock.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::sizesToIntrinsicWidth):
* rendering/RenderBox.h:
(WebCore::RenderBox::width):
(WebCore::RenderBox::height):
(WebCore::RenderBox::size):
(WebCore::RenderBox::frameRect):
* rendering/RenderFlow.cpp:
(WebCore::RenderFlow::paintLines):
(WebCore::RenderFlow::hitTestLines):
(WebCore::RenderFlow::absoluteClippedOverflowRect):
(WebCore::RenderFlow::linesBoundingBox):
* rendering/RenderObject.h:
(WebCore::RenderObject::isInline):
* rendering/bidi.cpp:
(WebCore::RenderBlock::computeHorizontalPositionsForLine):
(WebCore::RenderBlock::layoutInlineChildren):
* rendering/bidi.h:
(WebCore::BidiRun::BidiRun):
2009-01-26 Adam Langley <agl@google.com>
Reviewed by Nikolas Zimmermann.
......@@ -330,15 +330,10 @@ int InlineFlowBox::placeBoxesHorizontally(int x, int& leftPosition, int& rightPo
}
if (curr->object()->isInlineFlow()) {
InlineFlowBox* flow = static_cast<InlineFlowBox*>(curr);
if (curr->object()->isCompact()) {
int ignoredX = x;
flow->placeBoxesHorizontally(ignoredX, leftPosition, rightPosition, needsWordSpacing);
} else {
x += flow->marginLeft();
x = flow->placeBoxesHorizontally(x, leftPosition, rightPosition, needsWordSpacing);
x += flow->marginRight();
}
} else if (!curr->object()->isCompact() && (!curr->object()->isListMarker() || static_cast<RenderListMarker*>(curr->object())->isInside())) {
x += flow->marginLeft();
x = flow->placeBoxesHorizontally(x, leftPosition, rightPosition, needsWordSpacing);
x += flow->marginRight();
} else if (!curr->object()->isListMarker() || static_cast<RenderListMarker*>(curr->object())->isInside()) {
x += curr->renderBox()->marginLeft();
curr->setXPos(x);
leftPosition = min(x + curr->renderBox()->overflowLeft(false), leftPosition);
......
......@@ -837,7 +837,7 @@ void RenderBlock::adjustFloatingBlock(const MarginInfo& marginInfo)
setHeight(height() - marginOffset);
}
RenderBox* RenderBlock::handleSpecialChild(RenderBox* child, const MarginInfo& marginInfo, CompactInfo& compactInfo, bool& handled)
RenderBox* RenderBlock::handleSpecialChild(RenderBox* child, const MarginInfo& marginInfo, bool& handled)
{
// Handle positioned children first.
RenderBox* next = handlePositionedChild(child, marginInfo, handled);
......@@ -847,10 +847,6 @@ RenderBox* RenderBlock::handleSpecialChild(RenderBox* child, const MarginInfo& m
next = handleFloatingChild(child, marginInfo, handled);
if (handled) return next;
// See if we have a compact element. If we do, then try to tuck the compact element into the margin space of the next block.
next = handleCompactChild(child, compactInfo, handled);
if (handled) return next;
// Finally, see if we have a run-in element.
return handleRunInChild(child, handled);
}
......@@ -880,64 +876,6 @@ RenderBox* RenderBlock::handleFloatingChild(RenderBox* child, const MarginInfo&
return 0;
}
RenderBox* RenderBlock::handleCompactChild(RenderBox* child, CompactInfo& compactInfo, bool& handled)
{
// FIXME: We only deal with one compact at a time. It is unclear what should be
// done if multiple contiguous compacts are encountered. For now we assume that
// compact A followed by another compact B should simply be treated as block A.
if (child->isCompact() && !compactInfo.compact() && (child->childrenInline() || child->isReplaced())) {
// Get the next non-positioned/non-floating RenderBlock.
RenderBox* next = child->nextSiblingBox();
RenderBox* curr = next;
while (curr && curr->isFloatingOrPositioned())
curr = curr->nextSiblingBox();
if (curr && curr->isRenderBlock() && !curr->isCompact() && !curr->isRunIn()) {
curr->calcWidth(); // So that horizontal margins are correct.
child->setInline(true); // Need to compute the margins/width for the child as though it is an inline, so that it won't try to puff up the margins to
// fill the containing block width.
child->calcWidth();
int childMargins = child->marginLeft() + child->marginRight();
int margin = style()->direction() == LTR ? curr->marginLeft() : curr->marginRight();
if (margin >= (childMargins + child->maxPrefWidth())) {
// The compact will fit in the margin.
handled = true;
compactInfo.set(child, curr);
toRenderBox(child)->setLocation(IntPoint()); // This position will be updated to reflect the compact's
// desired position and the line box for the compact will
// pick that position up.
// Remove the child.
RenderBox* next = child->nextSiblingBox();
removeChildNode(child);
// Now insert the child under |curr|.
curr->insertChildNode(child, curr->firstChild());
return next;
}
else
child->setInline(false); // We didn't fit, so we remain a block-level element.
}
}
return 0;
}
void RenderBlock::insertCompactIfNeeded(RenderBox* child, CompactInfo& compactInfo)
{
if (compactInfo.matches(child)) {
// We have a compact child to squeeze in.
RenderBox* compactChild = compactInfo.compact();
int compactXPos = borderLeft() + paddingLeft() + compactChild->marginLeft();
if (style()->direction() == RTL) {
compactChild->calcWidth(); // have to do this because of the capped maxwidth
compactXPos = width() - borderRight() - paddingRight() - marginRight() -
compactChild->width() - compactChild->marginRight();
}
compactXPos -= child->x(); // Put compactXPos into the child's coordinate space.
compactChild->setLocation(compactXPos, compactChild->y()); // Set the x position.
compactInfo.clear();
}
}
RenderBox* RenderBlock::handleRunInChild(RenderBox* blockRunIn, bool& handled)
{
// See if we have a run-in element with inline children. If the
......@@ -948,7 +886,7 @@ RenderBox* RenderBlock::handleRunInChild(RenderBox* blockRunIn, bool& handled)
RenderObject* curr = blockRunIn->nextSibling();
while (curr && curr->isFloatingOrPositioned())
curr = curr->nextSibling();
if (curr && (curr->isRenderBlock() && curr->childrenInline() && !curr->isCompact() && !curr->isRunIn())) {
if (curr && (curr->isRenderBlock() && curr->childrenInline() && !curr->isRunIn())) {
// The block acts like an inline, so just null out its
// position.
handled = true;
......@@ -1284,7 +1222,6 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom
// The margin struct caches all our current margin collapsing state. The compact struct caches state when we encounter compacts,
MarginInfo marginInfo(this, top, bottom);
CompactInfo compactInfo;
// Fieldsets need to find their legend and position it inside the border of the object.
// The legend then gets skipped during normal layout.
......@@ -1316,7 +1253,7 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom
// Handle the four types of special elements first. These include positioned content, floating content, compacts and
// run-ins. When we encounter these four types of objects, we don't actually lay them out as normal flow blocks.
bool handled = false;
RenderBox* next = handleSpecialChild(child, marginInfo, compactInfo, handled);
RenderBox* next = handleSpecialChild(child, marginInfo, handled);
if (handled) {
child = next;
continue;
......@@ -1397,9 +1334,6 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom
m_overflowHeight = max(m_overflowHeight, height() + child->overflowHeight(false) - child->height());
m_overflowWidth = max(child->x() + child->overflowWidth(false), m_overflowWidth);
m_overflowLeft = min(child->x() + child->overflowLeft(false), m_overflowLeft);
// Insert our compact into the block margin if we have one.
insertCompactIfNeeded(child, compactInfo);
IntSize childOffset(child->x() - oldRect.x(), child->y() - oldRect.y());
if (childOffset.width() || childOffset.height()) {
......@@ -1527,7 +1461,7 @@ void RenderBlock::paint(PaintInfo& paintInfo, int tx, int ty)
// Check if we need to do anything at all.
// FIXME: Could eliminate the isRoot() check if we fix background painting so that the RenderView
// paints the root's background.
if (!isInlineFlow() && !isRoot()) {
if (!isRoot()) {
IntRect overflowBox = overflowRect(false);
overflowBox.inflate(maximalOutlineSize(paintInfo.phase));
overflowBox.move(tx, ty);
......@@ -1699,12 +1633,8 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, int tx, int ty)
{
PaintPhase paintPhase = paintInfo.phase;
// If we're a repositioned run-in or a compact, don't paint background/borders.
bool inlineFlow = isInlineFlow();
// 1. paint background, borders etc
if (!inlineFlow &&
(paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) &&
if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) &&
hasBoxDecorations() && style()->visibility() == VISIBLE) {
paintBoxDecorations(paintInfo, tx, ty);
}
......@@ -1735,11 +1665,11 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, int tx, int ty)
// 3. paint selection
// FIXME: Make this work with multi column layouts. For now don't fill gaps.
bool isPrinting = document()->printing();
if (!inlineFlow && !isPrinting && !m_hasColumns)
if (!isPrinting && !m_hasColumns)
paintSelection(paintInfo, scrolledX, scrolledY); // Fill in gaps in selection on lines and between blocks.
// 4. paint floats.
if (!inlineFlow && (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip)) {
if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip) {
if (m_hasColumns)
paintColumns(paintInfo, scrolledX, scrolledY, true);
else
......@@ -1747,11 +1677,11 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, int tx, int ty)
}
// 5. paint outline.
if (!inlineFlow && (paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && hasOutline() && style()->visibility() == VISIBLE)
if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && hasOutline() && style()->visibility() == VISIBLE)
RenderBox::paintOutline(paintInfo.context, tx, ty, width(), height(), style());
// 6. paint continuation outlines.
if (!inlineFlow && (paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutlines)) {
if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutlines)) {
if (continuation() && continuation()->hasOutline() && continuation()->style()->visibility() == VISIBLE) {
RenderFlow* inlineFlow = static_cast<RenderFlow*>(continuation()->element()->renderer());
if (!inlineFlow->hasLayer())
......@@ -1766,7 +1696,7 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, int tx, int ty)
// 7. paint caret.
// If the caret's node's render object's containing block is this block, and the paint action is PaintPhaseForeground,
// then paint the caret.
if (!inlineFlow && paintPhase == PaintPhaseForeground) {
if (paintPhase == PaintPhaseForeground) {
paintCaret(paintInfo, scrolledX, scrolledY, CursorCaret);
paintCaret(paintInfo, scrolledX, scrolledY, DragCaret);
}
......@@ -3140,12 +3070,10 @@ bool RenderBlock::isPointInOverflowControl(HitTestResult& result, int, int, int,
bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int _x, int _y, int _tx, int _ty, HitTestAction hitTestAction)
{
bool inlineFlow = isInlineFlow();
int tx = _tx + x();
int ty = _ty + y();
if (!inlineFlow && !isRenderView()) {
if (!isRenderView()) {
// Check if we need to do anything at all.
IntRect overflowBox = overflowRect(false);
overflowBox.move(tx, ty);
......@@ -3200,7 +3128,7 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
}
// Now hit test our background
if (!inlineFlow && (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground)) {
if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) {
IntRect boundsRect(tx, ty, width(), height());
if (visibleToHitTesting() && boundsRect.contains(_x, _y)) {
updateHitTestResult(result, IntPoint(_x - tx, _y - ty));
......@@ -3337,7 +3265,7 @@ VisiblePosition RenderBlock::positionForCoordinates(int x, int y)
if (y < top || (isEditableRoot && (y < bottom && x < left))) {
if (!isEditableRoot)
if (RenderBox* c = firstChildBox()) { // FIXME: This code doesn't make any sense. This child could be an inline or a positioned element or a float or a compact, etc.
if (RenderBox* c = firstChildBox()) { // FIXME: This code doesn't make any sense. This child could be an inline or a positioned element or a float, etc.
VisiblePosition p = c->positionForCoordinates(contentsX - c->x(), contentsY - c->y());
if (p.isNotNull())
return p;
......@@ -3353,7 +3281,7 @@ VisiblePosition RenderBlock::positionForCoordinates(int x, int y)
if (y >= bottom || (isEditableRoot && (y >= top && x >= right))) {
if (!isEditableRoot)
if (RenderBox* c = lastChildBox()) { // FIXME: This code doesn't make any sense. This child could be an inline or a positioned element or a float or a compact, ect.
if (RenderBox* c = lastChildBox()) { // FIXME: This code doesn't make any sense. This child could be an inline or a positioned element or a float, etc.
VisiblePosition p = c->positionForCoordinates(contentsX - c->x(), contentsY - c->y());
if (p.isNotNull())
return p;
......@@ -4499,7 +4427,7 @@ bool RenderBlock::inRootBlockContext() const
// (crawling into blocks).
static bool shouldCheckLines(RenderObject* obj)
{
return !obj->isFloatingOrPositioned() && !obj->isCompact() && !obj->isRunIn() &&
return !obj->isFloatingOrPositioned() && !obj->isRunIn() &&
obj->isBlockFlow() && obj->style()->height().isAuto() &&
(!obj->isFlexibleBox() || obj->style()->boxOrient() == VERTICAL);
}
......@@ -4543,7 +4471,7 @@ static int getHeightForLineCount(RenderBlock* block, int l, bool includeBottom,
if (result != -1)
return result + obj->y() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : 0);
}
else if (!obj->isFloatingOrPositioned() && !obj->isCompact() && !obj->isRunIn())
else if (!obj->isFloatingOrPositioned() && !obj->isRunIn())
normalFlowChildWithoutLines = obj;
}
if (normalFlowChildWithoutLines && l == 0)
......@@ -4700,8 +4628,6 @@ const char* RenderBlock::renderName() const
return "RenderBlock (generated)";
if (isRelPositioned())
return "RenderBlock (relative positioned)";
if (isCompact())
return "RenderBlock (compact)";
if (isRunIn())
return "RenderBlock (run-in)";
return "RenderBlock";
......
......@@ -364,25 +364,6 @@ protected:
bool m_isDescendant : 1;
};
// The following helper functions and structs are used by layoutBlockChildren.
class CompactInfo {
// A compact child that needs to be collapsed into the margin of the following block.
RenderBox* m_compact;
// The block with the open margin that the compact child is going to place itself within.
RenderObject* m_block;
public:
RenderBox* compact() const { return m_compact; }
RenderObject* block() const { return m_block; }
bool matches(RenderObject* child) const { return m_compact && m_block == child; }
void clear() { set(0, 0); }
void set(RenderBox* c, RenderObject* b) { m_compact = c; m_block = b; }
CompactInfo() { clear(); }
};
class MarginInfo {
// Collapsing flags for whether we can collapse our margins with our children's margins.
bool m_canCollapseWithChildren : 1;
......@@ -451,14 +432,12 @@ protected:
void adjustPositionedBlock(RenderBox* child, const MarginInfo&);
void adjustFloatingBlock(const MarginInfo&);
RenderBox* handleSpecialChild(RenderBox* child, const MarginInfo&, CompactInfo&, bool& handled);
RenderBox* handleSpecialChild(RenderBox* child, const MarginInfo&, bool& handled);
RenderBox* handleFloatingChild(RenderBox* child, const MarginInfo&, bool& handled);
RenderBox* handlePositionedChild(RenderBox* child, const MarginInfo&, bool& handled);
RenderBox* handleCompactChild(RenderBox* child, CompactInfo&, bool& handled);
RenderBox* handleRunInChild(RenderBox* child, bool& handled);
void collapseMargins(RenderBox* child, MarginInfo&, int yPosEstimate);
void clearFloatsIfNeeded(RenderBox* child, MarginInfo&, int oldTopPosMargin, int oldTopNegMargin);
void insertCompactIfNeeded(RenderBox* child, CompactInfo&);
int estimateVerticalPosition(RenderBox* child, const MarginInfo&);
void determineHorizontalPosition(RenderBox* child);
void handleBottomOfBlock(int top, int bottom, MarginInfo&);
......
......@@ -1801,8 +1801,7 @@ bool RenderBox::sizesToIntrinsicWidth(WidthType widthType) const
{
// Marquees in WinIE are like a mixture of blocks and inline-blocks. They size as though they're blocks,
// but they allow text to sit on the same line as the marquee.
if (isFloating() || (isCompact() && isInline())
|| (isInlineBlockOrInlineTable() && !isHTMLMarquee()))
if (isFloating() || (isInlineBlockOrInlineTable() && !isHTMLMarquee()))
return true;
// This code may look a bit strange. Basically width:intrinsic should clamp the size when testing both
......
......@@ -39,8 +39,8 @@ public:
int x() const { return m_frameRect.x(); }
int y() const { return m_frameRect.y(); }
int width() const { ASSERT(!isInlineFlow() || isCompact()); return m_frameRect.width(); }
int height() const { ASSERT(!isInlineFlow() || isCompact()); return m_frameRect.height(); }
int width() const { ASSERT(!isInlineFlow()); return m_frameRect.width(); }
int height() const { ASSERT(!isInlineFlow()); return m_frameRect.height(); }
void setX(int x) { m_frameRect.setX(x); }
void setY(int y) { m_frameRect.setY(y); }
......@@ -48,7 +48,7 @@ public:
void setHeight(int height) { m_frameRect.setHeight(height); }
IntPoint location() const { return m_frameRect.location(); }
IntSize size() const { ASSERT(!isInlineFlow() || isCompact()); return m_frameRect.size(); }
IntSize size() const { ASSERT(!isInlineFlow()); return m_frameRect.size(); }
void setLocation(const IntPoint& location) { m_frameRect.setLocation(location); }
void setLocation(int x, int y) { setLocation(IntPoint(x, y)); }
......@@ -56,7 +56,7 @@ public:
void setSize(const IntSize& size) { m_frameRect.setSize(size); }
void move(int dx, int dy) { m_frameRect.move(dx, dy); }
IntRect frameRect() const { ASSERT(!isInlineFlow() || isCompact()); return m_frameRect; }
IntRect frameRect() const { ASSERT(!isInlineFlow()); return m_frameRect; }
void setFrameRect(const IntRect& rect) { m_frameRect = rect; }
IntRect borderBoxRect() const { return IntRect(0, 0, width(), height()); }
......
......@@ -383,7 +383,7 @@ void RenderFlow::paintLines(PaintInfo& paintInfo, int tx, int ty)
bool inlineFlow = isInlineFlow();
if (inlineFlow)
ASSERT(m_layer); // The only way a compact/run-in/inline could paint like this is if it has a layer.
ASSERT(m_layer); // The only way an inline could paint like this is if it has a layer.
// If we have no lines then we have no work to do.
if (!firstLineBox())
......@@ -451,7 +451,7 @@ bool RenderFlow::hitTestLines(const HitTestRequest& request, HitTestResult& resu
bool inlineFlow = isInlineFlow();
if (inlineFlow)
ASSERT(m_layer); // The only way a compact/run-in/inline could paint like this is if it has a layer.
ASSERT(m_layer); // The only way an inline can hit test like this is if it has a layer.
// If we have no lines then we have no work to do.
if (!firstLineBox())
......@@ -483,8 +483,8 @@ bool RenderFlow::hitTestLines(const HitTestRequest& request, HitTestResult& resu
IntRect RenderFlow::absoluteClippedOverflowRect()
{
if (isInlineFlow()) {
// Only compacts and run-ins are allowed in here during layout.
ASSERT(!view() || !view()->layoutStateEnabled() || isCompact() || isRunIn());
// Only run-ins are allowed in here during layout.
ASSERT(!view() || !view()->layoutStateEnabled() || isRunIn());
if (!firstLineBox() && !continuation())
return IntRect();
......@@ -562,7 +562,7 @@ IntRect RenderFlow::linesBoundingBox() const
rightSide = curr->xPos() + curr->width();
}
result.setWidth(rightSide - leftSide);
result.setX(isCompact() ? leftSide : leftSide - x());
result.setX(leftSide);
result.setHeight(lastLineBox()->yPos() + lastLineBox()->height() - firstLineBox()->yPos());
result.setY(firstLineBox()->yPos());
}
......
......@@ -308,7 +308,6 @@ public:
bool isText() const { return m_isText; }
bool isBox() const { return m_isBox; }
bool isInline() const { return m_inline; } // inline object
bool isCompact() const { return style()->display() == COMPACT; } // compact object
bool isRunIn() const { return style()->display() == RUN_IN; } // run-in object
bool isDragging() const { return m_isDragging; }
bool isReplaced() const { return m_replaced; } // a "replaced" element (see CSS)
......
......@@ -590,7 +590,7 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, Bidi
}
if (int length = rt->textLength()) {
if (!r->m_compact && !r->m_start && needsWordSpacing && isSpaceOrNewline(rt->characters()[r->m_start]))
if (!r->m_start && needsWordSpacing && isSpaceOrNewline(rt->characters()[r->m_start]))
totWidth += rt->style(m_firstLine)->font().wordSpacing();
needsWordSpacing = !isSpaceOrNewline(rt->characters()[r->m_stop - 1]) && r->m_stop == length;
}
......@@ -599,13 +599,10 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, Bidi
RenderBox* renderBox = toRenderBox(r->m_object);
renderBox->calcWidth();
r->m_box->setWidth(renderBox->width());
if (!r->m_compact)
totWidth += renderBox->marginLeft() + renderBox->marginRight();
totWidth += renderBox->marginLeft() + renderBox->marginRight();
}
// Compacts don't contribute to the width of the line, since they are placed in the margin.
if (!r->m_compact)
totWidth += r->m_box->width();
totWidth += r->m_box->width();
}
// Armed with the total width of the line (without justification),
......@@ -686,7 +683,7 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, Bidi
continue;
int spaceAdd = 0;
if (r->m_object->isText() && !r->m_compact) {
if (r->m_object->isText()) {
unsigned spaces = 0;
const UChar* characters = toRenderText(r->m_object)->characters();
for (int i = r->m_start; i < r->m_stop; i++) {
......@@ -754,34 +751,6 @@ void RenderBlock::bidiReorderLine(InlineBidiResolver& resolver, const InlineIter
resolver.createBidiRunsForLine(end, style()->visuallyOrdered(), previousLineBrokeCleanly);
}
static void buildCompactRuns(RenderObject* compactObj, InlineBidiResolver& resolver)
{
ASSERT(compactObj->isRenderBlock());
ASSERT(!resolver.firstRun());
// Format the compact like it is its own single line. We build up all the runs for
// the little compact and then reorder them for bidi.
RenderBlock* compactBlock = static_cast<RenderBlock*>(compactObj);
InlineIterator start(compactBlock, bidiFirst(compactBlock, &resolver), 0);
resolver.setPosition(start);
betweenMidpoints = false;
isLineEmpty = true;
previousLineBrokeCleanly = true;
InlineIterator end = compactBlock->findNextLineBreak(resolver);
if (!isLineEmpty)
compactBlock->bidiReorderLine(resolver, end);
for (BidiRun* run = resolver.firstRun(); run; run = run->next())
run->m_compact = true;
sNumMidpoints = 0;
sCurrMidpoint = 0;
betweenMidpoints = false;
}
static inline bool isCollapsibleSpace(UChar character, RenderText* renderer)
{
if (character == ' ' || character == '\t' || character == softHyphen)
......@@ -941,10 +910,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
betweenMidpoints = false;
isLineEmpty = true;
if (m_firstLine && firstChild()->isCompact() && firstChild()->isRenderBlock()) {
buildCompactRuns(firstChild(), resolver);
resolver.setPosition(InlineIterator(this, firstChild()->nextSibling(), 0));
}
EClear clear = CNONE;
end = findNextLineBreak(resolver, &clear);
if (resolver.position().atEnd()) {
......
......@@ -38,7 +38,6 @@ struct BidiRun : BidiCharacterRun {
: BidiCharacterRun(start, stop, context, dir)
, m_object(object)
, m_box(0)
, m_compact(false)
{
}
......@@ -59,7 +58,6 @@ private:
public:
RenderObject* m_object;
InlineBox* m_box;
bool m_compact;
};
} // namespace WebCore
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment