[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
hyatt
hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:23:24 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit a9f48e3a18931c27762258bc0971bd2dc7434697
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Feb 3 22:48:01 2003 +0000
Enable support for the "run-in" and "compact" display types.
Also implementing support for :before and :after (they were not even
remotely working before these fixes).
Made sure :first-letter drills into inline children to find the
first letter in a block, e.g., so :before content can be used in
conjunction with :first-letter.
Fixed a regression in addOverhangingFloats that broke meyerweb.com's
front page.
Patched findNextLineBreak to correctly handle words that cross
inline boundaries and white-space mixtures. We now pass Hixie's
insanely evil mixed white-space test (we are the only browser
to do so).
Reviewed by kocienda
* ChangeLog:
* khtml/css/cssstyleselector.cpp:
* khtml/rendering/bidi.cpp:
(RenderBlock::findNextLineBreak):
* khtml/rendering/render_block.cpp:
(RenderBlock::setStyle):
(RenderBlock::addChildToFlow):
(getInlineRun):
(RenderBlock::layoutBlockChildren):
(RenderBlock::paintObject):
(RenderBlock::clearFloats):
* khtml/rendering/render_box.cpp:
(RenderBox::calcWidthUsing):
* khtml/rendering/render_box.h:
* khtml/rendering/render_container.cpp:
(RenderContainer::insertPseudoChild):
* khtml/rendering/render_container.h:
* khtml/rendering/render_flow.cpp:
(RenderFlow::addChild):
* khtml/rendering/render_image.cpp:
(RenderImage::setStyle):
* khtml/rendering/render_inline.cpp:
(RenderInline::setStyle):
(RenderInline::addChildToFlow):
* khtml/rendering/render_object.cpp:
(RenderObject::createObject):
* khtml/rendering/render_object.h:
* khtml/rendering/render_style.cpp:
(RenderStyle::addPseudoStyle):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3548 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index e4a006c..632b326 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,54 @@
+2003-02-02 David Hyatt <hyatt at apple.com>
+
+ Enable support for the "run-in" and "compact" display types.
+
+ Also implementing support for :before and :after (they were not even
+ remotely working before these fixes).
+
+ Made sure :first-letter drills into inline children to find the
+ first letter in a block, e.g., so :before content can be used in
+ conjunction with :first-letter.
+
+ Fixed a regression in addOverhangingFloats that broke meyerweb.com's
+ front page.
+
+ Patched findNextLineBreak to correctly handle words that cross
+ inline boundaries and white-space mixtures. We now pass Hixie's
+ insanely evil mixed white-space test (we are the only browser
+ to do so).
+
+ Reviewed by kocienda
+
+ * ChangeLog:
+ * khtml/css/cssstyleselector.cpp:
+ * khtml/rendering/bidi.cpp:
+ (RenderBlock::findNextLineBreak):
+ * khtml/rendering/render_block.cpp:
+ (RenderBlock::setStyle):
+ (RenderBlock::addChildToFlow):
+ (getInlineRun):
+ (RenderBlock::layoutBlockChildren):
+ (RenderBlock::paintObject):
+ (RenderBlock::clearFloats):
+ * khtml/rendering/render_box.cpp:
+ (RenderBox::calcWidthUsing):
+ * khtml/rendering/render_box.h:
+ * khtml/rendering/render_container.cpp:
+ (RenderContainer::insertPseudoChild):
+ * khtml/rendering/render_container.h:
+ * khtml/rendering/render_flow.cpp:
+ (RenderFlow::addChild):
+ * khtml/rendering/render_image.cpp:
+ (RenderImage::setStyle):
+ * khtml/rendering/render_inline.cpp:
+ (RenderInline::setStyle):
+ (RenderInline::addChildToFlow):
+ * khtml/rendering/render_object.cpp:
+ (RenderObject::createObject):
+ * khtml/rendering/render_object.h:
+ * khtml/rendering/render_style.cpp:
+ (RenderStyle::addPseudoStyle):
+
2003-02-03 Darin Adler <darin at apple.com>
Reviewed by Maciej.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index e4a006c..632b326 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,54 @@
+2003-02-02 David Hyatt <hyatt at apple.com>
+
+ Enable support for the "run-in" and "compact" display types.
+
+ Also implementing support for :before and :after (they were not even
+ remotely working before these fixes).
+
+ Made sure :first-letter drills into inline children to find the
+ first letter in a block, e.g., so :before content can be used in
+ conjunction with :first-letter.
+
+ Fixed a regression in addOverhangingFloats that broke meyerweb.com's
+ front page.
+
+ Patched findNextLineBreak to correctly handle words that cross
+ inline boundaries and white-space mixtures. We now pass Hixie's
+ insanely evil mixed white-space test (we are the only browser
+ to do so).
+
+ Reviewed by kocienda
+
+ * ChangeLog:
+ * khtml/css/cssstyleselector.cpp:
+ * khtml/rendering/bidi.cpp:
+ (RenderBlock::findNextLineBreak):
+ * khtml/rendering/render_block.cpp:
+ (RenderBlock::setStyle):
+ (RenderBlock::addChildToFlow):
+ (getInlineRun):
+ (RenderBlock::layoutBlockChildren):
+ (RenderBlock::paintObject):
+ (RenderBlock::clearFloats):
+ * khtml/rendering/render_box.cpp:
+ (RenderBox::calcWidthUsing):
+ * khtml/rendering/render_box.h:
+ * khtml/rendering/render_container.cpp:
+ (RenderContainer::insertPseudoChild):
+ * khtml/rendering/render_container.h:
+ * khtml/rendering/render_flow.cpp:
+ (RenderFlow::addChild):
+ * khtml/rendering/render_image.cpp:
+ (RenderImage::setStyle):
+ * khtml/rendering/render_inline.cpp:
+ (RenderInline::setStyle):
+ (RenderInline::addChildToFlow):
+ * khtml/rendering/render_object.cpp:
+ (RenderObject::createObject):
+ * khtml/rendering/render_object.h:
+ * khtml/rendering/render_style.cpp:
+ (RenderStyle::addPseudoStyle):
+
2003-02-03 Darin Adler <darin at apple.com>
Reviewed by Maciej.
diff --git a/WebCore/khtml/css/cssstyleselector.cpp b/WebCore/khtml/css/cssstyleselector.cpp
index d2f6749..ad9e27b 100644
--- a/WebCore/khtml/css/cssstyleselector.cpp
+++ b/WebCore/khtml/css/cssstyleselector.cpp
@@ -451,9 +451,9 @@ RenderStyle *CSSStyleSelector::styleForElement(ElementImpl *e)
}
// Mutate the display to BLOCK for certain cases, e.g., if someone attempts to
- // position or float an inline.
- if (style->display() == INLINE &&
- (style->position() == ABSOLUTE || style->position() == FIXED || style->floating() != FNONE))
+ // position or float an inline, compact, or run-in.
+ if ((style->display() == INLINE || style->display() == COMPACT || style->display() == RUN_IN) &&
+ (style->position() == ABSOLUTE || style->position() == FIXED || style->floating() != FNONE))
style->setDisplay(BLOCK);
return style;
@@ -1441,9 +1441,8 @@ void CSSStyleSelector::applyRule( DOM::CSSProperty *prop )
EDisplay d;
if ( id == CSS_VAL_NONE) {
d = NONE;
- } else if ( id == CSS_VAL_RUN_IN || id == CSS_VAL_COMPACT ||
- id == CSS_VAL_MARKER ) {
- // these are not supported at the moment, so we just ignore them.
+ } else if ( id == CSS_VAL_MARKER ) {
+ // marker is not supported at the moment, so we just ignore it.
return;
} else {
d = EDisplay(primitiveValue->getIdent() - CSS_VAL_INLINE);
diff --git a/WebCore/khtml/rendering/bidi.cpp b/WebCore/khtml/rendering/bidi.cpp
index ab8f91f..125dac8 100644
--- a/WebCore/khtml/rendering/bidi.cpp
+++ b/WebCore/khtml/rendering/bidi.cpp
@@ -1336,18 +1336,23 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, QPtrList<BidiIt
goto end;
}
- lBreak.obj = o;
- lBreak.pos = pos;
-
if( *(str+pos) == '\n' && isPre) {
+ lBreak.obj = o;
+ lBreak.pos = pos;
+
#ifdef DEBUG_LINEBREAKS
kdDebug(6041) << "forced break sol: " << start.obj << " " << start.pos << " end: " << lBreak.obj << " " << lBreak.pos << " width=" << w << endl;
#endif
return lBreak;
}
+
+ if (o->style()->whiteSpace() == NORMAL) {
+ w += tmpW;
+ tmpW = 0;
+ lBreak.obj = o;
+ lBreak.pos = pos;
+ }
- w += tmpW;
- tmpW = 0;
lastSpace = pos;
if (applyWordSpacing)
@@ -1404,7 +1409,39 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, QPtrList<BidiIt
} else
KHTMLAssert( false );
- if( w + tmpW > width+1 && o->style()->whiteSpace() == NORMAL ) {
+ RenderObject* next = Bidinext(start.par, o);
+ bool isNormal = o->style()->whiteSpace() == NORMAL;
+ bool checkForBreak = isNormal;
+ if (next && o->isText() && next->isText() && !next->isBR()) {
+ if (isNormal || (next->style()->whiteSpace() == NORMAL)) {
+ if (currentCharacterIsSpace)
+ checkForBreak = true;
+ else {
+ RenderText* nextText = static_cast<RenderText*>(next);
+ int strlen = nextText->stringLength();
+ QChar *str = nextText->text();
+ if (strlen &&
+ ((str[0].direction() == QChar::DirWS) ||
+ (next->style()->whiteSpace() != PRE && str[0] == '\n')))
+ // If the next item on the line is text, and if we did not end with
+ // a space, then the next text run continues our word (and so it needs to
+ // keep adding to |tmpW|. Just update and continue.
+ checkForBreak = true;
+ else
+ checkForBreak = false;
+
+ bool canPlaceOnLine = (w + tmpW <= width+1) || !isNormal;
+ if (canPlaceOnLine && checkForBreak) {
+ w += tmpW;
+ tmpW = 0;
+ lBreak.obj = next;
+ lBreak.pos = 0;
+ }
+ }
+ }
+ }
+
+ if (checkForBreak && (w + tmpW > width+1)) {
//kdDebug() << " too wide w=" << w << " tmpW = " << tmpW << " width = " << width << endl;
//kdDebug() << "start=" << start.obj << " current=" << o << endl;
// if we have floats, try to get below them.
@@ -1421,23 +1458,6 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, QPtrList<BidiIt
#endif
}
- if( !w && w + tmpW > width+1 && (o != start.obj || (unsigned) pos != start.pos) ) {
- // getting below floats wasn't enough...
- //kdDebug() << "still too wide w=" << w << " tmpW = " << tmpW << " width = " << width << endl;
- lBreak.obj = o;
- if(last != o) {
- //kdDebug() << " using last " << last << endl;
- lBreak.pos = 0;
- }
- else if ( unsigned ( pos ) >= o->length() ) {
- lBreak.obj = Bidinext( start.par, o );
- lBreak.pos = 0;
- }
- else {
- lBreak.pos = pos;
- }
- }
-
// |width| may have been adjusted because we got shoved down past a float (thus
// giving us more room), so we need to retest, and only jump to
// the end label if we still don't fit on the line. -dwh
@@ -1446,7 +1466,7 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, QPtrList<BidiIt
}
last = o;
- o = Bidinext( start.par, o );
+ o = next;
if (!last->isSpecial() && last->isReplaced() && last->style()->whiteSpace() != NOWRAP) {
// Go ahead and add in tmpW.
@@ -1456,6 +1476,11 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, QPtrList<BidiIt
lBreak.pos = 0;
}
+ // Clear out our character space bool, since inline <pre>s don't collapse whitespace
+ // with adjacent inline normal/nowrap spans.
+ if (last->style()->whiteSpace() == PRE)
+ currentCharacterIsSpace = false;
+
pos = 0;
}
diff --git a/WebCore/khtml/rendering/render_block.cpp b/WebCore/khtml/rendering/render_block.cpp
index 280c4f0..03528b0 100644
--- a/WebCore/khtml/rendering/render_block.cpp
+++ b/WebCore/khtml/rendering/render_block.cpp
@@ -61,8 +61,9 @@ RenderBlock::~RenderBlock()
void RenderBlock::setStyle(RenderStyle* _style)
{
- setInline(false);
RenderFlow::setStyle(_style);
+ setInline(false);
+
m_pre = false;
if (_style->whiteSpace() == PRE)
m_pre = true;
@@ -81,7 +82,11 @@ void RenderBlock::setStyle(RenderStyle* _style)
child->setIsAnonymousBox(true);
}
child = child->nextSibling();
- }
+ }
+
+ // Update pseudos for :before and :after now.
+ insertPseudoChild(RenderStyle::BEFORE, firstChild());
+ insertPseudoChild(RenderStyle::AFTER, lastChild());
}
void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChild)
@@ -91,17 +96,28 @@ void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChi
bool madeBoxesNonInline = FALSE;
RenderStyle* pseudoStyle=0;
- if ((!firstChild() || firstChild() == beforeChild) && newChild->isText())
+ if ((!firstChild() || firstChild() == beforeChild) &&
+ (newChild->isInline() || newChild->isText()) &&
+ (pseudoStyle=style()->getPseudoStyle(RenderStyle::FIRST_LETTER)))
{
- RenderText* newTextChild = static_cast<RenderText*>(newChild);
+ // Drill into inlines looking for our first text child.
+ RenderObject* textChild = newChild;
+ while (textChild && !textChild->isText())
+ textChild = textChild->firstChild();
+
+ if (textChild) {
+ RenderObject* firstLetterContainer = textChild->parent();
+ if (!firstLetterContainer)
+ firstLetterContainer = this;
+
+ RenderText* newTextChild = static_cast<RenderText*>(textChild);
//kdDebug( 6040 ) << "first letter" << endl;
- if ( (pseudoStyle=style()->getPseudoStyle(RenderStyle::FIRST_LETTER)) ) {
pseudoStyle->setDisplay( INLINE );
pseudoStyle->setPosition( STATIC ); // CSS2 says first-letter can't be positioned.
RenderObject* firstLetter = RenderFlow::createFlow(0, pseudoStyle, renderArena()); // anonymous box
- addChild(firstLetter);
+ firstLetterContainer->addChild(firstLetter, firstLetterContainer->firstChild());
DOMStringImpl* oldText = newTextChild->string();
@@ -124,8 +140,6 @@ void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChi
}
}
- insertPseudoChild(RenderStyle::BEFORE, newChild, beforeChild);
-
// If the requested beforeChild is not one of our children, then this is most likely because
// there is an anonymous block box within this object that contains the beforeChild. So
// just insert the child into the anonymous block box instead of here.
@@ -224,8 +238,7 @@ void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChi
newChild->setLayouted( false );
newChild->setMinMaxKnown( false );
- insertPseudoChild(RenderStyle::AFTER, newChild, beforeChild);
-
+
if ( madeBoxesNonInline )
removeLeftoverAnonymousBoxes();
}
@@ -256,6 +269,7 @@ static void getInlineRun(RenderObject* start, RenderObject* stop,
return; // No more inline children to be found.
inlineRunStart = inlineRunEnd = curr;
+
curr = curr->nextSibling();
while (curr && curr->isInline() && (curr != stop)) {
inlineRunEnd = curr;
@@ -526,6 +540,15 @@ void RenderBlock::layoutBlockChildren( bool relayoutChildren )
RenderObject *child = firstChild();
RenderBlock *prevFlow = 0;
+ // A compact child that needs to be collapsed into the margin of the following block.
+ RenderObject* compactChild = 0;
+ // The block with the open margin that the compact child is going to place itself within.
+ RenderObject* blockForCompactChild = 0;
+ // For compact children that don't fit, we lay them out as though they are blocks. This
+ // boolean allows us to temporarily treat a compact like a block and lets us know we need
+ // to turn the block back into a compact when we're done laying out.
+ bool treatCompactAsBlock = false;
+
// Whether or not we can collapse our own margins with our children. We don't do this
// if we had any border/padding (obviously), if we're the root or HTML elements, or if
// we're positioned, floating, a table cell.
@@ -617,6 +640,69 @@ void RenderBlock::layoutBlockChildren( bool relayoutChildren )
continue;
}
+ // 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.
+ // 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() && !compactChild) {
+ // Get the next non-positioned/non-floating RenderBlock.
+ RenderObject* next = child->nextSibling();
+ RenderObject* curr = next;
+ while (curr && curr->isSpecial())
+ curr = curr->nextSibling();
+ if (curr && !curr->isCompact() && !curr->isRunIn()) {
+ curr->calcWidth(); // So that horizontal margins are correct.
+ // Need to compute margins for the child as though it is a block.
+ child->style()->setDisplay(BLOCK);
+ child->calcWidth();
+ child->style()->setDisplay(COMPACT);
+ int childMargins = child->marginLeft() + child->marginRight();
+ int margin = style()->direction() == LTR ? curr->marginLeft() : curr->marginRight();
+ if (margin < (childMargins + child->minWidth())) {
+ // It won't fit. Kill the "compact" boolean and just treat
+ // the child like a normal block. This is only temporary.
+ child->style()->setDisplay(BLOCK);
+ treatCompactAsBlock = true;
+ }
+ else {
+ // Cap our maxwidth at the margin's value.
+ if (child->maxWidth() + childMargins > margin)
+ child->setMaxWidth(margin - childMargins);
+ blockForCompactChild = curr;
+ compactChild = child;
+ child = child->nextSibling();
+ continue;
+ }
+ }
+ }
+
+ // See if we have a run-in element with inline children. If the
+ // children aren't inline, then just treat the run-in as a normal
+ // block.
+ if (child->isRunIn() && (child->childrenInline() || child->isReplaced())) {
+ // Get the next non-positioned/non-floating RenderBlock.
+ RenderObject* curr = child->nextSibling();
+ while (curr && curr->isSpecial())
+ curr = curr->nextSibling();
+ if (curr && (curr->isRenderBlock() && curr->childrenInline() &&
+ !curr->isCompact() && !curr->isRunIn())) {
+ // The block acts like an inline, so just null out its
+ // position.
+ child->setInline(true);
+ child->setPos(0,0);
+
+ // Remove the child.
+ RenderObject* next = child->nextSibling();
+ removeChildNode(child);
+
+ // Now insert the child under |curr|.
+ curr->insertChildNode(child, curr->firstChild());
+ child = next;
+ continue;
+ }
+ }
+
// Note this occurs after the test for positioning and floating above, since
// we want to ensure that we don't artificially increase our height because of
// a positioned or floating child.
@@ -831,6 +917,38 @@ void RenderBlock::layoutBlockChildren( bool relayoutChildren )
if (rightChildPos > m_overflowWidth)
m_overflowWidth = rightChildPos;
+ if (child == blockForCompactChild) {
+ blockForCompactChild = 0;
+ if (compactChild) {
+ // We have a compact child to squeeze in.
+ // FIXME: Align the compact box vertically such that the baseline of its
+ // first line box and the baseline of the block child's first line box are aligned.
+ int compactXPos = xPos+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();
+ }
+ compactChild->setPos(compactXPos, child->yPos());
+ if (!compactChild->layouted())
+ compactChild->layout();
+
+ // FIXME: Is this right? Do we grow the block to accommodate the compact child?
+ // It seems like we could be smart and keep looking for blocks that leave space
+ // for us. For now just grow the block.
+ if (compactChild->yPos() + compactChild->height() > m_height)
+ m_height = compactChild->yPos() + compactChild->height();
+
+ compactChild = 0;
+ }
+ }
+
+ // We did a layout as though the compact child was a block. Set it back to compact now.
+ if (treatCompactAsBlock) {
+ child->style()->setDisplay(COMPACT);
+ treatCompactAsBlock = false;
+ }
+
child = child->nextSibling();
}
@@ -931,8 +1049,11 @@ void RenderBlock::paintObject(QPainter *p, int _x, int _y,
// kdDebug( 6040 ) << renderName() << "(RenderBlock) " << this << " ::paintObject() w/h = (" << width() << "/" << height() << ")" << endl;
#endif
+ // If we're a repositioned run-in, don't paint background/borders.
+ bool inlineRunIn = (isRunIn() && isInline());
+
// 1. paint background, borders etc
- if (paintAction == PaintActionBackground &&
+ if (!inlineRunIn && paintAction == PaintActionBackground &&
shouldPaintBackgroundOrBorder() && style()->visibility() == VISIBLE )
paintBoxDecorations(p, _x, _y, _w, _h, _tx, _ty);
@@ -946,10 +1067,10 @@ void RenderBlock::paintObject(QPainter *p, int _x, int _y,
}
// 3. paint floats.
- if (paintAction == PaintActionFloat || paintAction == PaintActionSelection)
+ if (!inlineRunIn && (paintAction == PaintActionFloat || paintAction == PaintActionSelection))
paintFloats(p, _x, _y, _w, _h, _tx, _ty, paintAction == PaintActionSelection);
- if (paintAction == PaintActionBackground &&
+ if (!inlineRunIn && paintAction == PaintActionBackground &&
!childrenInline() && style()->outlineWidth())
paintOutline(p, _tx, _ty, width(), height(), style());
@@ -1439,7 +1560,7 @@ RenderBlock::clearFloats()
// pass fAF's unless they contain overhanging stuff
bool parentHasFloats = false;
while (prev) {
- if (!(prev->isRenderBlock() && prev->isRenderInline()) || prev->isFloating() ||
+ if (!prev->isRenderBlock() || prev->isFloating() ||
(prev->style()->flowAroundFloats() &&
// A <table> or <ul> can have a height of 0, so its ypos may be the same
// as m_y. That's why we have a <= and not a < here. -dwh
diff --git a/WebCore/khtml/rendering/render_box.cpp b/WebCore/khtml/rendering/render_box.cpp
index 2934b3a..0e759ad 100644
--- a/WebCore/khtml/rendering/render_box.cpp
+++ b/WebCore/khtml/rendering/render_box.cpp
@@ -71,6 +71,8 @@ void RenderBox::setStyle(RenderStyle *_style)
//if(!_style->backgroundXPosition().isVariable() && _style->backgroundYPosition().isVariable())
//style()->setBackgroundYPosition(Length(50, Percent));
+ setInline(style()->display()==INLINE);
+
switch(_style->position())
{
case ABSOLUTE:
@@ -604,7 +606,7 @@ int RenderBox::calcWidthUsing(WidthType widthType, int cw, LengthType& lengthTyp
int marginRight = style()->marginRight().minWidth(cw);
if (cw) width = cw - marginLeft - marginRight;
- if (isFloating()) {
+ if (isFloating() || isCompact()) {
if (width < m_minWidth)
width = m_minWidth;
if (width > m_maxWidth)
diff --git a/WebCore/khtml/rendering/render_box.h b/WebCore/khtml/rendering/render_box.h
index faed5bd..755eca0 100644
--- a/WebCore/khtml/rendering/render_box.h
+++ b/WebCore/khtml/rendering/render_box.h
@@ -56,7 +56,9 @@ public:
virtual short minWidth() const { return m_minWidth; }
virtual short maxWidth() const { return m_maxWidth; }
-
+ virtual void setMaxWidth(short s) { m_maxWidth = s; }
+ virtual void setMinWidth(short s) { m_minWidth = s; }
+
virtual short contentWidth() const;
virtual int contentHeight() const;
diff --git a/WebCore/khtml/rendering/render_container.cpp b/WebCore/khtml/rendering/render_container.cpp
index 5d3aa43..c605f26 100644
--- a/WebCore/khtml/rendering/render_container.cpp
+++ b/WebCore/khtml/rendering/render_container.cpp
@@ -203,17 +203,20 @@ void RenderContainer::removeChild(RenderObject *oldChild)
setLayouted(false);
}
-
-void RenderContainer::insertPseudoChild(RenderStyle::PseudoId type, RenderObject* child, RenderObject* beforeChild)
+void RenderContainer::insertPseudoChild(RenderStyle::PseudoId type, RenderObject* child)
{
-
- if (child->isText())
- return;
-
- RenderStyle* pseudo = child->style()->getPseudoStyle(type);
+ // FIXME: This method should really be renamed to "updatePseudoChild" and be capable of
+ // detecting that before/after children need to be deleted as well.
+
+ if (child && child->style()->styleType() == type)
+ return; // Generated content is already added. No need to add more.
+
+ RenderStyle* pseudo = style()->getPseudoStyle(type);
if (pseudo && pseudo->display() != NONE)
{
+ RenderObject* insertBefore = (type == RenderStyle::BEFORE) ? child : 0;
+
// From the CSS2 specification:
// User agents must ignore the following properties with :before and :after
// pseudo-elements: 'position', 'float', list properties, and table properties.
@@ -228,11 +231,14 @@ void RenderContainer::insertPseudoChild(RenderStyle::PseudoId type, RenderObject
if (pseudo->contentType()==CONTENT_TEXT)
{
RenderObject* po = RenderFlow::createFlow(0, pseudo, renderArena()); /* anonymous box */
- addChild(po, beforeChild);
RenderText* t = new (renderArena()) RenderText(0 /*anonymous object */, pseudo->contentText());
t->setStyle(pseudo);
po->addChild(t);
+
+ // Add this after we've installed our text, so that addChild will be able to find the text
+ // inside the inline for e.g., first-letter styling.
+ addChild(po, insertBefore);
// kdDebug() << DOM::DOMString(pseudo->contentText()).string() << endl;
@@ -243,7 +249,7 @@ void RenderContainer::insertPseudoChild(RenderStyle::PseudoId type, RenderObject
{
RenderObject* po = new (renderArena()) RenderImage(0);
po->setStyle(pseudo);
- addChild(po, beforeChild);
+ addChild(po, insertBefore);
po->close();
}
diff --git a/WebCore/khtml/rendering/render_container.h b/WebCore/khtml/rendering/render_container.h
index 30969da..f587302 100644
--- a/WebCore/khtml/rendering/render_container.h
+++ b/WebCore/khtml/rendering/render_container.h
@@ -62,7 +62,7 @@ private:
protected:
- void insertPseudoChild(RenderStyle::PseudoId type, RenderObject* child, RenderObject* before);
+ void insertPseudoChild(RenderStyle::PseudoId type, RenderObject* child);
RenderObject *m_first;
RenderObject *m_last;
diff --git a/WebCore/khtml/rendering/render_flow.cpp b/WebCore/khtml/rendering/render_flow.cpp
index 60f99e5..eebdc7a 100644
--- a/WebCore/khtml/rendering/render_flow.cpp
+++ b/WebCore/khtml/rendering/render_flow.cpp
@@ -118,6 +118,10 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
kdDebug( 6040 ) << "current height = " << m_height << endl;
#endif
+ // Make sure we don't append things after :after-generated content if we have it.
+ if (!beforeChild && lastChild() && lastChild()->style()->styleType() == RenderStyle::AFTER)
+ beforeChild = lastChild();
+
if (continuation())
return addChildWithContinuation(newChild, beforeChild);
return addChildToFlow(newChild, beforeChild);
diff --git a/WebCore/khtml/rendering/render_image.cpp b/WebCore/khtml/rendering/render_image.cpp
index c541e6f..7c34eef 100644
--- a/WebCore/khtml/rendering/render_image.cpp
+++ b/WebCore/khtml/rendering/render_image.cpp
@@ -68,8 +68,7 @@ RenderImage::~RenderImage()
void RenderImage::setStyle(RenderStyle* _style)
{
RenderReplaced::setStyle(_style);
- // init RenderObject attributes
- setInline( !isPositioned() && style()->display()==INLINE );
+
setOverhangingContents(style()->height().isPercent());
setShouldPaintBackgroundOrBorder(true);
diff --git a/WebCore/khtml/rendering/render_inline.cpp b/WebCore/khtml/rendering/render_inline.cpp
index ec7b12e..a9a7300 100644
--- a/WebCore/khtml/rendering/render_inline.cpp
+++ b/WebCore/khtml/rendering/render_inline.cpp
@@ -35,8 +35,9 @@ RenderInline::~RenderInline()
void RenderInline::setStyle(RenderStyle* _style)
{
- setInline(true);
RenderFlow::setStyle(_style);
+ setInline(true);
+
// Ensure that all of the split inlines pick up the new style. We
// only do this if we're an inline, since we don't want to propagate
// a block's style to the other inlines.
@@ -53,14 +54,16 @@ void RenderInline::setStyle(RenderStyle* _style)
}
currCont = currCont->continuation();
}
+
+ // Update pseudos for :before and :after now.
+ insertPseudoChild(RenderStyle::BEFORE, firstChild());
+ insertPseudoChild(RenderStyle::AFTER, lastChild());
}
void RenderInline::addChildToFlow(RenderObject* newChild, RenderObject* beforeChild)
{
setLayouted( false );
- insertPseudoChild(RenderStyle::BEFORE, newChild, beforeChild);
-
if (!newChild->isText() && newChild->style()->position() != STATIC)
setOverhangingContents();
@@ -87,7 +90,6 @@ void RenderInline::addChildToFlow(RenderObject* newChild, RenderObject* beforeCh
newChild->setLayouted( false );
newChild->setMinMaxKnown( false );
- insertPseudoChild(RenderStyle::AFTER, newChild, beforeChild);
}
static RenderInline* cloneInline(RenderFlow* src)
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index 72382e5..ea41ca7 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -89,6 +89,8 @@ RenderObject *RenderObject::createObject(DOM::NodeImpl* node, RenderStyle* styl
break;
case RUN_IN:
case COMPACT:
+ o = new (arena) RenderBlock(node);
+ break;
case MARKER:
break;
case TABLE:
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index b411071..1ba374d 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -197,6 +197,8 @@ public:
bool isRelPositioned() const { return m_relPositioned; } // relative positioning
bool isText() const { return m_isText; }
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 mouseInside() const;
bool isReplaced() const { return m_replaced; } // a "replaced" element (see CSS)
bool shouldPaintBackgroundOrBorder() const { return m_paintBackground; }
@@ -464,7 +466,9 @@ public:
virtual short minWidth() const { return 0; }
virtual short maxWidth() const { return 0; }
-
+ virtual void setMaxWidth(short s) { }
+ virtual void setMinWidth(short s) { }
+
RenderStyle* style() const { return m_style; }
RenderStyle* style( bool firstLine ) const {
RenderStyle *s = m_style;
@@ -579,7 +583,6 @@ private:
bool m_recalcMinMax : 1;
bool m_isText : 1;
bool m_inline : 1;
-
bool m_replaced : 1;
bool m_mouseInside : 1;
bool m_hasFirstLine : 1;
diff --git a/WebCore/khtml/rendering/render_style.cpp b/WebCore/khtml/rendering/render_style.cpp
index b58dbbb..f4dbfe0 100644
--- a/WebCore/khtml/rendering/render_style.cpp
+++ b/WebCore/khtml/rendering/render_style.cpp
@@ -266,7 +266,7 @@ RenderStyle* RenderStyle::addPseudoStyle(PseudoId pid)
if (!ps)
{
- ps = new RenderStyle(*this); // use the real copy constructor to get an identical copy
+ ps = new RenderStyle(); // So that noninherited flags are reset.
ps->ref();
ps->noninherited_flags._styleType = pid;
ps->pseudoStyle = pseudoStyle;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list