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())) {
} 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);
......
This diff is collapsed.
......@@ -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,12 +599,9 @@ 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();
}
// 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();
}
......@@ -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