[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
hyatt at apple.com
hyatt at apple.com
Wed Dec 22 14:20:27 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 81c1d743590c9a1f4a569ec69c2517695a5afa4b
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 6 21:44:02 2010 +0000
https://bugs.webkit.org/show_bug.cgi?id=47303
Reviewed by Dan Bernstein.
Convert layoutInlineChildren to be block-flow-aware. None of the functions it calls are patched yet.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutBlock):
* rendering/RenderBlock.h:
(WebCore::RenderBlock::forceLayoutInlineChildren):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::layoutInlineChildren):
(WebCore::RenderBlock::beforeSideVisibleOverflowForLine):
(WebCore::RenderBlock::afterSideVisibleOverflowForLine):
(WebCore::RenderBlock::beforeSideLayoutOverflowForLine):
(WebCore::RenderBlock::afterSideLayoutOverflowForLine):
* rendering/RenderBox.h:
(WebCore::RenderBox::logicalLeftLayoutOverflow):
(WebCore::RenderBox::logicalRightLayoutOverflow):
(WebCore::RenderBox::logicalLeftVisualOverflow):
(WebCore::RenderBox::logicalRightVisualOverflow):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69235 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3159159..a99d1c0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,30 @@
Reviewed by Dan Bernstein.
+ https://bugs.webkit.org/show_bug.cgi?id=47303
+
+ Convert layoutInlineChildren to be block-flow-aware. None of the functions it calls are patched yet.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::layoutBlock):
+ * rendering/RenderBlock.h:
+ (WebCore::RenderBlock::forceLayoutInlineChildren):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::layoutInlineChildren):
+ (WebCore::RenderBlock::beforeSideVisibleOverflowForLine):
+ (WebCore::RenderBlock::afterSideVisibleOverflowForLine):
+ (WebCore::RenderBlock::beforeSideLayoutOverflowForLine):
+ (WebCore::RenderBlock::afterSideLayoutOverflowForLine):
+ * rendering/RenderBox.h:
+ (WebCore::RenderBox::logicalLeftLayoutOverflow):
+ (WebCore::RenderBox::logicalRightLayoutOverflow):
+ (WebCore::RenderBox::logicalLeftVisualOverflow):
+ (WebCore::RenderBox::logicalRightVisualOverflow):
+
+2010-10-06 David Hyatt <hyatt at apple.com>
+
+ Reviewed by Dan Bernstein.
+
https://bugs.webkit.org/show_bug.cgi?id=47298
Rename blockHeight to blockLogicalHeight.
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index 2bf72d9..479179d 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -1197,13 +1197,13 @@ void RenderBlock::layoutBlock(bool relayoutChildren, int pageHeight)
layer()->setHasVerticalScrollbar(true);
}
- int repaintTop = 0;
- int repaintBottom = 0;
+ int repaintLogicalTop = 0;
+ int repaintLogicalBottom = 0;
int maxFloatLogicalBottom = 0;
if (!firstChild() && !isAnonymousBlock())
setChildrenInline(true);
if (childrenInline())
- layoutInlineChildren(relayoutChildren, repaintTop, repaintBottom);
+ layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
else
layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom);
@@ -1266,10 +1266,15 @@ void RenderBlock::layoutBlock(bool relayoutChildren, int pageHeight)
// Repaint with our new bounds if they are different from our old bounds.
bool didFullRepaint = repainter.repaintAfterLayout();
- if (!didFullRepaint && repaintTop != repaintBottom && (style()->visibility() == VISIBLE || enclosingLayer()->hasVisibleContent())) {
- int repaintLeft = min(leftVisualOverflow(), leftLayoutOverflow());
- int repaintRight = max(rightVisualOverflow(), rightLayoutOverflow());
- IntRect repaintRect(repaintLeft, repaintTop, repaintRight - repaintLeft, repaintBottom - repaintTop);
+ if (!didFullRepaint && repaintLogicalTop != repaintLogicalBottom && (style()->visibility() == VISIBLE || enclosingLayer()->hasVisibleContent())) {
+ int repaintLogicalLeft = min(logicalLeftVisualOverflow(), logicalLeftLayoutOverflow());
+ int repaintLogicalRight = max(logicalRightVisualOverflow(), logicalRightLayoutOverflow());
+
+ IntRect repaintRect;
+ if (style()->isHorizontalWritingMode())
+ repaintRect = IntRect(repaintLogicalLeft, repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop);
+ else
+ repaintRect = IntRect(repaintLogicalTop, repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft);
// The repaint rect may be split across columns, in which case adjustRectForColumns() will return the union.
adjustRectForColumns(repaintRect);
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index 2533852..9d5346b 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -299,9 +299,9 @@ protected:
// Only used by RenderSVGText, which explicitely overrides RenderBlock::layoutBlock(), do NOT use for anything else.
void forceLayoutInlineChildren()
{
- int repaintTop = 0;
- int repaintBottom = 0;
- layoutInlineChildren(true, repaintTop, repaintBottom);
+ int repaintLogicalTop = 0;
+ int repaintLogicalBottom = 0;
+ layoutInlineChildren(true, repaintLogicalTop, repaintLogicalBottom);
}
#endif
@@ -333,7 +333,7 @@ private:
virtual void repaintOverhangingFloats(bool paintAllDescendants);
void layoutBlockChildren(bool relayoutChildren, int& maxFloatLogicalBottom);
- void layoutInlineChildren(bool relayoutChildren, int& repaintTop, int& repaintBottom);
+ void layoutInlineChildren(bool relayoutChildren, int& repaintLogicalTop, int& repaintLogicalBottom);
virtual void positionListMarker() { }
@@ -469,6 +469,10 @@ private:
void deleteEllipsisLineBoxes();
void checkLinesForTextOverflow();
void addOverflowFromInlineChildren();
+ int beforeSideVisibleOverflowForLine(RootInlineBox*) const;
+ int afterSideVisibleOverflowForLine(RootInlineBox*) const;
+ int beforeSideLayoutOverflowForLine(RootInlineBox*) const;
+ int afterSideLayoutOverflowForLine(RootInlineBox*) const;
// End of functions defined in RenderBlockLineLayout.cpp.
void addOverflowFromBlockChildren();
diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp
index 0fd6ae6..6566b71 100644
--- a/WebCore/rendering/RenderBlockLineLayout.cpp
+++ b/WebCore/rendering/RenderBlockLineLayout.cpp
@@ -500,14 +500,13 @@ static inline bool isCollapsibleSpace(UChar character, RenderText* renderer)
return false;
}
-void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, int& repaintBottom)
+void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintLogicalTop, int& repaintLogicalBottom)
{
bool useRepaintBounds = false;
m_overflow.clear();
- setLogicalHeight(borderTop() + paddingTop());
- int toAdd = borderBottom() + paddingBottom() + horizontalScrollbarHeight();
+ setLogicalHeight(borderBefore() + paddingBefore());
// Figure out if we should clear out our line boxes.
// FIXME: Handle resize eventually!
@@ -543,7 +542,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
o->setChildNeedsLayout(true, false);
// If relayoutChildren is set and we have percentage padding, we also need to invalidate the child's pref widths.
- if (relayoutChildren && (o->style()->paddingLeft().isPercent() || o->style()->paddingRight().isPercent()))
+ if (relayoutChildren && (o->style()->paddingStart().isPercent() || o->style()->paddingEnd().isPercent()))
o->setPreferredLogicalWidthsDirty(true, false);
if (o->isPositioned())
@@ -571,7 +570,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
bool firstLine = true;
bool previousLineBrokeCleanly = true;
RootInlineBox* startLine = determineStartPosition(firstLine, fullLayout, previousLineBrokeCleanly, resolver, floats, floatIndex,
- useRepaintBounds, repaintTop, repaintBottom);
+ useRepaintBounds, repaintLogicalTop, repaintLogicalBottom);
if (fullLayout && hasInlineChild && !selfNeedsLayout()) {
setNeedsLayout(true, false); // Mark ourselves as needing a full layout. This way we'll repaint like
@@ -594,21 +593,21 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
// if we determine that we're able to synchronize after handling all our dirty lines.
InlineIterator cleanLineStart;
BidiStatus cleanLineBidiStatus;
- int endLineYPos = 0;
+ int endLineLogicalTop = 0;
RootInlineBox* endLine = (fullLayout || !startLine) ?
- 0 : determineEndPosition(startLine, cleanLineStart, cleanLineBidiStatus, endLineYPos);
+ 0 : determineEndPosition(startLine, cleanLineStart, cleanLineBidiStatus, endLineLogicalTop);
if (startLine) {
if (!useRepaintBounds) {
useRepaintBounds = true;
- repaintTop = height();
- repaintBottom = height();
+ repaintLogicalTop = logicalHeight();
+ repaintLogicalBottom = logicalHeight();
}
RenderArena* arena = renderArena();
RootInlineBox* box = startLine;
while (box) {
- repaintTop = min(repaintTop, box->topVisibleOverflow());
- repaintBottom = max(repaintBottom, box->bottomVisibleOverflow());
+ repaintLogicalTop = min(repaintLogicalTop, beforeSideVisibleOverflowForLine(box));
+ repaintLogicalBottom = max(repaintLogicalBottom, afterSideVisibleOverflowForLine(box));
RootInlineBox* next = box->nextRootBox();
box->deleteLine(arena);
box = next;
@@ -642,7 +641,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
while (!end.atEnd()) {
// FIXME: Is this check necessary before the first iteration or can it be moved to the end?
- if (checkForEndLineMatch && (endLineMatched = matchedEndLine(resolver, cleanLineStart, cleanLineBidiStatus, endLine, endLineYPos, repaintBottom, repaintTop)))
+ if (checkForEndLineMatch && (endLineMatched = matchedEndLine(resolver, cleanLineStart, cleanLineBidiStatus, endLine, endLineLogicalTop, repaintLogicalBottom, repaintLogicalTop)))
break;
lineMidpointState.reset();
@@ -719,7 +718,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
// inline flow boxes.
RootInlineBox* lineBox = 0;
- int oldHeight = height();
+ int oldLogicalHeight = logicalHeight();
if (resolver.runCount()) {
if (hyphenated)
resolver.logicallyLastRun()->m_hasHyphen = true;
@@ -767,24 +766,24 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
if (lineBox) {
lineBox->setLineBreakInfo(end.obj, end.pos, resolver.status());
if (useRepaintBounds) {
- repaintTop = min(repaintTop, lineBox->topVisibleOverflow());
- repaintBottom = max(repaintBottom, lineBox->bottomVisibleOverflow());
+ repaintLogicalTop = min(repaintLogicalTop, beforeSideVisibleOverflowForLine(lineBox));
+ repaintLogicalBottom = max(repaintLogicalBottom, afterSideVisibleOverflowForLine(lineBox));
}
if (paginated) {
int adjustment = 0;
adjustLinePositionForPagination(lineBox, adjustment);
if (adjustment) {
- int oldLineWidth = availableLogicalWidthForLine(oldHeight, firstLine);
+ int oldLineWidth = availableLogicalWidthForLine(oldLogicalHeight, firstLine);
lineBox->adjustPosition(0, adjustment);
if (useRepaintBounds) // This can only be a positive adjustment, so no need to update repaintTop.
- repaintBottom = max(repaintBottom, lineBox->bottomVisibleOverflow());
+ repaintLogicalBottom = max(repaintLogicalBottom, afterSideVisibleOverflowForLine(lineBox));
- if (availableLogicalWidthForLine(oldHeight + adjustment, firstLine) != oldLineWidth) {
+ if (availableLogicalWidthForLine(oldLogicalHeight + adjustment, firstLine) != oldLineWidth) {
// We have to delete this line, remove all floats that got added, and let line layout re-run.
lineBox->deleteLine(renderArena());
- removeFloatingObjectsBelow(lastFloatFromPreviousLine, oldHeight);
- setLogicalHeight(oldHeight + adjustment);
+ removeFloatingObjectsBelow(lastFloatFromPreviousLine, oldLogicalHeight);
+ setLogicalHeight(oldLogicalHeight + adjustment);
resolver.setPosition(oldEnd);
end = oldEnd;
continue;
@@ -824,7 +823,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
if (endLine) {
if (endLineMatched) {
// Attach all the remaining lines, and then adjust their y-positions as needed.
- int delta = height() - endLineYPos;
+ int delta = logicalHeight() - endLineLogicalTop;
for (RootInlineBox* line = endLine; line; line = line->nextRootBox()) {
line->attachLine();
if (paginated) {
@@ -832,16 +831,15 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
adjustLinePositionForPagination(line, delta);
}
if (delta) {
- repaintTop = min(repaintTop, line->topVisibleOverflow() + min(delta, 0));
- repaintBottom = max(repaintBottom, line->bottomVisibleOverflow() + max(delta, 0));
+ repaintLogicalTop = min(repaintLogicalTop, beforeSideVisibleOverflowForLine(line) + min(delta, 0));
+ repaintLogicalBottom = max(repaintLogicalBottom, afterSideVisibleOverflowForLine(line) + max(delta, 0));
line->adjustPosition(0, delta);
}
if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) {
Vector<RenderBox*>::iterator end = cleanLineFloats->end();
for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin(); f != end; ++f) {
- int floatTop = (*f)->y() - (*f)->marginTop();
insertFloatingObject(*f);
- setLogicalHeight(floatTop + delta);
+ setLogicalHeight(logicalTopForChild(*f) - marginBeforeForChild(*f) + delta);
positionNewFloats();
}
}
@@ -852,8 +850,8 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
RootInlineBox* line = endLine;
RenderArena* arena = renderArena();
while (line) {
- repaintTop = min(repaintTop, line->topVisibleOverflow());
- repaintBottom = max(repaintBottom, line->bottomVisibleOverflow());
+ repaintLogicalTop = min(repaintLogicalTop, beforeSideVisibleOverflowForLine(line));
+ repaintLogicalBottom = max(repaintLogicalBottom, afterSideVisibleOverflowForLine(line));
RootInlineBox* next = line->nextRootBox();
line->deleteLine(arena);
line = next;
@@ -865,15 +863,15 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
// This has to be done before adding in the bottom border/padding, or the float will
// include the padding incorrectly. -dwh
if (checkForFloatsFromLastLine) {
- int bottomVisualOverflow = lastRootBox()->bottomVisualOverflow();
- int bottomLayoutOverflow = lastRootBox()->bottomLayoutOverflow();
+ int bottomVisualOverflow = afterSideVisibleOverflowForLine(lastRootBox());
+ int bottomLayoutOverflow = afterSideLayoutOverflowForLine(lastRootBox());
TrailingFloatsRootInlineBox* trailingFloatsLineBox = new (renderArena()) TrailingFloatsRootInlineBox(this);
m_lineBoxes.appendLineBox(trailingFloatsLineBox);
trailingFloatsLineBox->setConstructed();
GlyphOverflowAndFallbackFontsMap textBoxDataMap;
- trailingFloatsLineBox->alignBoxesInBlockDirection(height(), textBoxDataMap);
- trailingFloatsLineBox->setBlockDirectionOverflowPositions(height(), bottomLayoutOverflow, height(), bottomVisualOverflow, 0);
- trailingFloatsLineBox->setBlockLogicalHeight(height());
+ trailingFloatsLineBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap);
+ trailingFloatsLineBox->setBlockDirectionOverflowPositions(logicalHeight(), bottomLayoutOverflow, logicalHeight(), bottomVisualOverflow, 0);
+ trailingFloatsLineBox->setBlockLogicalHeight(logicalHeight());
}
if (lastFloat) {
for (FloatingObject* f = m_floatingObjects->last(); f != lastFloat; f = m_floatingObjects->prev()) {
@@ -899,7 +897,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
}
// Now add in the bottom border/padding.
- setLogicalHeight(logicalHeight() + toAdd);
+ setLogicalHeight(logicalHeight() + borderAfter() + paddingAfter() + scrollbarLogicalHeight());
if (!firstLineBox() && hasLineIfEmpty())
setLogicalHeight(logicalHeight() + lineHeight(true, true));
@@ -2014,6 +2012,70 @@ void RenderBlock::addOverflowFromInlineChildren()
}
}
+int RenderBlock::beforeSideVisibleOverflowForLine(RootInlineBox* line) const
+{
+ switch (style()->writingMode()) {
+ case TopToBottomWritingMode:
+ return line->topVisibleOverflow();
+ case LeftToRightWritingMode:
+ return line->leftVisibleOverflow();
+ case RightToLeftWritingMode:
+ return line->rightVisibleOverflow();
+ case BottomToTopWritingMode:
+ return line->bottomVisibleOverflow();
+ }
+ ASSERT_NOT_REACHED();
+ return line->topVisibleOverflow();
+}
+
+int RenderBlock::afterSideVisibleOverflowForLine(RootInlineBox* line) const
+{
+ switch (style()->writingMode()) {
+ case TopToBottomWritingMode:
+ return line->bottomVisibleOverflow();
+ case LeftToRightWritingMode:
+ return line->rightVisibleOverflow();
+ case RightToLeftWritingMode:
+ return line->leftVisibleOverflow();
+ case BottomToTopWritingMode:
+ return line->topVisibleOverflow();
+ }
+ ASSERT_NOT_REACHED();
+ return line->bottomVisibleOverflow();
+}
+
+int RenderBlock::beforeSideLayoutOverflowForLine(RootInlineBox* line) const
+{
+ switch (style()->writingMode()) {
+ case TopToBottomWritingMode:
+ return line->topLayoutOverflow();
+ case LeftToRightWritingMode:
+ return line->leftLayoutOverflow();
+ case RightToLeftWritingMode:
+ return line->rightLayoutOverflow();
+ case BottomToTopWritingMode:
+ return line->bottomLayoutOverflow();
+ }
+ ASSERT_NOT_REACHED();
+ return line->topLayoutOverflow();
+}
+
+int RenderBlock::afterSideLayoutOverflowForLine(RootInlineBox* line) const
+{
+ switch (style()->writingMode()) {
+ case TopToBottomWritingMode:
+ return line->bottomLayoutOverflow();
+ case LeftToRightWritingMode:
+ return line->rightLayoutOverflow();
+ case RightToLeftWritingMode:
+ return line->leftLayoutOverflow();
+ case BottomToTopWritingMode:
+ return line->topLayoutOverflow();
+ }
+ ASSERT_NOT_REACHED();
+ return line->bottomLayoutOverflow();
+}
+
void RenderBlock::deleteEllipsisLineBoxes()
{
for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox())
diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h
index dc7a4b3..6051475 100644
--- a/WebCore/rendering/RenderBox.h
+++ b/WebCore/rendering/RenderBox.h
@@ -127,19 +127,23 @@ public:
int bottomVisibleOverflow() const { return hasOverflowClip() ? bottomVisualOverflow() : std::max(bottomLayoutOverflow(), bottomVisualOverflow()); }
int leftVisibleOverflow() const { return hasOverflowClip() ? leftVisualOverflow() : std::min(leftLayoutOverflow(), leftVisualOverflow()); }
int rightVisibleOverflow() const { return hasOverflowClip() ? rightVisualOverflow() : std::max(rightLayoutOverflow(), rightVisualOverflow()); }
-
+
IntRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : borderBoxRect(); }
int topLayoutOverflow() const { return m_overflow? m_overflow->topLayoutOverflow() : 0; }
int bottomLayoutOverflow() const { return m_overflow ? m_overflow->bottomLayoutOverflow() : height(); }
int leftLayoutOverflow() const { return m_overflow ? m_overflow->leftLayoutOverflow() : 0; }
int rightLayoutOverflow() const { return m_overflow ? m_overflow->rightLayoutOverflow() : width(); }
+ int logicalLeftLayoutOverflow() const { return style()->isHorizontalWritingMode() ? leftLayoutOverflow() : topLayoutOverflow(); }
+ int logicalRightLayoutOverflow() const { return style()->isHorizontalWritingMode() ? rightLayoutOverflow() : bottomLayoutOverflow(); }
IntRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : borderBoxRect(); }
int topVisualOverflow() const { return m_overflow? m_overflow->topVisualOverflow() : 0; }
int bottomVisualOverflow() const { return m_overflow ? m_overflow->bottomVisualOverflow() : height(); }
int leftVisualOverflow() const { return m_overflow ? m_overflow->leftVisualOverflow() : 0; }
int rightVisualOverflow() const { return m_overflow ? m_overflow->rightVisualOverflow() : width(); }
-
+ int logicalLeftVisualOverflow() const { return style()->isHorizontalWritingMode() ? leftVisualOverflow() : topVisualOverflow(); }
+ int logicalRightVisualOverflow() const { return style()->isHorizontalWritingMode() ? rightVisualOverflow() : bottomVisualOverflow(); }
+
void addLayoutOverflow(const IntRect&);
void addVisualOverflow(const IntRect&);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list