summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-09-30 15:42:16 +0100
committerSteve Block <steveblock@google.com>2010-10-07 10:59:29 +0100
commitbec39347bb3bb5bf1187ccaf471d26247f28b585 (patch)
tree56bdc4c2978fbfd3d79d0d36d5d6c640ecc09cc8 /WebCore/rendering
parent90b7966e7815b262cd19ac25f03aaad9b21fdc06 (diff)
downloadexternal_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.zip
external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.tar.gz
external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.tar.bz2
Merge WebKit at r68651 : Initial merge by git.
Change-Id: I3d6bff59f17eedd6722723354f386fec9be8ad12
Diffstat (limited to 'WebCore/rendering')
-rw-r--r--WebCore/rendering/AutoTableLayout.cpp20
-rw-r--r--WebCore/rendering/AutoTableLayout.h2
-rw-r--r--WebCore/rendering/EllipsisBox.cpp8
-rw-r--r--WebCore/rendering/EllipsisBox.h4
-rw-r--r--WebCore/rendering/FixedTableLayout.cpp8
-rw-r--r--WebCore/rendering/FixedTableLayout.h2
-rw-r--r--WebCore/rendering/HitTestResult.cpp183
-rw-r--r--WebCore/rendering/HitTestResult.h60
-rw-r--r--WebCore/rendering/InlineBox.cpp8
-rw-r--r--WebCore/rendering/InlineBox.h68
-rw-r--r--WebCore/rendering/InlineFlowBox.cpp99
-rw-r--r--WebCore/rendering/InlineFlowBox.h105
-rw-r--r--WebCore/rendering/InlineTextBox.cpp58
-rw-r--r--WebCore/rendering/InlineTextBox.h4
-rw-r--r--WebCore/rendering/MediaControlElements.cpp58
-rw-r--r--WebCore/rendering/MediaControlElements.h2
-rw-r--r--WebCore/rendering/RenderApplet.cpp4
-rw-r--r--WebCore/rendering/RenderBlock.cpp477
-rw-r--r--WebCore/rendering/RenderBlock.h139
-rw-r--r--WebCore/rendering/RenderBlockLineLayout.cpp203
-rw-r--r--WebCore/rendering/RenderBox.cpp726
-rw-r--r--WebCore/rendering/RenderBox.h191
-rw-r--r--WebCore/rendering/RenderBoxModelObject.cpp71
-rw-r--r--WebCore/rendering/RenderBoxModelObject.h12
-rw-r--r--WebCore/rendering/RenderCounter.cpp4
-rw-r--r--WebCore/rendering/RenderCounter.h2
-rw-r--r--WebCore/rendering/RenderDataGrid.cpp28
-rw-r--r--WebCore/rendering/RenderDataGrid.h2
-rw-r--r--WebCore/rendering/RenderEmbeddedObject.cpp4
-rw-r--r--WebCore/rendering/RenderFieldset.cpp8
-rw-r--r--WebCore/rendering/RenderFieldset.h4
-rw-r--r--WebCore/rendering/RenderFileUploadControl.cpp30
-rw-r--r--WebCore/rendering/RenderFileUploadControl.h2
-rw-r--r--WebCore/rendering/RenderFlexibleBox.cpp90
-rw-r--r--WebCore/rendering/RenderFlexibleBox.h2
-rw-r--r--WebCore/rendering/RenderForeignObject.cpp6
-rw-r--r--WebCore/rendering/RenderForeignObject.h4
-rw-r--r--WebCore/rendering/RenderFrameBase.cpp6
-rw-r--r--WebCore/rendering/RenderHTMLCanvas.cpp8
-rw-r--r--WebCore/rendering/RenderIFrame.cpp16
-rw-r--r--WebCore/rendering/RenderIFrame.h4
-rw-r--r--WebCore/rendering/RenderImage.cpp30
-rw-r--r--WebCore/rendering/RenderImage.h10
-rw-r--r--WebCore/rendering/RenderIndicator.cpp4
-rw-r--r--WebCore/rendering/RenderInline.cpp63
-rw-r--r--WebCore/rendering/RenderInline.h11
-rw-r--r--WebCore/rendering/RenderLayer.cpp32
-rw-r--r--WebCore/rendering/RenderLayerBacking.cpp44
-rw-r--r--WebCore/rendering/RenderLayerBacking.h8
-rw-r--r--WebCore/rendering/RenderLineBoxList.cpp8
-rw-r--r--WebCore/rendering/RenderListBox.cpp34
-rw-r--r--WebCore/rendering/RenderListBox.h4
-rw-r--r--WebCore/rendering/RenderListItem.cpp45
-rw-r--r--WebCore/rendering/RenderListItem.h3
-rw-r--r--WebCore/rendering/RenderListMarker.cpp50
-rw-r--r--WebCore/rendering/RenderListMarker.h3
-rw-r--r--WebCore/rendering/RenderMenuList.cpp28
-rw-r--r--WebCore/rendering/RenderMenuList.h2
-rw-r--r--WebCore/rendering/RenderMeter.cpp8
-rw-r--r--WebCore/rendering/RenderMeter.h4
-rw-r--r--WebCore/rendering/RenderObject.cpp28
-rw-r--r--WebCore/rendering/RenderObject.h27
-rw-r--r--WebCore/rendering/RenderPath.cpp2
-rw-r--r--WebCore/rendering/RenderReplaced.cpp45
-rw-r--r--WebCore/rendering/RenderReplaced.h8
-rw-r--r--WebCore/rendering/RenderReplica.cpp8
-rw-r--r--WebCore/rendering/RenderReplica.h2
-rw-r--r--WebCore/rendering/RenderSVGContainer.cpp2
-rw-r--r--WebCore/rendering/RenderSVGImage.cpp2
-rw-r--r--WebCore/rendering/RenderSVGInline.cpp4
-rw-r--r--WebCore/rendering/RenderSVGInlineText.cpp2
-rw-r--r--WebCore/rendering/RenderSVGResourceFilter.cpp2
-rw-r--r--WebCore/rendering/RenderSVGResourceFilterPrimitive.h5
-rw-r--r--WebCore/rendering/RenderSVGRoot.cpp28
-rw-r--r--WebCore/rendering/RenderSVGRoot.h6
-rw-r--r--WebCore/rendering/RenderSVGText.cpp4
-rw-r--r--WebCore/rendering/RenderScrollbarPart.cpp8
-rw-r--r--WebCore/rendering/RenderScrollbarPart.h2
-rw-r--r--WebCore/rendering/RenderSlider.cpp32
-rw-r--r--WebCore/rendering/RenderSlider.h2
-rw-r--r--WebCore/rendering/RenderTable.cpp36
-rw-r--r--WebCore/rendering/RenderTable.h4
-rw-r--r--WebCore/rendering/RenderTableCell.cpp79
-rw-r--r--WebCore/rendering/RenderTableCell.h38
-rw-r--r--WebCore/rendering/RenderTableCol.cpp6
-rw-r--r--WebCore/rendering/RenderTableCol.h2
-rw-r--r--WebCore/rendering/RenderTableRow.cpp2
-rw-r--r--WebCore/rendering/RenderTableSection.cpp18
-rw-r--r--WebCore/rendering/RenderText.cpp54
-rw-r--r--WebCore/rendering/RenderText.h8
-rw-r--r--WebCore/rendering/RenderTextControl.cpp34
-rw-r--r--WebCore/rendering/RenderTextControl.h4
-rw-r--r--WebCore/rendering/RenderTextControlSingleLine.cpp24
-rw-r--r--WebCore/rendering/RenderTreeAsText.cpp56
-rw-r--r--WebCore/rendering/RenderTreeAsText.h29
-rw-r--r--WebCore/rendering/RenderVideo.cpp10
-rw-r--r--WebCore/rendering/RenderVideo.h4
-rw-r--r--WebCore/rendering/RenderView.cpp28
-rw-r--r--WebCore/rendering/RenderView.h8
-rw-r--r--WebCore/rendering/RootInlineBox.cpp55
-rw-r--r--WebCore/rendering/RootInlineBox.h12
-rw-r--r--WebCore/rendering/SVGInlineFlowBox.h8
-rw-r--r--WebCore/rendering/SVGInlineTextBox.cpp2
-rw-r--r--WebCore/rendering/SVGInlineTextBox.h8
-rw-r--r--WebCore/rendering/SVGRenderTreeAsText.cpp50
-rw-r--r--WebCore/rendering/SVGRenderTreeAsText.h22
-rw-r--r--WebCore/rendering/SVGRootInlineBox.cpp12
-rw-r--r--WebCore/rendering/SVGRootInlineBox.h12
-rw-r--r--WebCore/rendering/TableLayout.h2
-rw-r--r--WebCore/rendering/TrailingFloatsRootInlineBox.h9
-rw-r--r--WebCore/rendering/style/RenderStyle.cpp52
-rw-r--r--WebCore/rendering/style/RenderStyle.h16
-rw-r--r--WebCore/rendering/style/StyleRareNonInheritedData.cpp12
-rw-r--r--WebCore/rendering/style/StyleRareNonInheritedData.h4
114 files changed, 2415 insertions, 1647 deletions
diff --git a/WebCore/rendering/AutoTableLayout.cpp b/WebCore/rendering/AutoTableLayout.cpp
index d9233a2..bf1bcd9 100644
--- a/WebCore/rendering/AutoTableLayout.cpp
+++ b/WebCore/rendering/AutoTableLayout.cpp
@@ -60,7 +60,7 @@ void AutoTableLayout::recalcColumn(int effCol)
while (child) {
if (child->isTableCol())
- toRenderTableCol(child)->calcPrefWidths();
+ toRenderTableCol(child)->computePreferredLogicalWidths();
else if (child->isTableSection()) {
RenderTableSection* section = toRenderTableSection(child);
int numRows = section->numRows();
@@ -79,11 +79,11 @@ void AutoTableLayout::recalcColumn(int effCol)
// a min/max width of at least 1px for this column now.
l.minWidth = max(l.minWidth, cellHasContent ? 1 : 0);
l.maxWidth = max(l.maxWidth, 1);
- if (cell->prefWidthsDirty())
- cell->calcPrefWidths();
- l.minWidth = max(cell->minPrefWidth(), l.minWidth);
- if (cell->maxPrefWidth() > l.maxWidth) {
- l.maxWidth = cell->maxPrefWidth();
+ if (cell->preferredLogicalWidthsDirty())
+ cell->computePreferredLogicalWidths();
+ l.minWidth = max(cell->minPreferredLogicalWidth(), l.minWidth);
+ if (cell->maxPreferredLogicalWidth() > l.maxWidth) {
+ l.maxWidth = cell->maxPreferredLogicalWidth();
maxContributor = cell;
}
@@ -97,7 +97,7 @@ void AutoTableLayout::recalcColumn(int effCol)
case Fixed:
// ignore width=0
if (w.value() > 0 && (int)l.width.type() != Percent) {
- int wval = cell->calcBorderBoxWidth(w.value());
+ int wval = cell->computeBorderBoxLogicalWidth(w.value());
if (l.width.isFixed()) {
// Nav/IE weirdness
if ((wval > l.width.value()) ||
@@ -239,7 +239,7 @@ static bool shouldScaleColumns(RenderTable* table)
return scale;
}
-void AutoTableLayout::calcPrefWidths(int& minWidth, int& maxWidth)
+void AutoTableLayout::computePreferredLogicalWidths(int& minWidth, int& maxWidth)
{
fullRecalc();
@@ -317,8 +317,8 @@ int AutoTableLayout::calcEffectiveWidth()
int col = m_table->colToEffCol(cell->col());
unsigned int lastCol = col;
- int cMinWidth = cell->minPrefWidth() + hspacing;
- float cMaxWidth = cell->maxPrefWidth() + hspacing;
+ int cMinWidth = cell->minPreferredLogicalWidth() + hspacing;
+ float cMaxWidth = cell->maxPreferredLogicalWidth() + hspacing;
int totalPercent = 0;
int minWidth = 0;
float maxWidth = 0;
diff --git a/WebCore/rendering/AutoTableLayout.h b/WebCore/rendering/AutoTableLayout.h
index f1ef768..5726ba6 100644
--- a/WebCore/rendering/AutoTableLayout.h
+++ b/WebCore/rendering/AutoTableLayout.h
@@ -35,7 +35,7 @@ public:
AutoTableLayout(RenderTable*);
~AutoTableLayout();
- virtual void calcPrefWidths(int& minWidth, int& maxWidth);
+ virtual void computePreferredLogicalWidths(int& minWidth, int& maxWidth);
virtual void layout();
protected:
diff --git a/WebCore/rendering/EllipsisBox.cpp b/WebCore/rendering/EllipsisBox.cpp
index 61cd524..1d71d35 100644
--- a/WebCore/rendering/EllipsisBox.cpp
+++ b/WebCore/rendering/EllipsisBox.cpp
@@ -62,7 +62,7 @@ void EllipsisBox::paint(PaintInfo& paintInfo, int tx, int ty)
if (m_markupBox) {
// Paint the markup box
- tx += m_x + m_width - m_markupBox->x();
+ tx += m_x + m_logicalWidth - m_markupBox->x();
ty += m_y + style->font().ascent() - (m_markupBox->y() + m_markupBox->renderer()->style(m_firstLine)->font().ascent());
m_markupBox->paint(paintInfo, tx, ty);
}
@@ -91,7 +91,7 @@ void EllipsisBox::paintSelection(GraphicsContext* context, int tx, int ty, Rende
context->save();
int y = root()->selectionTop();
int h = root()->selectionHeight();
- context->clip(IntRect(m_x + tx, y + ty, m_width, h));
+ context->clip(IntRect(m_x + tx, y + ty, m_logicalWidth, h));
context->drawHighlightForText(font, TextRun(m_str.characters(), m_str.length(), false, 0, 0, false, style->visuallyOrdered()),
IntPoint(m_x + tx, m_y + ty + y), h, c, style->colorSpace());
context->restore();
@@ -105,7 +105,7 @@ bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
// Hit test the markup box.
if (m_markupBox) {
RenderStyle* style = m_renderer->style(m_firstLine);
- int mtx = tx + m_width - m_markupBox->x();
+ int mtx = tx + m_logicalWidth - m_markupBox->x();
int mty = ty + style->font().ascent() - (m_markupBox->y() + m_markupBox->renderer()->style(m_firstLine)->font().ascent());
if (m_markupBox->nodeAtPoint(request, result, x, y, mtx, mty)) {
renderer()->updateHitTestResult(result, IntPoint(x - mtx, y - mty));
@@ -113,7 +113,7 @@ bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
}
}
- IntRect boundsRect = IntRect(tx, ty, m_width, m_height);
+ IntRect boundsRect = IntRect(tx, ty, m_logicalWidth, m_height);
if (visibleToHitTesting() && boundsRect.intersects(result.rectFromPoint(x, y))) {
renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty));
if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, boundsRect))
diff --git a/WebCore/rendering/EllipsisBox.h b/WebCore/rendering/EllipsisBox.h
index 476331c..ec1b00b 100644
--- a/WebCore/rendering/EllipsisBox.h
+++ b/WebCore/rendering/EllipsisBox.h
@@ -30,8 +30,8 @@ class HitTestResult;
class EllipsisBox : public InlineBox {
public:
EllipsisBox(RenderObject* obj, const AtomicString& ellipsisStr, InlineFlowBox* parent,
- int width, int height, int y, bool firstLine, InlineBox* markupBox)
- : InlineBox(obj, 0, y, width, firstLine, true, false, false, 0, 0, parent)
+ int width, int height, int y, bool firstLine, bool isVertical, InlineBox* markupBox)
+ : InlineBox(obj, 0, y, width, firstLine, true, false, false, isVertical, 0, 0, parent)
, m_height(height)
, m_str(ellipsisStr)
, m_markupBox(markupBox)
diff --git a/WebCore/rendering/FixedTableLayout.cpp b/WebCore/rendering/FixedTableLayout.cpp
index b5ff971..ba99336 100644
--- a/WebCore/rendering/FixedTableLayout.cpp
+++ b/WebCore/rendering/FixedTableLayout.cpp
@@ -126,7 +126,7 @@ int FixedTableLayout::calcWidthArray(int)
currentEffectiveColumn++;
}
}
- toRenderTableCol(child)->calcPrefWidths();
+ toRenderTableCol(child)->computePreferredLogicalWidths();
} else
break;
@@ -155,8 +155,8 @@ int FixedTableLayout::calcWidthArray(int)
while (child) {
if (child->isTableCell()) {
RenderTableCell* cell = toRenderTableCell(child);
- if (cell->prefWidthsDirty())
- cell->calcPrefWidths();
+ if (cell->preferredLogicalWidthsDirty())
+ cell->computePreferredLogicalWidths();
Length w = cell->styleOrColWidth();
int span = cell->colSpan();
@@ -190,7 +190,7 @@ int FixedTableLayout::calcWidthArray(int)
// Keep this in synch with BLOCK_MAX_WIDTH in RenderBlock.cpp
#define TABLE_MAX_WIDTH 15000
-void FixedTableLayout::calcPrefWidths(int& minWidth, int& maxWidth)
+void FixedTableLayout::computePreferredLogicalWidths(int& minWidth, int& maxWidth)
{
// FIXME: This entire calculation is incorrect for both minwidth and maxwidth.
diff --git a/WebCore/rendering/FixedTableLayout.h b/WebCore/rendering/FixedTableLayout.h
index 758ddbb..bf26d1b 100644
--- a/WebCore/rendering/FixedTableLayout.h
+++ b/WebCore/rendering/FixedTableLayout.h
@@ -33,7 +33,7 @@ class FixedTableLayout : public TableLayout {
public:
FixedTableLayout(RenderTable*);
- virtual void calcPrefWidths(int& minWidth, int& maxWidth);
+ virtual void computePreferredLogicalWidths(int& minWidth, int& maxWidth);
virtual void layout();
protected:
diff --git a/WebCore/rendering/HitTestResult.cpp b/WebCore/rendering/HitTestResult.cpp
index 496c4ba..35a6d23 100644
--- a/WebCore/rendering/HitTestResult.cpp
+++ b/WebCore/rendering/HitTestResult.cpp
@@ -24,6 +24,7 @@
#include "Frame.h"
#include "FrameTree.h"
#include "HTMLAnchorElement.h"
+#include "HTMLVideoElement.h"
#include "HTMLImageElement.h"
#include "HTMLInputElement.h"
#include "HTMLMediaElement.h"
@@ -50,17 +51,27 @@ HitTestResult::HitTestResult(const IntPoint& point)
: m_point(point)
, m_isOverWidget(false)
, m_isRectBased(false)
+ , m_topPadding(0)
+ , m_rightPadding(0)
+ , m_bottomPadding(0)
+ , m_leftPadding(0)
{
}
-HitTestResult::HitTestResult(const IntPoint& centerPoint, const IntSize& padding)
+HitTestResult::HitTestResult(const IntPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
: m_point(centerPoint)
, m_isOverWidget(false)
+ , m_topPadding(topPadding)
+ , m_rightPadding(rightPadding)
+ , m_bottomPadding(bottomPadding)
+ , m_leftPadding(leftPadding)
{
- // If a zero padding is passed in or either width or height is negative, then it
- // is not a valid padding and hence not a rect based hit test.
- m_isRectBased = !(padding.isZero() || (padding.width() < 0 || padding.height() < 0));
- m_padding = m_isRectBased ? padding : IntSize();
+ // If all padding values passed in are zero then it is not a rect based hit test.
+ m_isRectBased = topPadding || rightPadding || bottomPadding || leftPadding;
+
+ // Make sure all padding values are clamped to zero if it is not a rect hit test.
+ if (!m_isRectBased)
+ m_topPadding = m_rightPadding = m_bottomPadding = m_leftPadding = 0;
}
HitTestResult::HitTestResult(const HitTestResult& other)
@@ -75,9 +86,13 @@ HitTestResult::HitTestResult(const HitTestResult& other)
// Only copy the padding and ListHashSet in case of rect hit test.
// Copying the later is rather expensive.
if ((m_isRectBased = other.isRectBasedTest())) {
- m_padding = other.padding();
+ m_topPadding = other.m_topPadding;
+ m_rightPadding = other.m_rightPadding;
+ m_bottomPadding = other.m_bottomPadding;
+ m_leftPadding = other.m_leftPadding;
m_rectBasedTestResult = other.rectBasedTestResult();
- }
+ } else
+ m_topPadding = m_rightPadding = m_bottomPadding = m_leftPadding = 0;
}
HitTestResult::~HitTestResult()
@@ -96,9 +111,13 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other)
// Only copy the padding and ListHashSet in case of rect hit test.
// Copying the later is rather expensive.
if ((m_isRectBased = other.isRectBasedTest())) {
- m_padding = other.padding();
+ m_topPadding = other.m_topPadding;
+ m_rightPadding = other.m_rightPadding;
+ m_bottomPadding = other.m_bottomPadding;
+ m_leftPadding = other.m_leftPadding;
m_rectBasedTestResult = other.rectBasedTestResult();
- }
+ } else
+ m_topPadding = m_rightPadding = m_bottomPadding = m_leftPadding = 0;
return *this;
}
@@ -292,22 +311,134 @@ KURL HitTestResult::absoluteImageURL() const
KURL HitTestResult::absoluteMediaURL() const
{
#if ENABLE(VIDEO)
+ if (HTMLMediaElement* mediaElt = mediaElement())
+ return m_innerNonSharedNode->document()->completeURL(deprecatedParseURL(mediaElt->currentSrc()));
+ return KURL();
+#else
+ return KURL();
+#endif
+}
+
+bool HitTestResult::mediaSupportsFullscreen() const
+{
+#if ENABLE(VIDEO)
+ HTMLMediaElement* mediaElt(mediaElement());
+ return (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag) && mediaElt->supportsFullscreen());
+#else
+ return false;
+#endif
+}
+
+#if ENABLE(VIDEO)
+HTMLMediaElement* HitTestResult::mediaElement() const
+{
if (!(m_innerNonSharedNode && m_innerNonSharedNode->document()))
- return KURL();
+ return 0;
if (!(m_innerNonSharedNode->renderer() && m_innerNonSharedNode->renderer()->isMedia()))
- return KURL();
+ return 0;
- AtomicString urlString;
- if (m_innerNonSharedNode->hasTagName(HTMLNames::videoTag) || m_innerNonSharedNode->hasTagName(HTMLNames::audioTag)) {
- HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(m_innerNonSharedNode.get());
- urlString = mediaElement->currentSrc();
- } else
- return KURL();
+ if (m_innerNonSharedNode->hasTagName(HTMLNames::videoTag) || m_innerNonSharedNode->hasTagName(HTMLNames::audioTag))
+ return static_cast<HTMLMediaElement*>(m_innerNonSharedNode.get());
+ return 0;
+}
+#endif
- return m_innerNonSharedNode->document()->completeURL(deprecatedParseURL(urlString));
-#else
- return KURL();
+void HitTestResult::toggleMediaControlsDisplay() const
+{
+#if ENABLE(VIDEO)
+ if (HTMLMediaElement* mediaElt = mediaElement())
+ mediaElt->setControls(!mediaElt->controls());
+#endif
+}
+
+void HitTestResult::toggleMediaLoopPlayback() const
+{
+#if ENABLE(VIDEO)
+ if (HTMLMediaElement* mediaElt = mediaElement())
+ mediaElt->setLoop(!mediaElt->loop());
+#endif
+}
+
+void HitTestResult::enterFullscreenForVideo() const
+{
+#if ENABLE(VIDEO)
+ HTMLMediaElement* mediaElt(mediaElement());
+ if (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag)) {
+ HTMLVideoElement* videoElt = static_cast<HTMLVideoElement*>(mediaElt);
+ if (!videoElt->isFullscreen() && mediaElt->supportsFullscreen())
+ videoElt->enterFullscreen();
+ }
+#endif
+}
+
+bool HitTestResult::mediaControlsEnabled() const
+{
+#if ENABLE(VIDEO)
+ if (HTMLMediaElement* mediaElt = mediaElement())
+ return mediaElt->controls();
+#endif
+ return false;
+}
+
+bool HitTestResult::mediaLoopEnabled() const
+{
+#if ENABLE(VIDEO)
+ if (HTMLMediaElement* mediaElt = mediaElement())
+ return mediaElt->loop();
+#endif
+ return false;
+}
+
+bool HitTestResult::mediaPlaying() const
+{
+#if ENABLE(VIDEO)
+ if (HTMLMediaElement* mediaElt = mediaElement())
+ return !mediaElt->paused();
+#endif
+ return false;
+}
+
+void HitTestResult::toggleMediaPlayState() const
+{
+#if ENABLE(VIDEO)
+ if (HTMLMediaElement* mediaElt = mediaElement())
+ mediaElt->togglePlayState();
+#endif
+}
+
+bool HitTestResult::mediaHasAudio() const
+{
+#if ENABLE(VIDEO)
+ if (HTMLMediaElement* mediaElt = mediaElement())
+ return mediaElt->hasAudio();
+#endif
+ return false;
+}
+
+bool HitTestResult::mediaIsVideo() const
+{
+#if ENABLE(VIDEO)
+ if (HTMLMediaElement* mediaElt = mediaElement())
+ return mediaElt->hasTagName(HTMLNames::videoTag);
+#endif
+ return false;
+}
+
+bool HitTestResult::mediaMuted() const
+{
+#if ENABLE(VIDEO)
+ if (HTMLMediaElement* mediaElt = mediaElement())
+ return mediaElt->muted();
+#endif
+ return false;
+}
+
+void HitTestResult::toggleMediaMuteState() const
+{
+#if ENABLE(VIDEO)
+ if (HTMLMediaElement* mediaElt = mediaElement())
+ mediaElt->setMuted(!mediaElt->muted());
#endif
}
@@ -421,4 +552,16 @@ void HitTestResult::append(const HitTestResult& other)
m_rectBasedTestResult.add(it->get());
}
+IntRect HitTestResult::rectFromPoint(const IntPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
+{
+ IntPoint actualPoint(point);
+ actualPoint -= IntSize(leftPadding, topPadding);
+
+ IntSize actualPadding(leftPadding + rightPadding, topPadding + bottomPadding);
+ // As IntRect is left inclusive and right exclusive (seeing IntRect::contains(x, y)), adding "1".
+ actualPadding += IntSize(1, 1);
+
+ return IntRect(actualPoint, actualPadding);
+}
+
} // namespace WebCore
diff --git a/WebCore/rendering/HitTestResult.h b/WebCore/rendering/HitTestResult.h
index 3a42719..1304e22 100644
--- a/WebCore/rendering/HitTestResult.h
+++ b/WebCore/rendering/HitTestResult.h
@@ -32,6 +32,9 @@ namespace WebCore {
class Element;
class Frame;
+#if ENABLE(VIDEO)
+class HTMLMediaElement;
+#endif
class Image;
class IntRect;
class KURL;
@@ -41,8 +44,8 @@ class Scrollbar;
class HitTestResult {
public:
HitTestResult(const IntPoint&);
- // Pass a non-negative IntSize value as padding to perform a rect-based hit test.
- HitTestResult(const IntPoint& centerPoint, const IntSize& padding);
+ // Pass non-negative padding values to perform a rect-based hit test.
+ HitTestResult(const IntPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
HitTestResult(const HitTestResult&);
~HitTestResult();
HitTestResult& operator=(const HitTestResult&);
@@ -80,14 +83,29 @@ public:
String textContent() const;
bool isLiveLink() const;
bool isContentEditable() const;
+ void toggleMediaControlsDisplay() const;
+ void toggleMediaLoopPlayback() const;
+ void enterFullscreenForVideo() const;
+ bool mediaControlsEnabled() const;
+ bool mediaLoopEnabled() const;
+ bool mediaPlaying() const;
+ bool mediaSupportsFullscreen() const;
+ void toggleMediaPlayState() const;
+ bool mediaHasAudio() const;
+ bool mediaIsVideo() const;
+ bool mediaMuted() const;
+ void toggleMediaMuteState() const;
// Rect-based hit test related methods.
bool isRectBasedTest() const { return m_isRectBased; }
IntRect rectFromPoint(int x, int y) const;
IntRect rectFromPoint(const IntPoint&) const;
- IntSize padding() const { return m_padding; }
- int paddingWidth() const { return m_padding.width(); }
- int paddingHeight() const { return m_padding.height(); }
+ static IntRect rectFromPoint(const IntPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
+ int topPadding() const { return m_topPadding; }
+ int rightPadding() const { return m_rightPadding; }
+ int bottomPadding() const { return m_bottomPadding; }
+ int leftPadding() const { return m_leftPadding; }
+
// Returns true if it is rect-based hit test and needs to continue until the rect is fully
// enclosed by the boundaries of a node.
bool addNodeToRectBasedTestResult(Node*, int x, int y, const IntRect& rect = IntRect());
@@ -96,6 +114,10 @@ public:
private:
+#if ENABLE(VIDEO)
+ HTMLMediaElement* mediaElement() const;
+#endif
+
RefPtr<Node> m_innerNode;
RefPtr<Node> m_innerNonSharedNode;
IntPoint m_point;
@@ -105,34 +127,26 @@ private:
RefPtr<Scrollbar> m_scrollbar;
bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example).
bool m_isRectBased;
- IntSize m_padding;
+ int m_topPadding;
+ int m_rightPadding;
+ int m_bottomPadding;
+ int m_leftPadding;
ListHashSet<RefPtr<Node> > m_rectBasedTestResult;
};
inline IntRect HitTestResult::rectFromPoint(int x, int y) const
{
- return rectFromPoint(IntPoint(x, y));
+ return rectFromPoint(IntPoint(x, y), m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding);
}
// Formula:
-// x = p.x() - padding.width()
-// y = p.y() - padding.height()
-// width = 2 * padding.width() + 1
-// height = 2 * m_padding.height() + 1
+// x = p.x() - rightPadding
+// y = p.y() - topPadding
+// width = leftPadding + rightPadding + 1
+// height = topPadding + bottomPadding + 1
inline IntRect HitTestResult::rectFromPoint(const IntPoint& point) const
{
- IntPoint realPoint(point);
- IntSize realPadding(m_padding);
-
- // Real IntPoint for the rect.
- realPadding.clampNegativeToZero();
- realPoint -= realPadding;
-
- // Real IntSize for the rect.
- realPadding.scale(2);
- realPadding += IntSize(1, 1);
-
- return IntRect(realPoint, realPadding);
+ return rectFromPoint(point, m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding);
}
String displayString(const String&, const Node*);
diff --git a/WebCore/rendering/InlineBox.cpp b/WebCore/rendering/InlineBox.cpp
index 5475187..91cbaff 100644
--- a/WebCore/rendering/InlineBox.cpp
+++ b/WebCore/rendering/InlineBox.cpp
@@ -85,11 +85,11 @@ void InlineBox::showTreeForThis() const
}
#endif
-int InlineBox::height() const
+int InlineBox::logicalHeight() const
{
#if ENABLE(SVG)
- if (hasVirtualHeight())
- return virtualHeight();
+ if (hasVirtualLogicalHeight())
+ return virtualLogicalHeight();
#endif
if (renderer()->isText())
@@ -268,7 +268,7 @@ bool InlineBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidt
if (!m_renderer || !m_renderer->isReplaced())
return true;
- IntRect boxRect(m_x, 0, m_width, 10);
+ IntRect boxRect(m_x, 0, m_logicalWidth, 10);
IntRect ellipsisRect(ltr ? blockEdge - ellipsisWidth : blockEdge, 0, ellipsisWidth, 10);
return !(boxRect.intersects(ellipsisRect));
}
diff --git a/WebCore/rendering/InlineBox.h b/WebCore/rendering/InlineBox.h
index ab0167c..1cd88ff 100644
--- a/WebCore/rendering/InlineBox.h
+++ b/WebCore/rendering/InlineBox.h
@@ -30,7 +30,6 @@ class HitTestRequest;
class HitTestResult;
class RootInlineBox;
-
// InlineBox represents a rectangle that occurs on a line. It corresponds to
// some RenderObject (i.e., it represents a portion of that RenderObject).
class InlineBox {
@@ -42,15 +41,16 @@ public:
, m_renderer(obj)
, m_x(0)
, m_y(0)
- , m_width(0)
+ , m_logicalWidth(0)
, m_firstLine(false)
, m_constructed(false)
, m_bidiEmbeddingLevel(0)
, m_dirty(false)
, m_extracted(false)
#if ENABLE(SVG)
- , m_hasVirtualHeight(false)
+ , m_hasVirtualLogicalHeight(false)
#endif
+ , m_isVertical(false)
, m_endsWithBreak(false)
, m_hasSelectedChildren(false)
, m_hasEllipsisBoxOrHyphen(false)
@@ -67,23 +67,24 @@ public:
{
}
- InlineBox(RenderObject* obj, int x, int y, int width, bool firstLine, bool constructed,
- bool dirty, bool extracted, InlineBox* next, InlineBox* prev, InlineFlowBox* parent)
+ InlineBox(RenderObject* obj, int x, int y, int logicalWidth, bool firstLine, bool constructed,
+ bool dirty, bool extracted, bool isVertical, InlineBox* next, InlineBox* prev, InlineFlowBox* parent)
: m_next(next)
, m_prev(prev)
, m_parent(parent)
, m_renderer(obj)
, m_x(x)
, m_y(y)
- , m_width(width)
+ , m_logicalWidth(logicalWidth)
, m_firstLine(firstLine)
, m_constructed(constructed)
, m_bidiEmbeddingLevel(0)
, m_dirty(dirty)
, m_extracted(extracted)
#if ENABLE(SVG)
- , m_hasVirtualHeight(false)
+ , m_hasVirtualLogicalHeight(false)
#endif
+ , m_isVertical(isVertical)
, m_endsWithBreak(false)
, m_hasSelectedChildren(false)
, m_hasEllipsisBoxOrHyphen(false)
@@ -139,15 +140,18 @@ public:
#if ENABLE(SVG)
virtual bool isSVGInlineTextBox() const { return false; }
virtual bool isSVGRootInlineBox() const { return false; }
+#endif
- bool hasVirtualHeight() const { return m_hasVirtualHeight; }
- void setHasVirtualHeight() { m_hasVirtualHeight = true; }
- virtual int virtualHeight() const
+ bool hasVirtualLogicalHeight() const { return m_hasVirtualLogicalHeight; }
+ void setHasVirtualLogicalHeight() { m_hasVirtualLogicalHeight = true; }
+ virtual int virtualLogicalHeight() const
{
ASSERT_NOT_REACHED();
return 0;
}
-#endif
+
+ bool isVertical() const { return m_isVertical; }
+ void setIsVertical(bool v) { m_isVertical = v; }
virtual IntRect calculateBoundaries() const
{
@@ -202,18 +206,40 @@ public:
const RootInlineBox* root() const;
RootInlineBox* root();
- void setWidth(int w) { m_width = w; }
- int width() const { return m_width; }
-
- // x() is the left side of the box in the parent's coordinate system.
+ // x() is the left side of the box in the containing block's coordinate system.
void setX(int x) { m_x = x; }
int x() const { return m_x; }
- // y() is the top of the box in the parent's coordinate system.
+ // y() is the top side of the box in the containing block's coordinate system.
void setY(int y) { m_y = y; }
int y() const { return m_y; }
- int height() const;
+ // The logicalLeft position is the left edge of the line box in a horizontal line and the top edge in a vertical line.
+ int logicalLeft() const { return !m_isVertical ? m_x : m_y; }
+ void setLogicalLeft(int left)
+ {
+ if (!m_isVertical)
+ m_x = left;
+ else
+ m_y = left;
+ }
+
+ // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line.
+ int logicalTop() const { return !m_isVertical ? m_y : m_x; }
+ void setLogicalTop(int top)
+ {
+ if (!m_isVertical)
+ m_y = top;
+ else
+ m_x = top;
+ }
+
+ // The logical width is our extent in the line's overall inline direction, i.e., width for horizontal text and height for vertical text.
+ void setLogicalWidth(int w) { m_logicalWidth = w; }
+ int logicalWidth() const { return m_logicalWidth; }
+
+ // The logical height is our extent in the block flow direction, i.e., height for horizontal text and width for vertical text.
+ int logicalHeight() const;
inline int baselinePosition(bool isRootLineBox) const { return renderer()->baselinePosition(m_firstLine, isRootLineBox); }
inline int lineHeight(bool isRootLineBox) const { return renderer()->lineHeight(m_firstLine, isRootLineBox); }
@@ -266,7 +292,7 @@ public:
int m_x;
int m_y;
- int m_width;
+ int m_logicalWidth;
// Some of these bits are actually for subclasses and moved here to compact the structures.
@@ -279,7 +305,9 @@ private:
protected:
bool m_dirty : 1;
bool m_extracted : 1;
- bool m_hasVirtualHeight : 1;
+ bool m_hasVirtualLogicalHeight : 1;
+
+ bool m_isVertical : 1;
// for RootInlineBox
bool m_endsWithBreak : 1; // Whether the line ends with a <br>.
@@ -295,7 +323,7 @@ protected:
mutable bool m_determinedIfPrevOnLineExists : 1;
mutable bool m_nextOnLineExists : 1;
mutable bool m_prevOnLineExists : 1;
- int m_toAdd : 12; // for justified text
+ int m_toAdd : 11; // for justified text
#ifndef NDEBUG
private:
diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp
index a71b796..588d054 100644
--- a/WebCore/rendering/InlineFlowBox.cpp
+++ b/WebCore/rendering/InlineFlowBox.cpp
@@ -53,12 +53,12 @@ InlineFlowBox::~InlineFlowBox()
#endif
-int InlineFlowBox::getFlowSpacingWidth()
+int InlineFlowBox::getFlowSpacingLogicalWidth()
{
- int totWidth = marginBorderPaddingLeft() + marginBorderPaddingRight();
+ int totWidth = marginBorderPaddingLogicalLeft() + marginBorderPaddingLogicalRight();
for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
if (curr->isInlineFlowBox())
- totWidth += static_cast<InlineFlowBox*>(curr)->getFlowSpacingWidth();
+ totWidth += static_cast<InlineFlowBox*>(curr)->getFlowSpacingLogicalWidth();
}
return totWidth;
}
@@ -80,6 +80,7 @@ void InlineFlowBox::addToLine(InlineBox* child)
m_lastChild = child;
}
child->setFirstLineStyleBit(m_firstLine);
+ child->setIsVertical(m_isVertical);
if (child->isText())
m_hasTextChildren = true;
if (child->renderer()->selectionState() != RenderObject::SelectionNone)
@@ -252,7 +253,7 @@ void InlineFlowBox::determineSpacingForFlowBoxes(bool lastLine, RenderObject* en
}
}
-int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
+int InlineFlowBox::placeBoxesInInlineDirection(int xPos, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
{
// Set our x position.
setX(xPos);
@@ -269,7 +270,7 @@ int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, Glyp
leftVisualOverflow = min(xPos + boxShadowLeft, leftVisualOverflow);
int startX = xPos;
- xPos += borderLeft() + paddingLeft();
+ xPos += borderLogicalLeft() + paddingLogicalLeft();
for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
if (curr->renderer()->isText()) {
@@ -287,7 +288,7 @@ int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, Glyp
// If letter-spacing is negative, we should factor that into right layout overflow. (Even in RTL, letter-spacing is
// applied to the right, so this is not an issue with left overflow.
int letterSpacing = min(0, (int)rt->style(m_firstLine)->font().letterSpacing());
- rightLayoutOverflow = max(xPos + text->width() - letterSpacing, rightLayoutOverflow);
+ rightLayoutOverflow = max(xPos + text->logicalWidth() - letterSpacing, rightLayoutOverflow);
GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(static_cast<InlineTextBox*>(curr));
GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->second.second;
@@ -303,9 +304,9 @@ int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, Glyp
}
leftVisualOverflow = min(xPos + childOverflowLeft, leftVisualOverflow);
- rightVisualOverflow = max(xPos + text->width() + childOverflowRight, rightVisualOverflow);
+ rightVisualOverflow = max(xPos + text->logicalWidth() + childOverflowRight, rightVisualOverflow);
- xPos += text->width();
+ xPos += text->logicalWidth();
} else {
if (curr->renderer()->isPositioned()) {
if (curr->renderer()->parent()->style()->direction() == LTR)
@@ -319,9 +320,9 @@ int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, Glyp
}
if (curr->renderer()->isRenderInline()) {
InlineFlowBox* flow = static_cast<InlineFlowBox*>(curr);
- xPos += flow->marginLeft();
- xPos = flow->placeBoxesHorizontally(xPos, needsWordSpacing, textBoxDataMap);
- xPos += flow->marginRight();
+ xPos += flow->marginLogicalLeft();
+ xPos = flow->placeBoxesInInlineDirection(xPos, needsWordSpacing, textBoxDataMap);
+ xPos += flow->marginLogicalRight();
leftLayoutOverflow = min(leftLayoutOverflow, flow->leftLayoutOverflow());
rightLayoutOverflow = max(rightLayoutOverflow, flow->rightLayoutOverflow());
leftVisualOverflow = min(leftVisualOverflow, flow->leftVisualOverflow());
@@ -332,7 +333,7 @@ int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, Glyp
RenderBox* box = toRenderBox(curr->renderer());
int childLeftOverflow = box->hasOverflowClip() ? 0 : box->leftLayoutOverflow();
- int childRightOverflow = box->hasOverflowClip() ? curr->width() : box->rightLayoutOverflow();
+ int childRightOverflow = box->hasOverflowClip() ? curr->logicalWidth() : box->rightLayoutOverflow();
leftLayoutOverflow = min(xPos + childLeftOverflow, leftLayoutOverflow);
rightLayoutOverflow = max(xPos + childRightOverflow, rightLayoutOverflow);
@@ -340,17 +341,17 @@ int InlineFlowBox::placeBoxesHorizontally(int xPos, bool& needsWordSpacing, Glyp
leftVisualOverflow = min(xPos + box->leftVisualOverflow(), leftVisualOverflow);
rightVisualOverflow = max(xPos + box->rightVisualOverflow(), rightVisualOverflow);
- xPos += curr->width() + curr->boxModelObject()->marginRight();
+ xPos += curr->logicalWidth() + curr->boxModelObject()->marginRight();
}
}
}
- xPos += borderRight() + paddingRight();
- setWidth(xPos - startX);
- rightVisualOverflow = max(x() + width() + boxShadowRight, rightVisualOverflow);
- rightLayoutOverflow = max(x() + width(), rightLayoutOverflow);
+ xPos += borderLogicalRight() + paddingLogicalRight();
+ setLogicalWidth(xPos - startX);
+ rightVisualOverflow = max(x() + logicalWidth() + boxShadowRight, rightVisualOverflow);
+ rightLayoutOverflow = max(x() + logicalWidth(), rightLayoutOverflow);
- setHorizontalOverflowPositions(leftLayoutOverflow, rightLayoutOverflow, leftVisualOverflow, rightVisualOverflow);
+ setInlineDirectionOverflowPositions(leftLayoutOverflow, rightLayoutOverflow, leftVisualOverflow, rightVisualOverflow);
return xPos;
}
@@ -475,7 +476,7 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
}
}
-void InlineFlowBox::placeBoxesVertically(int yPos, int maxHeight, int maxAscent, bool strictMode, int& selectionTop, int& selectionBottom)
+void InlineFlowBox::placeBoxesInBlockDirection(int yPos, int maxHeight, int maxAscent, bool strictMode, int& selectionTop, int& selectionBottom)
{
if (isRootInlineBox())
setY(yPos + maxAscent - baselinePosition(true)); // Place our root box.
@@ -488,7 +489,7 @@ void InlineFlowBox::placeBoxesVertically(int yPos, int maxHeight, int maxAscent,
// line-height).
bool isInlineFlow = curr->isInlineFlowBox();
if (isInlineFlow)
- static_cast<InlineFlowBox*>(curr)->placeBoxesVertically(yPos, maxHeight, maxAscent, strictMode, selectionTop, selectionBottom);
+ static_cast<InlineFlowBox*>(curr)->placeBoxesInBlockDirection(yPos, maxHeight, maxAscent, strictMode, selectionTop, selectionBottom);
bool childAffectsTopBottomPos = true;
if (curr->y() == PositionTop)
@@ -516,7 +517,7 @@ void InlineFlowBox::placeBoxesVertically(int yPos, int maxHeight, int maxAscent,
curr->setY(newY);
if (childAffectsTopBottomPos) {
- int boxHeight = curr->height();
+ int boxHeight = curr->logicalHeight();
selectionTop = min(selectionTop, newY);
selectionBottom = max(selectionBottom, newY + boxHeight);
}
@@ -527,14 +528,14 @@ void InlineFlowBox::placeBoxesVertically(int yPos, int maxHeight, int maxAscent,
setY(y() + baselinePosition(true) - font.ascent());
if (hasTextChildren() || strictMode) {
selectionTop = min(selectionTop, y());
- selectionBottom = max(selectionBottom, y() + height());
+ selectionBottom = max(selectionBottom, y() + logicalHeight());
}
}
}
-void InlineFlowBox::computeVerticalOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
+void InlineFlowBox::computeBlockDirectionOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
{
- int boxHeight = height();
+ int boxHeight = logicalHeight();
// Any spillage outside of the line top and bottom is not considered overflow. We just ignore this, since it only happens
// from the "your ascent/descent don't affect the line" quirk.
@@ -583,10 +584,10 @@ void InlineFlowBox::computeVerticalOverflow(int lineTop, int lineBottom, bool st
}
topVisualOverflow = min(curr->y() + childOverflowTop, topVisualOverflow);
- bottomVisualOverflow = max(curr->y() + text->height() + childOverflowBottom, bottomVisualOverflow);
+ bottomVisualOverflow = max(curr->y() + text->logicalHeight() + childOverflowBottom, bottomVisualOverflow);
} else if (curr->renderer()->isRenderInline()) {
InlineFlowBox* flow = static_cast<InlineFlowBox*>(curr);
- flow->computeVerticalOverflow(lineTop, lineBottom, strictMode, textBoxDataMap);
+ flow->computeBlockDirectionOverflow(lineTop, lineBottom, strictMode, textBoxDataMap);
topLayoutOverflow = min(topLayoutOverflow, flow->topLayoutOverflow());
bottomLayoutOverflow = max(bottomLayoutOverflow, flow->bottomLayoutOverflow());
topVisualOverflow = min(topVisualOverflow, flow->topVisualOverflow());
@@ -596,7 +597,7 @@ void InlineFlowBox::computeVerticalOverflow(int lineTop, int lineBottom, bool st
RenderBox* box = toRenderBox(curr->renderer());
int boxY = curr->y();
int childTopOverflow = box->hasOverflowClip() ? 0 : box->topLayoutOverflow();
- int childBottomOverflow = box->hasOverflowClip() ? curr->height() : box->bottomLayoutOverflow();
+ int childBottomOverflow = box->hasOverflowClip() ? curr->logicalHeight() : box->bottomLayoutOverflow();
topLayoutOverflow = min(boxY + childTopOverflow, topLayoutOverflow);
bottomLayoutOverflow = max(boxY + childBottomOverflow, bottomLayoutOverflow);
topVisualOverflow = min(boxY + box->topVisualOverflow(), topVisualOverflow);
@@ -604,7 +605,7 @@ void InlineFlowBox::computeVerticalOverflow(int lineTop, int lineBottom, bool st
}
}
- setVerticalOverflowPositions(topLayoutOverflow, bottomLayoutOverflow, topVisualOverflow, bottomVisualOverflow, boxHeight);
+ setBlockDirectionOverflowPositions(topLayoutOverflow, bottomLayoutOverflow, topVisualOverflow, bottomVisualOverflow, boxHeight);
}
bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty)
@@ -623,7 +624,7 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
}
// Now check ourselves.
- IntRect rect(tx + m_x, ty + m_y, m_width, height());
+ IntRect rect(tx + m_x, ty + m_y, m_logicalWidth, logicalHeight());
if (visibleToHitTesting() && rect.intersects(result.rectFromPoint(x, y))) {
renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); // Don't add in m_x or m_y here, we want coords in the containing block's space.
if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, rect))
@@ -727,13 +728,13 @@ void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, c
// but it isn't even clear how this should work at all.
int xOffsetOnLine = 0;
for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox())
- xOffsetOnLine += curr->width();
+ xOffsetOnLine += curr->logicalWidth();
int startX = tx - xOffsetOnLine;
int totalWidth = xOffsetOnLine;
for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
- totalWidth += curr->width();
+ totalWidth += curr->logicalWidth();
paintInfo.context->save();
- paintInfo.context->clip(IntRect(tx, ty, width(), height()));
+ paintInfo.context->clip(IntRect(tx, ty, logicalWidth(), logicalHeight()));
boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, startX, ty, totalWidth, h, this, op);
paintInfo.context->restore();
}
@@ -746,7 +747,7 @@ void InlineFlowBox::paintBoxShadow(GraphicsContext* context, RenderStyle* s, Sha
else {
// FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't
// protrude incorrectly at the edges, and we want to possibly include shadows cast from the previous/following lines
- boxModelObject()->paintBoxShadow(context, tx, ty, w, h, s, shadowStyle, includeLeftEdge(), includeRightEdge());
+ boxModelObject()->paintBoxShadow(context, tx, ty, w, h, s, shadowStyle, includeLogicalLeftEdge(), includeLogicalRightEdge());
}
}
@@ -757,8 +758,8 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
int x = m_x;
int y = m_y;
- int w = width();
- int h = height();
+ int w = logicalWidth();
+ int h = logicalHeight();
// Constrain our background/border painting to the line top and bottom if necessary.
bool noQuirksMode = renderer()->document()->inNoQuirksMode();
@@ -800,7 +801,7 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
// The simple case is where we either have no border image or we are the only box for this object. In those
// cases only a single call to draw is required.
if (!hasBorderImage || (!prevLineBox() && !nextLineBox()))
- boxModelObject()->paintBorder(context, tx, ty, w, h, renderer()->style(), includeLeftEdge(), includeRightEdge());
+ boxModelObject()->paintBorder(context, tx, ty, w, h, renderer()->style(), includeLogicalLeftEdge(), includeLogicalRightEdge());
else {
// We have a border image that spans multiple lines.
// We need to adjust _tx and _ty by the width of all previous lines.
@@ -812,11 +813,11 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
// but it isn't even clear how this should work at all.
int xOffsetOnLine = 0;
for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox())
- xOffsetOnLine += curr->width();
+ xOffsetOnLine += curr->logicalWidth();
int startX = tx - xOffsetOnLine;
int totalWidth = xOffsetOnLine;
for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
- totalWidth += curr->width();
+ totalWidth += curr->logicalWidth();
context->save();
context->clip(IntRect(tx, ty, w, h));
boxModelObject()->paintBorder(context, startX, ty, totalWidth, h, renderer()->style());
@@ -833,8 +834,8 @@ void InlineFlowBox::paintMask(PaintInfo& paintInfo, int tx, int ty)
int x = m_x;
int y = m_y;
- int w = width();
- int h = height();
+ int w = logicalWidth();
+ int h = logicalHeight();
// Constrain our background/border painting to the line top and bottom if necessary.
bool noQuirksMode = renderer()->document()->inNoQuirksMode();
@@ -883,11 +884,11 @@ void InlineFlowBox::paintMask(PaintInfo& paintInfo, int tx, int ty)
// We need to adjust _tx and _ty by the width of all previous lines.
int xOffsetOnLine = 0;
for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox())
- xOffsetOnLine += curr->width();
+ xOffsetOnLine += curr->logicalWidth();
int startX = tx - xOffsetOnLine;
int totalWidth = xOffsetOnLine;
for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
- totalWidth += curr->width();
+ totalWidth += curr->logicalWidth();
paintInfo.context->save();
paintInfo.context->clip(IntRect(tx, ty, w, h));
boxModelObject()->paintNinePieceImage(paintInfo.context, startX, ty, totalWidth, h, renderer()->style(), maskNinePieceImage, compositeOp);
@@ -938,12 +939,12 @@ void InlineFlowBox::paintTextDecorations(PaintInfo& paintInfo, int tx, int ty, b
if (deco != TDNONE &&
((!paintedChildren && ((deco & UNDERLINE) || (deco & OVERLINE))) || (paintedChildren && (deco & LINE_THROUGH))) &&
shouldDrawTextDecoration(renderer())) {
- int x = m_x + borderLeft() + paddingLeft();
- int w = m_width - (borderLeft() + paddingLeft() + borderRight() + paddingRight());
+ int x = m_x + borderLogicalLeft() + paddingLogicalLeft();
+ int w = m_logicalWidth - (borderLogicalLeft() + paddingLogicalLeft() + borderLogicalRight() + paddingLogicalRight());
RootInlineBox* rootLine = root();
if (rootLine->ellipsisBox()) {
int ellipsisX = m_x + rootLine->ellipsisBox()->x();
- int ellipsisWidth = rootLine->ellipsisBox()->width();
+ int ellipsisWidth = rootLine->ellipsisBox()->logicalWidth();
bool ltr = renderer()->style()->direction() == LTR;
if (rootLine == this) {
// Trim w and x so that the underline isn't drawn underneath the ellipsis.
@@ -977,7 +978,7 @@ void InlineFlowBox::paintTextDecorations(PaintInfo& paintInfo, int tx, int ty, b
}
// We must have child boxes and have decorations defined.
- tx += borderLeft() + paddingLeft();
+ tx += borderLogicalLeft() + paddingLogicalLeft();
Color underline, overline, linethrough;
underline = overline = linethrough = styleToUse->visitedDependentColor(CSSPropertyColor);
@@ -995,7 +996,7 @@ void InlineFlowBox::paintTextDecorations(PaintInfo& paintInfo, int tx, int ty, b
int baselinePos = renderer()->style(m_firstLine)->font().ascent();
if (!isRootInlineBox())
- baselinePos += borderTop() + paddingTop();
+ baselinePos += boxModelObject()->borderTop() + boxModelObject()->paddingTop();
bool setClip = false;
int extraOffset = 0;
@@ -1104,11 +1105,11 @@ int InlineFlowBox::placeEllipsisBox(bool ltr, int blockLeftEdge, int blockRightE
result = currResult;
if (ltr) {
- visibleLeftEdge += box->width();
+ visibleLeftEdge += box->logicalWidth();
box = box->nextOnLine();
}
else {
- visibleRightEdge -= box->width();
+ visibleRightEdge -= box->logicalWidth();
box = box->prevOnLine();
}
}
diff --git a/WebCore/rendering/InlineFlowBox.h b/WebCore/rendering/InlineFlowBox.h
index b4ba59f..2d57cca 100644
--- a/WebCore/rendering/InlineFlowBox.h
+++ b/WebCore/rendering/InlineFlowBox.h
@@ -41,8 +41,8 @@ public:
, m_lastChild(0)
, m_prevLineBox(0)
, m_nextLineBox(0)
- , m_includeLeftEdge(false)
- , m_includeRightEdge(false)
+ , m_includeLogicalLeftEdge(false)
+ , m_includeLogicalRightEdge(false)
#ifndef NDEBUG
, m_hasBadChildList(false)
#endif
@@ -102,38 +102,65 @@ public:
virtual RenderLineBoxList* rendererLineBoxes() const;
- int marginBorderPaddingLeft() const { return marginLeft() + borderLeft() + paddingLeft(); }
- int marginBorderPaddingRight() const { return marginRight() + borderRight() + paddingRight(); }
- int marginLeft() const { if (includeLeftEdge()) return boxModelObject()->marginLeft(); return 0; }
- int marginRight() const { if (includeRightEdge()) return boxModelObject()->marginRight(); return 0; }
- int borderLeft() const { if (includeLeftEdge()) return renderer()->style()->borderLeftWidth(); return 0; }
- int borderRight() const { if (includeRightEdge()) return renderer()->style()->borderRightWidth(); return 0; }
- int borderTop() const { return renderer()->style()->borderTopWidth(); }
- int borderBottom() const { return renderer()->style()->borderBottomWidth(); }
- int paddingLeft() const { if (includeLeftEdge()) return boxModelObject()->paddingLeft(); return 0; }
- int paddingRight() const { if (includeRightEdge()) return boxModelObject()->paddingRight(); return 0; }
- int paddingTop() const { return boxModelObject()->paddingTop(); }
- int paddingBottom() const { return boxModelObject()->paddingBottom(); }
-
- bool includeLeftEdge() const { return m_includeLeftEdge; }
- bool includeRightEdge() const { return m_includeRightEdge; }
+ // logicalLeft = left in a horizontal line and top in a vertical line.
+ int marginBorderPaddingLogicalLeft() const { return marginLogicalLeft() + borderLogicalLeft() + paddingLogicalLeft(); }
+ int marginBorderPaddingLogicalRight() const { return marginLogicalRight() + borderLogicalRight() + paddingLogicalRight(); }
+ int marginLogicalLeft() const
+ {
+ if (!includeLogicalLeftEdge())
+ return 0;
+ return !isVertical() ? boxModelObject()->marginLeft() : boxModelObject()->marginTop();
+ }
+ int marginLogicalRight() const
+ {
+ if (!includeLogicalRightEdge())
+ return 0;
+ return !isVertical() ? boxModelObject()->marginRight() : boxModelObject()->marginBottom();
+ }
+ int borderLogicalLeft() const
+ {
+ if (!includeLogicalLeftEdge())
+ return 0;
+ return !isVertical() ? renderer()->style()->borderLeftWidth() : renderer()->style()->borderTopWidth();
+ }
+ int borderLogicalRight() const
+ {
+ if (!includeLogicalRightEdge())
+ return 0;
+ return !isVertical() ? renderer()->style()->borderRightWidth() : renderer()->style()->borderBottomWidth();
+ }
+ int paddingLogicalLeft() const
+ {
+ if (!includeLogicalLeftEdge())
+ return 0;
+ return !isVertical() ? boxModelObject()->paddingLeft() : boxModelObject()->paddingTop();
+ }
+ int paddingLogicalRight() const
+ {
+ if (!includeLogicalRightEdge())
+ return 0;
+ return !isVertical() ? boxModelObject()->paddingRight() : boxModelObject()->paddingBottom();
+ }
+
+ bool includeLogicalLeftEdge() const { return m_includeLogicalLeftEdge; }
+ bool includeLogicalRightEdge() const { return m_includeLogicalRightEdge; }
void setEdges(bool includeLeft, bool includeRight)
{
- m_includeLeftEdge = includeLeft;
- m_includeRightEdge = includeRight;
+ m_includeLogicalLeftEdge = includeLeft;
+ m_includeLogicalRightEdge = includeRight;
}
// Helper functions used during line construction and placement.
void determineSpacingForFlowBoxes(bool lastLine, RenderObject* endObject);
- int getFlowSpacingWidth();
+ int getFlowSpacingLogicalWidth();
bool onEndChain(RenderObject* endObject);
- int placeBoxesHorizontally(int x, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&);
+ int placeBoxesInInlineDirection(int x, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&);
void computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom,
int& maxAscent, int& maxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap&);
void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent,
int maxPositionTop, int maxPositionBottom);
- void placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom);
- void computeVerticalOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap&);
+ void placeBoxesInBlockDirection(int y, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom);
+ void computeBlockDirectionOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap&);
void removeChild(InlineBox* child);
@@ -151,22 +178,22 @@ public:
int bottomVisibleOverflow() const { return std::max(bottomLayoutOverflow(), bottomVisualOverflow()); }
int leftVisibleOverflow() const { return std::min(leftLayoutOverflow(), leftVisualOverflow()); }
int rightVisibleOverflow() const { return std::max(rightLayoutOverflow(), rightVisualOverflow()); }
- IntRect visibleOverflowRect() const { return m_overflow ? m_overflow->visibleOverflowRect() : IntRect(m_x, m_y, m_width, height()); }
+ IntRect visibleOverflowRect() const { return m_overflow ? m_overflow->visibleOverflowRect() : IntRect(m_x, m_y, m_logicalWidth, logicalHeight()); }
int topLayoutOverflow() const { return m_overflow ? m_overflow->topLayoutOverflow() : m_y; }
- int bottomLayoutOverflow() const { return m_overflow ? m_overflow->bottomLayoutOverflow() : m_y + height(); }
+ int bottomLayoutOverflow() const { return m_overflow ? m_overflow->bottomLayoutOverflow() : m_y + logicalHeight(); }
int leftLayoutOverflow() const { return m_overflow ? m_overflow->leftLayoutOverflow() : m_x; }
- int rightLayoutOverflow() const { return m_overflow ? m_overflow->rightLayoutOverflow() : m_x + m_width; }
- IntRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : IntRect(m_x, m_y, m_width, height()); }
+ int rightLayoutOverflow() const { return m_overflow ? m_overflow->rightLayoutOverflow() : m_x + m_logicalWidth; }
+ IntRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : IntRect(m_x, m_y, m_logicalWidth, logicalHeight()); }
int topVisualOverflow() const { return m_overflow ? m_overflow->topVisualOverflow() : m_y; }
- int bottomVisualOverflow() const { return m_overflow ? m_overflow->bottomVisualOverflow() : m_y + height(); }
+ int bottomVisualOverflow() const { return m_overflow ? m_overflow->bottomVisualOverflow() : m_y + logicalHeight(); }
int leftVisualOverflow() const { return m_overflow ? m_overflow->leftVisualOverflow() : m_x; }
- int rightVisualOverflow() const { return m_overflow ? m_overflow->rightVisualOverflow() : m_x + m_width; }
- IntRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : IntRect(m_x, m_y, m_width, height()); }
+ int rightVisualOverflow() const { return m_overflow ? m_overflow->rightVisualOverflow() : m_x + m_logicalWidth; }
+ IntRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : IntRect(m_x, m_y, m_logicalWidth, logicalHeight()); }
- void setHorizontalOverflowPositions(int leftLayoutOverflow, int rightLayoutOverflow, int leftVisualOverflow, int rightVisualOverflow);
- void setVerticalOverflowPositions(int topLayoutOverflow, int bottomLayoutOverflow, int topVisualOverflow, int bottomVisualOverflow, int boxHeight);
+ void setInlineDirectionOverflowPositions(int leftLayoutOverflow, int rightLayoutOverflow, int leftVisualOverflow, int rightVisualOverflow);
+ void setBlockDirectionOverflowPositions(int topLayoutOverflow, int bottomLayoutOverflow, int topVisualOverflow, int bottomVisualOverflow, int boxHeight);
protected:
OwnPtr<RenderOverflow> m_overflow;
@@ -179,8 +206,8 @@ protected:
InlineFlowBox* m_prevLineBox; // The previous box that also uses our RenderObject
InlineFlowBox* m_nextLineBox; // The next box that also uses our RenderObject
- bool m_includeLeftEdge : 1;
- bool m_includeRightEdge : 1;
+ bool m_includeLogicalLeftEdge : 1;
+ bool m_includeLogicalRightEdge : 1;
bool m_hasTextChildren : 1;
#ifndef NDEBUG
@@ -188,12 +215,12 @@ protected:
#endif
};
-inline void InlineFlowBox::setHorizontalOverflowPositions(int leftLayoutOverflow, int rightLayoutOverflow, int leftVisualOverflow, int rightVisualOverflow)
+inline void InlineFlowBox::setInlineDirectionOverflowPositions(int leftLayoutOverflow, int rightLayoutOverflow, int leftVisualOverflow, int rightVisualOverflow)
{
if (!m_overflow) {
- if (leftLayoutOverflow == m_x && rightLayoutOverflow == m_x + m_width && leftVisualOverflow == m_x && rightVisualOverflow == m_x + m_width)
+ if (leftLayoutOverflow == m_x && rightLayoutOverflow == m_x + m_logicalWidth && leftVisualOverflow == m_x && rightVisualOverflow == m_x + m_logicalWidth)
return;
- m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, m_width, m_renderer->style(m_firstLine)->font().height())));
+ m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, m_logicalWidth, m_renderer->style(m_firstLine)->font().height())));
}
m_overflow->setLeftLayoutOverflow(leftLayoutOverflow);
@@ -202,12 +229,12 @@ inline void InlineFlowBox::setHorizontalOverflowPositions(int leftLayoutOverflow
m_overflow->setRightVisualOverflow(rightVisualOverflow);
}
-inline void InlineFlowBox::setVerticalOverflowPositions(int topLayoutOverflow, int bottomLayoutOverflow, int topVisualOverflow, int bottomVisualOverflow, int boxHeight)
+inline void InlineFlowBox::setBlockDirectionOverflowPositions(int topLayoutOverflow, int bottomLayoutOverflow, int topVisualOverflow, int bottomVisualOverflow, int boxHeight)
{
if (!m_overflow) {
if (topLayoutOverflow == m_y && bottomLayoutOverflow == m_y + boxHeight && topVisualOverflow == m_y && bottomVisualOverflow == m_y + boxHeight)
return;
- m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, m_width, boxHeight)));
+ m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, m_logicalWidth, boxHeight)));
}
m_overflow->setTopLayoutOverflow(topLayoutOverflow);
diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp
index eb5947c..68bff3c 100644
--- a/WebCore/rendering/InlineTextBox.cpp
+++ b/WebCore/rendering/InlineTextBox.cpp
@@ -139,10 +139,10 @@ IntRect InlineTextBox::selectionRect(int tx, int ty, int startPos, int endPos)
IntRect r = enclosingIntRect(f.selectionRectForText(TextRun(characters, len, textObj->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride),
IntPoint(tx + m_x, ty + selTop), selHeight, sPos, ePos));
- if (r.x() > tx + m_x + m_width)
+ if (r.x() > tx + m_x + m_logicalWidth)
r.setWidth(0);
- else if (r.right() - 1 > tx + m_x + m_width)
- r.setWidth(tx + m_x + m_width - r.x());
+ else if (r.right() - 1 > tx + m_x + m_logicalWidth)
+ r.setWidth(tx + m_x + m_logicalWidth - r.x());
return r;
}
@@ -182,7 +182,7 @@ int InlineTextBox::placeEllipsisBox(bool flowIsLTR, int visibleLeftEdge, int vis
// LTR: the left edge of the ellipsis is to the left of our text run.
// RTL: the right edge of the ellipsis is to the right of our text run.
bool ltrFullTruncation = flowIsLTR && ellipsisX <= m_x;
- bool rtlFullTruncation = !flowIsLTR && ellipsisX >= (m_x + m_width);
+ bool rtlFullTruncation = !flowIsLTR && ellipsisX >= (m_x + m_logicalWidth);
if (ltrFullTruncation || rtlFullTruncation) {
// Too far. Just set full truncation, but return -1 and let the ellipsis just be placed at the edge of the box.
m_truncation = cFullTruncation;
@@ -190,7 +190,7 @@ int InlineTextBox::placeEllipsisBox(bool flowIsLTR, int visibleLeftEdge, int vis
return -1;
}
- bool ltrEllipsisWithinBox = flowIsLTR && (ellipsisX < m_x + m_width);
+ bool ltrEllipsisWithinBox = flowIsLTR && (ellipsisX < m_x + m_logicalWidth);
bool rtlEllipsisWithinBox = !flowIsLTR && (ellipsisX > m_x);
if (ltrEllipsisWithinBox || rtlEllipsisWithinBox) {
foundBox = true;
@@ -202,7 +202,7 @@ int InlineTextBox::placeEllipsisBox(bool flowIsLTR, int visibleLeftEdge, int vis
if (ltr != flowIsLTR) {
// Width in pixels of the visible portion of the box, excluding the ellipsis.
int visibleBoxWidth = visibleRightEdge - visibleLeftEdge - ellipsisWidth;
- ellipsisX = ltr ? m_x + visibleBoxWidth : m_x + m_width - visibleBoxWidth;
+ ellipsisX = ltr ? m_x + visibleBoxWidth : m_x + m_logicalWidth - visibleBoxWidth;
}
int offset = offsetForPosition(ellipsisX, false);
@@ -228,7 +228,7 @@ int InlineTextBox::placeEllipsisBox(bool flowIsLTR, int visibleLeftEdge, int vis
if (flowIsLTR)
return m_x + widthOfVisibleText;
else
- return (m_x + m_width) - widthOfVisibleText - ellipsisWidth;
+ return (m_x + m_logicalWidth) - widthOfVisibleText - ellipsisWidth;
}
return -1;
}
@@ -286,7 +286,7 @@ bool InlineTextBox::nodeAtPoint(const HitTestRequest&, HitTestResult& result, in
if (isLineBreak())
return false;
- IntRect rect(tx + m_x, ty + m_y, m_width, height());
+ IntRect rect(tx + m_x, ty + m_y, m_logicalWidth, logicalHeight());
if (m_truncation != cFullTruncation && visibleToHitTesting() && rect.intersects(result.rectFromPoint(x, y))) {
renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty));
if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, rect))
@@ -367,9 +367,9 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
// FIXME: Technically we're potentially incorporating other visual overflow that had nothing to do with us.
// Would it be simpler to just check our own shadow and stroke overflow by hand here?
int leftOverflow = parent()->x() - parent()->leftVisualOverflow();
- int rightOverflow = parent()->rightVisualOverflow() - (parent()->x() + parent()->width());
+ int rightOverflow = parent()->rightVisualOverflow() - (parent()->x() + parent()->logicalWidth());
int xPos = tx + m_x - leftOverflow;
- int w = width() + leftOverflow + rightOverflow;
+ int w = logicalWidth() + leftOverflow + rightOverflow;
if (xPos >= paintInfo.rect.right() || xPos + w <= paintInfo.rect.x())
return;
@@ -393,7 +393,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
// NOTE: WebKit's behavior differs from that of IE which appears to just overlay the ellipsis on top of the
// truncated string i.e. |Hello|CBA| -> |...lo|CBA|
int widthOfVisibleText = toRenderText(renderer())->width(m_start, m_truncation, textPos(), m_firstLine);
- int widthOfHiddenText = m_width - widthOfVisibleText;
+ int widthOfHiddenText = m_logicalWidth - widthOfVisibleText;
// FIXME: The hit testing logic also needs to take this translation int account.
tx += direction() == LTR ? widthOfHiddenText : -widthOfHiddenText;
}
@@ -526,9 +526,9 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
updateGraphicsContext(context, textFillColor, textStrokeColor, textStrokeWidth, styleToUse->colorSpace());
if (!paintSelectedTextSeparately || ePos <= sPos) {
// FIXME: Truncate right-to-left text correctly.
- paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin, m_x + tx, m_y + ty, width(), height(), textShadow, textStrokeWidth > 0);
+ paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin, m_x + tx, m_y + ty, logicalWidth(), logicalHeight(), textShadow, textStrokeWidth > 0);
} else
- paintTextWithShadows(context, font, textRun, ePos, sPos, length, textOrigin, m_x + tx, m_y + ty, width(), height(), textShadow, textStrokeWidth > 0);
+ paintTextWithShadows(context, font, textRun, ePos, sPos, length, textOrigin, m_x + tx, m_y + ty, logicalWidth(), logicalHeight(), textShadow, textStrokeWidth > 0);
if (textStrokeWidth > 0)
context->restore();
@@ -540,7 +540,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
context->save();
updateGraphicsContext(context, selectionFillColor, selectionStrokeColor, selectionStrokeWidth, styleToUse->colorSpace());
- paintTextWithShadows(context, font, textRun, sPos, ePos, length, textOrigin, m_x + tx, m_y + ty, width(), height(), selectionShadow, selectionStrokeWidth > 0);
+ paintTextWithShadows(context, font, textRun, sPos, ePos, length, textOrigin, m_x + tx, m_y + ty, logicalWidth(), logicalHeight(), selectionShadow, selectionStrokeWidth > 0);
if (selectionStrokeWidth > 0)
context->restore();
@@ -633,7 +633,7 @@ void InlineTextBox::paintSelection(GraphicsContext* context, int tx, int ty, Ren
ePos = length;
}
- context->clip(IntRect(m_x + tx, y + ty, m_width, h));
+ context->clip(IntRect(m_x + tx, y + ty, m_logicalWidth, h));
context->drawHighlightForText(font, TextRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd,
direction() == RTL, m_dirOverride || style->visuallyOrdered()),
IntPoint(m_x + tx, y + ty), h, c, style->colorSpace(), sPos, ePos);
@@ -675,8 +675,8 @@ void InlineTextBox::paintCustomHighlight(int tx, int ty, const AtomicString& typ
return;
RootInlineBox* r = root();
- FloatRect rootRect(tx + r->x(), ty + selectionTop(), r->width(), selectionHeight());
- FloatRect textRect(tx + x(), rootRect.y(), width(), rootRect.height());
+ FloatRect rootRect(tx + r->x(), ty + selectionTop(), r->logicalWidth(), selectionHeight());
+ FloatRect textRect(tx + x(), rootRect.y(), logicalWidth(), rootRect.height());
page->chrome()->client()->paintCustomHighlight(renderer()->node(), type, textRect, rootRect, true, false);
}
@@ -691,11 +691,11 @@ void InlineTextBox::paintDecoration(GraphicsContext* context, int tx, int ty, in
if (m_truncation == cFullTruncation)
return;
- int width = m_width;
+ int width = m_logicalWidth;
if (m_truncation != cNoTruncation) {
width = toRenderText(renderer())->width(m_start, m_truncation, textPos(), m_firstLine);
if (direction() == RTL)
- tx += (m_width - width);
+ tx += (m_logicalWidth - width);
}
// Get the text decoration colors.
@@ -775,7 +775,7 @@ static GraphicsContext::TextCheckingLineStyle textCheckingLineStyleForMarkerType
return GraphicsContext::TextCheckingSpellingLineStyle;
case DocumentMarker::Grammar:
return GraphicsContext::TextCheckingGrammarLineStyle;
- case DocumentMarker::Replacement:
+ case DocumentMarker::CorrectionIndicator:
return GraphicsContext::TextCheckingReplacementLineStyle;
default:
ASSERT_NOT_REACHED();
@@ -793,7 +793,7 @@ void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, int tx, in
return;
int start = 0; // start of line to draw, relative to tx
- int width = m_width; // how much line to draw
+ int width = m_logicalWidth; // how much line to draw
// Determine whether we need to measure text
bool markerSpansWholeBox = true;
@@ -837,11 +837,11 @@ void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, int tx, in
// we pin to two pixels under the baseline.
int lineThickness = cMisspellingLineThickness;
int baseline = renderer()->style(m_firstLine)->font().ascent();
- int descent = height() - baseline;
+ int descent = logicalHeight() - baseline;
int underlineOffset;
if (descent <= (2 + lineThickness)) {
// Place the underline at the very bottom of the text in small/medium fonts.
- underlineOffset = height() - lineThickness;
+ underlineOffset = logicalHeight() - lineThickness;
} else {
// In larger fonts, though, place the underline up near the baseline to prevent a big gap.
underlineOffset = baseline + 2;
@@ -872,7 +872,7 @@ void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, int tx, int ty, co
renderer()->theme()->platformInactiveTextSearchHighlightColor();
pt->save();
updateGraphicsContext(pt, color, color, 0, style->colorSpace()); // Don't draw text at all!
- pt->clip(IntRect(tx + m_x, ty + y, m_width, h));
+ pt->clip(IntRect(tx + m_x, ty + y, m_logicalWidth, h));
pt->drawHighlightForText(font, run, IntPoint(m_x + tx, y + ty), h, color, style->colorSpace(), sPos, ePos);
pt->restore();
}
@@ -913,6 +913,7 @@ void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, int tx, int ty, Re
case DocumentMarker::Grammar:
case DocumentMarker::Spelling:
case DocumentMarker::Replacement:
+ case DocumentMarker::CorrectionIndicator:
case DocumentMarker::RejectedCorrection:
if (background)
continue;
@@ -946,10 +947,11 @@ void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, int tx, int ty, Re
case DocumentMarker::TextMatch:
paintTextMatchMarker(pt, tx, ty, marker, style, font);
break;
- case DocumentMarker::Replacement:
+ case DocumentMarker::CorrectionIndicator:
computeRectForReplacementMarker(tx, ty, marker, style, font);
paintSpellingOrGrammarMarker(pt, tx, ty, marker, style, font, false);
break;
+ case DocumentMarker::Replacement:
case DocumentMarker::RejectedCorrection:
break;
default:
@@ -969,7 +971,7 @@ void InlineTextBox::paintCompositionUnderline(GraphicsContext* ctx, int tx, int
return;
int start = 0; // start of line to draw, relative to tx
- int width = m_width; // how much line to draw
+ int width = m_logicalWidth; // how much line to draw
bool useWholeWidth = true;
unsigned paintStart = m_start;
unsigned paintEnd = end() + 1; // end points at the last char, not past it
@@ -995,7 +997,7 @@ void InlineTextBox::paintCompositionUnderline(GraphicsContext* ctx, int tx, int
// If there's not enough space the underline will touch or overlap characters.
int lineThickness = 1;
int baseline = renderer()->style(m_firstLine)->font().ascent();
- if (underline.thick && height() - baseline >= 2)
+ if (underline.thick && logicalHeight() - baseline >= 2)
lineThickness = 2;
// We need to have some space between underlines of subsequent clauses, because some input methods do not use different underline styles for those.
@@ -1005,7 +1007,7 @@ void InlineTextBox::paintCompositionUnderline(GraphicsContext* ctx, int tx, int
ctx->setStrokeColor(underline.color, renderer()->style()->colorSpace());
ctx->setStrokeThickness(lineThickness);
- ctx->drawLineForText(IntPoint(tx + start, ty + height() - lineThickness), width, textRenderer()->document()->printing());
+ ctx->drawLineForText(IntPoint(tx + start, ty + logicalHeight() - lineThickness), width, textRenderer()->document()->printing());
}
int InlineTextBox::caretMinOffset() const
diff --git a/WebCore/rendering/InlineTextBox.h b/WebCore/rendering/InlineTextBox.h
index 7d828f3..2bf099b 100644
--- a/WebCore/rendering/InlineTextBox.h
+++ b/WebCore/rendering/InlineTextBox.h
@@ -74,7 +74,7 @@ private:
virtual int selectionHeight();
public:
- virtual IntRect calculateBoundaries() const { return IntRect(x(), y(), width(), height()); }
+ virtual IntRect calculateBoundaries() const { return IntRect(x(), y(), logicalWidth(), logicalHeight()); }
virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos);
bool isSelected(int startPos, int endPos) const;
@@ -102,7 +102,7 @@ private:
public:
virtual bool isLineBreak() const;
- void setSpaceAdd(int add) { m_width -= m_toAdd; m_toAdd = add; m_width += m_toAdd; }
+ void setSpaceAdd(int add) { m_logicalWidth -= m_toAdd; m_toAdd = add; m_logicalWidth += m_toAdd; }
private:
virtual bool isInlineTextBox() const { return true; }
diff --git a/WebCore/rendering/MediaControlElements.cpp b/WebCore/rendering/MediaControlElements.cpp
index 5533326..adaac03 100644
--- a/WebCore/rendering/MediaControlElements.cpp
+++ b/WebCore/rendering/MediaControlElements.cpp
@@ -345,12 +345,11 @@ bool MediaControlStatusDisplayElement::rendererIsNeeded(RenderStyle* style)
// ----------------------------
-MediaControlInputElement::MediaControlInputElement(HTMLMediaElement* mediaElement, PseudoId pseudo, const String& type)
+MediaControlInputElement::MediaControlInputElement(HTMLMediaElement* mediaElement, PseudoId pseudo)
: HTMLInputElement(inputTag, mediaElement->document())
, m_mediaElement(mediaElement)
, m_pseudoStyleId(pseudo)
{
- setType(type);
setInDocument();
switch (pseudo) {
@@ -484,13 +483,15 @@ void MediaControlInputElement::setDisplayType(MediaControlElementType displayTyp
// ----------------------------
inline MediaControlMuteButtonElement::MediaControlMuteButtonElement(HTMLMediaElement* mediaElement, ButtonLocation location)
- : MediaControlInputElement(mediaElement, location == Controller ? MEDIA_CONTROLS_MUTE_BUTTON : MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON, "button")
+ : MediaControlInputElement(mediaElement, location == Controller ? MEDIA_CONTROLS_MUTE_BUTTON : MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON)
{
}
PassRefPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElement::create(HTMLMediaElement* mediaElement, ButtonLocation location)
{
- return adoptRef(new MediaControlMuteButtonElement(mediaElement, location));
+ RefPtr<MediaControlMuteButtonElement> button = adoptRef(new MediaControlMuteButtonElement(mediaElement, location));
+ button->setType("button");
+ return button.release();
}
void MediaControlMuteButtonElement::defaultEventHandler(Event* event)
@@ -510,13 +511,15 @@ void MediaControlMuteButtonElement::updateDisplayType()
// ----------------------------
inline MediaControlPlayButtonElement::MediaControlPlayButtonElement(HTMLMediaElement* mediaElement)
- : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_PLAY_BUTTON, "button")
+ : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_PLAY_BUTTON)
{
}
PassRefPtr<MediaControlPlayButtonElement> MediaControlPlayButtonElement::create(HTMLMediaElement* mediaElement)
{
- return adoptRef(new MediaControlPlayButtonElement(mediaElement));
+ RefPtr<MediaControlPlayButtonElement> button = adoptRef(new MediaControlPlayButtonElement(mediaElement));
+ button->setType("button");
+ return button.release();
}
void MediaControlPlayButtonElement::defaultEventHandler(Event* event)
@@ -536,7 +539,7 @@ void MediaControlPlayButtonElement::updateDisplayType()
// ----------------------------
inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(HTMLMediaElement* mediaElement, PseudoId pseudoId)
- : MediaControlInputElement(mediaElement, pseudoId, "button")
+ : MediaControlInputElement(mediaElement, pseudoId)
, m_seeking(false)
, m_capturing(false)
, m_seekTimer(this, &MediaControlSeekButtonElement::seekTimerFired)
@@ -545,7 +548,9 @@ inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(HTMLMediaEle
PassRefPtr<MediaControlSeekButtonElement> MediaControlSeekButtonElement::create(HTMLMediaElement* mediaElement, PseudoId pseudoStyleId)
{
- return adoptRef(new MediaControlSeekButtonElement(mediaElement, pseudoStyleId));
+ RefPtr<MediaControlSeekButtonElement> button = adoptRef(new MediaControlSeekButtonElement(mediaElement, pseudoStyleId));
+ button->setType("button");
+ return button.release();
}
inline bool MediaControlSeekButtonElement::isForwardButton() const
@@ -603,13 +608,15 @@ void MediaControlSeekButtonElement::detach()
// ----------------------------
inline MediaControlRewindButtonElement::MediaControlRewindButtonElement(HTMLMediaElement* element)
- : MediaControlInputElement(element, MEDIA_CONTROLS_REWIND_BUTTON, "button")
+ : MediaControlInputElement(element, MEDIA_CONTROLS_REWIND_BUTTON)
{
}
PassRefPtr<MediaControlRewindButtonElement> MediaControlRewindButtonElement::create(HTMLMediaElement* mediaElement)
{
- return adoptRef(new MediaControlRewindButtonElement(mediaElement));
+ RefPtr<MediaControlRewindButtonElement> button = adoptRef(new MediaControlRewindButtonElement(mediaElement));
+ button->setType("button");
+ return button.release();
}
void MediaControlRewindButtonElement::defaultEventHandler(Event* event)
@@ -621,17 +628,18 @@ void MediaControlRewindButtonElement::defaultEventHandler(Event* event)
HTMLInputElement::defaultEventHandler(event);
}
-
// ----------------------------
inline MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(HTMLMediaElement* mediaElement)
- : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, "button")
+ : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON)
{
}
PassRefPtr<MediaControlReturnToRealtimeButtonElement> MediaControlReturnToRealtimeButtonElement::create(HTMLMediaElement* mediaElement)
{
- return adoptRef(new MediaControlReturnToRealtimeButtonElement(mediaElement));
+ RefPtr<MediaControlReturnToRealtimeButtonElement> button = adoptRef(new MediaControlReturnToRealtimeButtonElement(mediaElement));
+ button->setType("button");
+ return button.release();
}
void MediaControlReturnToRealtimeButtonElement::defaultEventHandler(Event* event)
@@ -647,13 +655,15 @@ void MediaControlReturnToRealtimeButtonElement::defaultEventHandler(Event* event
// ----------------------------
inline MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement(HTMLMediaElement* mediaElement)
- : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON, "button")
+ : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON)
{
}
PassRefPtr<MediaControlToggleClosedCaptionsButtonElement> MediaControlToggleClosedCaptionsButtonElement::create(HTMLMediaElement* mediaElement)
{
- return adoptRef(new MediaControlToggleClosedCaptionsButtonElement(mediaElement));
+ RefPtr<MediaControlToggleClosedCaptionsButtonElement> button = adoptRef(new MediaControlToggleClosedCaptionsButtonElement(mediaElement));
+ button->setType("button");
+ return button.release();
}
void MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler(Event* event)
@@ -674,13 +684,15 @@ void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType()
// ----------------------------
MediaControlTimelineElement::MediaControlTimelineElement(HTMLMediaElement* mediaElement)
- : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TIMELINE, "range")
+ : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TIMELINE)
{
}
PassRefPtr<MediaControlTimelineElement> MediaControlTimelineElement::create(HTMLMediaElement* mediaElement)
{
- return adoptRef(new MediaControlTimelineElement(mediaElement));
+ RefPtr<MediaControlTimelineElement> timeline = adoptRef(new MediaControlTimelineElement(mediaElement));
+ timeline->setType("range");
+ return timeline.release();
}
void MediaControlTimelineElement::defaultEventHandler(Event* event)
@@ -727,13 +739,15 @@ void MediaControlTimelineElement::update(bool updateDuration)
// ----------------------------
inline MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(HTMLMediaElement* mediaElement)
- : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_VOLUME_SLIDER, "range")
+ : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_VOLUME_SLIDER)
{
}
PassRefPtr<MediaControlVolumeSliderElement> MediaControlVolumeSliderElement::create(HTMLMediaElement* mediaElement)
{
- return adoptRef(new MediaControlVolumeSliderElement(mediaElement));
+ RefPtr<MediaControlVolumeSliderElement> slider = adoptRef(new MediaControlVolumeSliderElement(mediaElement));
+ slider->setType("range");
+ return slider.release();
}
void MediaControlVolumeSliderElement::defaultEventHandler(Event* event)
@@ -769,13 +783,15 @@ void MediaControlVolumeSliderElement::update()
// ----------------------------
inline MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(HTMLMediaElement* mediaElement)
- : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_FULLSCREEN_BUTTON, "button")
+ : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_FULLSCREEN_BUTTON)
{
}
PassRefPtr<MediaControlFullscreenButtonElement> MediaControlFullscreenButtonElement::create(HTMLMediaElement* mediaElement)
{
- return adoptRef(new MediaControlFullscreenButtonElement(mediaElement));
+ RefPtr<MediaControlFullscreenButtonElement> button = adoptRef(new MediaControlFullscreenButtonElement(mediaElement));
+ button->setType("button");
+ return button.release();
}
void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
diff --git a/WebCore/rendering/MediaControlElements.h b/WebCore/rendering/MediaControlElements.h
index 1dcf6be..a9ffb0b 100644
--- a/WebCore/rendering/MediaControlElements.h
+++ b/WebCore/rendering/MediaControlElements.h
@@ -178,7 +178,7 @@ public:
HTMLMediaElement* mediaElement() const { return m_mediaElement; }
protected:
- MediaControlInputElement(HTMLMediaElement*, PseudoId, const String& type);
+ MediaControlInputElement(HTMLMediaElement*, PseudoId);
void setDisplayType(MediaControlElementType);
diff --git a/WebCore/rendering/RenderApplet.cpp b/WebCore/rendering/RenderApplet.cpp
index 12eb4fb..63a18a0 100644
--- a/WebCore/rendering/RenderApplet.cpp
+++ b/WebCore/rendering/RenderApplet.cpp
@@ -79,8 +79,8 @@ void RenderApplet::layout()
{
ASSERT(needsLayout());
- calcWidth();
- calcHeight();
+ computeLogicalWidth();
+ computeLogicalHeight();
// The applet's widget gets created lazily upon first layout.
createWidgetIfNecessary();
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index 0e44b32..1e378d8 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -82,33 +82,34 @@ static int gDelayUpdateScrollInfo = 0;
static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0;
// Our MarginInfo state used when laying out block children.
-RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, int top, int bottom)
+RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, int beforeBorderPadding, int afterBorderPadding)
+ : m_atBeforeSideOfBlock(true)
+ , m_atAfterSideOfBlock(false)
+ , m_marginBeforeQuirk(false)
+ , m_marginAfterQuirk(false)
+ , m_determinedMarginBeforeQuirk(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.
- m_canCollapseWithChildren = !block->isRenderView() && !block->isRoot() && !block->isPositioned() &&
- !block->isFloating() && !block->isTableCell() && !block->hasOverflowClip() && !block->isInlineBlockOrInlineTable();
+ m_canCollapseWithChildren = !block->isRenderView() && !block->isRoot() && !block->isPositioned()
+ && !block->isFloating() && !block->isTableCell() && !block->hasOverflowClip() && !block->isInlineBlockOrInlineTable()
+ && !block->isBlockFlowRoot();
- m_canCollapseTopWithChildren = m_canCollapseWithChildren && (top == 0) && block->style()->marginTopCollapse() != MSEPARATE;
+ m_canCollapseMarginBeforeWithChildren = m_canCollapseWithChildren && (beforeBorderPadding == 0) && block->style()->marginBeforeCollapse() != MSEPARATE;
// If any height other than auto is specified in CSS, then we don't collapse our bottom
// margins with our children's margins. To do otherwise would be to risk odd visual
// effects when the children overflow out of the parent block and yet still collapse
// with it. We also don't collapse if we have any bottom border/padding.
- m_canCollapseBottomWithChildren = m_canCollapseWithChildren && (bottom == 0) &&
- (block->style()->height().isAuto() && block->style()->height().value() == 0) && block->style()->marginBottomCollapse() != MSEPARATE;
+ m_canCollapseMarginAfterWithChildren = m_canCollapseWithChildren && (afterBorderPadding == 0) &&
+ (block->style()->logicalHeight().isAuto() && block->style()->logicalHeight().value() == 0) && block->style()->marginAfterCollapse() != MSEPARATE;
- m_quirkContainer = block->isTableCell() || block->isBody() || block->style()->marginTopCollapse() == MDISCARD ||
- block->style()->marginBottomCollapse() == MDISCARD;
+ m_quirkContainer = block->isTableCell() || block->isBody() || block->style()->marginBeforeCollapse() == MDISCARD ||
+ block->style()->marginAfterCollapse() == MDISCARD;
- m_atTopOfBlock = true;
- m_atBottomOfBlock = false;
-
- m_posMargin = m_canCollapseTopWithChildren ? block->maxTopMargin(true) : 0;
- m_negMargin = m_canCollapseTopWithChildren ? block->maxTopMargin(false) : 0;
-
- m_topQuirk = m_bottomQuirk = m_determinedTopQuirk = false;
+ m_posMargin = m_canCollapseMarginBeforeWithChildren ? block->maxMarginBefore(RenderBox::PositiveMargin) : 0;
+ m_negMargin = m_canCollapseMarginBeforeWithChildren ? block->maxMarginBefore(RenderBox::NegativeMargin) : 0;
}
// -------------------------------------------------------------------------------------------------------
@@ -337,7 +338,7 @@ void RenderBlock::addChildToAnonymousColumnBlocks(RenderObject* newChild, Render
ASSERT(!continuation()); // We don't yet support column spans that aren't immediate children of the multi-column block.
// The goal is to locate a suitable box in which to place our child.
- RenderBlock* beforeChildParent = toRenderBlock(beforeChild ? beforeChild->parent() : lastChild());
+ RenderBlock* beforeChildParent = toRenderBlock(beforeChild && beforeChild->parent()->isRenderBlock() ? beforeChild->parent() : lastChild());
// If the new child is floating or positioned it can just go in that block.
if (newChild->isFloatingOrPositioned())
@@ -614,7 +615,7 @@ RenderBlock* RenderBlock::columnsBlockForSpanningElement(RenderObject* newChild)
&& !newChild->isInline() && !isAnonymousColumnSpanBlock()) {
if (style()->specifiesColumns())
columnsBlockAncestor = this;
- else
+ else if (parent() && parent()->isRenderBlock())
columnsBlockAncestor = toRenderBlock(parent())->containingColumnsBlock(false);
}
return columnsBlockAncestor;
@@ -1011,9 +1012,6 @@ void RenderBlock::removeChild(RenderObject* oldChild)
// If this was our last child be sure to clear out our line boxes.
if (childrenInline())
lineBoxes()->deleteLineBoxes(renderArena());
- // If we're now an empty anonymous columns or column span block, then go ahead and delete ourselves.
- else if ((isAnonymousColumnsBlock() || isAnonymousColumnSpanBlock()) && parent() && parent()->isRenderBlock() && !continuation())
- destroy();
}
}
@@ -1028,7 +1026,7 @@ bool RenderBlock::isSelfCollapsingBlock() const
if (height() > 0
|| isTable() || borderAndPaddingHeight()
|| style()->minHeight().isPositive()
- || style()->marginTopCollapse() == MSEPARATE || style()->marginBottomCollapse() == MSEPARATE)
+ || style()->marginBeforeCollapse() == MSEPARATE || style()->marginAfterCollapse() == MSEPARATE)
return false;
bool hasAutoHeight = style()->height().isAuto();
@@ -1130,12 +1128,12 @@ void RenderBlock::layoutBlock(bool relayoutChildren, int pageHeight)
int oldWidth = width();
int oldColumnWidth = desiredColumnWidth();
- calcWidth();
+ computeLogicalWidth();
calcColumnWidth();
m_overflow.clear();
- if (oldWidth != width() || oldColumnWidth != desiredColumnWidth())
+ if (oldWidth != logicalWidth() || oldColumnWidth != desiredColumnWidth())
relayoutChildren = true;
#ifdef ANDROID_LAYOUT
@@ -1144,21 +1142,21 @@ void RenderBlock::layoutBlock(bool relayoutChildren, int pageHeight)
clearFloats();
- int previousHeight = height();
- setHeight(0);
+ int previousHeight = logicalHeight();
+ setLogicalHeight(0);
bool hasSpecifiedPageHeight = false;
ColumnInfo* colInfo = columnInfo();
if (hasColumns()) {
if (!pageHeight) {
// We need to go ahead and set our explicit page height if one exists, so that we can
// avoid doing two layout passes.
- calcHeight();
- int columnHeight = contentHeight();
+ computeLogicalHeight();
+ int columnHeight = contentLogicalHeight();
if (columnHeight > 0) {
pageHeight = columnHeight;
hasSpecifiedPageHeight = true;
}
- setHeight(0);
+ setLogicalHeight(0);
}
if (colInfo->columnHeight() != pageHeight && m_everHadLayout) {
colInfo->setColumnHeight(pageHeight);
@@ -1185,14 +1183,14 @@ void RenderBlock::layoutBlock(bool relayoutChildren, int pageHeight)
if (!isCell) {
initMaxMarginValues();
- setTopMarginQuirk(style()->marginTop().quirk());
- setBottomMarginQuirk(style()->marginBottom().quirk());
+ setMarginBeforeQuirk(style()->marginBefore().quirk());
+ setMarginAfterQuirk(style()->marginAfter().quirk());
Node* n = node();
if (n && n->hasTagName(formTag) && static_cast<HTMLFormElement*>(n)->isMalformed()) {
// See if this form is malformed (i.e., unclosed). If so, don't give the form
// a bottom margin.
- setMaxBottomMargins(0, 0);
+ setMaxMarginAfterValues(0, 0);
}
setPaginationStrut(0);
@@ -1217,30 +1215,31 @@ void RenderBlock::layoutBlock(bool relayoutChildren, int pageHeight)
layoutBlockChildren(relayoutChildren, maxFloatBottom);
// Expand our intrinsic height to encompass floats.
- int toAdd = borderBottom() + paddingBottom() + horizontalScrollbarHeight();
- if (floatBottom() > (height() - toAdd) && expandsToEncloseOverhangingFloats())
- setHeight(floatBottom() + toAdd);
+ int toAdd = borderAfter() + paddingAfter() + horizontalScrollbarHeight(); // FIXME: https://bugs.webkit.org/show_bug.cgi?id=46645, overflow and block-flow.
+ if (floatBottom() > (logicalHeight() - toAdd) && expandsToEncloseOverhangingFloats())
+ setLogicalHeight(floatBottom() + toAdd);
if (layoutColumns(hasSpecifiedPageHeight, pageHeight, statePusher))
return;
// Calculate our new height.
- int oldHeight = height();
- calcHeight();
- if (oldHeight != height()) {
- if (oldHeight > height() && maxFloatBottom > height() && !childrenInline()) {
+ int oldHeight = logicalHeight();
+ computeLogicalHeight();
+ int newHeight = logicalHeight();
+ if (oldHeight != newHeight) {
+ if (oldHeight > newHeight && maxFloatBottom > newHeight && !childrenInline()) {
// One of our children's floats may have become an overhanging float for us. We need to look for it.
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
if (child->isBlockFlow() && !child->isFloatingOrPositioned()) {
RenderBlock* block = toRenderBlock(child);
- if (block->floatBottom() + block->y() > height())
+ if (block->floatBottom() + block->logicalTop() > newHeight)
addOverhangingFloats(block, -block->x(), -block->y(), false);
}
}
}
}
- if (previousHeight != height())
+ if (previousHeight != newHeight)
relayoutChildren = true;
// Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway).
@@ -1326,7 +1325,8 @@ void RenderBlock::addOverflowFromFloats()
bool RenderBlock::expandsToEncloseOverhangingFloats() const
{
- return isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() || (parent() && parent()->isFlexibleBox()) || hasColumns() || isTableCell() || isFieldset();
+ return isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() || (parent() && parent()->isFlexibleBox())
+ || hasColumns() || isTableCell() || isFieldset() || isBlockFlowRoot();
}
void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marginInfo)
@@ -1340,8 +1340,8 @@ void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marg
if (child->style()->hasStaticY()) {
int y = height();
- if (!marginInfo.canCollapseWithTop()) {
- child->calcVerticalMargins();
+ if (!marginInfo.canCollapseWithMarginBefore()) {
+ child->computeBlockDirectionMargins(this);
int marginTop = child->marginTop();
int collapsedTopPos = marginInfo.posMargin();
int collapsedTopNeg = marginInfo.negMargin();
@@ -1374,13 +1374,13 @@ void RenderBlock::adjustFloatingBlock(const MarginInfo& marginInfo)
// Note also that the previous flow may collapse its margin into the top of
// our block. If this is the case, then we do not add the margin in to our
// height when computing the position of the float. This condition can be tested
- // for by simply calling canCollapseWithTop. See
+ // for by simply calling canCollapseWithMarginBefore. See
// http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/046.html for
// an example of this scenario.
- int marginOffset = marginInfo.canCollapseWithTop() ? 0 : marginInfo.margin();
- setHeight(height() + marginOffset);
+ int marginOffset = marginInfo.canCollapseWithMarginBefore() ? 0 : marginInfo.margin();
+ setLogicalHeight(height() + marginOffset);
positionNewFloats();
- setHeight(height() - marginOffset);
+ setLogicalHeight(height() - marginOffset);
}
bool RenderBlock::handleSpecialChild(RenderBox* child, const MarginInfo& marginInfo)
@@ -1462,7 +1462,8 @@ bool RenderBlock::handleRunInChild(RenderBox* child)
if (runInNode)
runInNode->setRenderer(inlineRunIn);
- // Destroy the block run-in.
+ // Destroy the block run-in, which includes deleting its line box tree.
+ blockRunIn->deleteLineBoxTree();
blockRunIn->destroy();
// The block acts like an inline, so just null out its
@@ -1474,47 +1475,47 @@ bool RenderBlock::handleRunInChild(RenderBox* child)
int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)
{
// Get our max pos and neg top margins.
- int posTop = child->maxTopMargin(true);
- int negTop = child->maxTopMargin(false);
+ int posTop = child->maxMarginBefore(PositiveMargin);
+ int negTop = child->maxMarginBefore(NegativeMargin);
// For self-collapsing blocks, collapse our bottom margins into our
// top to get new posTop and negTop values.
if (child->isSelfCollapsingBlock()) {
- posTop = max(posTop, child->maxBottomMargin(true));
- negTop = max(negTop, child->maxBottomMargin(false));
+ posTop = max(posTop, child->maxMarginAfter(PositiveMargin));
+ negTop = max(negTop, child->maxMarginAfter(NegativeMargin));
}
// See if the top margin is quirky. We only care if this child has
// margins that will collapse with us.
- bool topQuirk = child->isTopMarginQuirk() || style()->marginTopCollapse() == MDISCARD;
+ bool topQuirk = child->isMarginBeforeQuirk() || style()->marginBeforeCollapse() == MDISCARD;
- if (marginInfo.canCollapseWithTop()) {
+ if (marginInfo.canCollapseWithMarginBefore()) {
// This child is collapsing with the top of the
// block. If it has larger margin values, then we need to update
// our own maximal values.
if (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !topQuirk)
- setMaxTopMargins(max(posTop, maxTopPosMargin()), max(negTop, maxTopNegMargin()));
+ setMaxMarginBeforeValues(max(posTop, maxPosMarginBefore()), max(negTop, maxNegMarginBefore()));
// The minute any of the margins involved isn't a quirk, don't
// collapse it away, even if the margin is smaller (www.webreference.com
// has an example of this, a <dt> with 0.8em author-specified inside
// a <dl> inside a <td>.
- if (!marginInfo.determinedTopQuirk() && !topQuirk && (posTop-negTop)) {
- setTopMarginQuirk(false);
- marginInfo.setDeterminedTopQuirk(true);
+ if (!marginInfo.determinedMarginBeforeQuirk() && !topQuirk && (posTop-negTop)) {
+ setMarginBeforeQuirk(false);
+ marginInfo.setDeterminedMarginBeforeQuirk(true);
}
- if (!marginInfo.determinedTopQuirk() && topQuirk && marginTop() == 0)
+ if (!marginInfo.determinedMarginBeforeQuirk() && topQuirk && marginTop() == 0)
// We have no top margin and our top child has a quirky margin.
// We will pick up this quirky margin and pass it through.
// This deals with the <td><div><p> case.
// Don't do this for a block that split two inlines though. You do
// still apply margins in this case.
- setTopMarginQuirk(true);
+ setMarginBeforeQuirk(true);
}
- if (marginInfo.quirkContainer() && marginInfo.atTopOfBlock() && (posTop - negTop))
- marginInfo.setTopQuirk(topQuirk);
+ if (marginInfo.quirkContainer() && marginInfo.atBeforeSideOfBlock() && (posTop - negTop))
+ marginInfo.setMarginBeforeQuirk(topQuirk);
int beforeCollapseY = height();
int ypos = beforeCollapseY;
@@ -1522,16 +1523,16 @@ int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)
// This child has no height. We need to compute our
// position before we collapse the child's margins together,
// so that we can get an accurate position for the zero-height block.
- int collapsedTopPos = max(marginInfo.posMargin(), child->maxTopMargin(true));
- int collapsedTopNeg = max(marginInfo.negMargin(), child->maxTopMargin(false));
+ int collapsedTopPos = max(marginInfo.posMargin(), child->maxMarginBefore(PositiveMargin));
+ int collapsedTopNeg = max(marginInfo.negMargin(), child->maxMarginBefore(NegativeMargin));
marginInfo.setMargin(collapsedTopPos, collapsedTopNeg);
// Now collapse the child's margins together, which means examining our
// bottom margin values as well.
- marginInfo.setPosMarginIfLarger(child->maxBottomMargin(true));
- marginInfo.setNegMarginIfLarger(child->maxBottomMargin(false));
+ marginInfo.setPosMarginIfLarger(child->maxMarginAfter(PositiveMargin));
+ marginInfo.setNegMarginIfLarger(child->maxMarginAfter(NegativeMargin));
- if (!marginInfo.canCollapseWithTop())
+ if (!marginInfo.canCollapseWithMarginBefore())
// We need to make sure that the position of the self-collapsing block
// is correct, since it could have overflowing content
// that needs to be positioned correctly (e.g., a block that
@@ -1539,24 +1540,24 @@ int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)
ypos = height() + collapsedTopPos - collapsedTopNeg;
}
else {
- if (child->style()->marginTopCollapse() == MSEPARATE) {
- setHeight(height() + marginInfo.margin() + child->marginTop());
+ if (child->style()->marginBeforeCollapse() == MSEPARATE) {
+ setLogicalHeight(height() + marginInfo.margin() + child->marginTop());
ypos = height();
}
- else if (!marginInfo.atTopOfBlock() ||
- (!marginInfo.canCollapseTopWithChildren()
- && (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !marginInfo.topQuirk()))) {
+ else if (!marginInfo.atBeforeSideOfBlock() ||
+ (!marginInfo.canCollapseMarginBeforeWithChildren()
+ && (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !marginInfo.marginBeforeQuirk()))) {
// We're collapsing with a previous sibling's margins and not
// with the top of the block.
- setHeight(height() + max(marginInfo.posMargin(), posTop) - max(marginInfo.negMargin(), negTop));
+ setLogicalHeight(height() + max(marginInfo.posMargin(), posTop) - max(marginInfo.negMargin(), negTop));
ypos = height();
}
- marginInfo.setPosMargin(child->maxBottomMargin(true));
- marginInfo.setNegMargin(child->maxBottomMargin(false));
+ marginInfo.setPosMargin(child->maxMarginAfter(PositiveMargin));
+ marginInfo.setNegMargin(child->maxMarginAfter(NegativeMargin));
if (marginInfo.margin())
- marginInfo.setBottomQuirk(child->isBottomMarginQuirk() || style()->marginBottomCollapse() == MDISCARD);
+ marginInfo.setMarginAfterQuirk(child->isMarginAfterQuirk() || style()->marginAfterCollapse() == MDISCARD);
}
// If margins would pull us past the top of the next page, then we need to pull back and pretend like the margins
@@ -1565,7 +1566,7 @@ int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)
if (paginated && ypos > beforeCollapseY) {
int oldY = ypos;
ypos = min(ypos, nextPageTop(beforeCollapseY));
- setHeight(height() + (ypos - oldY));
+ setLogicalHeight(height() + (ypos - oldY));
}
return ypos;
}
@@ -1590,28 +1591,28 @@ int RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& marginInfo, i
atBottomOfBlock = false;
}
if (atBottomOfBlock) {
- marginInfo.setPosMargin(child->maxBottomMargin(true));
- marginInfo.setNegMargin(child->maxBottomMargin(false));
+ marginInfo.setPosMargin(child->maxMarginAfter(PositiveMargin));
+ marginInfo.setNegMargin(child->maxMarginAfter(NegativeMargin));
} else {
- marginInfo.setPosMargin(max(child->maxTopMargin(true), child->maxBottomMargin(true)));
- marginInfo.setNegMargin(max(child->maxTopMargin(false), child->maxBottomMargin(false)));
+ marginInfo.setPosMargin(max(child->maxMarginBefore(PositiveMargin), child->maxMarginAfter(PositiveMargin)));
+ marginInfo.setNegMargin(max(child->maxMarginBefore(NegativeMargin), child->maxMarginAfter(NegativeMargin)));
}
// Adjust our height such that we are ready to be collapsed with subsequent siblings (or the bottom
// of the parent block).
- setHeight(child->y() - max(0, marginInfo.margin()));
+ setLogicalHeight(child->y() - max(0, marginInfo.margin()));
} else
// Increase our height by the amount we had to clear.
- setHeight(height() + heightIncrease);
+ setLogicalHeight(height() + heightIncrease);
- if (marginInfo.canCollapseWithTop()) {
+ if (marginInfo.canCollapseWithMarginBefore()) {
// We can no longer collapse with the top of the block since a clear
// occurred. The empty blocks collapse into the cleared block.
// FIXME: This isn't quite correct. Need clarification for what to do
// if the height the cleared block is offset by is smaller than the
// margins involved.
- setMaxTopMargins(oldTopPosMargin, oldTopNegMargin);
- marginInfo.setAtTopOfBlock(false);
+ setMaxMarginBeforeValues(oldTopPosMargin, oldTopNegMargin);
+ marginInfo.setAtBeforeSideOfBlock(false);
}
return yPos + heightIncrease;
@@ -1622,8 +1623,8 @@ int RenderBlock::estimateVerticalPosition(RenderBox* child, const MarginInfo& ma
// FIXME: We need to eliminate the estimation of vertical position, because when it's wrong we sometimes trigger a pathological
// relayout if there are intruding floats.
int yPosEstimate = height();
- if (!marginInfo.canCollapseWithTop()) {
- int childMarginTop = child->selfNeedsLayout() ? child->marginTop() : child->collapsedMarginTop();
+ if (!marginInfo.canCollapseWithMarginBefore()) {
+ int childMarginTop = child->selfNeedsLayout() ? child->marginTop() : child->collapsedMarginBefore();
yPosEstimate += max(marginInfo.margin(), childMarginTop);
}
@@ -1660,7 +1661,7 @@ void RenderBlock::determineHorizontalPosition(RenderBox* child)
// Some objects (e.g., tables, horizontal rules, overflow:auto blocks) avoid floats. They need
// to shift over as necessary to dodge any floats that might get in the way.
if (child->avoidsFloats()) {
- int leftOff = leftOffset(height(), false);
+ int leftOff = logicalLeftOffsetForLine(height(), false);
if (style()->textAlign() != WEBKIT_CENTER && child->style()->marginLeft().type() != Auto) {
if (child->marginLeft() < 0)
leftOff += child->marginLeft();
@@ -1670,19 +1671,19 @@ void RenderBlock::determineHorizontalPosition(RenderBox* child)
// The object is shifting right. The object might be centered, so we need to
// recalculate our horizontal margins. Note that the containing block content
// width computation will take into account the delta between |leftOff| and |xPos|
- // so that we can just pass the content width in directly to the |calcHorizontalMargins|
+ // so that we can just pass the content width in directly to the |computeMarginsInContainingBlockInlineDirection|
// function.
- child->calcHorizontalMargins(child->style()->marginLeft(), child->style()->marginRight(), lineWidth(child->y(), false));
+ child->computeInlineDirectionMargins(this, availableLogicalWidthForLine(child->y(), false), child->width());
chPos = leftOff + child->marginLeft();
}
}
view()->addLayoutDelta(IntSize(child->x() - chPos, 0));
child->setLocation(chPos, child->y());
} else {
- xPos += availableWidth();
+ xPos += availableLogicalWidth();
int chPos = xPos - (child->width() + child->marginRight());
if (child->avoidsFloats()) {
- int rightOff = rightOffset(height(), false);
+ int rightOff = logicalRightOffsetForLine(height(), false);
if (style()->textAlign() != WEBKIT_CENTER && child->style()->marginRight().type() != Auto) {
if (child->marginRight() < 0)
rightOff -= child->marginRight();
@@ -1691,9 +1692,9 @@ void RenderBlock::determineHorizontalPosition(RenderBox* child)
// The object is shifting left. The object might be centered, so we need to
// recalculate our horizontal margins. Note that the containing block content
// width computation will take into account the delta between |rightOff| and |xPos|
- // so that we can just pass the content width in directly to the |calcHorizontalMargins|
+ // so that we can just pass the content width in directly to the |computeInlineDirectionMargins|
// function.
- child->calcHorizontalMargins(child->style()->marginLeft(), child->style()->marginRight(), lineWidth(child->y(), false));
+ child->computeInlineDirectionMargins(this, availableLogicalWidthForLine(child->y(), false), child->width());
chPos = rightOff - child->marginRight() - child->width();
}
}
@@ -1704,37 +1705,37 @@ void RenderBlock::determineHorizontalPosition(RenderBox* child)
void RenderBlock::setCollapsedBottomMargin(const MarginInfo& marginInfo)
{
- if (marginInfo.canCollapseWithBottom() && !marginInfo.canCollapseWithTop()) {
+ if (marginInfo.canCollapseWithMarginAfter() && !marginInfo.canCollapseWithMarginBefore()) {
// Update our max pos/neg bottom margins, since we collapsed our bottom margins
// with our children.
- setMaxBottomMargins(max(maxBottomPosMargin(), marginInfo.posMargin()), max(maxBottomNegMargin(), marginInfo.negMargin()));
+ setMaxMarginAfterValues(max(maxPosMarginAfter(), marginInfo.posMargin()), max(maxNegMarginAfter(), marginInfo.negMargin()));
- if (!marginInfo.bottomQuirk())
- setBottomMarginQuirk(false);
+ if (!marginInfo.marginAfterQuirk())
+ setMarginAfterQuirk(false);
- if (marginInfo.bottomQuirk() && marginBottom() == 0)
+ if (marginInfo.marginAfterQuirk() && marginBottom() == 0)
// We have no bottom margin and our last child has a quirky margin.
// We will pick up this quirky margin and pass it through.
// This deals with the <td><div><p> case.
- setBottomMarginQuirk(true);
+ setMarginAfterQuirk(true);
}
}
void RenderBlock::handleBottomOfBlock(int top, int bottom, MarginInfo& marginInfo)
{
- marginInfo.setAtBottomOfBlock(true);
+ marginInfo.setAtAfterSideOfBlock(true);
// If we can't collapse with children then go ahead and add in the bottom margin.
- if (!marginInfo.canCollapseWithBottom() && !marginInfo.canCollapseWithTop()
- && (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !marginInfo.bottomQuirk()))
- setHeight(height() + marginInfo.margin());
+ if (!marginInfo.canCollapseWithMarginAfter() && !marginInfo.canCollapseWithMarginBefore()
+ && (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !marginInfo.marginAfterQuirk()))
+ setLogicalHeight(height() + marginInfo.margin());
// Now add in our bottom border/padding.
- setHeight(height() + bottom);
+ setLogicalHeight(height() + bottom);
// Negative margins can cause our height to shrink below our minimal height (border/padding).
// If this happens, ensure that the computed height is increased to the minimal height.
- setHeight(max(height(), top + bottom));
+ setLogicalHeight(max(height(), top + bottom));
// Update our bottom collapsed margin info.
setCollapsedBottomMargin(marginInfo);
@@ -1763,7 +1764,7 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom
int top = borderTop() + paddingTop();
int bottom = borderBottom() + paddingBottom() + horizontalScrollbarHeight();
- setHeight(top);
+ setLogicalHeight(top);
// The margin struct caches all our current margin collapsing state. The compact struct caches state when we encounter compacts,
MarginInfo marginInfo(this, top, bottom);
@@ -1792,7 +1793,7 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom
// If relayoutChildren is set and we have percentage padding, we also need to invalidate the child's pref widths.
if (relayoutChildren && (child->style()->paddingLeft().isPercent() || child->style()->paddingRight().isPercent()))
- child->setPrefWidthsDirty(true, false);
+ child->setPreferredLogicalWidthsDirty(true, false);
// 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.
@@ -1810,15 +1811,15 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom
void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int& previousFloatBottom, int& maxFloatBottom)
{
- int oldTopPosMargin = maxTopPosMargin();
- int oldTopNegMargin = maxTopNegMargin();
+ int oldTopPosMargin = maxPosMarginBefore();
+ int oldTopNegMargin = maxNegMarginBefore();
// The child is a normal flow object. Compute its vertical margins now.
- child->calcVerticalMargins();
+ child->computeBlockDirectionMargins(this);
// Do not allow a collapse if the margin top collapse style is set to SEPARATE.
- if (child->style()->marginTopCollapse() == MSEPARATE) {
- marginInfo.setAtTopOfBlock(false);
+ if (child->style()->marginBeforeCollapse() == MSEPARATE) {
+ marginInfo.setAtBeforeSideOfBlock(false);
marginInfo.clearMargin();
}
@@ -1864,7 +1865,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int
child->layout();
// Cache if we are at the top of the block right now.
- bool atTopOfBlock = marginInfo.atTopOfBlock();
+ bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock();
// Now determine the correct ypos based off examination of collapsing margin
// values.
@@ -1893,7 +1894,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int
if (paginationStrut) {
// We are willing to propagate out to our parent block as long as we were at the top of the block prior
// to collapsing our margins, and as long as we didn't clear or move as a result of other pagination.
- if (atTopOfBlock && oldY == yBeforeClear && !isPositioned() && !isTableCell()) {
+ if (atBeforeSideOfBlock && oldY == yBeforeClear && !isPositioned() && !isTableCell()) {
// FIXME: Should really check if we're exceeding the page height before propagating the strut, but we don't
// have all the information to do so (the strut only has the remaining amount to push). Gecko gets this wrong too
// and pushes to the next page anyway, so not too concerned about it.
@@ -1905,7 +1906,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int
}
// Similar to how we apply clearance. Go ahead and boost height() to be the place where we're going to position the child.
- setHeight(height() + (yAfterClear - oldY));
+ setLogicalHeight(height() + (yAfterClear - oldY));
}
view()->addLayoutDelta(IntSize(0, yPosEstimate - yAfterClear));
@@ -1933,16 +1934,16 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int
// We are no longer at the top of the block if we encounter a non-empty child.
// This has to be done after checking for clear, so that margins can be reset if a clear occurred.
- if (marginInfo.atTopOfBlock() && !child->isSelfCollapsingBlock())
- marginInfo.setAtTopOfBlock(false);
+ if (marginInfo.atBeforeSideOfBlock() && !child->isSelfCollapsingBlock())
+ marginInfo.setAtBeforeSideOfBlock(false);
// Now place the child in the correct horizontal position
determineHorizontalPosition(child);
// Update our height now that the child has been placed in the correct position.
- setHeight(height() + child->height());
- if (child->style()->marginBottomCollapse() == MSEPARATE) {
- setHeight(height() + child->marginBottom());
+ setLogicalHeight(height() + child->height());
+ if (child->style()->marginAfterCollapse() == MSEPARATE) {
+ setLogicalHeight(height() + child->marginBottom());
marginInfo.clearMargin();
}
// If the child has overhanging floats that intrude into following siblings (or possibly out
@@ -1970,7 +1971,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int
// Check for an after page/column break.
int newHeight = applyAfterBreak(child, height(), marginInfo);
if (newHeight != height())
- setHeight(newHeight);
+ setLogicalHeight(newHeight);
}
ASSERT(oldLayoutDelta == view()->layoutDelta());
@@ -2028,7 +2029,7 @@ void RenderBlock::layoutPositionedObjects(bool relayoutChildren)
// If relayoutChildren is set and we have percentage padding, we also need to invalidate the child's pref widths.
//if (relayoutChildren && (r->style()->paddingLeft().isPercent() || r->style()->paddingRight().isPercent()))
- r->setPrefWidthsDirty(true, false);
+ r->setPreferredLogicalWidthsDirty(true, false);
if (!r->needsLayout() && paginated && view()->layoutState()->m_pageHeight) {
RenderBlock* childRenderBlock = r->isRenderBlock() ? toRenderBlock(r) : 0;
@@ -2266,7 +2267,7 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty)
if (checkAfterAlways
&& (ty + child->y() + child->height()) > paintInfo.rect.y()
&& (ty + child->y() + child->height()) < paintInfo.rect.bottom()) {
- view()->setBestTruncatedAt(ty + child->y() + child->height() + max(0, child->collapsedMarginBottom()), this, true);
+ view()->setBestTruncatedAt(ty + child->y() + child->height() + max(0, child->collapsedMarginAfter()), this, true);
return;
}
}
@@ -2418,7 +2419,7 @@ void RenderBlock::paintEllipsisBoxes(PaintInfo& paintInfo, int tx, int ty)
// We can check the first box and last box and avoid painting if we don't
// intersect.
int yPos = ty + firstLineBox()->y();
- int h = lastLineBox()->y() + lastLineBox()->height() - firstLineBox()->y();
+ int h = lastLineBox()->y() + lastLineBox()->logicalHeight() - firstLineBox()->y();
if (yPos >= paintInfo.rect.bottom() || yPos + h <= paintInfo.rect.y())
return;
@@ -2427,7 +2428,7 @@ void RenderBlock::paintEllipsisBoxes(PaintInfo& paintInfo, int tx, int ty)
// based off positions of our first line box or our last line box.
for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
yPos = ty + curr->y();
- h = curr->height();
+ h = curr->logicalHeight();
if (curr->ellipsisBox() && yPos < paintInfo.rect.bottom() && yPos + h > paintInfo.rect.y())
curr->paintEllipsisBox(paintInfo, tx, ty);
}
@@ -2825,7 +2826,7 @@ void RenderBlock::getHorizontalSelectionGapInfo(SelectionState state, bool& left
int RenderBlock::leftSelectionOffset(RenderBlock* rootBlock, int yPos)
{
- int left = leftOffset(yPos, false);
+ int left = logicalLeftOffsetForLine(yPos, false);
if (left == borderLeft() + paddingLeft()) {
if (rootBlock != this)
// The border can potentially be further extended by our containingBlock().
@@ -2845,7 +2846,7 @@ int RenderBlock::leftSelectionOffset(RenderBlock* rootBlock, int yPos)
int RenderBlock::rightSelectionOffset(RenderBlock* rootBlock, int yPos)
{
- int right = rightOffset(yPos, false);
+ int right = logicalRightOffsetForLine(yPos, false);
if (right == (contentWidth() + (borderLeft() + paddingLeft()))) {
if (rootBlock != this)
// The border can potentially be further extended by our containingBlock().
@@ -2942,8 +2943,8 @@ RenderBlock::FloatingObject* RenderBlock::insertFloatingObject(RenderBox* o)
if (!affectedByPagination)
o->layoutIfNeeded();
else {
- o->calcWidth();
- o->calcVerticalMargins();
+ o->computeLogicalWidth();
+ o->computeBlockDirectionMargins(this);
}
newObj->m_width = o->width() + o->marginLeft() + o->marginRight();
@@ -3026,8 +3027,8 @@ bool RenderBlock::positionNewFloats()
RenderBox* o = f->m_renderer;
- int ro = rightOffset(); // Constant part of right offset.
- int lo = leftOffset(); // Constant part of left offset.
+ int ro = logicalRightOffsetForContent(); // Constant part of right offset.
+ int lo = logicalLeftOffsetForContent(); // Constant part of left offset.
int fwidth = f->m_width; // The width we look for.
if (ro - lo < fwidth)
fwidth = ro - lo; // Never look for more than what will be available.
@@ -3042,10 +3043,10 @@ bool RenderBlock::positionNewFloats()
if (o->style()->floating() == FLEFT) {
int heightRemainingLeft = 1;
int heightRemainingRight = 1;
- int fx = leftRelOffset(y, lo, false, &heightRemainingLeft);
- while (rightRelOffset(y, ro, false, &heightRemainingRight)-fx < fwidth) {
+ int fx = logicalLeftOffsetForLine(y, lo, false, &heightRemainingLeft);
+ while (logicalRightOffsetForLine(y, ro, false, &heightRemainingRight)-fx < fwidth) {
y += min(heightRemainingLeft, heightRemainingRight);
- fx = leftRelOffset(y, lo, false, &heightRemainingLeft);
+ fx = logicalLeftOffsetForLine(y, lo, false, &heightRemainingLeft);
}
fx = max(0, fx);
f->m_left = fx;
@@ -3053,10 +3054,10 @@ bool RenderBlock::positionNewFloats()
} else {
int heightRemainingLeft = 1;
int heightRemainingRight = 1;
- int fx = rightRelOffset(y, ro, false, &heightRemainingRight);
- while (fx - leftRelOffset(y, lo, false, &heightRemainingLeft) < fwidth) {
+ int fx = logicalRightOffsetForLine(y, ro, false, &heightRemainingRight);
+ while (fx - logicalLeftOffsetForLine(y, lo, false, &heightRemainingLeft) < fwidth) {
y += min(heightRemainingLeft, heightRemainingRight);
- fx = rightRelOffset(y, ro, false, &heightRemainingRight);
+ fx = logicalRightOffsetForLine(y, ro, false, &heightRemainingRight);
}
f->m_left = fx - f->m_width;
o->setLocation(fx - o->marginRight() - o->width(), y + o->marginTop());
@@ -3132,7 +3133,7 @@ bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObjec
}
}
- setHeight(height() + paginationStrut);
+ setLogicalHeight(height() + paginationStrut);
return didPosition;
}
@@ -3156,7 +3157,7 @@ void RenderBlock::newLine(EClear clear)
break;
}
if (height() < newY)
- setHeight(newY);
+ setLogicalHeight(newY);
}
void RenderBlock::addPercentHeightDescendant(RenderBox* descendant)
@@ -3219,12 +3220,12 @@ HashSet<RenderBox*>* RenderBlock::percentHeightDescendants() const
return gPercentHeightDescendantsMap ? gPercentHeightDescendantsMap->get(this) : 0;
}
-int RenderBlock::leftOffset() const
+int RenderBlock::logicalLeftOffsetForContent() const
{
return borderLeft() + paddingLeft();
}
-int RenderBlock::leftRelOffset(int y, int fixedOffset, bool applyTextIndent, int* heightRemaining) const
+int RenderBlock::logicalLeftOffsetForLine(int y, int fixedOffset, bool applyTextIndent, int* heightRemaining) const
{
int left = fixedOffset;
if (m_floatingObjects) {
@@ -3245,19 +3246,19 @@ int RenderBlock::leftRelOffset(int y, int fixedOffset, bool applyTextIndent, int
if (applyTextIndent && style()->direction() == LTR) {
int cw = 0;
if (style()->textIndent().isPercent())
- cw = containingBlock()->availableWidth();
+ cw = containingBlock()->availableLogicalWidth();
left += style()->textIndent().calcMinValue(cw);
}
return left;
}
-int RenderBlock::rightOffset() const
+int RenderBlock::logicalRightOffsetForContent() const
{
- return borderLeft() + paddingLeft() + availableWidth();
+ return borderLeft() + paddingLeft() + availableLogicalWidth();
}
-int RenderBlock::rightRelOffset(int y, int fixedOffset, bool applyTextIndent, int* heightRemaining) const
+int RenderBlock::logicalRightOffsetForLine(int y, int fixedOffset, bool applyTextIndent, int* heightRemaining) const
{
int right = fixedOffset;
@@ -3279,7 +3280,7 @@ int RenderBlock::rightRelOffset(int y, int fixedOffset, bool applyTextIndent, in
if (applyTextIndent && style()->direction() == RTL) {
int cw = 0;
if (style()->textIndent().isPercent())
- cw = containingBlock()->availableWidth();
+ cw = containingBlock()->availableLogicalWidth();
right -= style()->textIndent().calcMinValue(cw);
}
@@ -3287,9 +3288,9 @@ int RenderBlock::rightRelOffset(int y, int fixedOffset, bool applyTextIndent, in
}
int
-RenderBlock::lineWidth(int y, bool firstLine) const
+RenderBlock::availableLogicalWidthForLine(int position, bool firstLine) const
{
- int result = rightOffset(y, firstLine) - leftOffset(y, firstLine);
+ int result = logicalRightOffsetForLine(position, firstLine) - logicalLeftOffsetForLine(position, firstLine);
return (result < 0) ? 0 : result;
}
@@ -3407,7 +3408,7 @@ int RenderBlock::lowestPosition(bool includeOverflowInterior, bool includeSelf)
while (currBox && currBox->isFloatingOrPositioned())
currBox = currBox->previousSiblingBox();
if (currBox) {
- int childBottomEdge = currBox->y() + currBox->height() + currBox->collapsedMarginBottom();
+ int childBottomEdge = currBox->y() + currBox->height() + currBox->collapsedMarginAfter(); // FIXME: "after" is wrong here for lowestPosition.
bottom = max(bottom, childBottomEdge + paddingBottom() + relativeOffset);
}
}
@@ -3495,7 +3496,7 @@ int RenderBlock::rightmostPosition(bool includeOverflowInterior, bool includeSel
right = max(right, borderLeft() + paddingLeft() + paddingRight() + relativeOffset);
if (childrenInline()) {
for (InlineFlowBox* currBox = firstLineBox(); currBox; currBox = currBox->nextLineBox()) {
- int childRightEdge = currBox->x() + currBox->width();
+ int childRightEdge = currBox->x() + currBox->logicalWidth();
// If this node is a root editable element, then the rightmostPosition should account for a caret at the end.
// FIXME: Need to find another way to do this, since scrollbars could show when we don't want them to.
@@ -3748,7 +3749,7 @@ void RenderBlock::clearFloats()
int RenderBlock::addOverhangingFloats(RenderBlock* child, int xoff, int yoff, bool makeChildPaintOtherFloats)
{
// Prevent floats from being added to the canvas by the root element, e.g., <html>.
- if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot() || child->hasColumns())
+ if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot() || child->hasColumns() || child->isBlockFlowRoot())
return 0;
int lowestFloatBottom = 0;
@@ -3950,20 +3951,20 @@ int RenderBlock::getClearDelta(RenderBox* child, int yPos)
// We also clear floats if we are too big to sit on the same line as a float (and wish to avoid floats by default).
int result = clearSet ? max(0, bottom - yPos) : 0;
if (!result && child->avoidsFloats()) {
- int availableWidth = this->availableWidth();
- if (child->minPrefWidth() > availableWidth)
+ int availableWidth = availableLogicalWidth();
+ if (child->minPreferredLogicalWidth() > availableWidth)
return 0;
int y = yPos;
while (true) {
- int widthAtY = lineWidth(y, false);
+ int widthAtY = availableLogicalWidthForLine(y, false);
if (widthAtY == availableWidth)
return y - yPos;
int oldChildY = child->y();
int oldChildWidth = child->width();
child->setY(y);
- child->calcWidth();
+ child->computeLogicalWidth();
int childWidthAtY = child->width();
child->setY(oldChildY);
child->setWidth(oldChildWidth);
@@ -4315,14 +4316,6 @@ void RenderBlock::offsetForContents(int& tx, int& ty) const
ty = contentsPoint.y();
}
-int RenderBlock::availableWidth() const
-{
- // If we have multiple columns, then the available width is reduced to our column width.
- if (hasColumns())
- return desiredColumnWidth();
- return RenderBox::availableWidth();
-}
-
int RenderBlock::availableLogicalWidth() const
{
// If we have multiple columns, then the available logical width is reduced to our column width.
@@ -4496,7 +4489,7 @@ bool RenderBlock::layoutColumns(bool hasSpecifiedPageHeight, int pageHeight, Lay
int overflowRight = style()->direction() == LTR ? max(width(), lastRect.x() + lastRect.width()) : 0;
int overflowHeight = borderTop() + paddingTop() + colInfo->columnHeight();
- setHeight(overflowHeight + borderBottom() + paddingBottom() + horizontalScrollbarHeight());
+ setLogicalHeight(overflowHeight + borderBottom() + paddingBottom() + horizontalScrollbarHeight());
m_overflow.clear();
addLayoutOverflow(IntRect(overflowLeft, 0, overflowRight - overflowLeft, overflowHeight));
@@ -4608,48 +4601,48 @@ void RenderBlock::adjustForColumns(IntSize& offset, const IntPoint& point) const
}
}
-void RenderBlock::calcPrefWidths()
+void RenderBlock::computePreferredLogicalWidths()
{
- ASSERT(prefWidthsDirty());
+ ASSERT(preferredLogicalWidthsDirty());
updateFirstLetter();
if (!isTableCell() && style()->width().isFixed() && style()->width().value() > 0)
- m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value());
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value());
else {
- m_minPrefWidth = 0;
- m_maxPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
+ m_maxPreferredLogicalWidth = 0;
if (childrenInline())
- calcInlinePrefWidths();
+ computeInlinePreferredLogicalWidths();
else
- calcBlockPrefWidths();
+ computeBlockPreferredLogicalWidths();
- m_maxPrefWidth = max(m_minPrefWidth, m_maxPrefWidth);
+ m_maxPreferredLogicalWidth = max(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
if (!style()->autoWrap() && childrenInline()) {
- m_minPrefWidth = m_maxPrefWidth;
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
// A horizontal marquee with inline children has no minimum width.
if (layer() && layer()->marquee() && layer()->marquee()->isHorizontal())
- m_minPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
}
if (isTableCell()) {
Length w = toRenderTableCell(this)->styleOrColWidth();
if (w.isFixed() && w.value() > 0)
- m_maxPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(w.value()));
+ m_maxPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(w.value()));
}
}
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
- m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
- m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
+ m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
+ m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
}
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
- m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
- m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
+ m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
}
int toAdd = 0;
@@ -4658,10 +4651,10 @@ void RenderBlock::calcPrefWidths()
if (hasOverflowClip() && style()->overflowY() == OSCROLL)
toAdd += verticalScrollbarWidth();
- m_minPrefWidth += toAdd;
- m_maxPrefWidth += toAdd;
+ m_minPreferredLogicalWidth += toAdd;
+ m_maxPreferredLogicalWidth += toAdd;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
struct InlineMinMaxIterator {
@@ -4765,7 +4758,7 @@ static inline void stripTrailingSpace(int& inlineMax, int& inlineMin,
}
}
-void RenderBlock::calcInlinePrefWidths()
+void RenderBlock::computeInlinePreferredLogicalWidths()
{
int inlineMax = 0;
int inlineMin = 0;
@@ -4844,7 +4837,7 @@ void RenderBlock::calcInlinePrefWidths()
inlineMin += childMin;
inlineMax += childMax;
- child->setPrefWidthsDirty(false);
+ child->setPreferredLogicalWidthsDirty(false);
} else {
// Inline replaced elts add in their margins to their min/max values.
int margins = 0;
@@ -4863,8 +4856,8 @@ void RenderBlock::calcInlinePrefWidths()
// Case (2). Inline replaced elements and floats.
// Go ahead and terminate the current line as far as
// minwidth is concerned.
- childMin += child->minPrefWidth();
- childMax += child->maxPrefWidth();
+ childMin += child->minPreferredLogicalWidth();
+ childMax += child->maxPreferredLogicalWidth();
bool clearPreviousFloat;
if (child->isFloating()) {
@@ -4877,13 +4870,13 @@ void RenderBlock::calcInlinePrefWidths()
bool canBreakReplacedElement = !child->isImage() || allowImagesToBreak;
if ((canBreakReplacedElement && (autoWrap || oldAutoWrap)) || clearPreviousFloat) {
- m_minPrefWidth = max(inlineMin, m_minPrefWidth);
+ m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth);
inlineMin = 0;
}
// If we're supposed to clear the previous float, then terminate maxwidth as well.
if (clearPreviousFloat) {
- m_maxPrefWidth = max(inlineMax, m_maxPrefWidth);
+ m_maxPreferredLogicalWidth = max(inlineMax, m_maxPreferredLogicalWidth);
inlineMax = 0;
}
@@ -4901,12 +4894,12 @@ void RenderBlock::calcInlinePrefWidths()
if (!autoWrap || !canBreakReplacedElement) {
if (child->isFloating())
- m_minPrefWidth = max(childMin, m_minPrefWidth);
+ m_minPreferredLogicalWidth = max(childMin, m_minPreferredLogicalWidth);
else
inlineMin += childMin;
} else {
// Now check our line.
- m_minPrefWidth = max(childMin, m_minPrefWidth);
+ m_minPreferredLogicalWidth = max(childMin, m_minPreferredLogicalWidth);
// Now start a new line.
inlineMin = 0;
@@ -4923,7 +4916,7 @@ void RenderBlock::calcInlinePrefWidths()
RenderText* t = toRenderText(child);
if (t->isWordBreak()) {
- m_minPrefWidth = max(inlineMin, m_minPrefWidth);
+ m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth);
inlineMin = 0;
continue;
}
@@ -4944,7 +4937,7 @@ void RenderBlock::calcInlinePrefWidths()
// This text object will not be rendered, but it may still provide a breaking opportunity.
if (!hasBreak && childMax == 0) {
if (autoWrap && (beginWS || endWS)) {
- m_minPrefWidth = max(inlineMin, m_minPrefWidth);
+ m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth);
inlineMin = 0;
}
continue;
@@ -4974,10 +4967,10 @@ void RenderBlock::calcInlinePrefWidths()
// we start and end with whitespace.
if (beginWS)
// Go ahead and end the current line.
- m_minPrefWidth = max(inlineMin, m_minPrefWidth);
+ m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth);
else {
inlineMin += beginMin;
- m_minPrefWidth = max(inlineMin, m_minPrefWidth);
+ m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth);
childMin -= ti;
}
@@ -4986,18 +4979,18 @@ void RenderBlock::calcInlinePrefWidths()
if (endWS) {
// We end in whitespace, which means we can go ahead
// and end our current line.
- m_minPrefWidth = max(inlineMin, m_minPrefWidth);
+ m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth);
inlineMin = 0;
} else {
- m_minPrefWidth = max(inlineMin, m_minPrefWidth);
+ m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth);
inlineMin = endMin;
}
}
if (hasBreak) {
inlineMax += beginMax;
- m_maxPrefWidth = max(inlineMax, m_maxPrefWidth);
- m_maxPrefWidth = max(childMax, m_maxPrefWidth);
+ m_maxPreferredLogicalWidth = max(inlineMax, m_maxPreferredLogicalWidth);
+ m_maxPreferredLogicalWidth = max(childMax, m_maxPreferredLogicalWidth);
inlineMax = endMax;
} else
inlineMax += childMax;
@@ -5007,8 +5000,8 @@ void RenderBlock::calcInlinePrefWidths()
if (child->isListMarker())
stripFrontSpaces = true;
} else {
- m_minPrefWidth = max(inlineMin, m_minPrefWidth);
- m_maxPrefWidth = max(inlineMax, m_maxPrefWidth);
+ m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth);
+ m_maxPreferredLogicalWidth = max(inlineMax, m_maxPreferredLogicalWidth);
inlineMin = inlineMax = 0;
stripFrontSpaces = true;
trailingSpaceChild = 0;
@@ -5020,14 +5013,14 @@ void RenderBlock::calcInlinePrefWidths()
if (style()->collapseWhiteSpace())
stripTrailingSpace(inlineMax, inlineMin, trailingSpaceChild);
- m_minPrefWidth = max(inlineMin, m_minPrefWidth);
- m_maxPrefWidth = max(inlineMax, m_maxPrefWidth);
+ m_minPreferredLogicalWidth = max(inlineMin, m_minPreferredLogicalWidth);
+ m_maxPreferredLogicalWidth = max(inlineMax, m_maxPreferredLogicalWidth);
}
// Use a very large value (in effect infinite).
#define BLOCK_MAX_WIDTH 15000
-void RenderBlock::calcBlockPrefWidths()
+void RenderBlock::computeBlockPreferredLogicalWidths()
{
bool nowrap = style()->whiteSpace() == NOWRAP;
@@ -5043,11 +5036,11 @@ void RenderBlock::calcBlockPrefWidths()
if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoidsFloats())) {
int floatTotalWidth = floatLeftWidth + floatRightWidth;
if (child->style()->clear() & CLEFT) {
- m_maxPrefWidth = max(floatTotalWidth, m_maxPrefWidth);
+ m_maxPreferredLogicalWidth = max(floatTotalWidth, m_maxPreferredLogicalWidth);
floatLeftWidth = 0;
}
if (child->style()->clear() & CRIGHT) {
- m_maxPrefWidth = max(floatTotalWidth, m_maxPrefWidth);
+ m_maxPreferredLogicalWidth = max(floatTotalWidth, m_maxPreferredLogicalWidth);
floatRightWidth = 0;
}
}
@@ -5064,14 +5057,14 @@ void RenderBlock::calcBlockPrefWidths()
marginRight += mr.value();
margin = marginLeft + marginRight;
- int w = child->minPrefWidth() + margin;
- m_minPrefWidth = max(w, m_minPrefWidth);
+ int w = child->minPreferredLogicalWidth() + margin;
+ m_minPreferredLogicalWidth = max(w, m_minPreferredLogicalWidth);
// IE ignores tables for calculation of nowrap. Makes some sense.
if (nowrap && !child->isTable())
- m_maxPrefWidth = max(w, m_maxPrefWidth);
+ m_maxPreferredLogicalWidth = max(w, m_maxPreferredLogicalWidth);
- w = child->maxPrefWidth() + margin;
+ w = child->maxPreferredLogicalWidth() + margin;
if (!child->isFloating()) {
if (child->isBox() && toRenderBox(child)->avoidsFloats()) {
@@ -5080,11 +5073,11 @@ void RenderBlock::calcBlockPrefWidths()
// is smaller than the float width.
int maxLeft = marginLeft > 0 ? max(floatLeftWidth, marginLeft) : floatLeftWidth + marginLeft;
int maxRight = marginRight > 0 ? max(floatRightWidth, marginRight) : floatRightWidth + marginRight;
- w = child->maxPrefWidth() + maxLeft + maxRight;
+ w = child->maxPreferredLogicalWidth() + maxLeft + maxRight;
w = max(w, floatLeftWidth + floatRightWidth);
}
else
- m_maxPrefWidth = max(floatLeftWidth + floatRightWidth, m_maxPrefWidth);
+ m_maxPreferredLogicalWidth = max(floatLeftWidth + floatRightWidth, m_maxPreferredLogicalWidth);
floatLeftWidth = floatRightWidth = 0;
}
@@ -5094,7 +5087,7 @@ void RenderBlock::calcBlockPrefWidths()
else
floatRightWidth += w;
} else
- m_maxPrefWidth = max(w, m_maxPrefWidth);
+ m_maxPreferredLogicalWidth = max(w, m_maxPreferredLogicalWidth);
// A very specific WinIE quirk.
// Example:
@@ -5110,22 +5103,22 @@ void RenderBlock::calcBlockPrefWidths()
// We can achieve this effect by making the maxwidth of blocks that contain tables
// with percentage widths be infinite (as long as they are not inside a table cell).
if (document()->inQuirksMode() && child->style()->width().isPercent() &&
- !isTableCell() && child->isTable() && m_maxPrefWidth < BLOCK_MAX_WIDTH) {
+ !isTableCell() && child->isTable() && m_maxPreferredLogicalWidth < BLOCK_MAX_WIDTH) {
RenderBlock* cb = containingBlock();
while (!cb->isRenderView() && !cb->isTableCell())
cb = cb->containingBlock();
if (!cb->isTableCell())
- m_maxPrefWidth = BLOCK_MAX_WIDTH;
+ m_maxPreferredLogicalWidth = BLOCK_MAX_WIDTH;
}
child = child->nextSibling();
}
// Always make sure these values are non-negative.
- m_minPrefWidth = max(0, m_minPrefWidth);
- m_maxPrefWidth = max(0, m_maxPrefWidth);
+ m_minPreferredLogicalWidth = max(0, m_minPreferredLogicalWidth);
+ m_maxPreferredLogicalWidth = max(0, m_maxPreferredLogicalWidth);
- m_maxPrefWidth = max(floatLeftWidth + floatRightWidth, m_maxPrefWidth);
+ m_maxPreferredLogicalWidth = max(floatLeftWidth + floatRightWidth, m_maxPreferredLogicalWidth);
}
bool RenderBlock::hasLineIfEmpty() const
@@ -5537,7 +5530,7 @@ void RenderBlock::adjustForBorderFit(int x, int& left, int& right) const
if (box->firstChild())
left = min(left, x + box->firstChild()->x());
if (box->lastChild())
- right = max(right, x + box->lastChild()->x() + box->lastChild()->width());
+ right = max(right, x + box->lastChild()->x() + box->lastChild()->logicalWidth());
}
}
else {
@@ -5609,26 +5602,26 @@ void RenderBlock::clearTruncation()
}
}
-void RenderBlock::setMaxTopMargins(int pos, int neg)
+void RenderBlock::setMaxMarginBeforeValues(int pos, int neg)
{
if (!m_rareData) {
- if (pos == RenderBlockRareData::topPosDefault(this) && neg == RenderBlockRareData::topNegDefault(this))
+ if (pos == RenderBlockRareData::beforePosDefault(this) && neg == RenderBlockRareData::beforeNegDefault(this))
return;
m_rareData = new RenderBlockRareData(this);
}
- m_rareData->m_topPos = pos;
- m_rareData->m_topNeg = neg;
+ m_rareData->m_beforePos = pos;
+ m_rareData->m_beforeNeg = neg;
}
-void RenderBlock::setMaxBottomMargins(int pos, int neg)
+void RenderBlock::setMaxMarginAfterValues(int pos, int neg)
{
if (!m_rareData) {
- if (pos == RenderBlockRareData::bottomPosDefault(this) && neg == RenderBlockRareData::bottomNegDefault(this))
+ if (pos == RenderBlockRareData::afterPosDefault(this) && neg == RenderBlockRareData::afterNegDefault(this))
return;
m_rareData = new RenderBlockRareData(this);
}
- m_rareData->m_bottomPos = pos;
- m_rareData->m_bottomNeg = neg;
+ m_rareData->m_afterPos = pos;
+ m_rareData->m_afterNeg = neg;
}
void RenderBlock::setPaginationStrut(int strut)
@@ -5657,8 +5650,10 @@ void RenderBlock::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
// inline boxes above and below us (thus getting merged with them to form a single irregular
// shape).
if (isAnonymousBlockContinuation()) {
- rects.append(IntRect(tx, ty - collapsedMarginTop(),
- width(), height() + collapsedMarginTop() + collapsedMarginBottom()));
+ // FIXME: This is wrong for block-flows that are horizontal.
+ // https://bugs.webkit.org/show_bug.cgi?id=46781
+ rects.append(IntRect(tx, ty - collapsedMarginBefore(),
+ width(), height() + collapsedMarginBefore() + collapsedMarginAfter()));
continuation()->absoluteRects(rects,
tx - x() + inlineElementContinuation()->containingBlock()->x(),
ty - y() + inlineElementContinuation()->containingBlock()->y());
@@ -5672,8 +5667,10 @@ void RenderBlock::absoluteQuads(Vector<FloatQuad>& quads)
// inline boxes above and below us (thus getting merged with them to form a single irregular
// shape).
if (isAnonymousBlockContinuation()) {
- FloatRect localRect(0, -collapsedMarginTop(),
- width(), height() + collapsedMarginTop() + collapsedMarginBottom());
+ // FIXME: This is wrong for block-flows that are horizontal.
+ // https://bugs.webkit.org/show_bug.cgi?id=46781
+ FloatRect localRect(0, -collapsedMarginBefore(),
+ width(), height() + collapsedMarginBefore() + collapsedMarginAfter());
quads.append(localToAbsoluteQuad(localRect));
continuation()->absoluteQuads(quads);
} else
@@ -5684,7 +5681,7 @@ IntRect RenderBlock::rectWithOutlineForRepaint(RenderBoxModelObject* repaintCont
{
IntRect r(RenderBox::rectWithOutlineForRepaint(repaintContainer, outlineWidth));
if (isAnonymousBlockContinuation())
- r.inflateY(collapsedMarginTop());
+ r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for block-flows that are horizontal.
return r;
}
@@ -5799,7 +5796,7 @@ IntRect RenderBlock::localCaretRect(InlineBox* inlineBox, int caretOffset, int*
// FIXME: why call localToAbsoluteForContent() twice here, too?
FloatPoint absRightPoint = localToAbsolute(FloatPoint(myRight, 0));
- int containerRight = containingBlock()->x() + containingBlockWidthForContent();
+ int containerRight = containingBlock()->x() + containingBlockLogicalWidthForContent();
FloatPoint absContainerPoint = localToAbsolute(FloatPoint(containerRight, 0));
*extraWidthToEndOfLine = absContainerPoint.x() - absRightPoint.x();
@@ -5820,9 +5817,11 @@ void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty)
// FIXME: This check really isn't accurate.
bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox();
// FIXME: This is wrong. The principal renderer may not be the continuation preceding this block.
+ // FIXME: This is wrong for block-flows that are horizontal.
+ // https://bugs.webkit.org/show_bug.cgi?id=46781
bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->node()->renderer())->firstLineBox();
- int topMargin = prevInlineHasLineBox ? collapsedMarginTop() : 0;
- int bottomMargin = nextInlineHasLineBox ? collapsedMarginBottom() : 0;
+ int topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : 0;
+ int bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : 0;
IntRect rect(tx, ty - topMargin, width(), height() + topMargin + bottomMargin);
if (!rect.isEmpty())
rects.append(rect);
@@ -5832,8 +5831,8 @@ void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty)
if (!hasOverflowClip() && !hasControlClip()) {
for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
int top = max(curr->lineTop(), curr->y());
- int bottom = min(curr->lineBottom(), curr->y() + curr->height());
- IntRect rect(tx + curr->x(), ty + top, curr->width(), bottom - top);
+ int bottom = min(curr->lineBottom(), curr->y() + curr->logicalHeight());
+ IntRect rect(tx + curr->x(), ty + top, curr->logicalWidth(), bottom - top);
if (!rect.isEmpty())
rects.append(rect);
}
@@ -5956,7 +5955,7 @@ int RenderBlock::applyAfterBreak(RenderBox* child, int yPos, MarginInfo& marginI
bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageHeight; // FIXME: Once columns can print we have to check this.
bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAfter() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS);
if (checkAfterAlways && inNormalFlow(child)) {
- marginInfo.setBottomQuirk(true); // Cause margins to be discarded for any following content.
+ marginInfo.setMarginAfterQuirk(true); // Cause margins to be discarded for any following content.
if (checkColumnBreaks)
view()->layoutState()->addForcedColumnBreak(yPos);
return nextPageTop(yPos);
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index b26c28c..0682039 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -102,19 +102,17 @@ public:
bool containsFloats() { return m_floatingObjects && !m_floatingObjects->isEmpty(); }
bool containsFloat(RenderObject*);
- int lineWidth(int y, bool firstLine) const;
+ int availableLogicalWidthForLine(int position, bool firstLine) const;
+ int logicalRightOffsetForLine(int position, bool firstLine) const { return logicalRightOffsetForLine(position, logicalRightOffsetForContent(), firstLine); }
+ int logicalLeftOffsetForLine(int position, bool firstLine) const { return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(), firstLine); }
virtual int lowestPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
virtual int rightmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
virtual int leftmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
-
- int rightOffset(int y, bool firstLine) const { return rightRelOffset(y, rightOffset(), firstLine); }
- int leftOffset(int y, bool firstLine) const { return leftRelOffset(y, leftOffset(), firstLine); }
-
+
virtual VisiblePosition positionForPoint(const IntPoint&);
// Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.)
- virtual int availableWidth() const; // FIXME: Should be possible to remove this. See https://bugs.webkit.org/show_bug.cgi?id=46127
virtual int availableLogicalWidth() const;
RootInlineBox* firstRootBox() const { return static_cast<RootInlineBox*>(firstLineBox()); }
@@ -196,21 +194,21 @@ protected:
}
void moveChildrenTo(RenderBlock* to, RenderObject* startChild, RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInsert = false);
- int maxTopPosMargin() const { return m_rareData ? m_rareData->m_topPos : RenderBlockRareData::topPosDefault(this); }
- int maxTopNegMargin() const { return m_rareData ? m_rareData->m_topNeg : RenderBlockRareData::topNegDefault(this); }
- int maxBottomPosMargin() const { return m_rareData ? m_rareData->m_bottomPos : RenderBlockRareData::bottomPosDefault(this); }
- int maxBottomNegMargin() const { return m_rareData ? m_rareData->m_bottomNeg : RenderBlockRareData::bottomNegDefault(this); }
+ int maxPosMarginBefore() const { return m_rareData ? m_rareData->m_beforePos : RenderBlockRareData::beforePosDefault(this); }
+ int maxNegMarginBefore() const { return m_rareData ? m_rareData->m_beforeNeg : RenderBlockRareData::beforeNegDefault(this); }
+ int maxPosMarginAfter() const { return m_rareData ? m_rareData->m_afterPos : RenderBlockRareData::afterPosDefault(this); }
+ int maxNegMarginAfter() const { return m_rareData ? m_rareData->m_afterNeg : RenderBlockRareData::afterNegDefault(this); }
- void setMaxTopMargins(int pos, int neg);
- void setMaxBottomMargins(int pos, int neg);
+ void setMaxMarginBeforeValues(int pos, int neg);
+ void setMaxMarginAfterValues(int pos, int neg);
void initMaxMarginValues()
{
if (m_rareData) {
- m_rareData->m_topPos = RenderBlockRareData::topPosDefault(this);
- m_rareData->m_topNeg = RenderBlockRareData::topNegDefault(this);
- m_rareData->m_bottomPos = RenderBlockRareData::bottomPosDefault(this);
- m_rareData->m_bottomNeg = RenderBlockRareData::bottomNegDefault(this);
+ m_rareData->m_beforePos = RenderBlockRareData::beforePosDefault(this);
+ m_rareData->m_beforeNeg = RenderBlockRareData::beforeNegDefault(this);
+ m_rareData->m_afterPos = RenderBlockRareData::afterPosDefault(this);
+ m_rareData->m_afterNeg = RenderBlockRareData::afterNegDefault(this);
m_rareData->m_paginationStrut = 0;
}
}
@@ -222,12 +220,14 @@ protected:
virtual void paint(PaintInfo&, int tx, int ty);
virtual void paintObject(PaintInfo&, int tx, int ty);
- int rightRelOffset(int y, int fixedOffset, bool applyTextIndent = true, int* heightRemaining = 0) const;
- int leftRelOffset(int y, int fixedOffset, bool applyTextIndent = true, int* heightRemaining = 0) const;
+ int logicalRightOffsetForContent() const;
+ int logicalLeftOffsetForContent() const;
+ int logicalRightOffsetForLine(int position, int fixedOffset, bool applyTextIndent = true, int* logicalHeightRemaining = 0) const;
+ int logicalLeftOffsetForLine(int position, int fixedOffset, bool applyTextIndent = true, int* logicalHeightRemaining = 0) const;
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
virtual int firstLineBoxBaseline() const;
virtual int lastLineBoxBaseline() const;
@@ -284,8 +284,14 @@ private:
virtual bool isSelfCollapsingBlock() const;
- virtual int maxTopMargin(bool positive) const { return positive ? maxTopPosMargin() : maxTopNegMargin(); }
- virtual int maxBottomMargin(bool positive) const { return positive ? maxBottomPosMargin() : maxBottomNegMargin(); }
+ virtual int maxMarginBefore(MarginSign sign) const
+ {
+ return (sign == PositiveMargin) ? maxPosMarginBefore() : maxNegMarginBefore();
+ }
+ virtual int maxMarginAfter(MarginSign sign) const
+ {
+ return (sign == PositiveMargin) ? maxPosMarginAfter() : maxNegMarginAfter();
+ }
virtual void repaintOverhangingFloats(bool paintAllDescendants);
@@ -364,8 +370,8 @@ private:
InlineIterator findNextLineBreak(InlineBidiResolver&, bool firstLine, bool& isLineEmpty, bool& previousLineBrokeCleanly, bool& hyphenated, EClear*, FloatingObject* lastFloatFromPreviousLine);
RootInlineBox* constructLine(unsigned runCount, BidiRun* firstRun, BidiRun* lastRun, bool firstLine, bool lastLine, RenderObject* endObject);
InlineFlowBox* createLineBoxes(RenderObject*, bool firstLine);
- void computeHorizontalPositionsForLine(RootInlineBox*, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&);
- void computeVerticalPositionsForLine(RootInlineBox*, BidiRun*, GlyphOverflowAndFallbackFontsMap&);
+ void computeInlineDirectionPositionsForLine(RootInlineBox*, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&);
+ void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOverflowAndFallbackFontsMap&);
void deleteEllipsisLineBoxes();
void checkLinesForTextOverflow();
void addOverflowFromInlineChildren();
@@ -409,16 +415,14 @@ private:
inline int leftBottom();
inline int rightBottom();
- int rightOffset() const;
- int leftOffset() const;
virtual bool hitTestColumns(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
virtual bool hitTestContents(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
bool hitTestFloats(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty);
virtual bool isPointInOverflowControl(HitTestResult&, int x, int y, int tx, int ty);
- void calcInlinePrefWidths();
- void calcBlockPrefWidths();
+ void computeInlinePreferredLogicalWidths();
+ void computeBlockPreferredLogicalWidths();
// Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline
// children.
@@ -496,8 +500,8 @@ private:
class MarginInfo {
// Collapsing flags for whether we can collapse our margins with our children's margins.
bool m_canCollapseWithChildren : 1;
- bool m_canCollapseTopWithChildren : 1;
- bool m_canCollapseBottomWithChildren : 1;
+ bool m_canCollapseMarginBeforeWithChildren : 1;
+ bool m_canCollapseMarginAfterWithChildren : 1;
// Whether or not we are a quirky container, i.e., do we collapse away top and bottom
// margins in our container. Table cells and the body are the common examples. We
@@ -508,30 +512,30 @@ private:
// They may or may not collapse with the top margin of the block (|m_canCollapseTopWithChildren| tells us that), but they will
// always be collapsing with one another. This variable can remain set to true through multiple iterations
// as long as we keep encountering self-collapsing blocks.
- bool m_atTopOfBlock : 1;
+ bool m_atBeforeSideOfBlock : 1;
// This flag is set when we know we're examining bottom margins and we know we're at the bottom of the block.
- bool m_atBottomOfBlock : 1;
+ bool m_atAfterSideOfBlock : 1;
// These variables are used to detect quirky margins that we need to collapse away (in table cells
// and in the body element).
- bool m_topQuirk : 1;
- bool m_bottomQuirk : 1;
- bool m_determinedTopQuirk : 1;
+ bool m_marginBeforeQuirk : 1;
+ bool m_marginAfterQuirk : 1;
+ bool m_determinedMarginBeforeQuirk : 1;
// These flags track the previous maximal positive and negative margins.
int m_posMargin;
int m_negMargin;
public:
- MarginInfo(RenderBlock* b, int top, int bottom);
+ MarginInfo(RenderBlock* b, int beforeBorderPadding, int afterBorderPadding);
- void setAtTopOfBlock(bool b) { m_atTopOfBlock = b; }
- void setAtBottomOfBlock(bool b) { m_atBottomOfBlock = b; }
+ void setAtBeforeSideOfBlock(bool b) { m_atBeforeSideOfBlock = b; }
+ void setAtAfterSideOfBlock(bool b) { m_atAfterSideOfBlock = b; }
void clearMargin() { m_posMargin = m_negMargin = 0; }
- void setTopQuirk(bool b) { m_topQuirk = b; }
- void setBottomQuirk(bool b) { m_bottomQuirk = b; }
- void setDeterminedTopQuirk(bool b) { m_determinedTopQuirk = b; }
+ void setMarginBeforeQuirk(bool b) { m_marginBeforeQuirk = b; }
+ void setMarginAfterQuirk(bool b) { m_marginAfterQuirk = b; }
+ void setDeterminedMarginBeforeQuirk(bool b) { m_determinedMarginBeforeQuirk = b; }
void setPosMargin(int p) { m_posMargin = p; }
void setNegMargin(int n) { m_negMargin = n; }
void setPosMarginIfLarger(int p) { if (p > m_posMargin) m_posMargin = p; }
@@ -539,15 +543,15 @@ private:
void setMargin(int p, int n) { m_posMargin = p; m_negMargin = n; }
- bool atTopOfBlock() const { return m_atTopOfBlock; }
- bool canCollapseWithTop() const { return m_atTopOfBlock && m_canCollapseTopWithChildren; }
- bool canCollapseWithBottom() const { return m_atBottomOfBlock && m_canCollapseBottomWithChildren; }
- bool canCollapseTopWithChildren() const { return m_canCollapseTopWithChildren; }
- bool canCollapseBottomWithChildren() const { return m_canCollapseBottomWithChildren; }
+ bool atBeforeSideOfBlock() const { return m_atBeforeSideOfBlock; }
+ bool canCollapseWithMarginBefore() const { return m_atBeforeSideOfBlock && m_canCollapseMarginBeforeWithChildren; }
+ bool canCollapseWithMarginAfter() const { return m_atAfterSideOfBlock && m_canCollapseMarginAfterWithChildren; }
+ bool canCollapseMarginBeforeWithChildren() const { return m_canCollapseMarginBeforeWithChildren; }
+ bool canCollapseMarginAfterWithChildren() const { return m_canCollapseMarginAfterWithChildren; }
bool quirkContainer() const { return m_quirkContainer; }
- bool determinedTopQuirk() const { return m_determinedTopQuirk; }
- bool topQuirk() const { return m_topQuirk; }
- bool bottomQuirk() const { return m_bottomQuirk; }
+ bool determinedMarginBeforeQuirk() const { return m_determinedMarginBeforeQuirk; }
+ bool marginBeforeQuirk() const { return m_marginBeforeQuirk; }
+ bool marginAfterQuirk() const { return m_marginAfterQuirk; }
int posMargin() const { return m_posMargin; }
int negMargin() const { return m_negMargin; }
int margin() const { return m_posMargin - m_negMargin; }
@@ -588,25 +592,38 @@ private:
// Allocated only when some of these fields have non-default values
struct RenderBlockRareData : Noncopyable {
- RenderBlockRareData(const RenderBlock* o)
- : m_topPos(topPosDefault(o))
- , m_topNeg(topNegDefault(o))
- , m_bottomPos(bottomPosDefault(o))
- , m_bottomNeg(bottomNegDefault(o))
+ RenderBlockRareData(const RenderBlock* block)
+ : m_beforePos(beforePosDefault(block))
+ , m_beforeNeg(beforeNegDefault(block))
+ , m_afterPos(afterPosDefault(block))
+ , m_afterNeg(afterNegDefault(block))
, m_paginationStrut(0)
, m_pageY(0)
{
}
- static int topPosDefault(const RenderBlock* o) { return o->marginTop() > 0 ? o->marginTop() : 0; }
- static int topNegDefault(const RenderBlock* o) { return o->marginTop() < 0 ? -o->marginTop() : 0; }
- static int bottomPosDefault(const RenderBlock* o) { return o->marginBottom() > 0 ? o->marginBottom() : 0; }
- static int bottomNegDefault(const RenderBlock* o) { return o->marginBottom() < 0 ? -o->marginBottom() : 0; }
+ static int beforePosDefault(const RenderBlock* block)
+ {
+ return std::max(block->marginBefore(), 0);
+ }
+
+ static int beforeNegDefault(const RenderBlock* block)
+ {
+ return std::max(-block->marginBefore(), 0);
+ }
+ static int afterPosDefault(const RenderBlock* block)
+ {
+ return std::max(block->marginAfter(), 0);
+ }
+ static int afterNegDefault(const RenderBlock* block)
+ {
+ return std::max(-block->marginAfter(), 0);
+ }
- int m_topPos;
- int m_topNeg;
- int m_bottomPos;
- int m_bottomNeg;
+ int m_beforePos;
+ int m_beforeNeg;
+ int m_afterPos;
+ int m_afterNeg;
int m_paginationStrut;
int m_pageY;
};
diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp
index c43f2a8..5076450 100644
--- a/WebCore/rendering/RenderBlockLineLayout.cpp
+++ b/WebCore/rendering/RenderBlockLineLayout.cpp
@@ -86,20 +86,6 @@ static int inlineWidth(RenderObject* child, bool start = true, bool end = true)
return extraWidth;
}
-static void chopMidpointsAt(LineMidpointState& lineMidpointState, RenderObject* obj, unsigned pos)
-{
- if (!lineMidpointState.numMidpoints)
- return;
- InlineIterator* midpoints = lineMidpointState.midpoints.data();
- for (int i = lineMidpointState.numMidpoints - 1; i >= 0; i--) {
- const InlineIterator& point = midpoints[i];
- if (point.obj == obj && point.pos == pos) {
- lineMidpointState.numMidpoints = i;
- break;
- }
- }
-}
-
static void checkMidpoints(LineMidpointState& lineMidpointState, InlineIterator& lBreak)
{
// Check to see if our last midpoint is a start point beyond the line break. If so,
@@ -115,21 +101,8 @@ static void checkMidpoints(LineMidpointState& lineMidpointState, InlineIterator&
if (currpoint == lBreak) {
// We hit the line break before the start point. Shave off the start point.
lineMidpointState.numMidpoints--;
- if (endpoint.obj->style()->collapseWhiteSpace()) {
- if (endpoint.obj->isText()) {
- // Don't shave a character off the endpoint if it was from a soft hyphen.
- RenderText* textObj = toRenderText(endpoint.obj);
- if (endpoint.pos + 1 < textObj->textLength()) {
- if (textObj->characters()[endpoint.pos+1] == softHyphen)
- return;
- } else if (startpoint.obj->isText()) {
- RenderText *startText = toRenderText(startpoint.obj);
- if (startText->textLength() && startText->characters()[0] == softHyphen)
- return;
- }
- }
+ if (endpoint.obj->style()->collapseWhiteSpace())
endpoint.pos--;
- }
}
}
}
@@ -209,8 +182,8 @@ static inline InlineBox* createInlineBoxForRenderer(RenderObject* obj, bool isRo
static inline void dirtyLineBoxesForRenderer(RenderObject* o, bool fullLayout)
{
if (o->isText()) {
- if (o->prefWidthsDirty() && o->isCounter())
- toRenderText(o)->calcPrefWidths(0); // FIXME: Counters depend on this hack. No clue why. Should be investigated and removed.
+ if (o->preferredLogicalWidthsDirty() && o->isCounter())
+ toRenderText(o)->computePreferredLogicalWidths(0); // FIXME: Counters depend on this hack. No clue why. Should be investigated and removed.
toRenderText(o)->dirtyLineBoxes(fullLayout);
} else
toRenderInline(o)->dirtyLineBoxes(fullLayout);
@@ -327,11 +300,11 @@ RootInlineBox* RenderBlock::constructLine(unsigned runCount, BidiRun* firstRun,
return lastRootBox();
}
-void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
+void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
{
// First determine our total width.
- int availableWidth = lineWidth(height(), firstLine);
- int totWidth = lineBox->getFlowSpacingWidth();
+ int availableWidth = availableLogicalWidthForLine(height(), firstLine);
+ int totWidth = lineBox->getFlowSpacingLogicalWidth();
bool needsWordSpacing = false;
unsigned numSpaces = 0;
ETextAlign textAlign = style()->textAlign();
@@ -365,7 +338,7 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool
const AtomicString& hyphenString = rt->style()->hyphenString();
hyphenWidth = rt->style(firstLine)->font().width(TextRun(hyphenString.characters(), hyphenString.length()));
}
- r->m_box->setWidth(rt->width(r->m_start, r->m_stop - r->m_start, totWidth, firstLine, &fallbackFonts, &glyphOverflow) + hyphenWidth);
+ r->m_box->setLogicalWidth(rt->width(r->m_start, r->m_stop - r->m_start, totWidth, firstLine, &fallbackFonts, &glyphOverflow) + hyphenWidth);
if (!fallbackFonts.isEmpty()) {
ASSERT(r->m_box->isText());
GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(static_cast<InlineTextBox*>(r->m_box), make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).first;
@@ -379,19 +352,19 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool
}
} else if (!r->m_object->isRenderInline()) {
RenderBox* renderBox = toRenderBox(r->m_object);
- renderBox->calcWidth();
- r->m_box->setWidth(renderBox->width());
+ renderBox->computeLogicalWidth();
+ r->m_box->setLogicalWidth(renderBox->width());
totWidth += renderBox->marginLeft() + renderBox->marginRight();
}
- totWidth += r->m_box->width();
+ totWidth += r->m_box->logicalWidth();
}
// Armed with the total width of the line (without justification),
// we now examine our text-align property in order to determine where to position the
// objects horizontally. The total width of the line can be increased if we end up
// justifying text.
- int x = leftOffset(height(), firstLine);
+ int x = logicalLeftOffsetForLine(height(), firstLine);
switch (textAlign) {
case LEFT:
case WEBKIT_LEFT:
@@ -399,10 +372,10 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool
// particular with RTL blocks, wide lines should still spill out to the left.
if (style()->direction() == LTR) {
if (totWidth > availableWidth && trailingSpaceRun)
- trailingSpaceRun->m_box->setWidth(max(0, trailingSpaceRun->m_box->width() - totWidth + availableWidth));
+ trailingSpaceRun->m_box->setLogicalWidth(max(0, trailingSpaceRun->m_box->logicalWidth() - totWidth + availableWidth));
} else {
if (trailingSpaceRun)
- trailingSpaceRun->m_box->setWidth(0);
+ trailingSpaceRun->m_box->setLogicalWidth(0);
else if (totWidth > availableWidth)
x -= (totWidth - availableWidth);
}
@@ -410,8 +383,8 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool
case JUSTIFY:
if (numSpaces && !reachedEnd && !lineBox->endsWithBreak()) {
if (trailingSpaceRun) {
- totWidth -= trailingSpaceRun->m_box->width();
- trailingSpaceRun->m_box->setWidth(0);
+ totWidth -= trailingSpaceRun->m_box->logicalWidth();
+ trailingSpaceRun->m_box->setLogicalWidth(0);
}
break;
}
@@ -421,7 +394,7 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool
// for right to left fall through to right aligned
if (style()->direction() == LTR) {
if (totWidth > availableWidth && trailingSpaceRun)
- trailingSpaceRun->m_box->setWidth(max(0, trailingSpaceRun->m_box->width() - totWidth + availableWidth));
+ trailingSpaceRun->m_box->setLogicalWidth(max(0, trailingSpaceRun->m_box->logicalWidth() - totWidth + availableWidth));
break;
}
case RIGHT:
@@ -431,15 +404,15 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool
// side of the block.
if (style()->direction() == LTR) {
if (trailingSpaceRun) {
- totWidth -= trailingSpaceRun->m_box->width();
- trailingSpaceRun->m_box->setWidth(0);
+ totWidth -= trailingSpaceRun->m_box->logicalWidth();
+ trailingSpaceRun->m_box->setLogicalWidth(0);
}
if (totWidth < availableWidth)
x += availableWidth - totWidth;
} else {
if (totWidth > availableWidth && trailingSpaceRun) {
- trailingSpaceRun->m_box->setWidth(max(0, trailingSpaceRun->m_box->width() - totWidth + availableWidth));
- totWidth -= trailingSpaceRun->m_box->width();
+ trailingSpaceRun->m_box->setLogicalWidth(max(0, trailingSpaceRun->m_box->logicalWidth() - totWidth + availableWidth));
+ totWidth -= trailingSpaceRun->m_box->logicalWidth();
} else
x += availableWidth - totWidth;
}
@@ -448,9 +421,9 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool
case WEBKIT_CENTER:
int trailingSpaceWidth = 0;
if (trailingSpaceRun) {
- totWidth -= trailingSpaceRun->m_box->width();
- trailingSpaceWidth = min(trailingSpaceRun->m_box->width(), (availableWidth - totWidth + 1) / 2);
- trailingSpaceRun->m_box->setWidth(max(0, trailingSpaceWidth));
+ totWidth -= trailingSpaceRun->m_box->logicalWidth();
+ trailingSpaceWidth = min(trailingSpaceRun->m_box->logicalWidth(), (availableWidth - totWidth + 1) / 2);
+ trailingSpaceRun->m_box->setLogicalWidth(max(0, trailingSpaceWidth));
}
if (style()->direction() == LTR)
x += max((availableWidth - totWidth) / 2, 0);
@@ -492,12 +465,12 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool
// The widths of all runs are now known. We can now place every inline box (and
// compute accurate widths for the inline flow boxes).
needsWordSpacing = false;
- lineBox->placeBoxesHorizontally(x, needsWordSpacing, textBoxDataMap);
+ lineBox->placeBoxesInInlineDirection(x, needsWordSpacing, textBoxDataMap);
}
-void RenderBlock::computeVerticalPositionsForLine(RootInlineBox* lineBox, BidiRun* firstRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
+void RenderBlock::computeBlockDirectionPositionsForLine(RootInlineBox* lineBox, BidiRun* firstRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
{
- setHeight(lineBox->verticallyAlignBoxes(height(), textBoxDataMap));
+ setLogicalHeight(lineBox->alignBoxesInBlockDirection(height(), textBoxDataMap));
lineBox->setBlockHeight(height());
// Now make sure we place replaced render objects correctly.
@@ -540,7 +513,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
m_overflow.clear();
- setHeight(borderTop() + paddingTop());
+ setLogicalHeight(borderTop() + paddingTop());
int toAdd = borderBottom() + paddingBottom() + horizontalScrollbarHeight();
// Figure out if we should clear out our line boxes.
@@ -610,7 +583,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
// 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()))
- o->setPrefWidthsDirty(true, false);
+ o->setPreferredLogicalWidthsDirty(true, false);
if (o->isPositioned())
o->containingBlock()->insertPositionedObject(box);
@@ -899,10 +872,10 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
// Now we position all of our text runs horizontally.
if (!isSVGRootInlineBox)
- computeHorizontalPositionsForLine(lineBox, firstLine, resolver.firstRun(), trailingSpaceRun, end.atEnd(), textBoxDataMap);
+ computeInlineDirectionPositionsForLine(lineBox, firstLine, resolver.firstRun(), trailingSpaceRun, end.atEnd(), textBoxDataMap);
// Now position our text runs vertically.
- computeVerticalPositionsForLine(lineBox, resolver.firstRun(), textBoxDataMap);
+ computeBlockDirectionPositionsForLine(lineBox, resolver.firstRun(), textBoxDataMap);
#if ENABLE(SVG)
// SVG text layout code computes vertical & horizontal positions on its own.
@@ -937,22 +910,22 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
int adjustment = 0;
adjustLinePositionForPagination(lineBox, adjustment);
if (adjustment) {
- int oldLineWidth = lineWidth(oldHeight, firstLine);
+ int oldLineWidth = availableLogicalWidthForLine(oldHeight, 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());
- if (lineWidth(oldHeight + adjustment, firstLine) != oldLineWidth) {
+ if (availableLogicalWidthForLine(oldHeight + 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);
- setHeight(oldHeight + adjustment);
+ setLogicalHeight(oldHeight + adjustment);
resolver.setPosition(oldEnd);
end = oldEnd;
continue;
}
- setHeight(lineBox->blockHeight());
+ setLogicalHeight(lineBox->blockHeight());
}
}
}
@@ -1003,12 +976,12 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin(); f != end; ++f) {
int floatTop = (*f)->y() - (*f)->marginTop();
insertFloatingObject(*f);
- setHeight(floatTop + delta);
+ setLogicalHeight(floatTop + delta);
positionNewFloats();
}
}
}
- setHeight(lastRootBox()->blockHeight());
+ setLogicalHeight(lastRootBox()->blockHeight());
} else {
// Delete all the remaining lines.
RootInlineBox* line = endLine;
@@ -1033,8 +1006,8 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
m_lineBoxes.appendLineBox(trailingFloatsLineBox);
trailingFloatsLineBox->setConstructed();
GlyphOverflowAndFallbackFontsMap textBoxDataMap;
- trailingFloatsLineBox->verticallyAlignBoxes(height(), textBoxDataMap);
- trailingFloatsLineBox->setVerticalOverflowPositions(height(), bottomLayoutOverflow, height(), bottomVisualOverflow, 0);
+ trailingFloatsLineBox->alignBoxesInBlockDirection(height(), textBoxDataMap);
+ trailingFloatsLineBox->setBlockDirectionOverflowPositions(height(), bottomLayoutOverflow, height(), bottomVisualOverflow, 0);
trailingFloatsLineBox->setBlockHeight(height());
}
if (lastFloat) {
@@ -1061,10 +1034,10 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
}
// Now add in the bottom border/padding.
- setHeight(height() + toAdd);
+ setLogicalHeight(height() + toAdd);
if (!firstLineBox() && hasLineIfEmpty())
- setHeight(height() + lineHeight(true, true));
+ setLogicalHeight(height() + lineHeight(true, true));
// See if we have any lines that spill out of our block. If we do, then we will possibly need to
// truncate text.
@@ -1179,7 +1152,7 @@ RootInlineBox* RenderBlock::determineStartPosition(bool& firstLine, bool& fullLa
Vector<RenderBox*>::iterator end = cleanLineFloats->end();
for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin(); f != end; ++f) {
insertFloatingObject(*f);
- setHeight((*f)->y() - (*f)->marginTop());
+ setLogicalHeight((*f)->y() - (*f)->marginTop());
positionNewFloats();
ASSERT(floats[numCleanFloats].object == *f);
numCleanFloats++;
@@ -1187,7 +1160,7 @@ RootInlineBox* RenderBlock::determineStartPosition(bool& firstLine, bool& fullLa
}
line = line->nextRootBox();
}
- setHeight(savedHeight);
+ setLogicalHeight(savedHeight);
}
firstLine = !last;
@@ -1196,7 +1169,7 @@ RootInlineBox* RenderBlock::determineStartPosition(bool& firstLine, bool& fullLa
RenderObject* startObj;
int pos = 0;
if (last) {
- setHeight(last->blockHeight());
+ setLogicalHeight(last->blockHeight());
startObj = last->lineBreakObj();
pos = last->lineBreakPos();
resolver.setStatus(last->lineBreakBidiStatus());
@@ -1414,14 +1387,14 @@ void RenderBlock::skipTrailingWhitespace(InlineIterator& iterator, bool isLineEm
// A relative positioned inline encloses us. In this case, we also have to determine our
// position as though we were an inline. Set |staticX| and |staticY| on the relative positioned
// inline so that we can obtain the value later.
- toRenderInline(c)->layer()->setStaticX(style()->direction() == LTR ? leftOffset(height(), false) : rightOffset(height(), false));
+ toRenderInline(c)->layer()->setStaticX(style()->direction() == LTR ? logicalLeftOffsetForLine(height(), false) : logicalRightOffsetForLine(height(), false));
toRenderInline(c)->layer()->setStaticY(height());
}
RenderBox* box = toRenderBox(object);
if (box->style()->hasStaticX()) {
if (box->style()->isOriginalDisplayInlineType())
- box->layer()->setStaticX(style()->direction() == LTR ? leftOffset(height(), false) : width() - rightOffset(height(), false));
+ box->layer()->setStaticX(style()->direction() == LTR ? logicalLeftOffsetForLine(height(), false) : width() - logicalRightOffsetForLine(height(), false));
else
box->layer()->setStaticX(style()->direction() == LTR ? borderLeft() + paddingLeft() : borderRight() + paddingRight());
}
@@ -1436,12 +1409,12 @@ void RenderBlock::skipTrailingWhitespace(InlineIterator& iterator, bool isLineEm
int RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, bool firstLine, bool isLineEmpty, bool previousLineBrokeCleanly,
FloatingObject* lastFloatFromPreviousLine)
{
- int availableWidth = lineWidth(height(), firstLine);
+ int availableWidth = availableLogicalWidthForLine(height(), firstLine);
while (!resolver.position().atEnd() && !requiresLineBox(resolver.position(), isLineEmpty, previousLineBrokeCleanly)) {
RenderObject* object = resolver.position().obj;
if (object->isFloating()) {
positionNewFloatOnLine(insertFloatingObject(toRenderBox(object)), lastFloatFromPreviousLine);
- availableWidth = lineWidth(height(), firstLine);
+ availableWidth = availableLogicalWidthForLine(height(), firstLine);
} else if (object->isPositioned()) {
// FIXME: The math here is actually not really right. It's a best-guess approximation that
// will work for the common cases
@@ -1450,14 +1423,14 @@ int RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, bool firstL
// A relative positioned inline encloses us. In this case, we also have to determine our
// position as though we were an inline. Set |staticX| and |staticY| on the relative positioned
// inline so that we can obtain the value later.
- toRenderInline(c)->layer()->setStaticX(style()->direction() == LTR ? leftOffset(height(), firstLine) : rightOffset(height(), firstLine));
+ toRenderInline(c)->layer()->setStaticX(style()->direction() == LTR ? logicalLeftOffsetForLine(height(), firstLine) : logicalRightOffsetForLine(height(), firstLine));
toRenderInline(c)->layer()->setStaticY(height());
}
RenderBox* box = toRenderBox(object);
if (box->style()->hasStaticX()) {
if (box->style()->isOriginalDisplayInlineType())
- box->layer()->setStaticX(style()->direction() == LTR ? leftOffset(height(), firstLine) : width() - rightOffset(height(), firstLine));
+ box->layer()->setStaticX(style()->direction() == LTR ? logicalLeftOffsetForLine(height(), firstLine) : width() - logicalRightOffsetForLine(height(), firstLine));
else
box->layer()->setStaticX(style()->direction() == LTR ? borderLeft() + paddingLeft() : borderRight() + paddingRight());
}
@@ -1500,14 +1473,14 @@ void RenderBlock::fitBelowFloats(int widthToFit, bool firstLine, int& availableW
if (!floatBottom)
break;
- newLineWidth = lineWidth(floatBottom, firstLine);
+ newLineWidth = availableLogicalWidthForLine(floatBottom, firstLine);
lastFloatBottom = floatBottom;
if (newLineWidth >= widthToFit)
break;
}
if (newLineWidth > availableWidth) {
- setHeight(lastFloatBottom);
+ setLogicalHeight(lastFloatBottom);
availableWidth = newLineWidth;
}
}
@@ -1650,7 +1623,7 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
// it after moving to next line (in newLine() func)
if (floatsFitOnLine && floatBox->width() + floatBox->marginLeft() + floatBox->marginRight() + w + tmpW <= width) {
positionNewFloatOnLine(f, lastFloatFromPreviousLine);
- width = lineWidth(height(), firstLine);
+ width = availableLogicalWidthForLine(height(), firstLine);
} else
floatsFitOnLine = false;
} else if (o->isPositioned()) {
@@ -1790,6 +1763,7 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
bool breakWords = o->style()->breakWords() && ((autoWrap && !w) || currWS == PRE);
bool midWordBreak = false;
bool breakAll = o->style()->wordBreak() == BreakAllWordBreak && autoWrap;
+ int hyphenWidth = 0;
if (t->isWordBreak()) {
w += tmpW;
@@ -1808,48 +1782,13 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
if (!collapseWhiteSpace || !currentCharacterIsSpace)
isLineEmpty = false;
-
- // Check for soft hyphens. Go ahead and ignore them.
- if (c == softHyphen) {
- if (!ignoringSpaces) {
- // Ignore soft hyphens
- InlineIterator beforeSoftHyphen;
- if (pos)
- beforeSoftHyphen = InlineIterator(0, o, pos - 1);
- else
- beforeSoftHyphen = InlineIterator(0, last, last->isText() ? toRenderText(last)->textLength() - 1 : 0);
- // Two consecutive soft hyphens. Avoid overlapping midpoints.
- if (lineMidpointState.numMidpoints && lineMidpointState.midpoints[lineMidpointState.numMidpoints - 1].obj == o &&
- lineMidpointState.midpoints[lineMidpointState.numMidpoints - 1].pos == pos)
- lineMidpointState.numMidpoints--;
- else
- addMidpoint(lineMidpointState, beforeSoftHyphen);
-
- // Add the width up to but not including the hyphen.
- tmpW += textWidth(t, lastSpace, pos - lastSpace, f, w + tmpW, isFixedPitch, collapseWhiteSpace) + lastSpaceWordSpacing;
-
- // For wrapping text only, include the hyphen. We need to ensure it will fit
- // on the line if it shows when we break.
- if (autoWrap)
- tmpW += textWidth(t, pos, 1, f, w + tmpW, isFixedPitch, collapseWhiteSpace);
-
- InlineIterator afterSoftHyphen(0, o, pos);
- afterSoftHyphen.increment();
- addMidpoint(lineMidpointState, afterSoftHyphen);
- }
- pos++;
- len--;
- lastSpaceWordSpacing = 0;
- lastSpace = pos; // Cheesy hack to prevent adding in widths of the run twice.
- if (style->hyphens() == HyphensNone) {
- // Prevent a line break at the soft hyphen by ensuring that betweenWords is false
- // in the next iteration.
- atStart = true;
- }
- continue;
+ if (c == softHyphen && autoWrap && !hyphenWidth && style->hyphens() != HyphensNone) {
+ const AtomicString& hyphenString = style->hyphenString();
+ hyphenWidth = f.width(TextRun(hyphenString.characters(), hyphenString.length()));
+ tmpW += hyphenWidth;
}
-
+
#if ENABLE(SVG)
if (isSVGText) {
RenderSVGInlineText* svgInlineText = static_cast<RenderSVGInlineText*>(t);
@@ -1872,8 +1811,8 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
midWordBreak = w + wrapW + charWidth > width;
}
- bool betweenWords = c == '\n' || (currWS != PRE && !atStart && isBreakable(str, pos, strlen, nextBreakable, breakNBSP));
-
+ bool betweenWords = c == '\n' || (currWS != PRE && !atStart && isBreakable(str, pos, strlen, nextBreakable, breakNBSP) && (style->hyphens() != HyphensNone || (pos && str[pos - 1] != softHyphen)));
+
if (betweenWords || midWordBreak) {
bool stoppedIgnoringSpaces = false;
if (ignoringSpaces) {
@@ -1943,13 +1882,17 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
lBreak.increment();
previousLineBrokeCleanly = true;
}
+ if (lBreak.obj && lBreak.pos && lBreak.obj->isText() && toRenderText(lBreak.obj)->textLength() && toRenderText(lBreak.obj)->characters()[lBreak.pos - 1] == softHyphen && style->hyphens() != HyphensNone)
+ hyphenated = true;
goto end; // Didn't fit. Jump to the end.
} else {
if (!betweenWords || (midWordBreak && !autoWrap))
tmpW -= additionalTmpW;
- if (pos > 0 && str[pos-1] == softHyphen)
+ if (hyphenWidth) {
// Subtract the width of the soft hyphen out since we fit on a line.
- tmpW -= textWidth(t, pos - 1, 1, f, w + tmpW, isFixedPitch, collapseWhiteSpace);
+ tmpW -= hyphenWidth;
+ hyphenWidth = 0;
+ }
}
}
@@ -2194,14 +2137,6 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
lBreak.increment();
}
- if (lBreak.obj && lBreak.pos >= 2 && lBreak.obj->isText()) {
- // For soft hyphens on line breaks, we have to chop out the midpoints that made us
- // ignore the hyphen so that it will render at the end of the line.
- UChar c = toRenderText(lBreak.obj)->characters()[lBreak.pos - 1];
- if (c == softHyphen)
- chopMidpointsAt(lineMidpointState, lBreak.obj, lBreak.pos - 2);
- }
-
return lBreak;
}
@@ -2237,9 +2172,9 @@ void RenderBlock::checkLinesForTextOverflow()
// Include the scrollbar for overflow blocks, which means we want to use "contentWidth()"
bool ltr = style()->direction() == LTR;
for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
- int blockRightEdge = rightOffset(curr->y(), curr == firstRootBox());
- int blockLeftEdge = leftOffset(curr->y(), curr == firstRootBox());
- int lineBoxEdge = ltr ? curr->x() + curr->width() : curr->x();
+ int blockRightEdge = logicalRightOffsetForLine(curr->y(), curr == firstRootBox());
+ int blockLeftEdge = logicalLeftOffsetForLine(curr->y(), curr == firstRootBox());
+ int lineBoxEdge = ltr ? curr->x() + curr->logicalWidth() : curr->x();
if ((ltr && lineBoxEdge > blockRightEdge) || (!ltr && lineBoxEdge < blockLeftEdge)) {
// This line spills out of our box in the appropriate direction. Now we need to see if the line
// can be truncated. In order for truncation to be possible, the line must have sufficient space to
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index 33772a3..553be53 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -75,8 +75,8 @@ RenderBox::RenderBox(Node* node)
, m_marginRight(0)
, m_marginTop(0)
, m_marginBottom(0)
- , m_minPrefWidth(-1)
- , m_maxPrefWidth(-1)
+ , m_minPreferredLogicalWidth(-1)
+ , m_maxPreferredLogicalWidth(-1)
, m_inlineBoxWrapper(0)
#ifdef ANDROID_LAYOUT
, m_visibleWidth(0)
@@ -90,6 +90,158 @@ RenderBox::~RenderBox()
{
}
+int RenderBox::marginBefore() const
+{
+ return marginBeforeUsing(style());
+}
+
+int RenderBox::marginBeforeUsing(const RenderStyle* s) const
+{
+ switch (s->blockFlow()) {
+ case TopToBottomBlockFlow:
+ return m_marginTop;
+ case BottomToTopBlockFlow:
+ return m_marginBottom;
+ case LeftToRightBlockFlow:
+ return m_marginLeft;
+ case RightToLeftBlockFlow:
+ return m_marginRight;
+ }
+ ASSERT_NOT_REACHED();
+ return m_marginTop;
+}
+
+int RenderBox::marginAfter() const
+{
+ return marginAfterUsing(style());
+}
+
+int RenderBox::marginAfterUsing(const RenderStyle* s) const
+{
+ switch (s->blockFlow()) {
+ case TopToBottomBlockFlow:
+ return m_marginBottom;
+ case BottomToTopBlockFlow:
+ return m_marginTop;
+ case LeftToRightBlockFlow:
+ return m_marginRight;
+ case RightToLeftBlockFlow:
+ return m_marginLeft;
+ }
+ ASSERT_NOT_REACHED();
+ return m_marginBottom;
+}
+
+int RenderBox::marginStart() const
+{
+ return marginStartUsing(style());
+}
+
+int RenderBox::marginStartUsing(const RenderStyle* s) const
+{
+ if (s->isVerticalBlockFlow())
+ return s->direction() == LTR ? m_marginLeft : m_marginRight;
+ return s->direction() == LTR ? m_marginTop : m_marginBottom;
+}
+
+int RenderBox::marginEnd() const
+{
+ return marginEndUsing(style());
+}
+
+int RenderBox::marginEndUsing(const RenderStyle* s) const
+{
+ if (s->isVerticalBlockFlow())
+ return s->direction() == LTR ? m_marginRight : m_marginLeft;
+ return s->direction() == LTR ? m_marginBottom : m_marginTop;
+}
+
+void RenderBox::setMarginStart(int margin)
+{
+ setMarginStartUsing(style(), margin);
+}
+
+void RenderBox::setMarginEnd(int margin)
+{
+ setMarginEndUsing(style(), margin);
+}
+
+void RenderBox::setMarginStartUsing(const RenderStyle* s, int margin)
+{
+ if (s->isVerticalBlockFlow()) {
+ if (s->direction() == LTR)
+ m_marginLeft = margin;
+ else
+ m_marginRight = margin;
+ } else {
+ if (s->direction() == LTR)
+ m_marginTop = margin;
+ else
+ m_marginBottom = margin;
+ }
+}
+
+void RenderBox::setMarginEndUsing(const RenderStyle* s, int margin)
+{
+ if (s->isVerticalBlockFlow()) {
+ if (s->direction() == LTR)
+ m_marginRight = margin;
+ else
+ m_marginLeft = margin;
+ } else {
+ if (s->direction() == LTR)
+ m_marginBottom = margin;
+ else
+ m_marginTop = margin;
+ }
+}
+
+void RenderBox::setMarginBefore(int margin)
+{
+ setMarginBeforeUsing(style(), margin);
+}
+
+void RenderBox::setMarginAfter(int margin)
+{
+ setMarginAfterUsing(style(), margin);
+}
+
+void RenderBox::setMarginBeforeUsing(const RenderStyle* s, int margin)
+{
+ switch (s->blockFlow()) {
+ case TopToBottomBlockFlow:
+ m_marginTop = margin;
+ break;
+ case BottomToTopBlockFlow:
+ m_marginBottom = margin;
+ break;
+ case LeftToRightBlockFlow:
+ m_marginLeft = margin;
+ break;
+ case RightToLeftBlockFlow:
+ m_marginRight = margin;
+ break;
+ }
+}
+
+void RenderBox::setMarginAfterUsing(const RenderStyle* s, int margin)
+{
+ switch (s->blockFlow()) {
+ case TopToBottomBlockFlow:
+ m_marginBottom = margin;
+ break;
+ case BottomToTopBlockFlow:
+ m_marginTop = margin;
+ break;
+ case LeftToRightBlockFlow:
+ m_marginRight = margin;
+ break;
+ case RightToLeftBlockFlow:
+ m_marginLeft = margin;
+ break;
+ }
+}
+
void RenderBox::destroy()
{
// A lot of the code in this function is just pasted into
@@ -195,6 +347,12 @@ void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
// Set the text color if we're the body.
if (isBody())
document()->setTextColor(style()->visitedDependentColor(CSSPropertyColor));
+ else if (oldStyle && isRoot() && oldStyle->blockFlow() != style()->blockFlow()) {
+ // Propagate the new block flow up to the RenderView.
+ RenderView* viewRenderer = view();
+ viewRenderer->style()->setBlockFlow(style()->blockFlow());
+ viewRenderer->setNeedsLayoutAndPrefWidthsRecalc();
+ }
}
void RenderBox::updateBoxModelInfoFromStyle()
@@ -468,20 +626,20 @@ void RenderBox::panScroll(const IntPoint& source)
layer()->panScrollFromPoint(source);
}
-int RenderBox::minPrefWidth() const
+int RenderBox::minPreferredLogicalWidth() const
{
- if (prefWidthsDirty())
- const_cast<RenderBox*>(this)->calcPrefWidths();
+ if (preferredLogicalWidthsDirty())
+ const_cast<RenderBox*>(this)->computePreferredLogicalWidths();
- return m_minPrefWidth;
+ return m_minPreferredLogicalWidth;
}
-int RenderBox::maxPrefWidth() const
+int RenderBox::maxPreferredLogicalWidth() const
{
- if (prefWidthsDirty())
- const_cast<RenderBox*>(this)->calcPrefWidths();
+ if (preferredLogicalWidthsDirty())
+ const_cast<RenderBox*>(this)->computePreferredLogicalWidths();
- return m_maxPrefWidth;
+ return m_maxPreferredLogicalWidth;
}
int RenderBox::overrideSize() const
@@ -516,33 +674,33 @@ int RenderBox::overrideHeight() const
return hasOverrideSize() ? overrideSize() : height();
}
-int RenderBox::calcBorderBoxWidth(int width) const
+int RenderBox::computeBorderBoxLogicalWidth(int width) const
{
- int bordersPlusPadding = borderAndPaddingWidth();
+ int bordersPlusPadding = borderAndPaddingLogicalWidth();
if (style()->boxSizing() == CONTENT_BOX)
return width + bordersPlusPadding;
return max(width, bordersPlusPadding);
}
-int RenderBox::calcBorderBoxHeight(int height) const
+int RenderBox::computeBorderBoxLogicalHeight(int height) const
{
- int bordersPlusPadding = borderAndPaddingHeight();
+ int bordersPlusPadding = borderAndPaddingLogicalHeight();
if (style()->boxSizing() == CONTENT_BOX)
return height + bordersPlusPadding;
return max(height, bordersPlusPadding);
}
-int RenderBox::calcContentBoxWidth(int width) const
+int RenderBox::computeContentBoxLogicalWidth(int width) const
{
if (style()->boxSizing() == BORDER_BOX)
- width -= borderAndPaddingWidth();
+ width -= borderAndPaddingLogicalWidth();
return max(0, width);
}
-int RenderBox::calcContentBoxHeight(int height) const
+int RenderBox::computeContentBoxLogicalHeight(int height) const
{
if (style()->boxSizing() == BORDER_BOX)
- height -= borderAndPaddingHeight();
+ height -= borderAndPaddingLogicalHeight();
return max(0, height);
}
@@ -858,7 +1016,7 @@ void RenderBox::paintCustomHighlight(int tx, int ty, const AtomicString& type, b
InlineBox* boxWrap = inlineBoxWrapper();
RootInlineBox* r = boxWrap ? boxWrap->root() : 0;
if (r) {
- FloatRect rootRect(tx + r->x(), ty + r->selectionTop(), r->width(), r->selectionHeight());
+ FloatRect rootRect(tx + r->x(), ty + r->selectionTop(), r->logicalWidth(), r->selectionHeight());
FloatRect imageRect(tx + x(), rootRect.y(), width(), rootRect.height());
page->chrome()->client()->paintCustomHighlight(node(), type, imageRect, rootRect, behindText, false);
} else {
@@ -964,12 +1122,30 @@ IntRect RenderBox::clipRect(int tx, int ty)
return IntRect(clipX, clipY, clipWidth, clipHeight);
}
-int RenderBox::containingBlockWidthForContent() const
+int RenderBox::containingBlockLogicalWidthForContent() const
{
RenderBlock* cb = containingBlock();
if (shrinkToAvoidFloats())
- return cb->lineWidth(y(), false);
- return cb->availableWidth();
+ return cb->availableLogicalWidthForLine(y(), false);
+ return cb->availableLogicalWidth();
+}
+
+int RenderBox::perpendicularContainingBlockLogicalHeight() const
+{
+ RenderBlock* cb = containingBlock();
+ RenderStyle* containingBlockStyle = cb->style();
+ Length logicalHeightLength = containingBlockStyle->logicalHeight();
+
+ // FIXME: For now just support fixed heights. Eventually should support percentage heights as well.
+ if (!logicalHeightLength.isFixed()) {
+ // Rather than making the child be completely unconstrained, WinIE uses the viewport width and height
+ // as a constraint. We do that for now as well even though it's likely being unconstrained is what the spec
+ // will decide.
+ return containingBlockStyle->isVerticalBlockFlow() ? view()->frameView()->visibleHeight() : view()->frameView()->visibleWidth();
+ }
+
+ // Use the content box logical height as specified by the style.
+ return cb->computeContentBoxLogicalHeight(logicalHeightLength.value());
}
void RenderBox::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState) const
@@ -1276,6 +1452,7 @@ void RenderBox::repaintDuringLayoutIfMoved(const IntRect& rect)
}
}
+<<<<<<< HEAD
#ifdef ANDROID_LAYOUT
void RenderBox::setVisibleWidth(int newWidth) {
const Settings* settings = document()->settings();
@@ -1298,6 +1475,9 @@ bool RenderBox::checkAndSetRelayoutChildren(bool* relayoutChildren) {
#endif
void RenderBox::calcWidth()
+=======
+void RenderBox::computeLogicalWidth()
+>>>>>>> webkit.org at r68651
{
#ifdef ANDROID_LAYOUT
if (view()->frameView())
@@ -1305,36 +1485,44 @@ void RenderBox::calcWidth()
#endif
if (isPositioned()) {
- calcAbsoluteHorizontal();
+ // FIXME: This calculation is not patched for block-flow yet.
+ // https://bugs.webkit.org/show_bug.cgi?id=46500
+ computePositionedLogicalWidth();
return;
}
- // If layout is limited to a subtree, the subtree root's width does not change.
+ // If layout is limited to a subtree, the subtree root's logical width does not change.
if (node() && view()->frameView() && view()->frameView()->layoutRoot(true) == this)
return;
// The parent box is flexing us, so it has increased or decreased our
// width. Use the width from the style context.
+ // FIXME: Account for block-flow in flexible boxes.
+ // https://bugs.webkit.org/show_bug.cgi?id=46418
if (hasOverrideSize() && parent()->style()->boxOrient() == HORIZONTAL
&& parent()->isFlexibleBox() && parent()->isFlexingChildren()) {
- setWidth(overrideSize());
+ setLogicalWidth(overrideSize());
return;
}
+ // FIXME: Account for block-flow in flexible boxes.
+ // https://bugs.webkit.org/show_bug.cgi?id=46418
bool inVerticalBox = parent()->isFlexibleBox() && (parent()->style()->boxOrient() == VERTICAL);
bool stretching = (parent()->style()->boxAlign() == BSTRETCH);
- bool treatAsReplaced = shouldCalculateSizeAsReplaced() && (!inVerticalBox || !stretching);
+ bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inVerticalBox || !stretching);
- Length w = (treatAsReplaced) ? Length(calcReplacedWidth(), Fixed) : style()->width();
+ Length logicalWidthLength = (treatAsReplaced) ? Length(computeReplacedWidth(), Fixed) : style()->logicalWidth();
RenderBlock* cb = containingBlock();
- int containerWidth = max(0, containingBlockWidthForContent());
-
- Length marginLeft = style()->marginLeft();
- Length marginRight = style()->marginRight();
-
+ int containerLogicalWidth = max(0, containingBlockLogicalWidthForContent());
+ bool hasPerpendicularContainingBlock = cb->style()->isVerticalBlockFlow() != style()->isVerticalBlockFlow();
+ int containerWidthInInlineDirection = containerLogicalWidth;
+ if (hasPerpendicularContainingBlock)
+ containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight();
+
if (isInline() && !isInlineBlockOrInlineTable()) {
// just calculate margins
+<<<<<<< HEAD
m_marginLeft = marginLeft.calcMinValue(containerWidth);
m_marginRight = marginRight.calcMinValue(containerWidth);
#ifdef ANDROID_LAYOUT
@@ -1355,38 +1543,46 @@ void RenderBox::calcWidth()
}
}
#endif
+=======
+ setMarginStart(style()->marginStart().calcMinValue(containerLogicalWidth));
+ setMarginEnd(style()->marginEnd().calcMinValue(containerLogicalWidth));
+ if (treatAsReplaced)
+ setLogicalWidth(max(logicalWidthLength.value() + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth()));
+>>>>>>> webkit.org at r68651
return;
}
// Width calculations
if (treatAsReplaced)
- setWidth(w.value() + borderAndPaddingWidth());
+ setLogicalWidth(logicalWidthLength.value() + borderAndPaddingLogicalWidth());
else {
- // Calculate Width
- setWidth(calcWidthUsing(Width, containerWidth));
-
- // Calculate MaxWidth
- if (!style()->maxWidth().isUndefined()) {
- int maxW = calcWidthUsing(MaxWidth, containerWidth);
- if (width() > maxW) {
- setWidth(maxW);
- w = style()->maxWidth();
+ // Calculate LogicalWidth
+ setLogicalWidth(computeLogicalWidthUsing(LogicalWidth, containerWidthInInlineDirection));
+
+ // Calculate MaxLogicalWidth
+ if (!style()->logicalMaxWidth().isUndefined()) {
+ int maxLogicalWidth = computeLogicalWidthUsing(MaxLogicalWidth, containerWidthInInlineDirection);
+ if (logicalWidth() > maxLogicalWidth) {
+ setLogicalWidth(maxLogicalWidth);
+ logicalWidthLength = style()->logicalMaxWidth();
}
}
- // Calculate MinWidth
- int minW = calcWidthUsing(MinWidth, containerWidth);
- if (width() < minW) {
- setWidth(minW);
- w = style()->minWidth();
+ // Calculate MinLogicalWidth
+ int minLogicalWidth = computeLogicalWidthUsing(MinLogicalWidth, containerWidthInInlineDirection);
+ if (logicalWidth() < minLogicalWidth) {
+ setLogicalWidth(minLogicalWidth);
+ logicalWidthLength = style()->logicalMinWidth();
}
}
- if (stretchesToMinIntrinsicWidth()) {
- setWidth(max(width(), minPrefWidth()));
- w = Length(width(), Fixed);
+ // Fieldsets are currently the only objects that stretch to their minimum width.
+ if (stretchesToMinIntrinsicLogicalWidth()) {
+ setLogicalWidth(max(logicalWidth(), minPreferredLogicalWidth()));
+ logicalWidthLength = Length(logicalWidth(), Fixed);
}
+<<<<<<< HEAD
// Margin calculations
if (w.isAuto()) {
m_marginLeft = marginLeft.calcMinValue(containerWidth);
@@ -1411,44 +1607,48 @@ void RenderBox::calcWidth()
setWidth(width() -(m_marginLeft + m_marginRight));
}
#endif
+=======
+ // Margin calculations.
+ if (logicalWidthLength.isAuto() || hasPerpendicularContainingBlock || isFloating() || isInline()) {
+ setMarginStart(style()->marginStart().calcMinValue(containerLogicalWidth));
+ setMarginEnd(style()->marginEnd().calcMinValue(containerLogicalWidth));
+ } else
+ computeInlineDirectionMargins(cb, containerLogicalWidth, logicalWidth());
+>>>>>>> webkit.org at r68651
- if (containerWidth && containerWidth != (width() + m_marginLeft + m_marginRight)
- && !isFloating() && !isInline() && !cb->isFlexibleBox()) {
- if (cb->style()->direction() == LTR)
- m_marginRight = containerWidth - width() - m_marginLeft;
- else
- m_marginLeft = containerWidth - width() - m_marginRight;
- }
+ if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLogicalWidth != (logicalWidth() + marginStart() + marginEnd())
+ && !isFloating() && !isInline() && !cb->isFlexibleBox())
+ setMarginEndUsing(cb->style(), containerLogicalWidth - logicalWidth() - marginStartUsing(cb->style()));
}
-int RenderBox::calcWidthUsing(WidthType widthType, int cw)
+int RenderBox::computeLogicalWidthUsing(LogicalWidthType widthType, int availableLogicalWidth)
{
- int widthResult = width();
- Length w;
- if (widthType == Width)
- w = style()->width();
- else if (widthType == MinWidth)
- w = style()->minWidth();
+ int logicalWidthResult = logicalWidth();
+ Length logicalWidth;
+ if (widthType == LogicalWidth)
+ logicalWidth = style()->logicalWidth();
+ else if (widthType == MinLogicalWidth)
+ logicalWidth = style()->logicalMinWidth();
else
- w = style()->maxWidth();
+ logicalWidth = style()->logicalMaxWidth();
- if (w.isIntrinsicOrAuto()) {
- int marginLeft = style()->marginLeft().calcMinValue(cw);
- int marginRight = style()->marginRight().calcMinValue(cw);
- if (cw)
- widthResult = cw - marginLeft - marginRight;
+ if (logicalWidth.isIntrinsicOrAuto()) {
+ int marginStart = style()->marginStart().calcMinValue(availableLogicalWidth);
+ int marginEnd = style()->marginEnd().calcMinValue(availableLogicalWidth);
+ if (availableLogicalWidth)
+ logicalWidthResult = availableLogicalWidth - marginStart - marginEnd;
- if (sizesToIntrinsicWidth(widthType)) {
- widthResult = max(widthResult, minPrefWidth());
- widthResult = min(widthResult, maxPrefWidth());
+ if (sizesToIntrinsicLogicalWidth(widthType)) {
+ logicalWidthResult = max(logicalWidthResult, minPreferredLogicalWidth());
+ logicalWidthResult = min(logicalWidthResult, maxPreferredLogicalWidth());
}
- } else
- widthResult = calcBorderBoxWidth(w.calcValue(cw));
+ } else // FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead.
+ logicalWidthResult = computeBorderBoxLogicalWidth(logicalWidth.calcValue(availableLogicalWidth));
- return widthResult;
+ return logicalWidthResult;
}
-bool RenderBox::sizesToIntrinsicWidth(WidthType widthType) const
+bool RenderBox::sizesToIntrinsicLogicalWidth(LogicalWidthType 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.
@@ -1457,12 +1657,15 @@ bool RenderBox::sizesToIntrinsicWidth(WidthType widthType) const
// This code may look a bit strange. Basically width:intrinsic should clamp the size when testing both
// min-width and width. max-width is only clamped if it is also intrinsic.
- Length width = (widthType == MaxWidth) ? style()->maxWidth() : style()->width();
- if (width.type() == Intrinsic)
+ Length logicalWidth = (widthType == MaxLogicalWidth) ? style()->logicalMaxWidth() : style()->logicalWidth();
+ if (logicalWidth.type() == Intrinsic)
return true;
// Children of a horizontal marquee do not fill the container by default.
// FIXME: Need to deal with MAUTO value properly. It could be vertical.
+ // FIXME: Think about block-flow here. Need to find out how marquee direction relates to
+ // block-flow (as well as how marquee overflow should relate to block flow).
+ // https://bugs.webkit.org/show_bug.cgi?id=46472
if (parent()->style()->overflowX() == OMARQUEE) {
EMarqueeDirection dir = parent()->style()->marqueeDirection();
if (dir == MAUTO || dir == MFORWARD || dir == MBACKWARD || dir == MLEFT || dir == MRIGHT)
@@ -1471,6 +1674,8 @@ bool RenderBox::sizesToIntrinsicWidth(WidthType widthType) const
// Flexible horizontal boxes lay out children at their intrinsic widths. Also vertical boxes
// that don't stretch their kids lay out their children at their intrinsic widths.
+ // FIXME: Think about block-flow here.
+ // https://bugs.webkit.org/show_bug.cgi?id=46473
if (parent()->isFlexibleBox()
&& (parent()->style()->boxOrient() == HORIZONTAL || parent()->style()->boxAlign() != BSTRETCH))
return true;
@@ -1478,82 +1683,108 @@ bool RenderBox::sizesToIntrinsicWidth(WidthType widthType) const
// Button, input, select, textarea, legend and datagrid treat
// width value of 'auto' as 'intrinsic' unless it's in a
// stretching vertical flexbox.
- if (width.type() == Auto && !(parent()->isFlexibleBox() && parent()->style()->boxOrient() == VERTICAL && parent()->style()->boxAlign() == BSTRETCH) && node() && (node()->hasTagName(inputTag) || node()->hasTagName(selectTag) || node()->hasTagName(buttonTag) || node()->hasTagName(textareaTag) || node()->hasTagName(legendTag) || node()->hasTagName(datagridTag)))
+ // FIXME: Think about block-flow here.
+ // https://bugs.webkit.org/show_bug.cgi?id=46473
+ if (logicalWidth.type() == Auto && !(parent()->isFlexibleBox() && parent()->style()->boxOrient() == VERTICAL && parent()->style()->boxAlign() == BSTRETCH) && node() && (node()->hasTagName(inputTag) || node()->hasTagName(selectTag) || node()->hasTagName(buttonTag) || node()->hasTagName(textareaTag) || node()->hasTagName(legendTag) || node()->hasTagName(datagridTag)))
return true;
return false;
}
-void RenderBox::calcHorizontalMargins(const Length& marginLeft, const Length& marginRight, int containerWidth)
+void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, int containerWidth, int childWidth)
{
- if (isFloating() || isInline()) {
- // Inline blocks/tables and floats don't have their margins increased.
- m_marginLeft = marginLeft.calcMinValue(containerWidth);
- m_marginRight = marginRight.calcMinValue(containerWidth);
+ const RenderStyle* containingBlockStyle = containingBlock->style();
+ Length marginStartLength = style()->marginStartUsing(containingBlockStyle);
+ Length marginEndLength = style()->marginEndUsing(containingBlockStyle);
+
+ // Case One: The object is being centered in the containing block's available logical width.
+ if ((marginStartLength.isAuto() && marginEndLength.isAuto() && childWidth < containerWidth)
+ || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containingBlock->style()->textAlign() == WEBKIT_CENTER)) {
+ setMarginStartUsing(containingBlockStyle, max(0, (containerWidth - childWidth) / 2));
+ setMarginEndUsing(containingBlockStyle, containerWidth - childWidth - marginStartUsing(containingBlockStyle));
return;
- }
-
- if ((marginLeft.isAuto() && marginRight.isAuto() && width() < containerWidth)
- || (!marginLeft.isAuto() && !marginRight.isAuto() && containingBlock()->style()->textAlign() == WEBKIT_CENTER)) {
- m_marginLeft = max(0, (containerWidth - width()) / 2);
- m_marginRight = containerWidth - width() - m_marginLeft;
- } else if ((marginRight.isAuto() && width() < containerWidth)
- || (!marginLeft.isAuto() && containingBlock()->style()->direction() == RTL && containingBlock()->style()->textAlign() == WEBKIT_LEFT)) {
- m_marginLeft = marginLeft.calcValue(containerWidth);
- m_marginRight = containerWidth - width() - m_marginLeft;
- } else if ((marginLeft.isAuto() && width() < containerWidth)
- || (!marginRight.isAuto() && containingBlock()->style()->direction() == LTR && containingBlock()->style()->textAlign() == WEBKIT_RIGHT)) {
- m_marginRight = marginRight.calcValue(containerWidth);
- m_marginLeft = containerWidth - width() - m_marginRight;
- } else {
- // This makes auto margins 0 if we failed a width() < containerWidth test above (css2.1, 10.3.3).
- m_marginLeft = marginLeft.calcMinValue(containerWidth);
- m_marginRight = marginRight.calcMinValue(containerWidth);
- }
+ }
+
+ // Case Two: The object is being pushed to the start of the containing block's available logical width.
+ if (marginEndLength.isAuto() && childWidth < containerWidth) {
+ setMarginStartUsing(containingBlockStyle, marginStartLength.calcValue(containerWidth));
+ setMarginEndUsing(containingBlockStyle, containerWidth - childWidth - marginStartUsing(containingBlockStyle));
+ return;
+ }
+
+ // Case Three: The object is being pushed to the end of the containing block's available logical width.
+ bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((containingBlockStyle->direction() == RTL && containingBlockStyle->textAlign() == WEBKIT_LEFT)
+ || (containingBlockStyle->direction() == LTR && containingBlockStyle->textAlign() == WEBKIT_RIGHT));
+ if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) {
+ setMarginEndUsing(containingBlockStyle, marginEndLength.calcValue(containerWidth));
+ setMarginStartUsing(containingBlockStyle, containerWidth - childWidth - marginEndUsing(containingBlockStyle));
+ return;
+ }
+
+ // Case Four: Either no auto margins, or our width is >= the container width (css2.1, 10.3.3). In that case
+ // auto margins will just turn into 0.
+ setMarginStartUsing(containingBlockStyle, marginStartLength.calcMinValue(containerWidth));
+ setMarginEndUsing(containingBlockStyle, marginEndLength.calcMinValue(containerWidth));
}
-void RenderBox::calcHeight()
+void RenderBox::computeLogicalHeight()
{
// Cell height is managed by the table and inline non-replaced elements do not support a height property.
if (isTableCell() || (isInline() && !isReplaced()))
return;
Length h;
- if (isPositioned())
- calcAbsoluteVertical();
- else {
- calcVerticalMargins();
+ if (isPositioned()) {
+ // FIXME: This calculation is not patched for block-flow yet.
+ // https://bugs.webkit.org/show_bug.cgi?id=46500
+ computePositionedLogicalHeight();
+ } else {
+ RenderBlock* cb = containingBlock();
+ bool hasPerpendicularContainingBlock = cb->style()->isVerticalBlockFlow() != style()->isVerticalBlockFlow();
+
+ if (!hasPerpendicularContainingBlock)
+ computeBlockDirectionMargins(cb);
// For tables, calculate margins only.
- if (isTable())
+ if (isTable()) {
+ if (hasPerpendicularContainingBlock)
+ computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), logicalHeight());
return;
+ }
+ // FIXME: Account for block-flow in flexible boxes.
+ // https://bugs.webkit.org/show_bug.cgi?id=46418
bool inHorizontalBox = parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL;
bool stretching = parent()->style()->boxAlign() == BSTRETCH;
- bool treatAsReplaced = shouldCalculateSizeAsReplaced() && (!inHorizontalBox || !stretching);
+ bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inHorizontalBox || !stretching);
bool checkMinMaxHeight = false;
// The parent box is flexing us, so it has increased or decreased our height. We have to
// grab our cached flexible height.
+ // FIXME: Account for block-flow in flexible boxes.
+ // https://bugs.webkit.org/show_bug.cgi?id=46418
if (hasOverrideSize() && parent()->isFlexibleBox() && parent()->style()->boxOrient() == VERTICAL
&& parent()->isFlexingChildren())
- h = Length(overrideSize() - borderAndPaddingHeight(), Fixed);
+ h = Length(overrideSize() - borderAndPaddingLogicalHeight(), Fixed);
else if (treatAsReplaced)
- h = Length(calcReplacedHeight(), Fixed);
+ h = Length(computeReplacedHeight(), Fixed);
else {
- h = style()->height();
+ h = style()->logicalHeight();
checkMinMaxHeight = true;
}
// Block children of horizontal flexible boxes fill the height of the box.
+ // FIXME: Account for block-flow in flexible boxes.
+ // https://bugs.webkit.org/show_bug.cgi?id=46418
if (h.isAuto() && parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL
&& parent()->isStretchingChildren()) {
- h = Length(parentBox()->contentHeight() - marginTop() - marginBottom() - borderAndPaddingHeight(), Fixed);
+ h = Length(parentBox()->contentLogicalHeight() - marginBefore() - marginAfter() - borderAndPaddingLogicalHeight(), Fixed);
checkMinMaxHeight = false;
}
int heightResult;
if (checkMinMaxHeight) {
+<<<<<<< HEAD
#ifdef ANDROID_LAYOUT
// in SSR mode, ignore CSS height as layout is so different
if (document()->settings()->layoutAlgorithm() == Settings::kLayoutSSR)
@@ -1561,10 +1792,13 @@ void RenderBox::calcHeight()
else
#endif
heightResult = calcHeightUsing(style()->height());
+=======
+ heightResult = computeLogicalHeightUsing(style()->logicalHeight());
+>>>>>>> webkit.org at r68651
if (heightResult == -1)
- heightResult = height();
- int minH = calcHeightUsing(style()->minHeight()); // Leave as -1 if unset.
- int maxH = style()->maxHeight().isUndefined() ? heightResult : calcHeightUsing(style()->maxHeight());
+ heightResult = logicalHeight();
+ int minH = computeLogicalHeightUsing(style()->logicalMinHeight()); // Leave as -1 if unset.
+ int maxH = style()->logicalMaxHeight().isUndefined() ? heightResult : computeLogicalHeightUsing(style()->logicalMaxHeight());
if (maxH == -1)
maxH = heightResult;
heightResult = min(maxH, heightResult);
@@ -1573,10 +1807,13 @@ void RenderBox::calcHeight()
// The only times we don't check min/max height are when a fixed length has
// been given as an override. Just use that. The value has already been adjusted
// for box-sizing.
- heightResult = h.value() + borderAndPaddingHeight();
+ heightResult = h.value() + borderAndPaddingLogicalHeight();
}
- setHeight(heightResult);
+ setLogicalHeight(heightResult);
+
+ if (hasPerpendicularContainingBlock)
+ computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), heightResult);
}
// WinIE quirk: The <html> block always fills the entire canvas in quirks mode. The <body> always fills the
@@ -1585,36 +1822,46 @@ void RenderBox::calcHeight()
// height since we don't set a height in RenderView when we're printing. So without this quirk, the
// height has nothing to be a percentage of, and it ends up being 0. That is bad.
bool paginatedContentNeedsBaseHeight = document()->printing() && h.isPercent()
- && (isRoot() || (isBody() && document()->documentElement()->renderer()->style()->height().isPercent()));
+ && (isRoot() || (isBody() && document()->documentElement()->renderer()->style()->logicalHeight().isPercent()));
if (stretchesToViewHeight() || paginatedContentNeedsBaseHeight) {
- int margins = collapsedMarginTop() + collapsedMarginBottom();
- int visHeight = document()->printing() ? view()->pageHeight() : view()->viewHeight();
+ // FIXME: Finish accounting for block flow here.
+ // https://bugs.webkit.org/show_bug.cgi?id=46603
+ int margins = collapsedMarginBefore() + collapsedMarginAfter();
+ int visHeight;
+ if (document()->printing())
+ visHeight = static_cast<int>(view()->pageHeight());
+ else {
+ if (style()->isVerticalBlockFlow())
+ visHeight = view()->viewHeight();
+ else
+ visHeight = view()->viewWidth();
+ }
if (isRoot())
- setHeight(max(height(), visHeight - margins));
+ setLogicalHeight(max(logicalHeight(), visHeight - margins));
else {
- int marginsBordersPadding = margins + parentBox()->marginTop() + parentBox()->marginBottom() + parentBox()->borderAndPaddingHeight();
- setHeight(max(height(), visHeight - marginsBordersPadding));
+ int marginsBordersPadding = margins + parentBox()->marginBefore() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight();
+ setLogicalHeight(max(logicalHeight(), visHeight - marginsBordersPadding));
}
}
}
-int RenderBox::calcHeightUsing(const Length& h)
+int RenderBox::computeLogicalHeightUsing(const Length& h)
{
- int height = -1;
+ int logicalHeight = -1;
if (!h.isAuto()) {
if (h.isFixed())
- height = h.value();
+ logicalHeight = h.value();
else if (h.isPercent())
- height = calcPercentageHeight(h);
- if (height != -1) {
- height = calcBorderBoxHeight(height);
- return height;
+ logicalHeight = computePercentageLogicalHeight(h);
+ if (logicalHeight != -1) {
+ logicalHeight = computeBorderBoxLogicalHeight(logicalHeight);
+ return logicalHeight;
}
}
- return height;
+ return logicalHeight;
}
-int RenderBox::calcPercentageHeight(const Length& height)
+int RenderBox::computePercentageLogicalHeight(const Length& height)
{
int result = -1;
bool skippedAutoHeightContainingBlock = false;
@@ -1624,7 +1871,7 @@ int RenderBox::calcPercentageHeight(const Length& height)
// block that may have a specified height and then use it. In strict mode, this violates the
// specification, which states that percentage heights just revert to auto if the containing
// block has an auto height.
- while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isPositioned() && cb->style()->height().isAuto()) {
+ while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isPositioned() && cb->style()->logicalHeight().isAuto()) {
skippedAutoHeightContainingBlock = true;
cb = cb->containingBlock();
cb->addPercentHeightDescendant(this);
@@ -1633,7 +1880,9 @@ int RenderBox::calcPercentageHeight(const Length& height)
// A positioned element that specified both top/bottom or that specifies height should be treated as though it has a height
// explicitly specified that can be used for any percentage computations.
- bool isPositionedWithSpecifiedHeight = cb->isPositioned() && (!cb->style()->height().isAuto() || (!cb->style()->top().isAuto() && !cb->style()->bottom().isAuto()));
+ // FIXME: We can't just check top/bottom here.
+ // https://bugs.webkit.org/show_bug.cgi?id=46500
+ bool isPositionedWithSpecifiedHeight = cb->isPositioned() && (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && !cb->style()->bottom().isAuto()));
bool includeBorderPadding = isTable();
@@ -1652,7 +1901,7 @@ int RenderBox::calcPercentageHeight(const Length& height)
// to grow to fill the space. This could end up being wrong in some cases, but it is
// preferable to the alternative (sizing intrinsically and making the row end up too big).
RenderTableCell* cell = toRenderTableCell(cb);
- if (scrollsOverflowY() && (!cell->style()->height().isAuto() || !cell->table()->style()->height().isAuto()))
+ if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAuto() || !cell->table()->style()->logicalHeight().isAuto()))
return 0;
return -1;
}
@@ -1661,24 +1910,24 @@ int RenderBox::calcPercentageHeight(const Length& height)
}
// Otherwise we only use our percentage height if our containing block had a specified
// height.
- else if (cb->style()->height().isFixed())
- result = cb->calcContentBoxHeight(cb->style()->height().value());
- else if (cb->style()->height().isPercent() && !isPositionedWithSpecifiedHeight) {
+ else if (cb->style()->logicalHeight().isFixed())
+ result = cb->computeContentBoxLogicalHeight(cb->style()->logicalHeight().value());
+ else if (cb->style()->logicalHeight().isPercent() && !isPositionedWithSpecifiedHeight) {
// We need to recur and compute the percentage height for our containing block.
- result = cb->calcPercentageHeight(cb->style()->height());
+ result = cb->computePercentageLogicalHeight(cb->style()->logicalHeight());
if (result != -1)
- result = cb->calcContentBoxHeight(result);
+ result = cb->computeContentBoxLogicalHeight(result);
} else if (cb->isRenderView() || (cb->isBody() && document()->inQuirksMode()) || isPositionedWithSpecifiedHeight) {
// Don't allow this to affect the block' height() member variable, since this
// can get called while the block is still laying out its kids.
- int oldHeight = cb->height();
- cb->calcHeight();
- result = cb->contentHeight();
- cb->setHeight(oldHeight);
+ int oldHeight = cb->logicalHeight();
+ cb->computeLogicalHeight();
+ result = cb->contentLogicalHeight();
+ cb->setLogicalHeight(oldHeight);
} else if (cb->isRoot() && isPositioned())
// Match the positioned objects behavior, which is that positioned objects will fill their viewport
- // always. Note we could only hit this case by recurring into calcPercentageHeight on a positioned containing block.
- result = cb->calcContentBoxHeight(cb->availableHeight());
+ // always. Note we could only hit this case by recurring into computePercentageLogicalHeight on a positioned containing block.
+ result = cb->computeContentBoxLogicalHeight(cb->availableLogicalHeight());
if (result != -1) {
result = height.calcValue(result);
@@ -1686,31 +1935,34 @@ int RenderBox::calcPercentageHeight(const Length& height)
// It is necessary to use the border-box to match WinIE's broken
// box model. This is essential for sizing inside
// table cells using percentage heights.
- result -= borderAndPaddingHeight();
+ result -= borderAndPaddingLogicalHeight();
result = max(0, result);
}
}
return result;
}
-int RenderBox::calcReplacedWidth(bool includeMaxWidth) const
+int RenderBox::computeReplacedWidth(bool includeMaxWidth) const
{
- int width = calcReplacedWidthUsing(style()->width());
- int minW = calcReplacedWidthUsing(style()->minWidth());
- int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth());
+ int width = computeReplacedWidthUsing(style()->width());
+ int minW = computeReplacedWidthUsing(style()->minWidth());
+ int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth());
return max(minW, min(width, maxW));
}
-int RenderBox::calcReplacedWidthUsing(Length width) const
+int RenderBox::computeReplacedWidthUsing(Length width) const
{
switch (width.type()) {
case Fixed:
- return calcContentBoxWidth(width.value());
+ return computeContentBoxLogicalWidth(width.value());
case Percent: {
- const int cw = isPositioned() ? containingBlockWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockWidthForContent();
+ // FIXME: containingBlockLogicalWidthForContent() is wrong if the replaced element's block-flow is perpendicular to the
+ // containing block's block-flow.
+ // https://bugs.webkit.org/show_bug.cgi?id=46496
+ const int cw = isPositioned() ? containingBlockWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent();
if (cw > 0)
- return calcContentBoxWidth(width.calcMinValue(cw));
+ return computeContentBoxLogicalWidth(width.calcMinValue(cw));
}
// fall through
default:
@@ -1718,20 +1970,20 @@ int RenderBox::calcReplacedWidthUsing(Length width) const
}
}
-int RenderBox::calcReplacedHeight() const
+int RenderBox::computeReplacedHeight() const
{
- int height = calcReplacedHeightUsing(style()->height());
- int minH = calcReplacedHeightUsing(style()->minHeight());
- int maxH = style()->maxHeight().isUndefined() ? height : calcReplacedHeightUsing(style()->maxHeight());
+ int height = computeReplacedHeightUsing(style()->height());
+ int minH = computeReplacedHeightUsing(style()->minHeight());
+ int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight());
return max(minH, min(height, maxH));
}
-int RenderBox::calcReplacedHeightUsing(Length height) const
+int RenderBox::computeReplacedHeightUsing(Length height) const
{
switch (height.type()) {
case Fixed:
- return calcContentBoxHeight(height.value());
+ return computeContentBoxLogicalHeight(height.value());
case Percent:
{
RenderObject* cb = isPositioned() ? container() : containingBlock();
@@ -1744,13 +1996,13 @@ int RenderBox::calcReplacedHeightUsing(Length height) const
ASSERT(cb->isRenderBlock());
RenderBlock* block = toRenderBlock(cb);
int oldHeight = block->height();
- block->calcHeight();
- int newHeight = block->calcContentBoxHeight(block->contentHeight());
+ block->computeLogicalHeight();
+ int newHeight = block->computeContentBoxLogicalHeight(block->contentHeight());
block->setHeight(oldHeight);
- return calcContentBoxHeight(height.calcValue(newHeight));
+ return computeContentBoxLogicalHeight(height.calcValue(newHeight));
}
- int availableHeight = isPositioned() ? containingBlockHeightForPositioned(toRenderBoxModelObject(cb)) : toRenderBox(cb)->availableHeight();
+ int availableHeight = isPositioned() ? containingBlockHeightForPositioned(toRenderBoxModelObject(cb)) : toRenderBox(cb)->availableLogicalHeight();
// It is necessary to use the border-box to match WinIE's broken
// box model. This is essential for sizing inside
@@ -1762,68 +2014,66 @@ int RenderBox::calcReplacedHeightUsing(Length height) const
return height.calcValue(availableHeight - borderAndPaddingHeight());
}
- return calcContentBoxHeight(height.calcValue(availableHeight));
+ return computeContentBoxLogicalHeight(height.calcValue(availableHeight));
}
default:
return intrinsicSize().height();
}
}
-int RenderBox::availableHeight() const
+int RenderBox::availableLogicalHeight() const
{
- return availableHeightUsing(style()->height());
+ return availableLogicalHeightUsing(style()->logicalHeight());
}
-int RenderBox::availableHeightUsing(const Length& h) const
+int RenderBox::availableLogicalHeightUsing(const Length& h) const
{
if (h.isFixed())
- return calcContentBoxHeight(h.value());
+ return computeContentBoxLogicalHeight(h.value());
if (isRenderView())
- return toRenderView(this)->frameView()->visibleHeight();
+ return style()->isVerticalBlockFlow() ? toRenderView(this)->frameView()->visibleHeight() : toRenderView(this)->frameView()->visibleWidth();
// We need to stop here, since we don't want to increase the height of the table
// artificially. We're going to rely on this cell getting expanded to some new
// height, and then when we lay out again we'll use the calculation below.
if (isTableCell() && (h.isAuto() || h.isPercent()))
- return overrideSize() - borderAndPaddingWidth();
+ return overrideSize() - borderAndPaddingLogicalWidth();
if (h.isPercent())
- return calcContentBoxHeight(h.calcValue(containingBlock()->availableHeight()));
+ return computeContentBoxLogicalHeight(h.calcValue(containingBlock()->availableLogicalHeight()));
+ // FIXME: We can't just check top/bottom here.
+ // https://bugs.webkit.org/show_bug.cgi?id=46500
if (isRenderBlock() && isPositioned() && style()->height().isAuto() && !(style()->top().isAuto() || style()->bottom().isAuto())) {
RenderBlock* block = const_cast<RenderBlock*>(toRenderBlock(this));
- int oldHeight = block->height();
- block->calcHeight();
- int newHeight = block->calcContentBoxHeight(block->contentHeight());
- block->setHeight(oldHeight);
- return calcContentBoxHeight(newHeight);
+ int oldHeight = block->logicalHeight();
+ block->computeLogicalHeight();
+ int newHeight = block->computeContentBoxLogicalHeight(block->contentLogicalHeight());
+ block->setLogicalHeight(oldHeight);
+ return computeContentBoxLogicalHeight(newHeight);
}
- return containingBlock()->availableHeight();
-}
-
-int RenderBox::availableLogicalWidth() const
-{
- if (style()->isVerticalBlockFlow())
- return contentWidth();
- return contentHeight();
+ return containingBlock()->availableLogicalHeight();
}
-void RenderBox::calcVerticalMargins()
+void RenderBox::computeBlockDirectionMargins(RenderBlock* containingBlock)
{
if (isTableCell()) {
- m_marginTop = 0;
- m_marginBottom = 0;
+ // FIXME: Not right if we allow cells to have different directionality than the table. If we do allow this, though,
+ // we may just do it with an extra anonymous block inside the cell.
+ setMarginBefore(0);
+ setMarginAfter(0);
return;
}
- // margins are calculated with respect to the _width_ of
+ // Margins are calculated with respect to the logical width of
// the containing block (8.3)
- int cw = containingBlock()->contentWidth();
+ int cw = containingBlockLogicalWidthForContent();
- m_marginTop = style()->marginTop().calcMinValue(cw);
- m_marginBottom = style()->marginBottom().calcMinValue(cw);
+ RenderStyle* containingBlockStyle = containingBlock->style();
+ setMarginBeforeUsing(containingBlockStyle, style()->marginBeforeUsing(containingBlockStyle).calcMinValue(cw));
+ setMarginAfterUsing(containingBlockStyle, style()->marginAfterUsing(containingBlockStyle).calcMinValue(cw));
}
int RenderBox::containingBlockWidthForPositioned(const RenderBoxModelObject* containingBlock) const
@@ -1846,11 +2096,11 @@ int RenderBox::containingBlockWidthForPositioned(const RenderBoxModelObject* con
int fromLeft;
int fromRight;
if (containingBlock->style()->direction() == LTR) {
- fromLeft = first->x() + first->borderLeft();
- fromRight = last->x() + last->width() - last->borderRight();
+ fromLeft = first->logicalLeft() + first->borderLogicalLeft();
+ fromRight = last->logicalLeft() + last->logicalWidth() - last->borderLogicalRight();
} else {
- fromRight = first->x() + first->width() - first->borderRight();
- fromLeft = last->x() + last->borderLeft();
+ fromRight = first->logicalLeft() + first->logicalWidth() - first->borderLogicalRight();
+ fromLeft = last->logicalLeft() + last->borderLogicalLeft();
}
return max(0, (fromRight - fromLeft));
@@ -1868,10 +2118,10 @@ int RenderBox::containingBlockHeightForPositioned(const RenderBoxModelObject* co
return heightResult - containingBlock->borderTop() - containingBlock->borderBottom();
}
-void RenderBox::calcAbsoluteHorizontal()
+void RenderBox::computePositionedLogicalWidth()
{
if (isReplaced()) {
- calcAbsoluteHorizontalReplaced();
+ computePositionedLogicalWidthReplaced();
return;
}
@@ -1881,8 +2131,8 @@ void RenderBox::calcAbsoluteHorizontal()
// was previously done in calculating the static distances, or ourself, which
// was also previously done for deciding what to override when you had
// over-constrained margins? Also note that the container block is used
- // in similar situations in other parts of the RenderBox class (see calcWidth()
- // and calcHorizontalMargins()). For now we are using the parent for quirks
+ // in similar situations in other parts of the RenderBox class (see computeLogicalWidth()
+ // and computeMarginsInContainingBlockInlineDirection()). For now we are using the parent for quirks
// mode and the containing block for strict mode.
// FIXME 2: Should we still deal with these the cases of 'left' or 'right' having
@@ -1896,7 +2146,7 @@ void RenderBox::calcAbsoluteHorizontal()
// The following is based off of the W3C Working Draft from April 11, 2006 of
// CSS 2.1: Section 10.3.7 "Absolutely positioned, non-replaced elements"
// <http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width>
- // (block-style-comments in this function and in calcAbsoluteHorizontalValues()
+ // (block-style-comments in this function and in computePositionedLogicalWidthUsing()
// correspond to text from the spec)
@@ -1968,7 +2218,7 @@ void RenderBox::calcAbsoluteHorizontal()
// Calculate constraint equation values for 'width' case.
int widthResult;
int xResult;
- calcAbsoluteHorizontalValues(style()->width(), containerBlock, containerDirection,
+ computePositionedLogicalWidthUsing(style()->width(), containerBlock, containerDirection,
containerWidth, bordersPlusPadding,
left, right, marginLeft, marginRight,
widthResult, m_marginLeft, m_marginRight, xResult);
@@ -1982,7 +2232,7 @@ void RenderBox::calcAbsoluteHorizontal()
int maxMarginRight;
int maxXPos;
- calcAbsoluteHorizontalValues(style()->maxWidth(), containerBlock, containerDirection,
+ computePositionedLogicalWidthUsing(style()->maxWidth(), containerBlock, containerDirection,
containerWidth, bordersPlusPadding,
left, right, marginLeft, marginRight,
maxWidth, maxMarginLeft, maxMarginRight, maxXPos);
@@ -2002,7 +2252,7 @@ void RenderBox::calcAbsoluteHorizontal()
int minMarginRight;
int minXPos;
- calcAbsoluteHorizontalValues(style()->minWidth(), containerBlock, containerDirection,
+ computePositionedLogicalWidthUsing(style()->minWidth(), containerBlock, containerDirection,
containerWidth, bordersPlusPadding,
left, right, marginLeft, marginRight,
minWidth, minMarginLeft, minMarginRight, minXPos);
@@ -2015,8 +2265,8 @@ void RenderBox::calcAbsoluteHorizontal()
}
}
- if (stretchesToMinIntrinsicWidth() && width() < minPrefWidth() - bordersPlusPadding) {
- calcAbsoluteHorizontalValues(Length(minPrefWidth() - bordersPlusPadding, Fixed), containerBlock, containerDirection,
+ if (stretchesToMinIntrinsicLogicalWidth() && width() < minPreferredLogicalWidth() - bordersPlusPadding) {
+ computePositionedLogicalWidthUsing(Length(minPreferredLogicalWidth() - bordersPlusPadding, Fixed), containerBlock, containerDirection,
containerWidth, bordersPlusPadding,
left, right, marginLeft, marginRight,
widthResult, m_marginLeft, m_marginRight, xResult);
@@ -2028,7 +2278,7 @@ void RenderBox::calcAbsoluteHorizontal()
setWidth(width() + bordersPlusPadding);
}
-void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
+void RenderBox::computePositionedLogicalWidthUsing(Length width, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
const int containerWidth, const int bordersPlusPadding,
const Length left, const Length right, const Length marginLeft, const Length marginRight,
int& widthValue, int& marginLeftValue, int& marginRightValue, int& xPos)
@@ -2060,7 +2310,7 @@ void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelO
// case because the value is not used for any further calculations.
leftValue = left.calcValue(containerWidth);
- widthValue = calcContentBoxWidth(width.calcValue(containerWidth));
+ widthValue = computeContentBoxLogicalWidth(width.calcValue(containerWidth));
const int availableSpace = containerWidth - (leftValue + widthValue + right.calcValue(containerWidth) + bordersPlusPadding);
@@ -2152,8 +2402,8 @@ void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelO
int rightValue = right.calcValue(containerWidth);
// FIXME: would it be better to have shrink-to-fit in one step?
- int preferredWidth = maxPrefWidth() - bordersPlusPadding;
- int preferredMinWidth = minPrefWidth() - bordersPlusPadding;
+ int preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
+ int preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPadding;
int availableWidth = availableSpace - rightValue;
widthValue = min(max(preferredMinWidth, availableWidth), preferredWidth);
leftValue = availableSpace - (widthValue + rightValue);
@@ -2162,13 +2412,13 @@ void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelO
leftValue = left.calcValue(containerWidth);
// FIXME: would it be better to have shrink-to-fit in one step?
- int preferredWidth = maxPrefWidth() - bordersPlusPadding;
- int preferredMinWidth = minPrefWidth() - bordersPlusPadding;
+ int preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
+ int preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPadding;
int availableWidth = availableSpace - leftValue;
widthValue = min(max(preferredMinWidth, availableWidth), preferredWidth);
} else if (leftIsAuto && !width.isAuto() && !rightIsAuto) {
// RULE 4: (solve for left)
- widthValue = calcContentBoxWidth(width.calcValue(containerWidth));
+ widthValue = computeContentBoxLogicalWidth(width.calcValue(containerWidth));
leftValue = availableSpace - (widthValue + right.calcValue(containerWidth));
} else if (!leftIsAuto && widthIsAuto && !rightIsAuto) {
// RULE 5: (solve for width)
@@ -2177,7 +2427,7 @@ void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelO
} else if (!leftIsAuto&& !widthIsAuto && rightIsAuto) {
// RULE 6: (no need solve for right)
leftValue = left.calcValue(containerWidth);
- widthValue = calcContentBoxWidth(width.calcValue(containerWidth));
+ widthValue = computeContentBoxLogicalWidth(width.calcValue(containerWidth));
}
}
@@ -2192,7 +2442,7 @@ void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelO
InlineFlowBox* firstLine = flow->firstLineBox();
InlineFlowBox* lastLine = flow->lastLineBox();
if (firstLine && lastLine && firstLine != lastLine) {
- xPos = leftValue + marginLeftValue + lastLine->borderLeft() + (lastLine->x() - firstLine->x());
+ xPos = leftValue + marginLeftValue + lastLine->borderLogicalLeft() + (lastLine->x() - firstLine->x());
return;
}
}
@@ -2200,17 +2450,17 @@ void RenderBox::calcAbsoluteHorizontalValues(Length width, const RenderBoxModelO
xPos = leftValue + marginLeftValue + containerBlock->borderLeft();
}
-void RenderBox::calcAbsoluteVertical()
+void RenderBox::computePositionedLogicalHeight()
{
if (isReplaced()) {
- calcAbsoluteVerticalReplaced();
+ computePositionedLogicalHeightReplaced();
return;
}
// The following is based off of the W3C Working Draft from April 11, 2006 of
// CSS 2.1: Section 10.6.4 "Absolutely positioned, non-replaced elements"
// <http://www.w3.org/TR/2005/WD-CSS21-20050613/visudet.html#abs-non-replaced-height>
- // (block-style-comments in this function and in calcAbsoluteVerticalValues()
+ // (block-style-comments in this function and in computePositionedLogicalHeightUsing()
// correspond to text from the spec)
@@ -2259,7 +2509,7 @@ void RenderBox::calcAbsoluteVertical()
int y;
// Calculate constraint equation values for 'height' case.
- calcAbsoluteVerticalValues(style()->height(), containerBlock, containerHeight, bordersPlusPadding,
+ computePositionedLogicalHeightUsing(style()->height(), containerBlock, containerHeight, bordersPlusPadding,
top, bottom, marginTop, marginBottom,
h, m_marginTop, m_marginBottom, y);
setY(y);
@@ -2274,7 +2524,7 @@ void RenderBox::calcAbsoluteVertical()
int maxMarginBottom;
int maxYPos;
- calcAbsoluteVerticalValues(style()->maxHeight(), containerBlock, containerHeight, bordersPlusPadding,
+ computePositionedLogicalHeightUsing(style()->maxHeight(), containerBlock, containerHeight, bordersPlusPadding,
top, bottom, marginTop, marginBottom,
maxHeight, maxMarginTop, maxMarginBottom, maxYPos);
@@ -2293,7 +2543,7 @@ void RenderBox::calcAbsoluteVertical()
int minMarginBottom;
int minYPos;
- calcAbsoluteVerticalValues(style()->minHeight(), containerBlock, containerHeight, bordersPlusPadding,
+ computePositionedLogicalHeightUsing(style()->minHeight(), containerBlock, containerHeight, bordersPlusPadding,
top, bottom, marginTop, marginBottom,
minHeight, minMarginTop, minMarginBottom, minYPos);
@@ -2309,13 +2559,13 @@ void RenderBox::calcAbsoluteVertical()
setHeight(h + bordersPlusPadding);
}
-void RenderBox::calcAbsoluteVerticalValues(Length h, const RenderBoxModelObject* containerBlock,
+void RenderBox::computePositionedLogicalHeightUsing(Length h, const RenderBoxModelObject* containerBlock,
const int containerHeight, const int bordersPlusPadding,
const Length top, const Length bottom, const Length marginTop, const Length marginBottom,
int& heightValue, int& marginTopValue, int& marginBottomValue, int& yPos)
{
// 'top' and 'bottom' cannot both be 'auto' because 'top would of been
- // converted to the static position in calcAbsoluteVertical()
+ // converted to the static position in computePositionedLogicalHeight()
ASSERT(!(top.isAuto() && bottom.isAuto()));
int contentHeight = height() - bordersPlusPadding;
@@ -2344,7 +2594,7 @@ void RenderBox::calcAbsoluteVerticalValues(Length h, const RenderBoxModelObject*
// NOTE: It is not necessary to solve for 'bottom' in the over constrained
// case because the value is not used for any further calculations.
- heightValue = calcContentBoxHeight(h.calcValue(containerHeight));
+ heightValue = computeContentBoxLogicalHeight(h.calcValue(containerHeight));
topValue = top.calcValue(containerHeight);
const int availableSpace = containerHeight - (topValue + heightValue + bottom.calcValue(containerHeight) + bordersPlusPadding);
@@ -2411,7 +2661,7 @@ void RenderBox::calcAbsoluteVerticalValues(Length h, const RenderBoxModelObject*
heightValue = contentHeight;
} else if (topIsAuto && !heightIsAuto && !bottomIsAuto) {
// RULE 4: (solve of top)
- heightValue = calcContentBoxHeight(h.calcValue(containerHeight));
+ heightValue = computeContentBoxLogicalHeight(h.calcValue(containerHeight));
topValue = availableSpace - (heightValue + bottom.calcValue(containerHeight));
} else if (!topIsAuto && heightIsAuto && !bottomIsAuto) {
// RULE 5: (solve of height)
@@ -2419,7 +2669,7 @@ void RenderBox::calcAbsoluteVerticalValues(Length h, const RenderBoxModelObject*
heightValue = max(0, availableSpace - (topValue + bottom.calcValue(containerHeight)));
} else if (!topIsAuto && !heightIsAuto && bottomIsAuto) {
// RULE 6: (no need solve of bottom)
- heightValue = calcContentBoxHeight(h.calcValue(containerHeight));
+ heightValue = computeContentBoxLogicalHeight(h.calcValue(containerHeight));
topValue = top.calcValue(containerHeight);
}
}
@@ -2428,7 +2678,7 @@ void RenderBox::calcAbsoluteVerticalValues(Length h, const RenderBoxModelObject*
yPos = topValue + marginTopValue + containerBlock->borderTop();
}
-void RenderBox::calcAbsoluteHorizontalReplaced()
+void RenderBox::computePositionedLogicalWidthReplaced()
{
// The following is based off of the W3C Working Draft from April 11, 2006 of
// CSS 2.1: Section 10.3.8 "Absolutely positioned, replaced elements"
@@ -2458,9 +2708,9 @@ void RenderBox::calcAbsoluteHorizontalReplaced()
* elements.
\*-----------------------------------------------------------------------*/
// NOTE: This value of width is FINAL in that the min/max width calculations
- // are dealt with in calcReplacedWidth(). This means that the steps to produce
+ // are dealt with in computeReplacedWidth(). This means that the steps to produce
// correct max/min in the non-replaced version, are not necessary.
- setWidth(calcReplacedWidth() + borderAndPaddingWidth());
+ setWidth(computeReplacedWidth() + borderAndPaddingWidth());
const int availableSpace = containerWidth - width();
/*-----------------------------------------------------------------------*\
@@ -2598,7 +2848,7 @@ void RenderBox::calcAbsoluteHorizontalReplaced()
InlineFlowBox* firstLine = flow->firstLineBox();
InlineFlowBox* lastLine = flow->lastLineBox();
if (firstLine && lastLine && firstLine != lastLine) {
- m_frameRect.setX(leftValue + m_marginLeft + lastLine->borderLeft() + (lastLine->x() - firstLine->x()));
+ m_frameRect.setX(leftValue + m_marginLeft + lastLine->borderLogicalLeft() + (lastLine->x() - firstLine->x()));
return;
}
}
@@ -2606,7 +2856,7 @@ void RenderBox::calcAbsoluteHorizontalReplaced()
m_frameRect.setX(leftValue + m_marginLeft + containerBlock->borderLeft());
}
-void RenderBox::calcAbsoluteVerticalReplaced()
+void RenderBox::computePositionedLogicalHeightReplaced()
{
// The following is based off of the W3C Working Draft from April 11, 2006 of
// CSS 2.1: Section 10.6.5 "Absolutely positioned, replaced elements"
@@ -2631,9 +2881,9 @@ void RenderBox::calcAbsoluteVerticalReplaced()
* elements.
\*-----------------------------------------------------------------------*/
// NOTE: This value of height is FINAL in that the min/max height calculations
- // are dealt with in calcReplacedHeight(). This means that the steps to produce
+ // are dealt with in computeReplacedHeight(). This means that the steps to produce
// correct max/min in the non-replaced version, are not necessary.
- setHeight(calcReplacedHeight() + borderAndPaddingHeight());
+ setHeight(computeReplacedHeight() + borderAndPaddingHeight());
const int availableSpace = containerHeight - height();
/*-----------------------------------------------------------------------*\
@@ -2913,7 +3163,7 @@ bool RenderBox::shrinkToAvoidFloats() const
bool RenderBox::avoidsFloats() const
{
- return isReplaced() || hasOverflowClip() || isHR();
+ return isReplaced() || hasOverflowClip() || isHR() || isBlockFlowRoot();
}
void RenderBox::addShadowOverflow()
diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h
index b008c09..445c7bb 100644
--- a/WebCore/rendering/RenderBox.h
+++ b/WebCore/rendering/RenderBox.h
@@ -29,7 +29,7 @@
namespace WebCore {
-enum WidthType { Width, MinWidth, MaxWidth };
+enum LogicalWidthType { LogicalWidth, MinLogicalWidth, MaxLogicalWidth };
class RenderBox : public RenderBoxModelObject {
public:
@@ -44,12 +44,52 @@ public:
int y() const { return m_frameRect.y(); }
int width() const { return m_frameRect.width(); }
int height() const { return m_frameRect.height(); }
-
+
void setX(int x) { m_frameRect.setX(x); }
void setY(int y) { m_frameRect.setY(y); }
void setWidth(int width) { m_frameRect.setWidth(width); }
void setHeight(int height) { m_frameRect.setHeight(height); }
-
+
+ int logicalLeft() const { return style()->isVerticalBlockFlow() ? x() : y(); }
+ int logicalTop() const { return style()->isVerticalBlockFlow() ? y() : x(); }
+ int logicalWidth() const { return style()->isVerticalBlockFlow() ? width() : height(); }
+ int logicalHeight() const { return style()->isVerticalBlockFlow() ? height() : width(); }
+ void setLogicalLeft(int left)
+ {
+ if (style()->isVerticalBlockFlow())
+ setX(left);
+ else
+ setY(left);
+ }
+ void setLogicalTop(int top)
+ {
+ if (style()->isVerticalBlockFlow())
+ setY(top);
+ else
+ setX(top);
+ }
+ void setLogicalWidth(int size)
+ {
+ if (style()->isVerticalBlockFlow())
+ setWidth(size);
+ else
+ setHeight(size);
+ }
+ void setLogicalHeight(int size)
+ {
+ if (style()->isVerticalBlockFlow())
+ setHeight(size);
+ else
+ setWidth(size);
+ }
+ void setLogicalLocation(int left, int top)
+ {
+ if (style()->isVerticalBlockFlow())
+ setLocation(left, top);
+ else
+ setLocation(top, left);
+ }
+
IntPoint location() const { return m_frameRect.location(); }
IntSize locationOffset() const { return IntSize(x(), y()); }
IntSize size() const { return m_frameRect.size(); }
@@ -110,6 +150,8 @@ public:
int contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); }
int contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); }
+ int contentLogicalWidth() const { return style()->isVerticalBlockFlow() ? contentWidth() : contentHeight(); }
+ int contentLogicalHeight() const { return style()->isVerticalBlockFlow() ? contentHeight() : contentWidth(); }
// IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow)
// to return the remaining width on a given line (and the height of a single line).
@@ -139,18 +181,41 @@ public:
virtual int marginBottom() const { return m_marginBottom; }
virtual int marginLeft() const { return m_marginLeft; }
virtual int marginRight() const { return m_marginRight; }
-
+ virtual int marginBefore() const;
+ virtual int marginAfter() const;
+ virtual int marginStart() const;
+ virtual int marginEnd() const;
+ void setMarginStart(int);
+ void setMarginEnd(int);
+ void setMarginBefore(int);
+ void setMarginAfter(int);
+
// The following five functions are used to implement collapsing margins.
// All objects know their maximal positive and negative margins. The
// formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargin|.
// For a non-collapsing box, such as a leaf element, this formula will simply return
- // the margin of the element. Blocks override the maxTopMargin and maxBottomMargin
+ // the margin of the element. Blocks override the maxMarginBefore and maxMarginAfter
// methods.
+ enum MarginSign { PositiveMargin, NegativeMargin };
virtual bool isSelfCollapsingBlock() const { return false; }
- int collapsedMarginTop() const { return maxTopMargin(true) - maxTopMargin(false); }
- int collapsedMarginBottom() const { return maxBottomMargin(true) - maxBottomMargin(false); }
- virtual int maxTopMargin(bool positive) const { return positive ? std::max(0, marginTop()) : -std::min(0, marginTop()); }
- virtual int maxBottomMargin(bool positive) const { return positive ? std::max(0, marginBottom()) : -std::min(0, marginBottom()); }
+ int collapsedMarginBefore() const
+ {
+ return maxMarginBefore(PositiveMargin) - maxMarginBefore(NegativeMargin);
+ }
+ int collapsedMarginAfter() const
+ {
+ return maxMarginAfter(PositiveMargin) - maxMarginAfter(NegativeMargin);
+}
+ virtual int maxMarginBefore(MarginSign sign) const
+ {
+ int beforeMargin = marginBefore();
+ return (sign == PositiveMargin) ? std::max(0, beforeMargin) : -std::min(0, beforeMargin);
+ }
+ virtual int maxMarginAfter(MarginSign sign) const
+ {
+ int afterMargin = marginAfter();
+ return (sign == PositiveMargin) ? std::max(0, afterMargin) : -std::min(0, afterMargin);
+ }
virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
virtual void absoluteQuads(Vector<FloatQuad>&);
@@ -166,8 +231,8 @@ public:
virtual void destroy();
- virtual int minPrefWidth() const;
- virtual int maxPrefWidth() const;
+ virtual int minPreferredLogicalWidth() const;
+ virtual int maxPreferredLogicalWidth() const;
int overrideSize() const;
int overrideWidth() const;
@@ -176,18 +241,19 @@ public:
virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
- int calcBorderBoxWidth(int width) const;
- int calcBorderBoxHeight(int height) const;
- int calcContentBoxWidth(int width) const;
- int calcContentBoxHeight(int height) const;
+ int computeBorderBoxLogicalWidth(int width) const;
+ int computeBorderBoxLogicalHeight(int height) const;
+ int computeContentBoxLogicalWidth(int width) const;
+ int computeContentBoxLogicalHeight(int height) const;
virtual void borderFitAdjust(int& /*x*/, int& /*w*/) const { } // Shrink the box in which the border paints if border-fit is set.
- // This method is now public so that centered objects like tables that are
- // shifted right by left-aligned floats can recompute their left and
- // right margins (so that they can remain centered after being
- // shifted. -dwh
- void calcHorizontalMargins(const Length& marginLeft, const Length& marginRight, int containerWidth);
+ // Resolve auto margins in the inline direction of the containing block so that objects can be pushed to the start, middle or end
+ // of the containing block.
+ void computeInlineDirectionMargins(RenderBlock* containingBlock, int containerWidth, int childWidth);
+
+ // Used to resolve margins in the containing block's block-flow direction.
+ void computeBlockDirectionMargins(RenderBlock* containingBlock);
void positionLineBox(InlineBox*);
@@ -210,40 +276,43 @@ public:
virtual void repaintDuringLayoutIfMoved(const IntRect&);
- virtual int containingBlockWidthForContent() const;
-
- virtual void calcWidth();
- virtual void calcHeight();
+ virtual int containingBlockLogicalWidthForContent() const;
+ int perpendicularContainingBlockLogicalHeight() const;
+
+ virtual void computeLogicalWidth();
+ virtual void computeLogicalHeight();
bool stretchesToViewHeight() const
{
- return document()->inQuirksMode() && style()->height().isAuto() && !isFloatingOrPositioned() && (isRoot() || isBody());
+ return document()->inQuirksMode() && style()->height().isAuto() && !isFloatingOrPositioned() && (isRoot() || isBody()) && !isBlockFlowRoot();
}
virtual IntSize intrinsicSize() const { return IntSize(); }
// Whether or not the element shrinks to its intrinsic width (rather than filling the width
// of a containing block). HTML4 buttons, <select>s, <input>s, legends, and floating/compact elements do this.
- bool sizesToIntrinsicWidth(WidthType) const;
- virtual bool stretchesToMinIntrinsicWidth() const { return false; }
+ bool sizesToIntrinsicLogicalWidth(LogicalWidthType) const;
+ virtual bool stretchesToMinIntrinsicLogicalWidth() const { return false; }
- int calcWidthUsing(WidthType, int containerWidth);
- int calcHeightUsing(const Length& height);
- int calcReplacedWidthUsing(Length width) const;
- int calcReplacedHeightUsing(Length height) const;
+ int computeLogicalWidthUsing(LogicalWidthType, int availableLogicalWidth);
+ int computeLogicalHeightUsing(const Length& height);
+ int computeReplacedWidthUsing(Length width) const;
+ int computeReplacedHeightUsing(Length height) const;
- virtual int calcReplacedWidth(bool includeMaxWidth = true) const;
- virtual int calcReplacedHeight() const;
+ virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
+ virtual int computeReplacedHeight() const;
- int calcPercentageHeight(const Length& height);
+ int computePercentageLogicalHeight(const Length& height);
// Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.)
- virtual int availableWidth() const { return contentWidth(); } // FIXME: Investigate removing eventually. https://bugs.webkit.org/show_bug.cgi?id=46127
- virtual int availableHeight() const;
- int availableHeightUsing(const Length&) const;
- virtual int availableLogicalWidth() const;
-
- void calcVerticalMargins();
+ virtual int availableLogicalWidth() const { return contentLogicalWidth(); }
+ int availableLogicalHeight() const;
+ int availableLogicalHeightUsing(const Length&) const;
+
+ // There are a few cases where we need to refer specifically to the available physical width and available physical height.
+ // Relative positioning is one of those cases, since left/top offsets are physical.
+ int availableWidth() const { return style()->isVerticalBlockFlow() ? availableLogicalWidth() : availableLogicalHeight(); }
+ int availableHeight() const { return style()->isVerticalBlockFlow() ? availableLogicalHeight() : availableLogicalWidth(); }
virtual int verticalScrollbarWidth() const;
int horizontalScrollbarHeight() const;
@@ -278,11 +347,11 @@ public:
void tryLayoutDoingPositionedMovementOnly()
{
int oldWidth = width();
- calcWidth();
+ computeLogicalWidth();
// If we shrink to fit our width may have changed, so we still need full layout.
if (oldWidth != width())
return;
- calcHeight();
+ computeLogicalHeight();
setNeedsLayout(false);
}
@@ -300,9 +369,13 @@ public:
virtual void markDescendantBlocksAndLinesForLayout(bool inLayout = true);
+<<<<<<< HEAD
#ifdef ANDROID_LAYOUT
int getVisibleWidth() const { return m_visibleWidth; }
#endif
+=======
+ bool isBlockFlowRoot() const { return !parent() || parent()->style()->blockFlow() != style()->blockFlow(); }
+>>>>>>> webkit.org at r68651
protected:
virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
@@ -319,9 +392,9 @@ protected:
void paintCustomHighlight(int tx, int ty, const AtomicString& type, bool behindText);
#endif
- void calcAbsoluteHorizontal();
+ void computePositionedLogicalWidth();
- virtual bool shouldCalculateSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); }
+ virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); }
virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&) const;
virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;
@@ -337,23 +410,33 @@ private:
int containingBlockWidthForPositioned(const RenderBoxModelObject* containingBlock) const;
int containingBlockHeightForPositioned(const RenderBoxModelObject* containingBlock) const;
- void calcAbsoluteVertical();
- void calcAbsoluteHorizontalValues(Length width, const RenderBoxModelObject* cb, TextDirection containerDirection,
+ void computePositionedLogicalHeight();
+ void computePositionedLogicalWidthUsing(Length width, const RenderBoxModelObject* cb, TextDirection containerDirection,
int containerWidth, int bordersPlusPadding,
Length left, Length right, Length marginLeft, Length marginRight,
int& widthValue, int& marginLeftValue, int& marginRightValue, int& xPos);
- void calcAbsoluteVerticalValues(Length height, const RenderBoxModelObject* cb,
+ void computePositionedLogicalHeightUsing(Length height, const RenderBoxModelObject* cb,
int containerHeight, int bordersPlusPadding,
Length top, Length bottom, Length marginTop, Length marginBottom,
int& heightValue, int& marginTopValue, int& marginBottomValue, int& yPos);
- void calcAbsoluteVerticalReplaced();
- void calcAbsoluteHorizontalReplaced();
+ void computePositionedLogicalHeightReplaced();
+ void computePositionedLogicalWidthReplaced();
// This function calculates the minimum and maximum preferred widths for an object.
// These values are used in shrink-to-fit layout systems.
// These include tables, positioned objects, floats and flexible boxes.
- virtual void calcPrefWidths() { setPrefWidthsDirty(false); }
+ virtual void computePreferredLogicalWidths() { setPreferredLogicalWidthsDirty(false); }
+
+ void setMarginStartUsing(const RenderStyle*, int);
+ void setMarginEndUsing(const RenderStyle*, int);
+ void setMarginBeforeUsing(const RenderStyle*, int);
+ void setMarginAfterUsing(const RenderStyle*, int);
+
+ int marginStartUsing(const RenderStyle*) const;
+ int marginEndUsing(const RenderStyle*) const;
+ int marginBeforeUsing(const RenderStyle*) const;
+ int marginAfterUsing(const RenderStyle*) const;
private:
// The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent).
@@ -371,11 +454,11 @@ protected:
int m_marginTop;
int m_marginBottom;
- // The preferred width of the element if it were to break its lines at every possible opportunity.
- int m_minPrefWidth;
+ // The preferred logical width of the element if it were to break its lines at every possible opportunity.
+ int m_minPreferredLogicalWidth;
- // The preferred width of the element if it never breaks any lines at all.
- int m_maxPrefWidth;
+ // The preferred logical width of the element if it never breaks any lines at all.
+ int m_maxPreferredLogicalWidth;
// For inline replaced elements, the inline box that owns us.
InlineBox* m_inlineBoxWrapper;
diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp
index f4c2d2a..bbb9c2c 100644
--- a/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/WebCore/rendering/RenderBoxModelObject.cpp
@@ -320,7 +320,7 @@ int RenderBoxModelObject::relativePositionOffsetX() const
{
// Objects that shrink to avoid floats normally use available line width when computing containing block width. However
// in the case of relative positioning using percentages, we can't do this. The offset should always be resolved using the
- // available width of the containing block. Therefore we don't use containingBlockWidthForContent() here, but instead explicitly
+ // available width of the containing block. Therefore we don't use containingBlockLogicalWidthForContent() here, but instead explicitly
// call availableWidth on our containing block.
if (!style()->left().isAuto()) {
RenderBlock* cb = containingBlock();
@@ -505,8 +505,8 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
if (context->paintingDisabled())
return;
- bool includeLeftEdge = box ? box->includeLeftEdge() : true;
- bool includeRightEdge = box ? box->includeRightEdge() : true;
+ bool includeLeftEdge = box ? box->includeLogicalLeftEdge() : true;
+ bool includeRightEdge = box ? box->includeLogicalRightEdge() : true;
int bLeft = includeLeftEdge ? borderLeft() : 0;
int bRight = includeRightEdge ? borderRight() : 0;
int pLeft = includeLeftEdge ? paddingLeft() : 0;
@@ -624,6 +624,12 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
// Can't scroll a frameset document anyway.
isOpaqueRoot = body->hasLocalName(framesetTag);
}
+#if ENABLE(SVG)
+ else {
+ // SVG documents and XML documents with SVG root nodes are transparent.
+ isOpaqueRoot = !document()->hasSVGRootNode();
+ }
+#endif
}
} else
isOpaqueRoot = !view()->frameView()->isTransparent();
@@ -1590,6 +1596,18 @@ void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContex
graphicsContext->clipConvexPolygon(4, secondQuad, !secondEdgeMatches);
}
+static inline void uniformlyExpandBorderRadii(int delta, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight)
+{
+ topLeft.expand(delta, delta);
+ topLeft.clampNegativeToZero();
+ topRight.expand(delta, delta);
+ topRight.clampNegativeToZero();
+ bottomLeft.expand(delta, delta);
+ bottomLeft.clampNegativeToZero();
+ bottomRight.expand(delta, delta);
+ bottomRight.clampNegativeToZero();
+}
+
void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int ty, int w, int h, const RenderStyle* s, ShadowStyle shadowStyle, bool begin, bool end)
{
// FIXME: Deal with border-image. Would be great to use border-image as a mask.
@@ -1673,37 +1691,15 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
IntSize bottomLeftToClipOut = bottomLeft;
IntSize bottomRightToClipOut = bottomRight;
- if (shadowSpread < 0) {
- topLeft.expand(shadowSpread, shadowSpread);
- topLeft.clampNegativeToZero();
-
- topRight.expand(shadowSpread, shadowSpread);
- topRight.clampNegativeToZero();
-
- bottomLeft.expand(shadowSpread, shadowSpread);
- bottomLeft.clampNegativeToZero();
-
- bottomRight.expand(shadowSpread, shadowSpread);
- bottomRight.clampNegativeToZero();
- }
+ if (shadowSpread < 0)
+ uniformlyExpandBorderRadii(shadowSpread, topLeft, topRight, bottomLeft, bottomRight);
// If the box is opaque, it is unnecessary to clip it out. However, doing so saves time
// when painting the shadow. On the other hand, it introduces subpixel gaps along the
// corners. Those are avoided by insetting the clipping path by one pixel.
if (hasOpaqueBackground) {
rectToClipOut.inflate(-1);
-
- topLeftToClipOut.expand(-1, -1);
- topLeftToClipOut.clampNegativeToZero();
-
- topRightToClipOut.expand(-1, -1);
- topRightToClipOut.clampNegativeToZero();
-
- bottomLeftToClipOut.expand(-1, -1);
- bottomLeftToClipOut.clampNegativeToZero();
-
- bottomRightToClipOut.expand(-1, -1);
- bottomRightToClipOut.clampNegativeToZero();
+ uniformlyExpandBorderRadii(-1, topLeftToClipOut, topRightToClipOut, bottomLeftToClipOut, bottomRightToClipOut);
}
if (!rectToClipOut.isEmpty())
@@ -1769,19 +1765,8 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
context->addPath(Path::createRectangle(outerRect));
if (hasBorderRadius) {
- if (shadowSpread > 0) {
- topLeft.expand(-shadowSpread, -shadowSpread);
- topLeft.clampNegativeToZero();
-
- topRight.expand(-shadowSpread, -shadowSpread);
- topRight.clampNegativeToZero();
-
- bottomLeft.expand(-shadowSpread, -shadowSpread);
- bottomLeft.clampNegativeToZero();
-
- bottomRight.expand(-shadowSpread, -shadowSpread);
- bottomRight.clampNegativeToZero();
- }
+ if (shadowSpread > 0)
+ uniformlyExpandBorderRadii(-shadowSpread, topLeft, topRight, bottomLeft, bottomRight);
context->addPath(Path::createRoundedRectangle(holeRect, topLeft, topRight, bottomLeft, bottomRight));
} else
context->addPath(Path::createRectangle(holeRect));
@@ -1796,9 +1781,9 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
}
}
-int RenderBoxModelObject::containingBlockWidthForContent() const
+int RenderBoxModelObject::containingBlockLogicalWidthForContent() const
{
- return containingBlock()->availableWidth();
+ return containingBlock()->availableLogicalWidth();
}
} // namespace WebCore
diff --git a/WebCore/rendering/RenderBoxModelObject.h b/WebCore/rendering/RenderBoxModelObject.h
index e91e799..83c9367 100644
--- a/WebCore/rendering/RenderBoxModelObject.h
+++ b/WebCore/rendering/RenderBoxModelObject.h
@@ -79,19 +79,29 @@ public:
virtual int borderBottom() const { return style()->borderBottomWidth(); }
virtual int borderLeft() const { return style()->borderLeftWidth(); }
virtual int borderRight() const { return style()->borderRightWidth(); }
+ virtual int borderBefore() const { return style()->borderBeforeWidth(); }
+ virtual int borderAfter() const { return style()->borderAfterWidth(); }
+ virtual int borderStart() const { return style()->borderStartWidth(); }
+ virtual int borderEnd() const { return style()->borderEndWidth(); }
int borderAndPaddingHeight() const { return borderTop() + borderBottom() + paddingTop() + paddingBottom(); }
int borderAndPaddingWidth() const { return borderLeft() + borderRight() + paddingLeft() + paddingRight(); }
+ int borderAndPaddingLogicalHeight() const { return borderBefore() + borderAfter() + paddingBefore() + paddingAfter(); }
+ int borderAndPaddingLogicalWidth() const { return borderStart() + borderEnd() + paddingStart() + paddingEnd(); }
virtual int marginTop() const = 0;
virtual int marginBottom() const = 0;
virtual int marginLeft() const = 0;
virtual int marginRight() const = 0;
+ virtual int marginBefore() const = 0;
+ virtual int marginAfter() const = 0;
+ virtual int marginStart() const = 0;
+ virtual int marginEnd() const = 0;
bool hasHorizontalBordersPaddingOrMargin() const { return hasHorizontalBordersOrPadding() || marginLeft() != 0 || marginRight() != 0; }
bool hasHorizontalBordersOrPadding() const { return borderLeft() != 0 || borderRight() != 0 || paddingLeft() != 0 || paddingRight() != 0; }
- virtual int containingBlockWidthForContent() const;
+ virtual int containingBlockLogicalWidthForContent() const;
virtual void childBecameNonInline(RenderObject* /*child*/) { }
diff --git a/WebCore/rendering/RenderCounter.cpp b/WebCore/rendering/RenderCounter.cpp
index 6e678e8..639221d 100644
--- a/WebCore/rendering/RenderCounter.cpp
+++ b/WebCore/rendering/RenderCounter.cpp
@@ -328,10 +328,10 @@ PassRefPtr<StringImpl> RenderCounter::originalText() const
return text.impl();
}
-void RenderCounter::calcPrefWidths(int lead)
+void RenderCounter::computePreferredLogicalWidths(int lead)
{
setTextInternal(originalText());
- RenderText::calcPrefWidths(lead);
+ RenderText::computePreferredLogicalWidths(lead);
}
void RenderCounter::invalidate(const AtomicString& identifier)
diff --git a/WebCore/rendering/RenderCounter.h b/WebCore/rendering/RenderCounter.h
index 10ba1dc..8d981df 100644
--- a/WebCore/rendering/RenderCounter.h
+++ b/WebCore/rendering/RenderCounter.h
@@ -49,7 +49,7 @@ private:
virtual bool isCounter() const;
virtual PassRefPtr<StringImpl> originalText() const;
- virtual void calcPrefWidths(int leadWidth);
+ virtual void computePreferredLogicalWidths(int leadWidth);
CounterContent m_counter;
mutable CounterNode* m_counterNode;
diff --git a/WebCore/rendering/RenderDataGrid.cpp b/WebCore/rendering/RenderDataGrid.cpp
index 63a21cd..c322389 100644
--- a/WebCore/rendering/RenderDataGrid.cpp
+++ b/WebCore/rendering/RenderDataGrid.cpp
@@ -88,34 +88,34 @@ RenderStyle* RenderDataGrid::headerStyle(DataGridColumn* column)
return column->headerStyle();
}
-void RenderDataGrid::calcPrefWidths()
+void RenderDataGrid::computePreferredLogicalWidths()
{
- m_minPrefWidth = 0;
- m_maxPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
+ m_maxPreferredLogicalWidth = 0;
if (style()->width().isFixed() && style()->width().value() > 0)
- m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value());
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value());
else
- m_maxPrefWidth = calcContentBoxWidth(cDefaultWidth);
+ m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(cDefaultWidth);
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
- m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
- m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
+ m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
+ m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
} else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
- m_minPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
else
- m_minPrefWidth = m_maxPrefWidth;
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
- m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
- m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
+ m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
}
int toAdd = borderAndPaddingWidth();
- m_minPrefWidth += toAdd;
- m_maxPrefWidth += toAdd;
+ m_minPreferredLogicalWidth += toAdd;
+ m_maxPreferredLogicalWidth += toAdd;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
void RenderDataGrid::layout()
diff --git a/WebCore/rendering/RenderDataGrid.h b/WebCore/rendering/RenderDataGrid.h
index c4b54df..1492d26 100644
--- a/WebCore/rendering/RenderDataGrid.h
+++ b/WebCore/rendering/RenderDataGrid.h
@@ -44,7 +44,7 @@ public:
virtual const char* renderName() const { return "RenderDataGrid"; }
virtual bool canHaveChildren() const { return false; }
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
virtual void layout();
virtual void paintObject(PaintInfo&, int tx, int ty);
diff --git a/WebCore/rendering/RenderEmbeddedObject.cpp b/WebCore/rendering/RenderEmbeddedObject.cpp
index 4179af3..aa301e2 100644
--- a/WebCore/rendering/RenderEmbeddedObject.cpp
+++ b/WebCore/rendering/RenderEmbeddedObject.cpp
@@ -215,8 +215,8 @@ void RenderEmbeddedObject::layout()
{
ASSERT(needsLayout());
- calcWidth();
- calcHeight();
+ computeLogicalWidth();
+ computeLogicalHeight();
RenderPart::layout();
diff --git a/WebCore/rendering/RenderFieldset.cpp b/WebCore/rendering/RenderFieldset.cpp
index bd245c7..d3b88c1 100644
--- a/WebCore/rendering/RenderFieldset.cpp
+++ b/WebCore/rendering/RenderFieldset.cpp
@@ -44,11 +44,11 @@ RenderFieldset::RenderFieldset(Node* element)
{
}
-void RenderFieldset::calcPrefWidths()
+void RenderFieldset::computePreferredLogicalWidths()
{
- RenderBlock::calcPrefWidths();
+ RenderBlock::computePreferredLogicalWidths();
if (RenderBox* legend = findLegend()) {
- int legendMinWidth = legend->minPrefWidth();
+ int legendMinWidth = legend->minPreferredLogicalWidth();
Length legendMarginLeft = legend->style()->marginLeft();
Length legendMarginRight = legend->style()->marginLeft();
@@ -59,7 +59,7 @@ void RenderFieldset::calcPrefWidths()
if (legendMarginRight.isFixed())
legendMinWidth += legendMarginRight.value();
- m_minPrefWidth = max(m_minPrefWidth, legendMinWidth + borderAndPaddingWidth());
+ m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, legendMinWidth + borderAndPaddingWidth());
}
}
diff --git a/WebCore/rendering/RenderFieldset.h b/WebCore/rendering/RenderFieldset.h
index df6a1da..bc8e8ae 100644
--- a/WebCore/rendering/RenderFieldset.h
+++ b/WebCore/rendering/RenderFieldset.h
@@ -40,9 +40,9 @@ private:
virtual RenderObject* layoutLegend(bool relayoutChildren);
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
virtual bool avoidsFloats() const { return true; }
- virtual bool stretchesToMinIntrinsicWidth() const { return true; }
+ virtual bool stretchesToMinIntrinsicLogicalWidth() const { return true; }
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
diff --git a/WebCore/rendering/RenderFileUploadControl.cpp b/WebCore/rendering/RenderFileUploadControl.cpp
index 20ebe4d..cdb0470 100644
--- a/WebCore/rendering/RenderFileUploadControl.cpp
+++ b/WebCore/rendering/RenderFileUploadControl.cpp
@@ -257,41 +257,41 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, int tx, int ty)
paintInfo.context->restore();
}
-void RenderFileUploadControl::calcPrefWidths()
+void RenderFileUploadControl::computePreferredLogicalWidths()
{
- ASSERT(prefWidthsDirty());
+ ASSERT(preferredLogicalWidthsDirty());
- m_minPrefWidth = 0;
- m_maxPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
+ m_maxPreferredLogicalWidth = 0;
if (style()->width().isFixed() && style()->width().value() > 0)
- m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value());
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value());
else {
// Figure out how big the filename space needs to be for a given number of characters
// (using "0" as the nominal character).
const UChar ch = '0';
float charWidth = style()->font().floatWidth(TextRun(&ch, 1, false, 0, 0, false, false, false));
- m_maxPrefWidth = (int)ceilf(charWidth * defaultWidthNumChars);
+ m_maxPreferredLogicalWidth = (int)ceilf(charWidth * defaultWidthNumChars);
}
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
- m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
- m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
+ m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
+ m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
} else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
- m_minPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
else
- m_minPrefWidth = m_maxPrefWidth;
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
- m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
- m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
+ m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
}
int toAdd = borderAndPaddingWidth();
- m_minPrefWidth += toAdd;
- m_maxPrefWidth += toAdd;
+ m_minPreferredLogicalWidth += toAdd;
+ m_maxPreferredLogicalWidth += toAdd;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
void RenderFileUploadControl::receiveDroppedFiles(const Vector<String>& paths)
diff --git a/WebCore/rendering/RenderFileUploadControl.h b/WebCore/rendering/RenderFileUploadControl.h
index 205ba47..c96800c 100644
--- a/WebCore/rendering/RenderFileUploadControl.h
+++ b/WebCore/rendering/RenderFileUploadControl.h
@@ -51,7 +51,7 @@ private:
virtual const char* renderName() const { return "RenderFileUploadControl"; }
virtual void updateFromElement();
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
virtual void paintObject(PaintInfo&, int tx, int ty);
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
diff --git a/WebCore/rendering/RenderFlexibleBox.cpp b/WebCore/rendering/RenderFlexibleBox.cpp
index 659df8d..636c873 100644
--- a/WebCore/rendering/RenderFlexibleBox.cpp
+++ b/WebCore/rendering/RenderFlexibleBox.cpp
@@ -137,8 +137,8 @@ void RenderFlexibleBox::calcHorizontalPrefWidths()
marginRight += mr.value();
margin = marginLeft + marginRight;
- m_minPrefWidth += child->minPrefWidth() + margin;
- m_maxPrefWidth += child->maxPrefWidth() + margin;
+ m_minPreferredLogicalWidth += child->minPreferredLogicalWidth() + margin;
+ m_maxPreferredLogicalWidth += child->maxPreferredLogicalWidth() + margin;
}
}
@@ -160,39 +160,39 @@ void RenderFlexibleBox::calcVerticalPrefWidths()
if (mr.isFixed())
margin += mr.value();
- int w = child->minPrefWidth() + margin;
- m_minPrefWidth = max(w, m_minPrefWidth);
+ int w = child->minPreferredLogicalWidth() + margin;
+ m_minPreferredLogicalWidth = max(w, m_minPreferredLogicalWidth);
- w = child->maxPrefWidth() + margin;
- m_maxPrefWidth = max(w, m_maxPrefWidth);
+ w = child->maxPreferredLogicalWidth() + margin;
+ m_maxPreferredLogicalWidth = max(w, m_maxPreferredLogicalWidth);
}
}
-void RenderFlexibleBox::calcPrefWidths()
+void RenderFlexibleBox::computePreferredLogicalWidths()
{
- ASSERT(prefWidthsDirty());
+ ASSERT(preferredLogicalWidthsDirty());
if (style()->width().isFixed() && style()->width().value() > 0)
- m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value());
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value());
else {
- m_minPrefWidth = m_maxPrefWidth = 0;
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 0;
if (hasMultipleLines() || isVertical())
calcVerticalPrefWidths();
else
calcHorizontalPrefWidths();
- m_maxPrefWidth = max(m_minPrefWidth, m_maxPrefWidth);
+ m_maxPreferredLogicalWidth = max(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
}
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
- m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
- m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
+ m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
+ m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
}
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
- m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
- m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
+ m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
}
int toAdd = borderAndPaddingWidth();
@@ -200,10 +200,10 @@ void RenderFlexibleBox::calcPrefWidths()
if (hasOverflowClip() && style()->overflowY() == OSCROLL)
toAdd += verticalScrollbarWidth();
- m_minPrefWidth += toAdd;
- m_maxPrefWidth += toAdd;
+ m_minPreferredLogicalWidth += toAdd;
+ m_maxPreferredLogicalWidth += toAdd;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXME: Implement */)
@@ -219,8 +219,8 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM
int previousWidth = width();
int previousHeight = height();
- calcWidth();
- calcHeight();
+ computeLogicalWidth();
+ computeLogicalHeight();
m_overflow.clear();
@@ -251,7 +251,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM
else
layoutVerticalBox(relayoutChildren);
- calcHeight();
+ computeLogicalHeight();
if (previousHeight != height())
relayoutChildren = true;
@@ -266,14 +266,14 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM
// bottom margin max values to 0. This way we don't factor in the values
// twice when we collapse with our previous vertically adjacent and
// following vertically adjacent blocks.
- int pos = maxTopPosMargin();
- int neg = maxTopNegMargin();
- if (maxBottomPosMargin() > pos)
- pos = maxBottomPosMargin();
- if (maxBottomNegMargin() > neg)
- neg = maxBottomNegMargin();
- setMaxTopMargins(pos, neg);
- setMaxBottomMargins(0, 0);
+ int pos = maxPosMarginBefore();
+ int neg = maxNegMarginBefore();
+ if (maxPosMarginAfter() > pos)
+ pos = maxPosMarginAfter();
+ if (maxNegMarginAfter() > neg)
+ neg = maxNegMarginAfter();
+ setMaxMarginBeforeValues(pos, neg);
+ setMaxMarginAfterValues(0, 0);
}
// Add in the overflow from children.
@@ -372,7 +372,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
}
// Compute the child's vertical margins.
- child->calcVerticalMargins();
+ child->computeBlockDirectionMargins(this);
if (!child->needsLayout() && paginated && view()->layoutState()->m_pageHeight) {
RenderBlock* childRenderBlock = child->isRenderBlock() ? toRenderBlock(child) : 0;
@@ -412,7 +412,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
setHeight(height() + toAdd);
oldHeight = height();
- calcHeight();
+ computeLogicalHeight();
relayoutChildren = false;
if (oldHeight != height())
@@ -444,7 +444,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
// fill the height of a containing box by default.
// Now do a layout.
int oldChildHeight = child->height();
- child->calcHeight();
+ child->computeLogicalHeight();
if (oldChildHeight != child->height())
child->setChildNeedsLayout(true, false);
@@ -643,7 +643,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
}
}
- // So that the calcHeight in layoutBlock() knows to relayout positioned objects because of
+ // So that the computeLogicalHeight in layoutBlock() knows to relayout positioned objects because of
// a height change, we revert our height back to the intrinsic height before returning.
if (heightSpecified)
setHeight(oldHeight);
@@ -713,7 +713,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
}
// Compute the child's vertical margins.
- child->calcVerticalMargins();
+ child->computeBlockDirectionMargins(this);
// Add in the child's marginTop to our height.
setHeight(height() + child->marginTop());
@@ -769,7 +769,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
// Now we have to calc our height, so we know how much space we have remaining.
oldHeight = height();
- calcHeight();
+ computeLogicalHeight();
if (oldHeight != height())
heightSpecified = true;
@@ -925,7 +925,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
}
}
- // So that the calcHeight in layoutBlock() knows to relayout positioned objects because of
+ // So that the computeLogicalHeight in layoutBlock() knows to relayout positioned objects because of
// a height change, we revert our height back to the intrinsic height before returning.
if (heightSpecified)
setHeight(oldHeight);
@@ -1001,7 +1001,7 @@ void RenderFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutC
int totalWidth;
InlineBox* anchorBox = lastLine->lastChild();
if (anchorBox && anchorBox->renderer()->node() && anchorBox->renderer()->node()->isLink())
- totalWidth = anchorBox->width() + font.width(TextRun(ellipsisAndSpace, 2));
+ totalWidth = anchorBox->logicalWidth() + font.width(TextRun(ellipsisAndSpace, 2));
else {
anchorBox = 0;
totalWidth = font.width(TextRun(&horizontalEllipsis, 1));
@@ -1018,12 +1018,12 @@ void RenderFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutC
continue;
int ltr = true;
- int blockRightEdge = destBlock->rightOffset(lastVisibleLine->y(), false);
- int blockLeftEdge = destBlock->leftOffset(lastVisibleLine->y(), false);
+ int blockRightEdge = destBlock->logicalRightOffsetForLine(lastVisibleLine->y(), false);
+ int blockLeftEdge = destBlock->logicalLeftOffsetForLine(lastVisibleLine->y(), false);
int blockEdge = ltr ? blockRightEdge : blockLeftEdge;
if (!lastVisibleLine->canAccommodateEllipsis(ltr, blockEdge,
- lastVisibleLine->x() + lastVisibleLine->width(),
+ lastVisibleLine->x() + lastVisibleLine->logicalWidth(),
totalWidth))
continue;
@@ -1062,9 +1062,9 @@ int RenderFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsign
child->style()->maxWidth().isFixed())
maxW = child->style()->maxWidth().value();
else if (child->style()->maxWidth().type() == Intrinsic)
- maxW = child->maxPrefWidth();
+ maxW = child->maxPreferredLogicalWidth();
else if (child->style()->maxWidth().type() == MinIntrinsic)
- maxW = child->minPrefWidth();
+ maxW = child->minPreferredLogicalWidth();
if (maxW == INT_MAX)
return maxW;
return max(0, maxW - w);
@@ -1083,14 +1083,14 @@ int RenderFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsign
// FIXME: For now just handle fixed values.
if (isHorizontal()) {
- int minW = child->minPrefWidth();
+ int minW = child->minPreferredLogicalWidth();
int w = child->overrideWidth() - child->borderAndPaddingWidth();
if (child->style()->minWidth().isFixed())
minW = child->style()->minWidth().value();
else if (child->style()->minWidth().type() == Intrinsic)
- minW = child->maxPrefWidth();
+ minW = child->maxPreferredLogicalWidth();
else if (child->style()->minWidth().type() == MinIntrinsic)
- minW = child->minPrefWidth();
+ minW = child->minPreferredLogicalWidth();
int allowedShrinkage = min(0, minW - w);
return allowedShrinkage;
diff --git a/WebCore/rendering/RenderFlexibleBox.h b/WebCore/rendering/RenderFlexibleBox.h
index 2aa20b5..8525c29 100644
--- a/WebCore/rendering/RenderFlexibleBox.h
+++ b/WebCore/rendering/RenderFlexibleBox.h
@@ -36,7 +36,7 @@ public:
virtual const char* renderName() const;
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
void calcHorizontalPrefWidths();
void calcVerticalPrefWidths();
diff --git a/WebCore/rendering/RenderForeignObject.cpp b/WebCore/rendering/RenderForeignObject.cpp
index bfcb940..839e963 100644
--- a/WebCore/rendering/RenderForeignObject.cpp
+++ b/WebCore/rendering/RenderForeignObject.cpp
@@ -82,13 +82,13 @@ const AffineTransform& RenderForeignObject::localToParentTransform() const
return m_localToParentTransform;
}
-void RenderForeignObject::calcWidth()
+void RenderForeignObject::computeLogicalWidth()
{
// FIXME: Investigate in size rounding issues
setWidth(static_cast<int>(roundf(m_viewport.width())));
}
-void RenderForeignObject::calcHeight()
+void RenderForeignObject::computeLogicalHeight()
{
// FIXME: Investigate in size rounding issues
setHeight(static_cast<int>(roundf(m_viewport.height())));
@@ -99,7 +99,7 @@ void RenderForeignObject::layout()
ASSERT(needsLayout());
ASSERT(!view()->layoutStateEnabled()); // RenderSVGRoot disables layoutState for the SVG rendering tree.
- LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout());
+ LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
SVGForeignObjectElement* foreign = static_cast<SVGForeignObjectElement*>(node());
bool updateCachedBoundariesInParents = false;
diff --git a/WebCore/rendering/RenderForeignObject.h b/WebCore/rendering/RenderForeignObject.h
index d8c1f68..87423e6 100644
--- a/WebCore/rendering/RenderForeignObject.h
+++ b/WebCore/rendering/RenderForeignObject.h
@@ -57,8 +57,8 @@ public:
virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; }
private:
- virtual void calcWidth();
- virtual void calcHeight();
+ virtual void computeLogicalWidth();
+ virtual void computeLogicalHeight();
virtual const AffineTransform& localToParentTransform() const;
virtual AffineTransform localTransform() const { return m_localTransform; }
diff --git a/WebCore/rendering/RenderFrameBase.cpp b/WebCore/rendering/RenderFrameBase.cpp
index 4a62f8a..b36ad3a 100644
--- a/WebCore/rendering/RenderFrameBase.cpp
+++ b/WebCore/rendering/RenderFrameBase.cpp
@@ -53,8 +53,8 @@ void RenderFrameBase::layoutWithFlattening(bool fixedWidth, bool fixedHeight)
// need to update to calculate min/max correctly
updateWidgetPosition();
- if (childRoot->prefWidthsDirty())
- childRoot->calcPrefWidths();
+ if (childRoot->preferredLogicalWidthsDirty())
+ childRoot->computePreferredLogicalWidths();
// if scrollbars are off, and the width or height are fixed
// we obey them and do not expand. With frame flattening
@@ -69,7 +69,7 @@ void RenderFrameBase::layoutWithFlattening(bool fixedWidth, bool fixedHeight)
// make sure minimum preferred width is enforced
if (isScrollable || !fixedWidth) {
- setWidth(max(width(), childRoot->minPrefWidth() + hBorder));
+ setWidth(max(width(), childRoot->minPreferredLogicalWidth() + hBorder));
// update again to pass the new width to the child frame
updateWidgetPosition();
childFrameView->layout();
diff --git a/WebCore/rendering/RenderHTMLCanvas.cpp b/WebCore/rendering/RenderHTMLCanvas.cpp
index c89495b..68bb536 100644
--- a/WebCore/rendering/RenderHTMLCanvas.cpp
+++ b/WebCore/rendering/RenderHTMLCanvas.cpp
@@ -73,12 +73,12 @@ void RenderHTMLCanvas::canvasSizeChanged()
if (!parent())
return;
- if (!prefWidthsDirty())
- setPrefWidthsDirty(true);
+ if (!preferredLogicalWidthsDirty())
+ setPreferredLogicalWidthsDirty(true);
IntSize oldSize = size();
- calcWidth();
- calcHeight();
+ computeLogicalWidth();
+ computeLogicalHeight();
if (oldSize == size())
return;
diff --git a/WebCore/rendering/RenderIFrame.cpp b/WebCore/rendering/RenderIFrame.cpp
index 8421c9e..cbe4c70 100644
--- a/WebCore/rendering/RenderIFrame.cpp
+++ b/WebCore/rendering/RenderIFrame.cpp
@@ -41,8 +41,9 @@ RenderIFrame::RenderIFrame(Element* element)
{
}
-void RenderIFrame::calcHeight()
+void RenderIFrame::computeLogicalHeight()
{
+<<<<<<< HEAD
RenderPart::calcHeight();
#ifdef ANDROID_FLATTEN_IFRAME
if (!node()->hasTagName(iframeTag) || !widget() || !widget()->isFrameView())
@@ -68,6 +69,9 @@ void RenderIFrame::calcHeight()
updateWidgetPosition();
return;
#endif
+=======
+ RenderPart::computeLogicalHeight();
+>>>>>>> webkit.org at r68651
if (!flattenFrame())
return;
@@ -83,8 +87,9 @@ void RenderIFrame::calcHeight()
}
}
-void RenderIFrame::calcWidth()
+void RenderIFrame::computeLogicalWidth()
{
+<<<<<<< HEAD
RenderPart::calcWidth();
#ifdef ANDROID_FLATTEN_IFRAME
if (!node()->hasTagName(iframeTag) || !widget() || !widget()->isFrameView())
@@ -117,6 +122,9 @@ void RenderIFrame::calcWidth()
updateWidgetPosition();
return;
#endif
+=======
+ RenderPart::computeLogicalWidth();
+>>>>>>> webkit.org at r68651
if (!flattenFrame())
return;
@@ -162,8 +170,8 @@ void RenderIFrame::layout()
{
ASSERT(needsLayout());
- RenderPart::calcWidth();
- RenderPart::calcHeight();
+ RenderPart::computeLogicalWidth();
+ RenderPart::computeLogicalHeight();
#ifdef ANDROID_FLATTEN_IFRAME
// Calculate the styled dimensions by subtracting the border and padding.
diff --git a/WebCore/rendering/RenderIFrame.h b/WebCore/rendering/RenderIFrame.h
index ab659a4..325e2b3 100644
--- a/WebCore/rendering/RenderIFrame.h
+++ b/WebCore/rendering/RenderIFrame.h
@@ -39,8 +39,8 @@ public:
#endif
private:
- virtual void calcHeight();
- virtual void calcWidth();
+ virtual void computeLogicalHeight();
+ virtual void computeLogicalWidth();
virtual void layout();
diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp
index d5d52f6..dd01861 100644
--- a/WebCore/rendering/RenderImage.cpp
+++ b/WebCore/rendering/RenderImage.cpp
@@ -155,10 +155,10 @@ void RenderImage::imageChanged(WrappedImagePtr newImage, const IntRect* rect)
// lets see if we need to relayout at all..
int oldwidth = width();
int oldheight = height();
- if (!prefWidthsDirty())
- setPrefWidthsDirty(true);
- calcWidth();
- calcHeight();
+ if (!preferredLogicalWidthsDirty())
+ setPreferredLogicalWidthsDirty(true);
+ computeLogicalWidth();
+ computeLogicalHeight();
if (imageSizeChanged || width() != oldwidth || height() != oldheight) {
shouldRepaint = false;
@@ -369,7 +369,7 @@ HTMLMapElement* RenderImage::imageMap() const
bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction)
{
- HitTestResult tempResult(result.point(), result.padding());
+ HitTestResult tempResult(result.point(), result.topPadding(), result.rightPadding(), result.bottomPadding(), result.leftPadding());
bool inside = RenderReplaced::nodeAtPoint(request, tempResult, x, y, tx, ty, hitTestAction);
if (tempResult.innerNode() && node()) {
@@ -439,7 +439,7 @@ bool RenderImage::isHeightSpecified() const
return false;
}
-int RenderImage::calcReplacedWidth(bool includeMaxWidth) const
+int RenderImage::computeReplacedWidth(bool includeMaxWidth) const
{
if (m_imageResource->imageHasRelativeWidth())
if (RenderObject* cb = isPositioned() ? container() : containingBlock()) {
@@ -449,7 +449,7 @@ int RenderImage::calcReplacedWidth(bool includeMaxWidth) const
int width;
if (isWidthSpecified())
- width = calcReplacedWidthUsing(style()->width());
+ width = computeReplacedWidthUsing(style()->width());
else if (m_imageResource->usesImageContainerSize())
width = m_imageResource->imageSize(style()->effectiveZoom()).width();
else if (m_imageResource->imageHasRelativeWidth())
@@ -457,8 +457,8 @@ int RenderImage::calcReplacedWidth(bool includeMaxWidth) const
else
width = calcAspectRatioWidth();
- int minW = calcReplacedWidthUsing(style()->minWidth());
- int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth());
+ int minW = computeReplacedWidthUsing(style()->minWidth());
+ int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth());
#ifdef ANDROID_LAYOUT
width = max(minW, min(width, maxW));
@@ -474,11 +474,11 @@ int RenderImage::calcReplacedWidth(bool includeMaxWidth) const
#endif
}
-int RenderImage::calcReplacedHeight() const
+int RenderImage::computeReplacedHeight() const
{
int height;
if (isHeightSpecified())
- height = calcReplacedHeightUsing(style()->height());
+ height = computeReplacedHeightUsing(style()->height());
else if (m_imageResource->usesImageContainerSize())
height = m_imageResource->imageSize(style()->effectiveZoom()).height();
else if (m_imageResource->imageHasRelativeHeight())
@@ -486,8 +486,8 @@ int RenderImage::calcReplacedHeight() const
else
height = calcAspectRatioHeight();
- int minH = calcReplacedHeightUsing(style()->minHeight());
- int maxH = style()->maxHeight().isUndefined() ? height : calcReplacedHeightUsing(style()->maxHeight());
+ int minH = computeReplacedHeightUsing(style()->minHeight());
+ int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight());
#ifdef ANDROID_LAYOUT
height = max(minH, min(height, maxH));
@@ -520,7 +520,7 @@ int RenderImage::calcAspectRatioWidth() const
return 0;
if (!m_imageResource->hasImage() || m_imageResource->errorOccurred())
return size.width(); // Don't bother scaling.
- return RenderBox::calcReplacedHeight() * size.width() / size.height();
+ return RenderBox::computeReplacedHeight() * size.width() / size.height();
}
int RenderImage::calcAspectRatioHeight() const
@@ -530,7 +530,7 @@ int RenderImage::calcAspectRatioHeight() const
return 0;
if (!m_imageResource->hasImage() || m_imageResource->errorOccurred())
return size.height(); // Don't bother scaling.
- return RenderBox::calcReplacedWidth() * size.height() / size.width();
+ return RenderBox::computeReplacedWidth() * size.height() / size.width();
}
} // namespace WebCore
diff --git a/WebCore/rendering/RenderImage.h b/WebCore/rendering/RenderImage.h
index f9acba8..022d792 100644
--- a/WebCore/rendering/RenderImage.h
+++ b/WebCore/rendering/RenderImage.h
@@ -61,7 +61,11 @@ protected:
bool isWidthSpecified() const;
bool isHeightSpecified() const;
- virtual void intrinsicSizeChanged() { imageChanged(m_imageResource->imagePtr()); }
+ virtual void intrinsicSizeChanged()
+ {
+ if (m_imageResource)
+ imageChanged(m_imageResource->imagePtr());
+ }
private:
virtual const char* renderName() const { return "RenderImage"; }
@@ -76,8 +80,8 @@ private:
virtual void notifyFinished(CachedResource*);
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
- virtual int calcReplacedWidth(bool includeMaxWidth = true) const;
- virtual int calcReplacedHeight() const;
+ virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
+ virtual int computeReplacedHeight() const;
int calcAspectRatioWidth() const;
int calcAspectRatioHeight() const;
diff --git a/WebCore/rendering/RenderIndicator.cpp b/WebCore/rendering/RenderIndicator.cpp
index 32ef916..cd7be36 100644
--- a/WebCore/rendering/RenderIndicator.cpp
+++ b/WebCore/rendering/RenderIndicator.cpp
@@ -44,8 +44,8 @@ void RenderIndicator::layout()
ASSERT(needsLayout());
LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
- calcWidth();
- calcHeight();
+ computeLogicalWidth();
+ computeLogicalHeight();
layoutParts();
repainter.repaintAfterLayout();
setNeedsLayout(false);
diff --git a/WebCore/rendering/RenderInline.cpp b/WebCore/rendering/RenderInline.cpp
index c985b92..b4bfe2f 100644
--- a/WebCore/rendering/RenderInline.cpp
+++ b/WebCore/rendering/RenderInline.cpp
@@ -413,7 +413,7 @@ void RenderInline::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
{
if (InlineFlowBox* curr = firstLineBox()) {
for (; curr; curr = curr->nextLineBox())
- rects.append(IntRect(tx + curr->x(), ty + curr->y(), curr->width(), curr->height()));
+ rects.append(IntRect(tx + curr->x(), ty + curr->y(), curr->logicalWidth(), curr->logicalHeight()));
} else
rects.append(IntRect(tx, ty, 0, 0));
@@ -432,7 +432,7 @@ void RenderInline::absoluteQuads(Vector<FloatQuad>& quads)
{
if (InlineFlowBox* curr = firstLineBox()) {
for (; curr; curr = curr->nextLineBox()) {
- FloatRect localRect(curr->x(), curr->y(), curr->width(), curr->height());
+ FloatRect localRect(curr->x(), curr->y(), curr->logicalWidth(), curr->logicalHeight());
quads.append(localToAbsoluteQuad(localRect));
}
} else
@@ -458,28 +458,53 @@ int RenderInline::offsetTop() const
return y;
}
-int RenderInline::marginLeft() const
+static int computeMargin(const RenderInline* renderer, const Length& margin)
{
- Length margin = style()->marginLeft();
if (margin.isAuto())
return 0;
if (margin.isFixed())
return margin.value();
if (margin.isPercent())
- return margin.calcMinValue(max(0, containingBlock()->availableWidth()));
+ return margin.calcMinValue(max(0, renderer->containingBlock()->availableLogicalWidth()));
return 0;
}
+int RenderInline::marginLeft() const
+{
+ if (!style()->isVerticalBlockFlow())
+ return 0;
+ return computeMargin(this, style()->marginLeft());
+}
+
int RenderInline::marginRight() const
{
- Length margin = style()->marginRight();
- if (margin.isAuto())
+ if (!style()->isVerticalBlockFlow())
return 0;
- if (margin.isFixed())
- return margin.value();
- if (margin.isPercent())
- return margin.calcMinValue(max(0, containingBlock()->availableWidth()));
- return 0;
+ return computeMargin(this, style()->marginRight());
+}
+
+int RenderInline::marginTop() const
+{
+ if (style()->isVerticalBlockFlow())
+ return 0;
+ return computeMargin(this, style()->marginTop());
+}
+
+int RenderInline::marginBottom() const
+{
+ if (style()->isVerticalBlockFlow())
+ return 0;
+ return computeMargin(this, style()->marginBottom());
+}
+
+int RenderInline::marginStart() const
+{
+ return computeMargin(this, style()->marginStart());
+}
+
+int RenderInline::marginEnd() const
+{
+ return computeMargin(this, style()->marginEnd());
}
const char* RenderInline::renderName() const
@@ -538,12 +563,12 @@ IntRect RenderInline::linesBoundingBox() const
for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
if (curr == firstLineBox() || curr->x() < leftSide)
leftSide = curr->x();
- if (curr == firstLineBox() || curr->x() + curr->width() > rightSide)
- rightSide = curr->x() + curr->width();
+ if (curr == firstLineBox() || curr->x() + curr->logicalWidth() > rightSide)
+ rightSide = curr->x() + curr->logicalWidth();
}
result.setWidth(rightSide - leftSide);
result.setX(leftSide);
- result.setHeight(lastLineBox()->y() + lastLineBox()->height() - firstLineBox()->y());
+ result.setHeight(lastLineBox()->y() + lastLineBox()->logicalHeight() - firstLineBox()->y());
result.setY(firstLineBox()->y());
}
@@ -931,8 +956,8 @@ void RenderInline::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty)
for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
RootInlineBox* root = curr->root();
int top = max(root->lineTop(), curr->y());
- int bottom = min(root->lineBottom(), curr->y() + curr->height());
- IntRect rect(tx + curr->x(), ty + top, curr->width(), bottom - top);
+ int bottom = min(root->lineBottom(), curr->y() + curr->logicalHeight());
+ IntRect rect(tx + curr->x(), ty + top, curr->logicalWidth(), bottom - top);
if (!rect.isEmpty())
rects.append(rect);
}
@@ -988,8 +1013,8 @@ void RenderInline::paintOutline(GraphicsContext* graphicsContext, int tx, int ty
for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
RootInlineBox* root = curr->root();
int top = max(root->lineTop(), curr->y());
- int bottom = min(root->lineBottom(), curr->y() + curr->height());
- rects.append(IntRect(curr->x(), top, curr->width(), bottom - top));
+ int bottom = min(root->lineBottom(), curr->y() + curr->logicalHeight());
+ rects.append(IntRect(curr->x(), top, curr->logicalWidth(), bottom - top));
}
rects.append(IntRect());
diff --git a/WebCore/rendering/RenderInline.h b/WebCore/rendering/RenderInline.h
index 71a8a89..feb8b8f 100644
--- a/WebCore/rendering/RenderInline.h
+++ b/WebCore/rendering/RenderInline.h
@@ -40,7 +40,13 @@ public:
virtual int marginLeft() const;
virtual int marginRight() const;
-
+ virtual int marginTop() const;
+ virtual int marginBottom() const;
+ virtual int marginBefore() const { return 0; }
+ virtual int marginAfter() const { return 0; }
+ virtual int marginStart() const;
+ virtual int marginEnd() const;
+
virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
virtual void absoluteQuads(Vector<FloatQuad>&);
@@ -108,9 +114,6 @@ private:
virtual int offsetWidth() const { return linesBoundingBox().width(); }
virtual int offsetHeight() const { return linesBoundingBox().height(); }
- // Just ignore top/bottom margins on RenderInlines.
- virtual int marginTop() const { return 0; }
- virtual int marginBottom() const { return 0; }
virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
virtual IntRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, int outlineWidth);
virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& rect, bool fixed);
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index da6fad1..63233e5 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -468,6 +468,28 @@ TransformationMatrix RenderLayer::renderableTransform(PaintBehavior paintBehavio
return *m_transform;
}
+static bool checkContainingBlockChainForPagination(RenderBoxModelObject* renderer, RenderBox* ancestorColumnsRenderer)
+{
+ RenderView* view = renderer->view();
+ RenderBoxModelObject* prevBlock = renderer;
+ RenderBlock* containingBlock;
+ for (containingBlock = renderer->containingBlock();
+ containingBlock && containingBlock != view && containingBlock != ancestorColumnsRenderer;
+ containingBlock = containingBlock->containingBlock())
+ prevBlock = containingBlock;
+
+ // If the columns block wasn't in our containing block chain, then we aren't paginated by it.
+ if (containingBlock != ancestorColumnsRenderer)
+ return false;
+
+ // If the previous block is absolutely positioned, then we can't be paginated by the columns block.
+ if (prevBlock->isPositioned())
+ return false;
+
+ // Otherwise we are paginated by the columns block.
+ return true;
+}
+
void RenderLayer::updatePagination()
{
m_isPaginated = false;
@@ -484,10 +506,10 @@ void RenderLayer::updatePagination()
RenderLayer* ancestorStackingContext = stackingContext();
for (RenderLayer* curr = parent(); curr; curr = curr->parent()) {
if (curr->renderer()->hasColumns()) {
- m_isPaginated = true;
+ m_isPaginated = checkContainingBlockChainForPagination(renderer(), curr->renderBox());
return;
}
- if (curr == ancestorStackingContext || (curr->parent() && curr->parent()->renderer()->isPositioned()))
+ if (curr == ancestorStackingContext)
return;
}
}
@@ -2912,7 +2934,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont
// Next we want to see if the mouse pos is inside the child RenderObjects of the layer.
if (fgRect.intersects(hitTestArea) && isSelfPaintingLayer()) {
// Hit test with a temporary HitTestResult, because we only want to commit to 'result' if we know we're frontmost.
- HitTestResult tempResult(result.point(), result.padding());
+ HitTestResult tempResult(result.point(), result.topPadding(), result.rightPadding(), result.bottomPadding(), result.leftPadding());
if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestDescendants) &&
isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) {
if (result.isRectBasedTest())
@@ -2941,7 +2963,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont
return candidateLayer;
if (bgRect.intersects(hitTestArea) && isSelfPaintingLayer()) {
- HitTestResult tempResult(result.point(), result.padding());
+ HitTestResult tempResult(result.point(), result.topPadding(), result.rightPadding(), result.bottomPadding(), result.leftPadding());
if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestSelf) &&
isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) {
if (result.isRectBasedTest())
@@ -2998,7 +3020,7 @@ RenderLayer* RenderLayer::hitTestList(Vector<RenderLayer*>* list, RenderLayer* r
for (int i = list->size() - 1; i >= 0; --i) {
RenderLayer* childLayer = list->at(i);
RenderLayer* hitLayer = 0;
- HitTestResult tempResult(result.point(), result.padding());
+ HitTestResult tempResult(result.point(), result.topPadding(), result.rightPadding(), result.bottomPadding(), result.leftPadding());
if (childLayer->isPaginated())
hitLayer = hitTestPaginatedChildLayer(childLayer, rootLayer, request, tempResult, hitTestRect, hitTestPoint, transformState, zOffsetForDescendants);
else
diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp
index dbd61e1..68086ca 100644
--- a/WebCore/rendering/RenderLayerBacking.cpp
+++ b/WebCore/rendering/RenderLayerBacking.cpp
@@ -1209,6 +1209,16 @@ bool RenderLayerBacking::startAnimation(double timeOffset, const Animation* anim
return runningAcceleratedAnimation;
}
+void RenderLayerBacking::animationPaused(double timeOffset, const String& animationName)
+{
+ m_graphicsLayer->pauseAnimation(animationName, timeOffset);
+}
+
+void RenderLayerBacking::animationFinished(const String& animationName)
+{
+ m_graphicsLayer->removeAnimation(animationName);
+}
+
bool RenderLayerBacking::startTransition(double timeOffset, int property, const RenderStyle* fromStyle, const RenderStyle* toStyle)
{
bool didAnimate = false;
@@ -1221,7 +1231,7 @@ bool RenderLayerBacking::startTransition(double timeOffset, int property, const
opacityVector.insert(new FloatAnimationValue(0, compositingOpacity(fromStyle->opacity())));
opacityVector.insert(new FloatAnimationValue(1, compositingOpacity(toStyle->opacity())));
// The boxSize param is only used for transform animations (which can only run on RenderBoxes), so we pass an empty size here.
- if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityAnim, String(), timeOffset)) {
+ if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyOpacity), timeOffset)) {
// To ensure that the correct opacity is visible when the animation ends, also set the final opacity.
updateLayerOpacity(toStyle);
didAnimate = true;
@@ -1235,7 +1245,7 @@ bool RenderLayerBacking::startTransition(double timeOffset, int property, const
KeyframeValueList transformVector(AnimatedPropertyWebkitTransform);
transformVector.insert(new TransformAnimationValue(0, &fromStyle->transform()));
transformVector.insert(new TransformAnimationValue(1, &toStyle->transform()));
- if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->borderBoxRect().size(), transformAnim, String(), timeOffset)) {
+ if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->borderBoxRect().size(), transformAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitTransform), timeOffset)) {
// To ensure that the correct transform is visible when the animation ends, also set the final opacity.
updateLayerTransform(toStyle);
didAnimate = true;
@@ -1249,34 +1259,32 @@ bool RenderLayerBacking::startTransition(double timeOffset, int property, const
return didAnimate;
}
-void RenderLayerBacking::notifyAnimationStarted(const GraphicsLayer*, double time)
-{
- renderer()->animation()->notifyAnimationStarted(renderer(), time);
-}
-
-void RenderLayerBacking::notifySyncRequired(const GraphicsLayer*)
+void RenderLayerBacking::transitionPaused(double timeOffset, int property)
{
- if (!renderer()->documentBeingDestroyed())
- compositor()->scheduleSync();
+ AnimatedPropertyID animatedProperty = cssToGraphicsLayerProperty(property);
+ if (animatedProperty != AnimatedPropertyInvalid)
+ m_graphicsLayer->pauseAnimation(GraphicsLayer::animationNameForTransition(animatedProperty), timeOffset);
}
-void RenderLayerBacking::animationFinished(const String& animationName)
+void RenderLayerBacking::transitionFinished(int property)
{
- m_graphicsLayer->removeAnimationsForKeyframes(animationName);
+ AnimatedPropertyID animatedProperty = cssToGraphicsLayerProperty(property);
+ if (animatedProperty != AnimatedPropertyInvalid)
+ m_graphicsLayer->removeAnimation(GraphicsLayer::animationNameForTransition(animatedProperty));
}
-void RenderLayerBacking::animationPaused(double timeOffset, const String& animationName)
+void RenderLayerBacking::notifyAnimationStarted(const GraphicsLayer*, double time)
{
- m_graphicsLayer->pauseAnimation(animationName, timeOffset);
+ renderer()->animation()->notifyAnimationStarted(renderer(), time);
}
-void RenderLayerBacking::transitionFinished(int property)
+void RenderLayerBacking::notifySyncRequired(const GraphicsLayer*)
{
- AnimatedPropertyID animatedProperty = cssToGraphicsLayerProperty(property);
- if (animatedProperty != AnimatedPropertyInvalid)
- m_graphicsLayer->removeAnimationsForProperty(animatedProperty);
+ if (!renderer()->documentBeingDestroyed())
+ compositor()->scheduleSync();
}
+// This is used for the 'freeze' API, for testing only.
void RenderLayerBacking::suspendAnimations(double time)
{
m_graphicsLayer->suspendAnimations(time);
diff --git a/WebCore/rendering/RenderLayerBacking.h b/WebCore/rendering/RenderLayerBacking.h
index 808000b..fb3ab67 100644
--- a/WebCore/rendering/RenderLayerBacking.h
+++ b/WebCore/rendering/RenderLayerBacking.h
@@ -105,12 +105,14 @@ public:
void rendererContentChanged();
// Interface to start, finish, suspend and resume animations and transitions
- bool startAnimation(double timeOffset, const Animation* anim, const KeyframeList& keyframes);
bool startTransition(double timeOffset, int property, const RenderStyle* fromStyle, const RenderStyle* toStyle);
- void animationFinished(const String& name);
- void animationPaused(double timeOffset, const String& name);
+ void transitionPaused(double timeOffset, int property);
void transitionFinished(int property);
+ bool startAnimation(double timeOffset, const Animation* anim, const KeyframeList& keyframes);
+ void animationPaused(double timeOffset, const String& name);
+ void animationFinished(const String& name);
+
void suspendAnimations(double time = 0);
void resumeAnimations();
diff --git a/WebCore/rendering/RenderLineBoxList.cpp b/WebCore/rendering/RenderLineBoxList.cpp
index 45e66eb..760d2ea 100644
--- a/WebCore/rendering/RenderLineBoxList.cpp
+++ b/WebCore/rendering/RenderLineBoxList.cpp
@@ -246,16 +246,16 @@ bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq
// contain the point. This is a quick short-circuit that we can take to avoid walking any lines.
// FIXME: This check is flawed in the following extremely obscure way:
// if some line in the middle has a huge overflow, it might actually extend below the last line.
- if (y - result.paddingHeight() >= ty + lastLineBox()->root()->bottomVisibleOverflow()
- || y + result.paddingHeight() < ty + firstLineBox()->root()->topVisibleOverflow())
+ if (y - result.topPadding() >= ty + lastLineBox()->root()->bottomVisibleOverflow()
+ || y + result.bottomPadding() < ty + firstLineBox()->root()->topVisibleOverflow())
return false;
// See if our root lines contain the point. If so, then we hit test
// them further. Note that boxes can easily overlap, so we can't make any assumptions
// based off positions of our first line box or our last line box.
for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox()) {
- if (y + result.paddingHeight() >= ty + curr->root()->topVisibleOverflow()
- && y - result.paddingHeight() < ty + curr->root()->bottomVisibleOverflow()) {
+ if (y + result.bottomPadding() >= ty + curr->root()->topVisibleOverflow()
+ && y - result.topPadding() < ty + curr->root()->bottomVisibleOverflow()) {
bool inside = curr->nodeAtPoint(request, result, x, y, tx, ty);
if (inside) {
renderer->updateHitTestResult(result, IntPoint(x - tx, y - ty));
diff --git a/WebCore/rendering/RenderListBox.cpp b/WebCore/rendering/RenderListBox.cpp
index aa31b6c..39442e1 100644
--- a/WebCore/rendering/RenderListBox.cpp
+++ b/WebCore/rendering/RenderListBox.cpp
@@ -160,39 +160,39 @@ void RenderListBox::scrollToRevealSelection()
scrollToRevealElementAtListIndex(firstIndex);
}
-void RenderListBox::calcPrefWidths()
+void RenderListBox::computePreferredLogicalWidths()
{
ASSERT(!m_optionsChanged);
- m_minPrefWidth = 0;
- m_maxPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
+ m_maxPreferredLogicalWidth = 0;
if (style()->width().isFixed() && style()->width().value() > 0)
- m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value());
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value());
else {
- m_maxPrefWidth = m_optionsWidth + 2 * optionsSpacingHorizontal;
+ m_maxPreferredLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal;
if (m_vBar)
- m_maxPrefWidth += m_vBar->width();
+ m_maxPreferredLogicalWidth += m_vBar->width();
}
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
- m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
- m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
+ m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
+ m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
} else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
- m_minPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
else
- m_minPrefWidth = m_maxPrefWidth;
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
- m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
- m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
+ m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
}
int toAdd = borderAndPaddingWidth();
- m_minPrefWidth += toAdd;
- m_maxPrefWidth += toAdd;
+ m_minPreferredLogicalWidth += toAdd;
+ m_maxPreferredLogicalWidth += toAdd;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
int RenderListBox::size() const
@@ -219,14 +219,14 @@ int RenderListBox::listHeight() const
return itemHeight() * numItems() - rowSpacing;
}
-void RenderListBox::calcHeight()
+void RenderListBox::computeLogicalHeight()
{
int toAdd = borderAndPaddingHeight();
int itemHeight = RenderListBox::itemHeight();
setHeight(itemHeight * size() - rowSpacing + toAdd);
- RenderBlock::calcHeight();
+ RenderBlock::computeLogicalHeight();
if (m_vBar) {
bool enabled = numVisibleItems() < numItems();
diff --git a/WebCore/rendering/RenderListBox.h b/WebCore/rendering/RenderListBox.h
index dcee739..c69f205 100644
--- a/WebCore/rendering/RenderListBox.h
+++ b/WebCore/rendering/RenderListBox.h
@@ -70,9 +70,9 @@ private:
virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Node** stopNode = 0);
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
virtual int baselinePosition(bool firstLine, bool isRootLineBox) const;
- virtual void calcHeight();
+ virtual void computeLogicalHeight();
virtual void layout();
diff --git a/WebCore/rendering/RenderListItem.cpp b/WebCore/rendering/RenderListItem.cpp
index 2366a34..b414f38 100644
--- a/WebCore/rendering/RenderListItem.cpp
+++ b/WebCore/rendering/RenderListItem.cpp
@@ -210,7 +210,7 @@ void RenderListItem::updateMarkerLocation()
lineBoxParent = this;
}
- if (markerPar != lineBoxParent || m_marker->prefWidthsDirty()) {
+ if (markerPar != lineBoxParent || m_marker->preferredLogicalWidthsDirty()) {
// Removing and adding the marker can trigger repainting in
// containers other than ourselves, so we need to disable LayoutState.
view()->disableLayoutState();
@@ -219,20 +219,20 @@ void RenderListItem::updateMarkerLocation()
if (!lineBoxParent)
lineBoxParent = this;
lineBoxParent->addChild(m_marker, firstNonMarkerChild(lineBoxParent));
- if (m_marker->prefWidthsDirty())
- m_marker->calcPrefWidths();
+ if (m_marker->preferredLogicalWidthsDirty())
+ m_marker->computePreferredLogicalWidths();
view()->enableLayoutState();
}
}
}
-void RenderListItem::calcPrefWidths()
+void RenderListItem::computePreferredLogicalWidths()
{
- ASSERT(prefWidthsDirty());
+ ASSERT(preferredLogicalWidthsDirty());
updateMarkerLocation();
- RenderBlock::calcPrefWidths();
+ RenderBlock::computePreferredLogicalWidths();
}
void RenderListItem::layout()
@@ -245,7 +245,7 @@ void RenderListItem::layout()
void RenderListItem::positionListMarker()
{
- if (m_marker && !m_marker->isInside() && m_marker->inlineBoxWrapper()) {
+ if (m_marker && m_marker->parent()->isBox() && !m_marker->isInside() && m_marker->inlineBoxWrapper()) {
int markerOldX = m_marker->x();
int yOffset = 0;
int xOffset = 0;
@@ -262,23 +262,23 @@ void RenderListItem::positionListMarker()
// and really shouldn't keep propagating overflow up. This won't really break anything other than repainting
// not being as tight as it could be though.
if (style()->direction() == LTR) {
- int leftLineOffset = leftRelOffset(yOffset, leftOffset(yOffset, false), false);
+ int leftLineOffset = logicalLeftOffsetForLine(yOffset, logicalLeftOffsetForLine(yOffset, false), false);
markerXPos = leftLineOffset - xOffset - paddingLeft() - borderLeft() + m_marker->marginLeft();
m_marker->inlineBoxWrapper()->adjustPosition(markerXPos - markerOldX, 0);
for (InlineFlowBox* box = m_marker->inlineBoxWrapper()->parent(); box; box = box->parent()) {
if (markerXPos < box->leftLayoutOverflow()) {
- box->setHorizontalOverflowPositions(markerXPos, box->rightLayoutOverflow(), box->leftVisualOverflow(), box->rightVisualOverflow());
+ box->setInlineDirectionOverflowPositions(markerXPos, box->rightLayoutOverflow(), box->leftVisualOverflow(), box->rightVisualOverflow());
if (box == root)
adjustOverflow = true;
}
}
} else {
- int rightLineOffset = rightRelOffset(yOffset, rightOffset(yOffset, false), false);
+ int rightLineOffset = logicalRightOffsetForLine(yOffset, logicalRightOffsetForLine(yOffset, false), false);
markerXPos = rightLineOffset - xOffset + paddingRight() + borderRight() + m_marker->marginLeft();
m_marker->inlineBoxWrapper()->adjustPosition(markerXPos - markerOldX, 0);
for (InlineFlowBox* box = m_marker->inlineBoxWrapper()->parent(); box; box = box->parent()) {
if (markerXPos + m_marker->width() > box->rightLayoutOverflow()) {
- box->setHorizontalOverflowPositions(box->leftLayoutOverflow(), markerXPos + m_marker->width(), box->leftVisualOverflow(), box->rightVisualOverflow());
+ box->setInlineDirectionOverflowPositions(box->leftLayoutOverflow(), markerXPos + m_marker->width(), box->leftVisualOverflow(), box->rightVisualOverflow());
if (box == root)
adjustOverflow = true;
}
@@ -314,6 +314,29 @@ const String& RenderListItem::markerText() const
return staticNullString;
}
+String RenderListItem::markerTextWithSuffix() const
+{
+ if (!m_marker)
+ return String();
+
+ // Append the suffix for the marker in the right place depending
+ // on the direction of the text (right-to-left or left-to-right).
+
+ const String& markerText = m_marker->text();
+ const String markerSuffix = m_marker->suffix();
+ Vector<UChar> resultVector;
+
+ if (m_marker->style()->direction() == RTL)
+ resultVector.append(markerSuffix.characters(), markerSuffix.length());
+
+ resultVector.append(markerText.characters(), markerText.length());
+
+ if (m_marker->style()->direction() == LTR)
+ resultVector.append(markerSuffix.characters(), markerSuffix.length());
+
+ return String::adopt(resultVector);
+}
+
void RenderListItem::explicitValueChanged()
{
if (m_marker)
diff --git a/WebCore/rendering/RenderListItem.h b/WebCore/rendering/RenderListItem.h
index 13d81f2..f7bd661 100644
--- a/WebCore/rendering/RenderListItem.h
+++ b/WebCore/rendering/RenderListItem.h
@@ -45,6 +45,7 @@ public:
bool notInList() const { return m_notInList; }
const String& markerText() const;
+ String markerTextWithSuffix() const;
void updateListMarkerNumbers();
@@ -59,7 +60,7 @@ private:
virtual void paint(PaintInfo&, int tx, int ty);
virtual void layout();
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
virtual void positionListMarker();
diff --git a/WebCore/rendering/RenderListMarker.cpp b/WebCore/rendering/RenderListMarker.cpp
index 7b33c3d..18811df 100644
--- a/WebCore/rendering/RenderListMarker.cpp
+++ b/WebCore/rendering/RenderListMarker.cpp
@@ -1274,13 +1274,12 @@ void RenderListMarker::paint(PaintInfo& paintInfo, int tx, int ty)
void RenderListMarker::layout()
{
ASSERT(needsLayout());
- ASSERT(!prefWidthsDirty());
-
+
if (isImage()) {
setWidth(m_image->imageSize(this, style()->effectiveZoom()).width());
setHeight(m_image->imageSize(this, style()->effectiveZoom()).height());
} else {
- setWidth(minPrefWidth());
+ setWidth(minPreferredLogicalWidth());
setHeight(style()->font().height());
}
@@ -1308,9 +1307,9 @@ void RenderListMarker::imageChanged(WrappedImagePtr o, const IntRect*)
repaint();
}
-void RenderListMarker::calcPrefWidths()
+void RenderListMarker::computePreferredLogicalWidths()
{
- ASSERT(prefWidthsDirty());
+ ASSERT(preferredLogicalWidthsDirty());
m_text = "";
@@ -1321,8 +1320,8 @@ void RenderListMarker::calcPrefWidths()
// until we support the CSS3 marker pseudoclass to allow control over the width and height of the marker box.
int bulletWidth = font.ascent() / 2;
m_image->setImageContainerSize(IntSize(bulletWidth, bulletWidth));
- m_minPrefWidth = m_maxPrefWidth = m_image->imageSize(this, style()->effectiveZoom()).width();
- setPrefWidthsDirty(false);
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = m_image->imageSize(this, style()->effectiveZoom()).width();
+ setPreferredLogicalWidthsDirty(false);
updateMargins();
return;
}
@@ -1428,10 +1427,10 @@ void RenderListMarker::calcPrefWidths()
break;
}
- m_minPrefWidth = width;
- m_maxPrefWidth = width;
+ m_minPreferredLogicalWidth = width;
+ m_maxPreferredLogicalWidth = width;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
updateMargins();
}
@@ -1455,9 +1454,9 @@ void RenderListMarker::updateMargins()
case Square:
if (style()->direction() == LTR) {
marginLeft = -1;
- marginRight = font.ascent() - minPrefWidth() + 1;
+ marginRight = font.ascent() - minPreferredLogicalWidth() + 1;
} else {
- marginLeft = font.ascent() - minPrefWidth() + 1;
+ marginLeft = font.ascent() - minPreferredLogicalWidth() + 1;
marginRight = -1;
}
break;
@@ -1467,7 +1466,7 @@ void RenderListMarker::updateMargins()
} else {
if (style()->direction() == LTR) {
if (isImage())
- marginLeft = -minPrefWidth() - cMarkerPadding;
+ marginLeft = -minPreferredLogicalWidth() - cMarkerPadding;
else {
int offset = font.ascent() * 2 / 3;
switch (style()->listStyleType()) {
@@ -1479,7 +1478,7 @@ void RenderListMarker::updateMargins()
case NoneListStyle:
break;
default:
- marginLeft = m_text.isEmpty() ? 0 : -minPrefWidth() - offset / 2;
+ marginLeft = m_text.isEmpty() ? 0 : -minPreferredLogicalWidth() - offset / 2;
}
}
} else {
@@ -1491,7 +1490,7 @@ void RenderListMarker::updateMargins()
case Disc:
case Circle:
case Square:
- marginLeft = offset + cMarkerPadding + 1 - minPrefWidth();
+ marginLeft = offset + cMarkerPadding + 1 - minPreferredLogicalWidth();
break;
case NoneListStyle:
break;
@@ -1500,7 +1499,7 @@ void RenderListMarker::updateMargins()
}
}
}
- marginRight = -marginLeft - minPrefWidth();
+ marginRight = -marginLeft - minPreferredLogicalWidth();
}
style()->setMarginLeft(Length(marginLeft, Fixed));
@@ -1523,6 +1522,25 @@ int RenderListMarker::baselinePosition(bool, bool) const
return height();
}
+String RenderListMarker::suffix() const
+{
+ EListStyleType type = style()->listStyleType();
+ const UChar suffix = listMarkerSuffix(type, m_listItem->value());
+
+ Vector<UChar> resultVector;
+ resultVector.append(suffix);
+
+ // If the suffix is not ' ', an extra space is needed
+ if (suffix != ' ') {
+ if (style()->direction() == LTR)
+ resultVector.append(' ');
+ else
+ resultVector.prepend(' ');
+ }
+
+ return String::adopt(resultVector);
+}
+
bool RenderListMarker::isInside() const
{
return m_listItem->notInList() || style()->listStylePosition() == INSIDE;
diff --git a/WebCore/rendering/RenderListMarker.h b/WebCore/rendering/RenderListMarker.h
index 971877b..1e55898 100644
--- a/WebCore/rendering/RenderListMarker.h
+++ b/WebCore/rendering/RenderListMarker.h
@@ -38,9 +38,10 @@ public:
RenderListMarker(RenderListItem*);
virtual ~RenderListMarker();
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
const String& text() const { return m_text; }
+ String suffix() const;
bool isInside() const;
diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp
index b6a97a9..a88903f 100644
--- a/WebCore/rendering/RenderMenuList.cpp
+++ b/WebCore/rendering/RenderMenuList.cpp
@@ -239,34 +239,34 @@ IntRect RenderMenuList::controlClipRect(int tx, int ty) const
return intersection(outerBox, innerBox);
}
-void RenderMenuList::calcPrefWidths()
+void RenderMenuList::computePreferredLogicalWidths()
{
- m_minPrefWidth = 0;
- m_maxPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
+ m_maxPreferredLogicalWidth = 0;
if (style()->width().isFixed() && style()->width().value() > 0)
- m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value());
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value());
else
- m_maxPrefWidth = max(m_optionsWidth, theme()->minimumMenuListSize(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight();
+ m_maxPreferredLogicalWidth = max(m_optionsWidth, theme()->minimumMenuListSize(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight();
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
- m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
- m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
+ m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
+ m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
} else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
- m_minPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
else
- m_minPrefWidth = m_maxPrefWidth;
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
- m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
- m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
+ m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
}
int toAdd = borderAndPaddingWidth();
- m_minPrefWidth += toAdd;
- m_maxPrefWidth += toAdd;
+ m_minPreferredLogicalWidth += toAdd;
+ m_maxPreferredLogicalWidth += toAdd;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
void RenderMenuList::showPopup()
diff --git a/WebCore/rendering/RenderMenuList.h b/WebCore/rendering/RenderMenuList.h
index 512fa9b..7faa372 100644
--- a/WebCore/rendering/RenderMenuList.h
+++ b/WebCore/rendering/RenderMenuList.h
@@ -74,7 +74,7 @@ private:
virtual const char* renderName() const { return "RenderMenuList"; }
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
diff --git a/WebCore/rendering/RenderMeter.cpp b/WebCore/rendering/RenderMeter.cpp
index 1a99976..226d605 100644
--- a/WebCore/rendering/RenderMeter.cpp
+++ b/WebCore/rendering/RenderMeter.cpp
@@ -48,15 +48,15 @@ RenderMeter::~RenderMeter()
m_barPart->detach();
}
-void RenderMeter::calcWidth()
+void RenderMeter::computeLogicalWidth()
{
- RenderBox::calcWidth();
+ RenderBox::computeLogicalWidth();
setWidth(theme()->meterSizeForBounds(this, frameRect()).width());
}
-void RenderMeter::calcHeight()
+void RenderMeter::computeLogicalHeight()
{
- RenderBox::calcHeight();
+ RenderBox::computeLogicalHeight();
setHeight(theme()->meterSizeForBounds(this, frameRect()).height());
}
diff --git a/WebCore/rendering/RenderMeter.h b/WebCore/rendering/RenderMeter.h
index 0e73e40..6d4c53b 100644
--- a/WebCore/rendering/RenderMeter.h
+++ b/WebCore/rendering/RenderMeter.h
@@ -40,8 +40,8 @@ public:
private:
virtual const char* renderName() const { return "RenderMeter"; }
virtual bool isMeter() const { return true; }
- virtual void calcWidth();
- virtual void calcHeight();
+ virtual void computeLogicalWidth();
+ virtual void computeLogicalHeight();
virtual void layoutParts();
virtual bool shouldHaveParts() const;
diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp
index 9ee97b4..eb75ce2 100644
--- a/WebCore/rendering/RenderObject.cpp
+++ b/WebCore/rendering/RenderObject.cpp
@@ -193,7 +193,7 @@ RenderObject::RenderObject(Node* node)
, m_needsPositionedMovementLayout(false)
, m_normalChildNeedsLayout(false)
, m_posChildNeedsLayout(false)
- , m_prefWidthsDirty(false)
+ , m_preferredLogicalWidthsDirty(false)
, m_floating(false)
, m_positioned(false)
, m_relPositioned(false)
@@ -212,8 +212,8 @@ RenderObject::RenderObject(Node* node)
, m_hasCounterNodeMap(false)
, m_everHadLayout(false)
, m_childrenInline(false)
- , m_topMarginQuirk(false)
- , m_bottomMarginQuirk(false)
+ , m_marginBeforeQuirk(false)
+ , m_marginAfterQuirk(false)
, m_hasMarkupTruncation(false)
, m_selectionState(SelectionNone)
, m_hasColumns(false)
@@ -576,27 +576,27 @@ RenderBlock* RenderObject::firstLineBlock() const
return 0;
}
-void RenderObject::setPrefWidthsDirty(bool b, bool markParents)
+void RenderObject::setPreferredLogicalWidthsDirty(bool b, bool markParents)
{
- bool alreadyDirty = m_prefWidthsDirty;
- m_prefWidthsDirty = b;
+ bool alreadyDirty = m_preferredLogicalWidthsDirty;
+ m_preferredLogicalWidthsDirty = b;
if (b && !alreadyDirty && markParents && (isText() || (style()->position() != FixedPosition && style()->position() != AbsolutePosition)))
- invalidateContainerPrefWidths();
+ invalidateContainerPreferredLogicalWidths();
}
-void RenderObject::invalidateContainerPrefWidths()
+void RenderObject::invalidateContainerPreferredLogicalWidths()
{
// In order to avoid pathological behavior when inlines are deeply nested, we do include them
// in the chain that we mark dirty (even though they're kind of irrelevant).
RenderObject* o = isTableCell() ? containingBlock() : container();
- while (o && !o->m_prefWidthsDirty) {
+ while (o && !o->m_preferredLogicalWidthsDirty) {
// Don't invalidate the outermost object of an unrooted subtree. That object will be
// invalidated when the subtree is added to the document.
RenderObject* container = o->isTableCell() ? o->containingBlock() : o->container();
if (!container && !o->isRenderView())
break;
- o->m_prefWidthsDirty = true;
+ o->m_preferredLogicalWidthsDirty = true;
if (o->style()->position() == FixedPosition || o->style()->position() == AbsolutePosition)
// A positioned object has no effect on the min/max width of its containing block ever.
// We can optimize this case and not go up any further.
@@ -1994,7 +1994,7 @@ void RenderObject::getTransformFromContainer(const RenderObject* containerObject
if (containerObject && containerObject->hasLayer() && containerObject->style()->hasPerspective()) {
// Perpsective on the container affects us, so we have to factor it in here.
ASSERT(containerObject->hasLayer());
- FloatPoint perspectiveOrigin = toRenderBox(containerObject)->layer()->perspectiveOrigin();
+ FloatPoint perspectiveOrigin = toRenderBoxModelObject(containerObject)->layer()->perspectiveOrigin();
TransformationMatrix perspectiveMatrix;
perspectiveMatrix.applyPerspective(containerObject->style()->perspective());
@@ -2098,8 +2098,8 @@ RenderObject* RenderObject::container(RenderBoxModelObject* repaintContainer, bo
// (2) For normal flow elements, it just returns the parent.
// (3) For absolute positioned elements, it will return a relative positioned inline.
// containingBlock() simply skips relpositioned inlines and lets an enclosing block handle
- // the layout of the positioned object. This does mean that calcAbsoluteHorizontal and
- // calcAbsoluteVertical have to use container().
+ // the layout of the positioned object. This does mean that computePositionedLogicalWidth and
+ // computePositionedLogicalHeight have to use container().
RenderObject* o = parent();
if (isText())
@@ -2345,7 +2345,7 @@ RenderStyle* RenderObject::firstLineStyleSlowCase() const
RenderStyle* parentStyle = renderer->parent()->firstLineStyle();
if (parentStyle != renderer->parent()->style()) {
// A first-line style is in effect. Cache a first-line style for ourselves.
- style->setHasPseudoStyle(FIRST_LINE_INHERITED);
+ renderer->style()->setHasPseudoStyle(FIRST_LINE_INHERITED);
style = renderer->getCachedPseudoStyle(FIRST_LINE_INHERITED, parentStyle);
}
}
diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h
index f2ca471..70b0da5 100644
--- a/WebCore/rendering/RenderObject.h
+++ b/WebCore/rendering/RenderObject.h
@@ -394,7 +394,7 @@ public:
bool posChildNeedsLayout() const { return m_posChildNeedsLayout; }
bool normalChildNeedsLayout() const { return m_normalChildNeedsLayout; }
- bool prefWidthsDirty() const { return m_prefWidthsDirty; }
+ bool preferredLogicalWidthsDirty() const { return m_preferredLogicalWidthsDirty; }
bool isSelectionBorder() const;
@@ -455,13 +455,13 @@ public:
void setNeedsLayout(bool b, bool markParents = true);
void setChildNeedsLayout(bool b, bool markParents = true);
void setNeedsPositionedMovementLayout();
- void setPrefWidthsDirty(bool, bool markParents = true);
- void invalidateContainerPrefWidths();
+ void setPreferredLogicalWidthsDirty(bool, bool markParents = true);
+ void invalidateContainerPreferredLogicalWidths();
void setNeedsLayoutAndPrefWidthsRecalc()
{
setNeedsLayout(true);
- setPrefWidthsDirty(true);
+ setPreferredLogicalWidthsDirty(true);
}
void setPositioned(bool b = true) { m_positioned = b; }
@@ -561,8 +561,8 @@ public:
// the rect that will be painted if this object is passed as the paintingRoot
IntRect paintingRootRect(IntRect& topLevelRect);
- virtual int minPrefWidth() const { return 0; }
- virtual int maxPrefWidth() const { return 0; }
+ virtual int minPreferredLogicalWidth() const { return 0; }
+ virtual int maxPreferredLogicalWidth() const { return 0; }
RenderStyle* style() const { return m_style.get(); }
RenderStyle* firstLineStyle() const { return document()->usesFirstLineRules() ? firstLineStyleSlowCase() : style(); }
@@ -688,11 +688,10 @@ public:
*/
virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
- virtual void calcVerticalMargins() { }
- bool isTopMarginQuirk() const { return m_topMarginQuirk; }
- bool isBottomMarginQuirk() const { return m_bottomMarginQuirk; }
- void setTopMarginQuirk(bool b = true) { m_topMarginQuirk = b; }
- void setBottomMarginQuirk(bool b = true) { m_bottomMarginQuirk = b; }
+ bool isMarginBeforeQuirk() const { return m_marginBeforeQuirk; }
+ bool isMarginAfterQuirk() const { return m_marginAfterQuirk; }
+ void setMarginBeforeQuirk(bool b = true) { m_marginBeforeQuirk = b; }
+ void setMarginAfterQuirk(bool b = true) { m_marginAfterQuirk = b; }
// When performing a global document tear-down, the renderer of the document is cleared. We use this
// as a hook to detect the case of document destruction and don't waste time doing unnecessary work.
@@ -812,7 +811,7 @@ private:
bool m_needsPositionedMovementLayout :1;
bool m_normalChildNeedsLayout : 1;
bool m_posChildNeedsLayout : 1;
- bool m_prefWidthsDirty : 1;
+ bool m_preferredLogicalWidthsDirty : 1;
bool m_floating : 1;
bool m_positioned : 1;
@@ -842,8 +841,8 @@ private:
// These bitfields are moved here from subclasses to pack them together
// from RenderBlock
bool m_childrenInline : 1;
- bool m_topMarginQuirk : 1;
- bool m_bottomMarginQuirk : 1;
+ bool m_marginBeforeQuirk : 1;
+ bool m_marginAfterQuirk : 1;
bool m_hasMarkupTruncation : 1;
unsigned m_selectionState : 3; // SelectionState
bool m_hasColumns : 1;
diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp
index 0f31df1..cbe1900 100644
--- a/WebCore/rendering/RenderPath.cpp
+++ b/WebCore/rendering/RenderPath.cpp
@@ -98,7 +98,7 @@ bool RenderPath::strokeContains(const FloatPoint& point, bool requiresStroke)
void RenderPath::layout()
{
- LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout());
+ LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && selfNeedsLayout());
SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node());
bool updateCachedBoundariesInParents = false;
diff --git a/WebCore/rendering/RenderReplaced.cpp b/WebCore/rendering/RenderReplaced.cpp
index b54a228..d3b449c 100644
--- a/WebCore/rendering/RenderReplaced.cpp
+++ b/WebCore/rendering/RenderReplaced.cpp
@@ -57,6 +57,13 @@ RenderReplaced::~RenderReplaced()
{
}
+void RenderReplaced::setStyle(PassRefPtr<RenderStyle> newStyle)
+{
+ if (newStyle->blockFlow() != TopToBottomBlockFlow)
+ newStyle->setBlockFlow(TopToBottomBlockFlow);
+ RenderBox::setStyle(newStyle);
+}
+
void RenderReplaced::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
RenderBox::styleDidChange(diff, oldStyle);
@@ -75,8 +82,8 @@ void RenderReplaced::layout()
setHeight(minimumReplacedHeight());
- calcWidth();
- calcHeight();
+ computeLogicalWidth();
+ computeLogicalHeight();
m_overflow.clear();
addShadowOverflow();
@@ -200,34 +207,34 @@ static inline bool lengthIsSpecified(Length length)
return lengthType == Fixed || lengthType == Percent;
}
-int RenderReplaced::calcReplacedWidth(bool includeMaxWidth) const
+int RenderReplaced::computeReplacedWidth(bool includeMaxWidth) const
{
int width;
if (lengthIsSpecified(style()->width()))
- width = calcReplacedWidthUsing(style()->width());
+ width = computeReplacedWidthUsing(style()->width());
else if (m_hasIntrinsicSize)
width = calcAspectRatioWidth();
else
width = intrinsicSize().width();
- int minW = calcReplacedWidthUsing(style()->minWidth());
- int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth());
+ int minW = computeReplacedWidthUsing(style()->minWidth());
+ int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth());
return max(minW, min(width, maxW));
}
-int RenderReplaced::calcReplacedHeight() const
+int RenderReplaced::computeReplacedHeight() const
{
int height;
if (lengthIsSpecified(style()->height()))
- height = calcReplacedHeightUsing(style()->height());
+ height = computeReplacedHeightUsing(style()->height());
else if (m_hasIntrinsicSize)
height = calcAspectRatioHeight();
else
height = intrinsicSize().height();
- int minH = calcReplacedHeightUsing(style()->minHeight());
- int maxH = style()->maxHeight().isUndefined() ? height : calcReplacedHeightUsing(style()->maxHeight());
+ int minH = computeReplacedHeightUsing(style()->minHeight());
+ int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight());
return max(minH, min(height, maxH));
}
@@ -238,7 +245,7 @@ int RenderReplaced::calcAspectRatioWidth() const
int intrinsicHeight = intrinsicSize().height();
if (!intrinsicHeight)
return 0;
- return RenderBox::calcReplacedHeight() * intrinsicWidth / intrinsicHeight;
+ return RenderBox::computeReplacedHeight() * intrinsicWidth / intrinsicHeight;
}
int RenderReplaced::calcAspectRatioHeight() const
@@ -247,27 +254,27 @@ int RenderReplaced::calcAspectRatioHeight() const
int intrinsicHeight = intrinsicSize().height();
if (!intrinsicWidth)
return 0;
- return RenderBox::calcReplacedWidth() * intrinsicHeight / intrinsicWidth;
+ return RenderBox::computeReplacedWidth() * intrinsicHeight / intrinsicWidth;
}
-void RenderReplaced::calcPrefWidths()
+void RenderReplaced::computePreferredLogicalWidths()
{
- ASSERT(prefWidthsDirty());
+ ASSERT(preferredLogicalWidthsDirty());
int borderAndPadding = borderAndPaddingWidth();
- m_maxPrefWidth = calcReplacedWidth(false) + borderAndPadding;
+ m_maxPreferredLogicalWidth = computeReplacedWidth(false) + borderAndPadding;
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength)
- m_maxPrefWidth = min(m_maxPrefWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0));
+ m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0));
if (style()->width().isPercent() || style()->height().isPercent()
|| style()->maxWidth().isPercent() || style()->maxHeight().isPercent()
|| style()->minWidth().isPercent() || style()->minHeight().isPercent())
- m_minPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
else
- m_minPrefWidth = m_maxPrefWidth;
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
int RenderReplaced::lineHeight(bool, bool) const
diff --git a/WebCore/rendering/RenderReplaced.h b/WebCore/rendering/RenderReplaced.h
index 8a0543c..872f6d0 100644
--- a/WebCore/rendering/RenderReplaced.h
+++ b/WebCore/rendering/RenderReplaced.h
@@ -32,13 +32,15 @@ public:
RenderReplaced(Node*, const IntSize& intrinsicSize);
virtual ~RenderReplaced();
+ virtual void setStyle(PassRefPtr<RenderStyle>);
+
protected:
virtual void layout();
virtual IntSize intrinsicSize() const;
- virtual int calcReplacedWidth(bool includeMaxWidth = true) const;
- virtual int calcReplacedHeight() const;
+ virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
+ virtual int computeReplacedHeight() const;
virtual int minimumReplacedHeight() const { return 0; }
virtual void setSelectionState(SelectionState);
@@ -63,7 +65,7 @@ private:
virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
virtual int baselinePosition(bool firstLine, bool isRootLineBox = false) const;
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
int calcAspectRatioWidth() const;
int calcAspectRatioHeight() const;
diff --git a/WebCore/rendering/RenderReplica.cpp b/WebCore/rendering/RenderReplica.cpp
index 1d589ae..4b11f40 100644
--- a/WebCore/rendering/RenderReplica.cpp
+++ b/WebCore/rendering/RenderReplica.cpp
@@ -52,11 +52,11 @@ void RenderReplica::layout()
setNeedsLayout(false);
}
-void RenderReplica::calcPrefWidths()
+void RenderReplica::computePreferredLogicalWidths()
{
- m_minPrefWidth = parentBox()->width();
- m_maxPrefWidth = m_minPrefWidth;
- setPrefWidthsDirty(false);
+ m_minPreferredLogicalWidth = parentBox()->width();
+ m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth;
+ setPreferredLogicalWidthsDirty(false);
}
void RenderReplica::paint(PaintInfo& paintInfo, int tx, int ty)
diff --git a/WebCore/rendering/RenderReplica.h b/WebCore/rendering/RenderReplica.h
index 48c64e4..a7b03f6 100644
--- a/WebCore/rendering/RenderReplica.h
+++ b/WebCore/rendering/RenderReplica.h
@@ -43,7 +43,7 @@ public:
virtual bool requiresLayer() const { return true; }
virtual void layout();
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
virtual void paint(PaintInfo&, int tx, int ty);
diff --git a/WebCore/rendering/RenderSVGContainer.cpp b/WebCore/rendering/RenderSVGContainer.cpp
index 8c99270..b5974ca 100644
--- a/WebCore/rendering/RenderSVGContainer.cpp
+++ b/WebCore/rendering/RenderSVGContainer.cpp
@@ -53,7 +53,7 @@ void RenderSVGContainer::layout()
// Allow RenderSVGViewportContainer to update its viewport.
calcViewport();
- LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout());
+ LayoutRepainter repainter(*this, checkForRepaintDuringLayout() || selfWillPaint());
// Allow RenderSVGTransformableContainer to update its transform.
bool updatedTransform = calculateLocalTransform();
diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp
index 0056fa3..a89a738 100644
--- a/WebCore/rendering/RenderSVGImage.cpp
+++ b/WebCore/rendering/RenderSVGImage.cpp
@@ -62,7 +62,7 @@ void RenderSVGImage::layout()
{
ASSERT(needsLayout());
- LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout());
+ LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
SVGImageElement* image = static_cast<SVGImageElement*>(node());
bool updateCachedBoundariesInParents = false;
diff --git a/WebCore/rendering/RenderSVGInline.cpp b/WebCore/rendering/RenderSVGInline.cpp
index bc6bc12..5d12a61 100644
--- a/WebCore/rendering/RenderSVGInline.cpp
+++ b/WebCore/rendering/RenderSVGInline.cpp
@@ -39,7 +39,7 @@ RenderSVGInline::RenderSVGInline(Node* n)
InlineFlowBox* RenderSVGInline::createInlineFlowBox()
{
InlineFlowBox* box = new (renderArena()) SVGInlineFlowBox(this);
- box->setHasVirtualHeight();
+ box->setHasVirtualLogicalHeight();
return box;
}
@@ -90,7 +90,7 @@ void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads)
FloatRect textBoundingBox = object->strokeBoundingBox();
for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
- quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->width(), box->height())));
+ quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->logicalWidth(), box->logicalHeight())));
}
void RenderSVGInline::destroy()
diff --git a/WebCore/rendering/RenderSVGInlineText.cpp b/WebCore/rendering/RenderSVGInlineText.cpp
index 0539d27..f5ea5fc 100644
--- a/WebCore/rendering/RenderSVGInlineText.cpp
+++ b/WebCore/rendering/RenderSVGInlineText.cpp
@@ -56,7 +56,7 @@ void RenderSVGInlineText::styleDidChange(StyleDifference diff, const RenderStyle
InlineTextBox* RenderSVGInlineText::createTextBox()
{
InlineTextBox* box = new (renderArena()) SVGInlineTextBox(this);
- box->setHasVirtualHeight();
+ box->setHasVirtualLogicalHeight();
return box;
}
diff --git a/WebCore/rendering/RenderSVGResourceFilter.cpp b/WebCore/rendering/RenderSVGResourceFilter.cpp
index 698033e..4dccad6 100644
--- a/WebCore/rendering/RenderSVGResourceFilter.cpp
+++ b/WebCore/rendering/RenderSVGResourceFilter.cpp
@@ -93,7 +93,6 @@ PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives()
// Add effects to the builder
RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create();
- builder->clearEffects();
for (Node* node = filterElement->firstChild(); node; node = node->nextSibling()) {
if (!node->isSVGElement())
continue;
@@ -108,6 +107,7 @@ PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives()
builder->clearEffects();
return 0;
}
+ builder->appendEffectToEffectReferences(effect);
effectElement->setStandardAttributes(primitiveBoundingBoxMode, effect.get());
builder->add(effectElement->result(), effect);
}
diff --git a/WebCore/rendering/RenderSVGResourceFilterPrimitive.h b/WebCore/rendering/RenderSVGResourceFilterPrimitive.h
index 96e2c5e..4b23737 100644
--- a/WebCore/rendering/RenderSVGResourceFilterPrimitive.h
+++ b/WebCore/rendering/RenderSVGResourceFilterPrimitive.h
@@ -36,10 +36,11 @@ namespace WebCore {
class RenderSVGResourceFilterPrimitive : public RenderSVGHiddenContainer {
public:
- RenderSVGResourceFilterPrimitive(SVGFilterPrimitiveStandardAttributes* filterPrimitiveElement);
+ RenderSVGResourceFilterPrimitive(SVGFilterPrimitiveStandardAttributes* filterPrimitiveElement);
private:
- virtual bool isSVGResourceFilterPrimitive() const { return true; }
+ virtual const char* renderName() const { return "RenderSVGResourceFilterPrimitive"; }
+ virtual bool isSVGResourceFilterPrimitive() const { return true; }
};
} // namespace WebCore
diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp
index 4e23c42..82b10d5 100644
--- a/WebCore/rendering/RenderSVGRoot.cpp
+++ b/WebCore/rendering/RenderSVGRoot.cpp
@@ -63,28 +63,28 @@ int RenderSVGRoot::baselinePosition(bool, bool) const
return height() + marginTop() + marginBottom();
}
-void RenderSVGRoot::calcPrefWidths()
+void RenderSVGRoot::computePreferredLogicalWidths()
{
- ASSERT(prefWidthsDirty());
+ ASSERT(preferredLogicalWidthsDirty());
int borderAndPadding = borderAndPaddingWidth();
- int width = calcReplacedWidth(false) + borderAndPadding;
+ int width = computeReplacedWidth(false) + borderAndPadding;
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength)
width = min(width, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0));
if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) {
- m_minPrefWidth = 0;
- m_maxPrefWidth = width;
+ m_minPreferredLogicalWidth = 0;
+ m_maxPreferredLogicalWidth = width;
} else
- m_minPrefWidth = m_maxPrefWidth = width;
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = width;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
-int RenderSVGRoot::calcReplacedWidth(bool includeMaxWidth) const
+int RenderSVGRoot::computeReplacedWidth(bool includeMaxWidth) const
{
- int replacedWidth = RenderBox::calcReplacedWidth(includeMaxWidth);
+ int replacedWidth = RenderBox::computeReplacedWidth(includeMaxWidth);
if (!style()->width().isPercent())
return replacedWidth;
@@ -93,9 +93,9 @@ int RenderSVGRoot::calcReplacedWidth(bool includeMaxWidth) const
return static_cast<int>(roundf(replacedWidth * svg->currentScale()));
}
-int RenderSVGRoot::calcReplacedHeight() const
+int RenderSVGRoot::computeReplacedHeight() const
{
- int replacedHeight = RenderBox::calcReplacedHeight();
+ int replacedHeight = RenderBox::computeReplacedHeight();
if (!style()->height().isPercent())
return replacedHeight;
@@ -112,11 +112,11 @@ void RenderSVGRoot::layout()
view()->disableLayoutState();
bool needsLayout = selfNeedsLayout();
- LayoutRepainter repainter(*this, needsLayout && m_everHadLayout && checkForRepaintDuringLayout());
+ LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayout);
IntSize oldSize(width(), height());
- calcWidth();
- calcHeight();
+ computeLogicalWidth();
+ computeLogicalHeight();
calcViewport();
SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
diff --git a/WebCore/rendering/RenderSVGRoot.h b/WebCore/rendering/RenderSVGRoot.h
index 63a7b3f..3c29b87 100644
--- a/WebCore/rendering/RenderSVGRoot.h
+++ b/WebCore/rendering/RenderSVGRoot.h
@@ -53,9 +53,9 @@ private:
virtual int lineHeight(bool b, bool isRootLineBox = false) const;
virtual int baselinePosition(bool b, bool isRootLineBox = false) const;
- virtual void calcPrefWidths();
- virtual int calcReplacedWidth(bool includeMaxWidth = true) const;
- virtual int calcReplacedHeight() const;
+ virtual void computePreferredLogicalWidths();
+ virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
+ virtual int computeReplacedHeight() const;
virtual void layout();
virtual void paint(PaintInfo&, int parentX, int parentY);
diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp
index c20a509..92091af 100644
--- a/WebCore/rendering/RenderSVGText.cpp
+++ b/WebCore/rendering/RenderSVGText.cpp
@@ -74,7 +74,7 @@ void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer,
void RenderSVGText::layout()
{
ASSERT(needsLayout());
- LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout());
+ LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
bool updateCachedBoundariesInParents = false;
if (m_needsTransformUpdate) {
@@ -124,7 +124,7 @@ void RenderSVGText::layout()
RootInlineBox* RenderSVGText::createRootInlineBox()
{
RootInlineBox* box = new (renderArena()) SVGRootInlineBox(this);
- box->setHasVirtualHeight();
+ box->setHasVirtualLogicalHeight();
return box;
}
diff --git a/WebCore/rendering/RenderScrollbarPart.cpp b/WebCore/rendering/RenderScrollbarPart.cpp
index ea61e24..16cc204 100644
--- a/WebCore/rendering/RenderScrollbarPart.cpp
+++ b/WebCore/rendering/RenderScrollbarPart.cpp
@@ -114,14 +114,14 @@ void RenderScrollbarPart::computeScrollbarHeight()
m_marginBottom = style()->marginBottom().calcMinValue(visibleSize);
}
-void RenderScrollbarPart::calcPrefWidths()
+void RenderScrollbarPart::computePreferredLogicalWidths()
{
- if (!prefWidthsDirty())
+ if (!preferredLogicalWidthsDirty())
return;
- m_minPrefWidth = m_maxPrefWidth = 0;
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 0;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
void RenderScrollbarPart::styleWillChange(StyleDifference diff, const RenderStyle* newStyle)
diff --git a/WebCore/rendering/RenderScrollbarPart.h b/WebCore/rendering/RenderScrollbarPart.h
index 114bbff..24485d0 100644
--- a/WebCore/rendering/RenderScrollbarPart.h
+++ b/WebCore/rendering/RenderScrollbarPart.h
@@ -43,7 +43,7 @@ public:
virtual bool requiresLayer() const { return false; }
virtual void layout();
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
void paintIntoRect(GraphicsContext*, int tx, int ty, const IntRect&);
diff --git a/WebCore/rendering/RenderSlider.cpp b/WebCore/rendering/RenderSlider.cpp
index 39ac2e5..33df244 100644
--- a/WebCore/rendering/RenderSlider.cpp
+++ b/WebCore/rendering/RenderSlider.cpp
@@ -164,34 +164,34 @@ int RenderSlider::baselinePosition(bool, bool) const
return height() + marginTop();
}
-void RenderSlider::calcPrefWidths()
+void RenderSlider::computePreferredLogicalWidths()
{
- m_minPrefWidth = 0;
- m_maxPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
+ m_maxPreferredLogicalWidth = 0;
if (style()->width().isFixed() && style()->width().value() > 0)
- m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value());
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value());
else
- m_maxPrefWidth = defaultTrackLength * style()->effectiveZoom();
+ m_maxPreferredLogicalWidth = defaultTrackLength * style()->effectiveZoom();
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
- m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
- m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
+ m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
+ m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
} else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
- m_minPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
else
- m_minPrefWidth = m_maxPrefWidth;
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
- m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
- m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
+ m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
}
int toAdd = borderAndPaddingWidth();
- m_minPrefWidth += toAdd;
- m_maxPrefWidth += toAdd;
+ m_minPreferredLogicalWidth += toAdd;
+ m_maxPreferredLogicalWidth += toAdd;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
void RenderSlider::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
@@ -278,8 +278,8 @@ void RenderSlider::layout()
IntSize oldSize = size();
setSize(baseSize);
- calcWidth();
- calcHeight();
+ computeLogicalWidth();
+ computeLogicalHeight();
if (thumb) {
if (oldSize != size())
diff --git a/WebCore/rendering/RenderSlider.h b/WebCore/rendering/RenderSlider.h
index fc8ce24..d214e41 100644
--- a/WebCore/rendering/RenderSlider.h
+++ b/WebCore/rendering/RenderSlider.h
@@ -43,7 +43,7 @@ namespace WebCore {
virtual bool isSlider() const { return true; }
virtual int baselinePosition(bool, bool) const;
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
virtual void layout();
virtual void updateFromElement();
diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp
index 931cf45..c2835d6 100644
--- a/WebCore/rendering/RenderTable.cpp
+++ b/WebCore/rendering/RenderTable.cpp
@@ -200,7 +200,7 @@ void RenderTable::removeChild(RenderObject* oldChild)
setNeedsSectionRecalc();
}
-void RenderTable::calcWidth()
+void RenderTable::computeLogicalWidth()
{
#ifdef ANDROID_LAYOUT
if (view()->frameView())
@@ -208,20 +208,20 @@ void RenderTable::calcWidth()
#endif
if (isPositioned())
- calcAbsoluteHorizontal();
+ computePositionedLogicalWidth();
RenderBlock* cb = containingBlock();
- int availableWidth = cb->availableWidth();
+ int availableWidth = cb->availableLogicalWidth();
LengthType widthType = style()->width().type();
if (widthType > Relative && style()->width().isPositive()) {
// Percent or fixed table
setWidth(style()->width().calcMinValue(availableWidth));
- setWidth(max(minPrefWidth(), width()));
+ setWidth(max(minPreferredLogicalWidth(), width()));
} else {
// An auto width table should shrink to fit within the line width if necessary in order to
// avoid overlapping floats.
- availableWidth = cb->lineWidth(y(), false);
+ availableWidth = cb->availableLogicalWidthForLine(y(), false);
// Subtract out any fixed margins from our available width for auto width tables.
int marginTotal = 0;
@@ -234,20 +234,24 @@ void RenderTable::calcWidth()
int availContentWidth = max(0, availableWidth - marginTotal);
// Ensure we aren't bigger than our max width or smaller than our min width.
- setWidth(min(availContentWidth, maxPrefWidth()));
+ setWidth(min(availContentWidth, maxPreferredLogicalWidth()));
}
- setWidth(max(width(), minPrefWidth()));
+ setWidth(max(width(), minPreferredLogicalWidth()));
// Finally, with our true width determined, compute our margins for real.
m_marginRight = 0;
m_marginLeft = 0;
+<<<<<<< HEAD
#ifdef ANDROID_LAYOUT
// in SSR mode, we ignore left/right margin for table
if (document()->settings()->layoutAlgorithm() == Settings::kLayoutSSR)
return;
#endif
calcHorizontalMargins(style()->marginLeft(), style()->marginRight(), availableWidth);
+=======
+ computeInlineDirectionMargins(cb, availableWidth, width());
+>>>>>>> webkit.org at r68651
}
void RenderTable::layout()
@@ -272,7 +276,7 @@ void RenderTable::layout()
#endif
int oldWidth = width();
- calcWidth();
+ computeLogicalWidth();
#ifdef ANDROID_LAYOUT
if (!checkAndSetRelayoutChildren(&relayoutChildren)
@@ -377,7 +381,7 @@ void RenderTable::layout()
setHeight(height() + bpTop);
if (!isPositioned())
- calcHeight();
+ computeLogicalHeight();
Length h = style()->height();
int th = 0;
@@ -385,7 +389,7 @@ void RenderTable::layout()
// Tables size as though CSS height includes border/padding.
th = h.value() - (bpTop + bpBottom);
else if (h.isPercent())
- th = calcPercentageHeight(h);
+ th = computePercentageLogicalHeight(h);
th = max(0, th);
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
@@ -430,7 +434,7 @@ void RenderTable::layout()
}
if (isPositioned())
- calcHeight();
+ computeLogicalHeight();
// table can be containing block of positioned elements.
// FIXME: Only pass true if width or height changed.
@@ -592,19 +596,19 @@ void RenderTable::paintMask(PaintInfo& paintInfo, int tx, int ty)
paintMaskImages(paintInfo, tx, ty, w, h);
}
-void RenderTable::calcPrefWidths()
+void RenderTable::computePreferredLogicalWidths()
{
- ASSERT(prefWidthsDirty());
+ ASSERT(preferredLogicalWidthsDirty());
recalcSectionsIfNeeded();
recalcHorizontalBorders();
- m_tableLayout->calcPrefWidths(m_minPrefWidth, m_maxPrefWidth);
+ m_tableLayout->computePreferredLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
if (m_caption)
- m_minPrefWidth = max(m_minPrefWidth, m_caption->minPrefWidth());
+ m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, m_caption->minPreferredLogicalWidth());
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
void RenderTable::splitColumn(int pos, int firstSpan)
diff --git a/WebCore/rendering/RenderTable.h b/WebCore/rendering/RenderTable.h
index dace8ba..58d4915 100644
--- a/WebCore/rendering/RenderTable.h
+++ b/WebCore/rendering/RenderTable.h
@@ -165,7 +165,7 @@ private:
virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
virtual void paintMask(PaintInfo&, int tx, int ty);
virtual void layout();
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int xPos, int yPos, int tx, int ty, HitTestAction);
virtual int firstLineBoxBaseline() const;
@@ -175,7 +175,7 @@ private:
virtual void setCellWidths();
- virtual void calcWidth();
+ virtual void computeLogicalWidth();
virtual IntRect overflowClipRect(int tx, int ty);
diff --git a/WebCore/rendering/RenderTableCell.cpp b/WebCore/rendering/RenderTableCell.cpp
index 66d1d7b..06f4726 100644
--- a/WebCore/rendering/RenderTableCell.cpp
+++ b/WebCore/rendering/RenderTableCell.cpp
@@ -50,8 +50,8 @@ RenderTableCell::RenderTableCell(Node* node)
, m_column(-1)
, m_rowSpan(1)
, m_columnSpan(1)
- , m_intrinsicPaddingTop(0)
- , m_intrinsicPaddingBottom(0)
+ , m_intrinsicPaddingBefore(0)
+ , m_intrinsicPaddingAfter(0)
, m_percentageHeight(0)
{
updateFromElement();
@@ -127,14 +127,14 @@ Length RenderTableCell::styleOrColWidth() const
return w;
}
-void RenderTableCell::calcPrefWidths()
+void RenderTableCell::computePreferredLogicalWidths()
{
- // The child cells rely on the grids up in the sections to do their calcPrefWidths work. Normally the sections are set up early, as table
+ // The child cells rely on the grids up in the sections to do their computePreferredLogicalWidths work. Normally the sections are set up early, as table
// cells are added, but relayout can cause the cells to be freed, leaving stale pointers in the sections'
// grids. We must refresh those grids before the child cells try to use them.
table()->recalcSectionsIfNeeded();
- RenderBlock::calcPrefWidths();
+ RenderBlock::computePreferredLogicalWidths();
if (node() && style()->autoWrap()) {
// See if nowrap was set.
Length w = styleOrColWidth();
@@ -145,11 +145,11 @@ void RenderTableCell::calcPrefWidths()
// to make the minwidth of the cell into the fixed width. They do this
// even in strict mode, so do not make this a quirk. Affected the top
// of hiptop.com.
- m_minPrefWidth = max(w.value(), m_minPrefWidth);
+ m_minPreferredLogicalWidth = max(w.value(), m_minPreferredLogicalWidth);
}
}
-void RenderTableCell::calcWidth()
+void RenderTableCell::computeLogicalWidth()
{
#ifdef ANDROID_LAYOUT
if (view()->frameView())
@@ -173,12 +173,51 @@ void RenderTableCell::layout()
int RenderTableCell::paddingTop(bool includeIntrinsicPadding) const
{
- return RenderBlock::paddingTop() + (includeIntrinsicPadding ? intrinsicPaddingTop() : 0);
+ int result = RenderBlock::paddingTop();
+ if (!includeIntrinsicPadding || !style()->isVerticalBlockFlow())
+ return result;
+ return result + (style()->blockFlow() == TopToBottomBlockFlow ? intrinsicPaddingBefore() : intrinsicPaddingAfter());
}
int RenderTableCell::paddingBottom(bool includeIntrinsicPadding) const
{
- return RenderBlock::paddingBottom() + (includeIntrinsicPadding ? intrinsicPaddingBottom() : 0);
+ int result = RenderBlock::paddingBottom();
+ if (!includeIntrinsicPadding || !style()->isVerticalBlockFlow())
+ return result;
+ return result + (style()->blockFlow() == TopToBottomBlockFlow ? intrinsicPaddingAfter() : intrinsicPaddingBefore());
+}
+
+int RenderTableCell::paddingLeft(bool includeIntrinsicPadding) const
+{
+ int result = RenderBlock::paddingLeft();
+ if (!includeIntrinsicPadding || style()->isVerticalBlockFlow())
+ return result;
+ return result + (style()->blockFlow() == LeftToRightBlockFlow ? intrinsicPaddingBefore() : intrinsicPaddingAfter());
+
+}
+
+int RenderTableCell::paddingRight(bool includeIntrinsicPadding) const
+{
+ int result = RenderBlock::paddingRight();
+ if (!includeIntrinsicPadding || style()->isVerticalBlockFlow())
+ return result;
+ return result + (style()->blockFlow() == LeftToRightBlockFlow ? intrinsicPaddingAfter() : intrinsicPaddingBefore());
+}
+
+int RenderTableCell::paddingBefore(bool includeIntrinsicPadding) const
+{
+ int result = RenderBlock::paddingBefore();
+ if (!includeIntrinsicPadding)
+ return result;
+ return result + intrinsicPaddingBefore();
+}
+
+int RenderTableCell::paddingAfter(bool includeIntrinsicPadding) const
+{
+ int result = RenderBlock::paddingAfter();
+ if (!includeIntrinsicPadding)
+ return result;
+ return result + intrinsicPaddingAfter();
}
void RenderTableCell::setOverrideSize(int size)
@@ -660,6 +699,28 @@ int RenderTableCell::borderBottom() const
return table()->collapseBorders() ? borderHalfBottom(false) : RenderBlock::borderBottom();
}
+// FIXME: https://bugs.webkit.org/show_bug.cgi?id=46191, make the collapsed border drawing
+// work with different block flow values instead of being hard-coded to top-to-bottom.
+int RenderTableCell::borderStart() const
+{
+ return table()->collapseBorders() ? borderHalfLeft(false) : RenderBlock::borderStart();
+}
+
+int RenderTableCell::borderEnd() const
+{
+ return table()->collapseBorders() ? borderHalfRight(false) : RenderBlock::borderEnd();
+}
+
+int RenderTableCell::borderBefore() const
+{
+ return table()->collapseBorders() ? borderHalfTop(false) : RenderBlock::borderBefore();
+}
+
+int RenderTableCell::borderAfter() const
+{
+ return table()->collapseBorders() ? borderHalfBottom(false) : RenderBlock::borderAfter();
+}
+
int RenderTableCell::borderHalfLeft(bool outer) const
{
CollapsedBorderValue border = collapsedLeftBorder(table()->style()->direction() == RTL);
diff --git a/WebCore/rendering/RenderTableCell.h b/WebCore/rendering/RenderTableCell.h
index b6622f4..79376e9 100644
--- a/WebCore/rendering/RenderTableCell.h
+++ b/WebCore/rendering/RenderTableCell.h
@@ -53,14 +53,18 @@ public:
Length styleOrColWidth() const;
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
void updateWidth(int);
- int borderLeft() const;
- int borderRight() const;
- int borderTop() const;
- int borderBottom() const;
+ virtual int borderLeft() const;
+ virtual int borderRight() const;
+ virtual int borderTop() const;
+ virtual int borderBottom() const;
+ virtual int borderStart() const;
+ virtual int borderEnd() const;
+ virtual int borderBefore() const;
+ virtual int borderAfter() const;
int borderHalfLeft(bool outer) const;
int borderHalfRight(bool outer) const;
@@ -86,16 +90,24 @@ public:
virtual int baselinePosition(bool firstLine = false, bool isRootLineBox = false) const;
- void setIntrinsicPaddingTop(int p) { m_intrinsicPaddingTop = p; }
- void setIntrinsicPaddingBottom(int p) { m_intrinsicPaddingBottom = p; }
- void setIntrinsicPadding(int top, int bottom) { setIntrinsicPaddingTop(top); setIntrinsicPaddingBottom(bottom); }
+ void setIntrinsicPaddingBefore(int p) { m_intrinsicPaddingBefore = p; }
+ void setIntrinsicPaddingAfter(int p) { m_intrinsicPaddingAfter = p; }
+ void setIntrinsicPadding(int before, int after) { setIntrinsicPaddingBefore(before); setIntrinsicPaddingAfter(after); }
void clearIntrinsicPadding() { setIntrinsicPadding(0, 0); }
- int intrinsicPaddingTop() const { return m_intrinsicPaddingTop; }
- int intrinsicPaddingBottom() const { return m_intrinsicPaddingBottom; }
+ int intrinsicPaddingBefore() const { return m_intrinsicPaddingBefore; }
+ int intrinsicPaddingAfter() const { return m_intrinsicPaddingAfter; }
virtual int paddingTop(bool includeIntrinsicPadding = true) const;
virtual int paddingBottom(bool includeIntrinsicPadding = true) const;
+ virtual int paddingLeft(bool includeIntrinsicPadding = true) const;
+ virtual int paddingRight(bool includeIntrinsicPadding = true) const;
+
+ // FIXME: For now we just assume the cell has the same block flow direction as the table. It's likely we'll
+ // create an extra anonymous RenderBlock to handle mixing directionality anyway, in which case we can lock
+ // the block flow directionality of the cells to the table's directionality.
+ virtual int paddingBefore(bool includeIntrinsicPadding = true) const;
+ virtual int paddingAfter(bool includeIntrinsicPadding = true) const;
virtual void setOverrideSize(int);
@@ -114,7 +126,7 @@ private:
virtual bool requiresLayer() const { return isPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask() || hasReflection(); }
- virtual void calcWidth();
+ virtual void computeLogicalWidth();
virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
virtual void paintMask(PaintInfo&, int tx, int ty);
@@ -129,8 +141,8 @@ private:
int m_column;
int m_rowSpan;
int m_columnSpan;
- int m_intrinsicPaddingTop;
- int m_intrinsicPaddingBottom;
+ int m_intrinsicPaddingBefore;
+ int m_intrinsicPaddingAfter;
int m_percentageHeight;
};
diff --git a/WebCore/rendering/RenderTableCol.cpp b/WebCore/rendering/RenderTableCol.cpp
index 80e74e1..66d060b 100644
--- a/WebCore/rendering/RenderTableCol.cpp
+++ b/WebCore/rendering/RenderTableCol.cpp
@@ -88,12 +88,12 @@ void RenderTableCol::imageChanged(WrappedImagePtr, const IntRect*)
repaint();
}
-void RenderTableCol::calcPrefWidths()
+void RenderTableCol::computePreferredLogicalWidths()
{
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
for (RenderObject* child = firstChild(); child; child = child->nextSibling())
- child->setPrefWidthsDirty(false);
+ child->setPreferredLogicalWidthsDirty(false);
}
RenderTable* RenderTableCol::table() const
diff --git a/WebCore/rendering/RenderTableCol.h b/WebCore/rendering/RenderTableCol.h
index 87209a1..c5f9afc 100644
--- a/WebCore/rendering/RenderTableCol.h
+++ b/WebCore/rendering/RenderTableCol.h
@@ -39,7 +39,7 @@ public:
const RenderObjectChildList* children() const { return &m_children; }
RenderObjectChildList* children() { return &m_children; }
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
int span() const { return m_span; }
void setSpan(int span) { m_span = span; }
diff --git a/WebCore/rendering/RenderTableRow.cpp b/WebCore/rendering/RenderTableRow.cpp
index 0a8bfde..d0bd511 100644
--- a/WebCore/rendering/RenderTableRow.cpp
+++ b/WebCore/rendering/RenderTableRow.cpp
@@ -126,7 +126,7 @@ void RenderTableRow::layout()
cell->setChildNeedsLayout(true, false);
if (child->needsLayout()) {
- cell->calcVerticalMargins();
+ cell->computeBlockDirectionMargins(table());
cell->layout();
}
}
diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp
index 9e59109..37f2025 100644
--- a/WebCore/rendering/RenderTableSection.cpp
+++ b/WebCore/rendering/RenderTableSection.cpp
@@ -379,9 +379,9 @@ int RenderTableSection::calcRowHeight()
cell->layoutIfNeeded();
}
- int adjustedPaddingTop = cell->paddingTop() - cell->intrinsicPaddingTop();
- int adjustedPaddingBottom = cell->paddingBottom() - cell->intrinsicPaddingBottom();
- int adjustedHeight = cell->height() - (cell->intrinsicPaddingTop() + cell->intrinsicPaddingBottom());
+ int adjustedPaddingTop = cell->paddingTop() - cell->intrinsicPaddingBefore();
+ int adjustedPaddingBottom = cell->paddingBottom() - cell->intrinsicPaddingAfter();
+ int adjustedHeight = cell->height() - (cell->intrinsicPaddingBefore() + cell->intrinsicPaddingAfter());
// Explicit heights use the border box in quirks mode. In strict mode do the right
// thing and actually add in the border and padding.
@@ -399,8 +399,8 @@ int RenderTableSection::calcRowHeight()
if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB) {
int b = cell->baselinePosition();
if (b > cell->borderTop() + cell->paddingTop()) {
- baseline = max(baseline, b - cell->intrinsicPaddingTop());
- bdesc = max(bdesc, m_rowPos[indx] + ch - (b - cell->intrinsicPaddingTop()));
+ baseline = max(baseline, b - cell->intrinsicPaddingBefore());
+ bdesc = max(bdesc, m_rowPos[indx] + ch - (b - cell->intrinsicPaddingBefore()));
}
}
}
@@ -657,8 +657,8 @@ int RenderTableSection::layoutRows(int toAdd)
}
}
- int oldTe = cell->intrinsicPaddingTop();
- int oldBe = cell->intrinsicPaddingBottom();
+ int oldTe = cell->intrinsicPaddingBefore();
+ int oldBe = cell->intrinsicPaddingAfter();
int heightWithoutIntrinsicPadding = cell->height() - oldTe - oldBe;
int te = 0;
@@ -687,8 +687,8 @@ int RenderTableSection::layoutRows(int toAdd)
}
int be = rHeight - heightWithoutIntrinsicPadding - te;
- cell->setIntrinsicPaddingTop(te);
- cell->setIntrinsicPaddingBottom(be);
+ cell->setIntrinsicPaddingBefore(te);
+ cell->setIntrinsicPaddingAfter(be);
IntRect oldCellRect(cell->x(), cell->y() , cell->width(), cell->height());
diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp
index d786e6a..fada8b4 100644
--- a/WebCore/rendering/RenderText.cpp
+++ b/WebCore/rendering/RenderText.cpp
@@ -263,7 +263,7 @@ PassRefPtr<StringImpl> RenderText::originalText() const
void RenderText::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
{
for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
- rects.append(IntRect(tx + box->x(), ty + box->y(), box->width(), box->height()));
+ rects.append(IntRect(tx + box->x(), ty + box->y(), box->logicalWidth(), box->logicalHeight()));
}
void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, unsigned end, bool useSelectionHeight)
@@ -281,7 +281,7 @@ void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, u
for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
// Note: box->end() returns the index of the last character, not the index past it
if (start <= box->start() && box->end() < end) {
- IntRect r = IntRect(box->x(), box->y(), box->width(), box->height());
+ IntRect r = IntRect(box->x(), box->y(), box->logicalWidth(), box->logicalHeight());
if (useSelectionHeight) {
IntRect selectionRect = box->selectionRect(0, 0, start, end);
r.setHeight(selectionRect.height());
@@ -297,7 +297,7 @@ void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, u
if (!r.isEmpty()) {
if (!useSelectionHeight) {
// change the height and y position because selectionRect uses selection-specific values
- r.setHeight(box->height());
+ r.setHeight(box->logicalHeight());
r.setY(box->y());
}
FloatPoint origin = localToAbsolute(r.location());
@@ -380,7 +380,7 @@ void RenderText::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned start,
if (r.height()) {
if (!useSelectionHeight) {
// change the height and y position because selectionRect uses selection-specific values
- r.setHeight(box->height());
+ r.setHeight(box->logicalHeight());
r.setY(box->y());
}
quads.append(localToAbsoluteQuad(FloatRect(r)));
@@ -425,7 +425,7 @@ VisiblePosition RenderText::positionForPoint(const IntPoint& point)
offset = firstTextBox()->offsetForPosition(point.x());
return createVisiblePosition(offset + firstTextBox()->start(), DOWNSTREAM);
}
- if (lastTextBox() && point.y() >= lastTextBox()->root()->lineTop() && point.x() >= lastTextBox()->m_x + lastTextBox()->m_width) {
+ if (lastTextBox() && point.y() >= lastTextBox()->root()->lineTop() && point.x() >= lastTextBox()->m_x + lastTextBox()->logicalWidth()) {
// at the y coordinate of the last line or below
// and the x coordinate is to the right of the last text box right edge
offset = lastTextBox()->offsetForPosition(point.x());
@@ -444,7 +444,7 @@ VisiblePosition RenderText::positionForPoint(const IntPoint& point)
// the affinity must be downstream so the position doesn't jump back to the previous line
return createVisiblePosition(offset + box->start(), DOWNSTREAM);
- if (point.x() < box->m_x + box->m_width)
+ if (point.x() < box->m_x + box->logicalWidth())
// and the x coordinate is to the left of the right edge of this box
// check to see if position goes in this box
return createVisiblePosition(offset + box->start(), offset > 0 ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM);
@@ -489,11 +489,11 @@ IntRect RenderText::localCaretRect(InlineBox* inlineBox, int caretOffset, int* e
int caretWidthRightOfOffset = caretWidth - caretWidthLeftOfOffset;
int rootLeft = box->root()->x();
- int rootRight = rootLeft + box->root()->width();
+ int rootRight = rootLeft + box->root()->logicalWidth();
// FIXME: should we use the width of the root inline box or the
// width of the containing block for this?
if (extraWidthToEndOfLine)
- *extraWidthToEndOfLine = (box->root()->width() + rootLeft) - (left + 1);
+ *extraWidthToEndOfLine = (box->root()->logicalWidth() + rootLeft) - (left + 1);
RenderBlock* cb = containingBlock();
RenderStyle* cbStyle = cb->style();
@@ -581,8 +581,8 @@ void RenderText::trimmedPrefWidths(int leadWidth,
if (!collapseWhiteSpace)
stripFrontSpaces = false;
- if (m_hasTab || prefWidthsDirty())
- calcPrefWidths(leadWidth);
+ if (m_hasTab || preferredLogicalWidthsDirty())
+ computePreferredLogicalWidths(leadWidth);
beginWS = !stripFrontSpaces && m_hasBeginWS;
endWS = m_hasEndWS;
@@ -664,34 +664,34 @@ static inline bool isSpaceAccordingToStyle(UChar c, RenderStyle* style)
return c == ' ' || (c == noBreakSpace && style->nbspMode() == SPACE);
}
-int RenderText::minPrefWidth() const
+int RenderText::minPreferredLogicalWidth() const
{
- if (prefWidthsDirty())
- const_cast<RenderText*>(this)->calcPrefWidths(0);
+ if (preferredLogicalWidthsDirty())
+ const_cast<RenderText*>(this)->computePreferredLogicalWidths(0);
return m_minWidth;
}
-int RenderText::maxPrefWidth() const
+int RenderText::maxPreferredLogicalWidth() const
{
- if (prefWidthsDirty())
- const_cast<RenderText*>(this)->calcPrefWidths(0);
+ if (preferredLogicalWidthsDirty())
+ const_cast<RenderText*>(this)->computePreferredLogicalWidths(0);
return m_maxWidth;
}
-void RenderText::calcPrefWidths(int leadWidth)
+void RenderText::computePreferredLogicalWidths(int leadWidth)
{
HashSet<const SimpleFontData*> fallbackFonts;
GlyphOverflow glyphOverflow;
- calcPrefWidths(leadWidth, fallbackFonts, glyphOverflow);
+ computePreferredLogicalWidths(leadWidth, fallbackFonts, glyphOverflow);
if (fallbackFonts.isEmpty() && !glyphOverflow.left && !glyphOverflow.right && !glyphOverflow.top && !glyphOverflow.bottom)
m_knownToHaveNoOverflowAndNoFallbackFonts = true;
}
-void RenderText::calcPrefWidths(int leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow)
+void RenderText::computePreferredLogicalWidths(int leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow)
{
- ASSERT(m_hasTab || prefWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts);
+ ASSERT(m_hasTab || preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts);
m_minWidth = 0;
m_beginMinWidth = 0;
@@ -877,7 +877,7 @@ void RenderText::calcPrefWidths(int leadWidth, HashSet<const SimpleFontData*>& f
m_endMinWidth = currMaxWidth;
}
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
bool RenderText::isAllCollapsibleWhitespace()
@@ -1249,14 +1249,14 @@ unsigned RenderText::width(unsigned from, unsigned len, const Font& f, int xPos,
if (!style()->preserveNewline() && !from && len == textLength()) {
if (fallbackFonts) {
ASSERT(glyphOverflow);
- if (prefWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts) {
- const_cast<RenderText*>(this)->calcPrefWidths(0, *fallbackFonts, *glyphOverflow);
+ if (preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts) {
+ const_cast<RenderText*>(this)->computePreferredLogicalWidths(0, *fallbackFonts, *glyphOverflow);
if (fallbackFonts->isEmpty() && !glyphOverflow->left && !glyphOverflow->right && !glyphOverflow->top && !glyphOverflow->bottom)
m_knownToHaveNoOverflowAndNoFallbackFonts = true;
}
w = m_maxWidth;
} else
- w = maxPrefWidth();
+ w = maxPreferredLogicalWidth();
} else
w = widthFromCache(f, from, len, xPos, fallbackFonts, glyphOverflow);
} else
@@ -1277,12 +1277,12 @@ IntRect RenderText::linesBoundingBox() const
for (InlineTextBox* curr = firstTextBox(); curr; curr = curr->nextTextBox()) {
if (curr == firstTextBox() || curr->x() < leftSide)
leftSide = curr->x();
- if (curr == firstTextBox() || curr->x() + curr->width() > rightSide)
- rightSide = curr->x() + curr->width();
+ if (curr == firstTextBox() || curr->x() + curr->logicalWidth() > rightSide)
+ rightSide = curr->x() + curr->logicalWidth();
}
result.setWidth(rightSide - leftSide);
result.setX(leftSide);
- result.setHeight(lastTextBox()->y() + lastTextBox()->height() - firstTextBox()->y());
+ result.setHeight(lastTextBox()->y() + lastTextBox()->logicalHeight() - firstTextBox()->y());
result.setY(firstTextBox()->y());
}
diff --git a/WebCore/rendering/RenderText.h b/WebCore/rendering/RenderText.h
index 6ab73f6..e3a6997 100644
--- a/WebCore/rendering/RenderText.h
+++ b/WebCore/rendering/RenderText.h
@@ -76,8 +76,8 @@ public:
virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
- virtual int minPrefWidth() const;
- virtual int maxPrefWidth() const;
+ virtual int minPreferredLogicalWidth() const;
+ virtual int maxPreferredLogicalWidth() const;
void trimmedPrefWidths(int leadWidth,
int& beginMinW, bool& beginWS,
@@ -124,7 +124,7 @@ public:
void checkConsistency() const;
- virtual void calcPrefWidths(int leadWidth);
+ virtual void computePreferredLogicalWidths(int leadWidth);
bool isAllCollapsibleWhitespace();
protected:
@@ -137,7 +137,7 @@ protected:
virtual InlineTextBox* createTextBox(); // Subclassed by SVG.
private:
- void calcPrefWidths(int leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow&);
+ void computePreferredLogicalWidths(int leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow&);
// Make length() private so that callers that have a RenderText*
// will use the more efficient textLength() instead, while
diff --git a/WebCore/rendering/RenderTextControl.cpp b/WebCore/rendering/RenderTextControl.cpp
index e66e4ed..f48081b 100644
--- a/WebCore/rendering/RenderTextControl.cpp
+++ b/WebCore/rendering/RenderTextControl.cpp
@@ -401,7 +401,7 @@ int RenderTextControl::scrollbarThickness() const
return ScrollbarTheme::nativeTheme()->scrollbarThickness();
}
-void RenderTextControl::calcHeight()
+void RenderTextControl::computeLogicalHeight()
{
setHeight(m_innerText->renderBox()->borderTop() + m_innerText->renderBox()->borderBottom() +
m_innerText->renderBox()->paddingTop() + m_innerText->renderBox()->paddingBottom() +
@@ -414,7 +414,7 @@ void RenderTextControl::calcHeight()
if (style()->overflowX() == OSCROLL || (style()->overflowX() == OAUTO && m_innerText->renderer()->style()->wordWrap() == NormalWordWrap))
setHeight(height() + scrollbarThickness());
- RenderBlock::calcHeight();
+ RenderBlock::computeLogicalHeight();
}
void RenderTextControl::hitInnerTextElement(HitTestResult& result, int xPos, int yPos, int tx, int ty)
@@ -504,40 +504,40 @@ float RenderTextControl::scaleEmToUnits(int x) const
return roundf(style()->font().size() * x / unitsPerEm);
}
-void RenderTextControl::calcPrefWidths()
+void RenderTextControl::computePreferredLogicalWidths()
{
- ASSERT(prefWidthsDirty());
+ ASSERT(preferredLogicalWidthsDirty());
- m_minPrefWidth = 0;
- m_maxPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
+ m_maxPreferredLogicalWidth = 0;
if (style()->width().isFixed() && style()->width().value() > 0)
- m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value());
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value());
else {
// Use average character width. Matches IE.
AtomicString family = style()->font().family().family();
- m_maxPrefWidth = preferredContentWidth(getAvgCharWidth(family)) + m_innerText->renderBox()->paddingLeft() + m_innerText->renderBox()->paddingRight();
+ m_maxPreferredLogicalWidth = preferredContentWidth(getAvgCharWidth(family)) + m_innerText->renderBox()->paddingLeft() + m_innerText->renderBox()->paddingRight();
}
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
- m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
- m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
+ m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
+ m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
} else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
- m_minPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
else
- m_minPrefWidth = m_maxPrefWidth;
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
- m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
- m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
+ m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
}
int toAdd = borderAndPaddingWidth();
- m_minPrefWidth += toAdd;
- m_maxPrefWidth += toAdd;
+ m_minPreferredLogicalWidth += toAdd;
+ m_maxPreferredLogicalWidth += toAdd;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
void RenderTextControl::selectionChanged(bool userTriggered)
diff --git a/WebCore/rendering/RenderTextControl.h b/WebCore/rendering/RenderTextControl.h
index de0b21b..a33f11d 100644
--- a/WebCore/rendering/RenderTextControl.h
+++ b/WebCore/rendering/RenderTextControl.h
@@ -85,7 +85,7 @@ protected:
virtual RenderStyle* textBaseStyle() const = 0;
virtual void updateFromElement();
- virtual void calcHeight();
+ virtual void computeLogicalHeight();
friend class TextIterator;
HTMLElement* innerTextElement() const;
@@ -95,7 +95,7 @@ protected:
private:
virtual const char* renderName() const { return "RenderTextControl"; }
virtual bool isTextControl() const { return true; }
- virtual void calcPrefWidths();
+ virtual void computePreferredLogicalWidths();
virtual void removeLeftoverAnonymousBlock(RenderBlock*) { }
virtual bool canHaveChildren() const { return false; }
virtual bool avoidsFloats() const { return true; }
diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp
index e49fa4c..7edbe7f 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.cpp
+++ b/WebCore/rendering/RenderTextControlSingleLine.cpp
@@ -227,10 +227,10 @@ void RenderTextControlSingleLine::addFocusRingRects(Vector<IntRect>& rects, int
void RenderTextControlSingleLine::layout()
{
int oldHeight = height();
- calcHeight();
+ computeLogicalHeight();
int oldWidth = width();
- calcWidth();
+ computeLogicalWidth();
bool relayoutChildren = oldHeight != height() || oldWidth != width();
@@ -483,23 +483,23 @@ int RenderTextControlSingleLine::textBlockWidth() const
int width = RenderTextControl::textBlockWidth();
if (RenderBox* resultsRenderer = m_resultsButton ? m_resultsButton->renderBox() : 0) {
- resultsRenderer->calcWidth();
+ resultsRenderer->computeLogicalWidth();
width -= resultsRenderer->width() + resultsRenderer->marginLeft() + resultsRenderer->marginRight();
}
if (RenderBox* cancelRenderer = m_cancelButton ? m_cancelButton->renderBox() : 0) {
- cancelRenderer->calcWidth();
+ cancelRenderer->computeLogicalWidth();
width -= cancelRenderer->width() + cancelRenderer->marginLeft() + cancelRenderer->marginRight();
}
if (RenderBox* spinRenderer = m_innerSpinButton ? m_innerSpinButton->renderBox() : 0) {
- spinRenderer->calcWidth();
+ spinRenderer->computeLogicalWidth();
width -= spinRenderer->width() + spinRenderer->marginLeft() + spinRenderer->marginRight();
}
#if ENABLE(INPUT_SPEECH)
if (RenderBox* speechRenderer = m_speechButton ? m_speechButton->renderBox() : 0) {
- speechRenderer->calcWidth();
+ speechRenderer->computeLogicalWidth();
width -= speechRenderer->width() + speechRenderer->marginLeft() + speechRenderer->marginRight();
}
#endif
@@ -511,7 +511,7 @@ int RenderTextControlSingleLine::decorationWidthRight() const
{
int width = 0;
if (RenderBox* spinRenderer = m_outerSpinButton ? m_outerSpinButton->renderBox() : 0) {
- spinRenderer->calcWidth();
+ spinRenderer->computeLogicalWidth();
width += spinRenderer->width() + spinRenderer->marginLeft() + spinRenderer->marginRight();
}
if (width > 0)
@@ -563,7 +563,7 @@ int RenderTextControlSingleLine::preferredContentWidth(float charWidth) const
cancelRenderer->paddingLeft() + cancelRenderer->paddingRight();
if (RenderBox* spinRenderer = m_innerSpinButton ? m_innerSpinButton->renderBox() : 0)
- result += spinRenderer->minPrefWidth();
+ result += spinRenderer->minPreferredLogicalWidth();
#if ENABLE(INPUT_SPEECH)
if (RenderBox* speechRenderer = m_speechButton ? m_speechButton->renderBox() : 0) {
@@ -578,8 +578,8 @@ int RenderTextControlSingleLine::preferredDecorationWidthRight() const
{
int width = 0;
if (RenderBox* spinRenderer = m_outerSpinButton ? m_outerSpinButton->renderBox() : 0) {
- spinRenderer->calcWidth();
- width += spinRenderer->minPrefWidth() + spinRenderer->marginLeft() + spinRenderer->marginRight();
+ spinRenderer->computeLogicalWidth();
+ width += spinRenderer->minPreferredLogicalWidth() + spinRenderer->marginLeft() + spinRenderer->marginRight();
}
if (width > 0)
width += paddingRight() + borderRight();
@@ -589,7 +589,7 @@ int RenderTextControlSingleLine::preferredDecorationWidthRight() const
void RenderTextControlSingleLine::adjustControlHeightBasedOnLineHeight(int lineHeight)
{
if (RenderBox* resultsRenderer = m_resultsButton ? m_resultsButton->renderBox() : 0) {
- toRenderBlock(resultsRenderer)->calcHeight();
+ toRenderBlock(resultsRenderer)->computeLogicalHeight();
setHeight(max(height(),
resultsRenderer->borderTop() + resultsRenderer->borderBottom() +
resultsRenderer->paddingTop() + resultsRenderer->paddingBottom() +
@@ -598,7 +598,7 @@ void RenderTextControlSingleLine::adjustControlHeightBasedOnLineHeight(int lineH
}
if (RenderBox* cancelRenderer = m_cancelButton ? m_cancelButton->renderBox() : 0) {
- toRenderBlock(cancelRenderer)->calcHeight();
+ toRenderBlock(cancelRenderer)->computeLogicalHeight();
setHeight(max(height(),
cancelRenderer->borderTop() + cancelRenderer->borderBottom() +
cancelRenderer->paddingTop() + cancelRenderer->paddingBottom() +
diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp
index e10c2f1..ab6247b 100644
--- a/WebCore/rendering/RenderTreeAsText.cpp
+++ b/WebCore/rendering/RenderTreeAsText.cpp
@@ -46,7 +46,6 @@
#include "RenderView.h"
#include "RenderWidget.h"
#include "SelectionController.h"
-#include "TextStream.h"
#include <wtf/UnusedParam.h>
#include <wtf/Vector.h>
@@ -75,12 +74,53 @@ using namespace HTMLNames;
static void writeLayers(TextStream&, const RenderLayer* rootLayer, RenderLayer*, const IntRect& paintDirtyRect, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal);
-#if !ENABLE(SVG)
-static TextStream &operator<<(TextStream& ts, const IntRect& r)
+bool hasFractions(double val)
+{
+ static const double s_epsilon = 0.0001;
+ int ival = static_cast<int>(val);
+ double dval = static_cast<double>(ival);
+ return fabs(val - dval) > s_epsilon;
+}
+
+TextStream& operator<<(TextStream& ts, const IntRect& r)
{
return ts << "at (" << r.x() << "," << r.y() << ") size " << r.width() << "x" << r.height();
}
-#endif
+
+TextStream& operator<<(TextStream& ts, const IntPoint& p)
+{
+ return ts << "(" << p.x() << "," << p.y() << ")";
+}
+
+TextStream& operator<<(TextStream& ts, const FloatPoint& p)
+{
+ ts << "(";
+ if (hasFractions(p.x()))
+ ts << p.x();
+ else
+ ts << int(p.x());
+ ts << ",";
+ if (hasFractions(p.y()))
+ ts << p.y();
+ else
+ ts << int(p.y());
+ return ts << ")";
+}
+
+TextStream& operator<<(TextStream& ts, const FloatSize& s)
+{
+ ts << "width=";
+ if (hasFractions(s.width()))
+ ts << s.width();
+ else
+ ts << int(s.width());
+ ts << " height=";
+ if (hasFractions(s.height()))
+ ts << s.height();
+ else
+ ts << int(s.height());
+ return ts;
+}
void writeIndent(TextStream& ts, int indent)
{
@@ -223,13 +263,13 @@ void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o,
// to clean up the results to dump both the outer box and the intrinsic padding so that both bits of information are
// captured by the results.
const RenderTableCell& cell = *toRenderTableCell(&o);
- r = IntRect(cell.x(), cell.y() + cell.intrinsicPaddingTop(), cell.width(), cell.height() - cell.intrinsicPaddingTop() - cell.intrinsicPaddingBottom());
+ r = IntRect(cell.x(), cell.y() + cell.intrinsicPaddingBefore(), cell.width(), cell.height() - cell.intrinsicPaddingBefore() - cell.intrinsicPaddingAfter());
} else if (o.isBox())
r = toRenderBox(&o)->frameRect();
// FIXME: Temporary in order to ensure compatibility with existing layout test results.
if (adjustForTableCells)
- r.move(0, -toRenderTableCell(o.containingBlock())->intrinsicPaddingTop());
+ r.move(0, -toRenderTableCell(o.containingBlock())->intrinsicPaddingBefore());
ts << " " << r;
@@ -398,8 +438,8 @@ static void writeTextRun(TextStream& ts, const RenderText& o, const InlineTextBo
// FIXME: Table cell adjustment is temporary until results can be updated.
int y = run.m_y;
if (o.containingBlock()->isTableCell())
- y -= toRenderTableCell(o.containingBlock())->intrinsicPaddingTop();
- ts << "text run at (" << run.m_x << "," << y << ") width " << run.m_width;
+ y -= toRenderTableCell(o.containingBlock())->intrinsicPaddingBefore();
+ ts << "text run at (" << run.m_x << "," << y << ") width " << run.m_logicalWidth;
if (run.direction() == RTL || run.m_dirOverride) {
ts << (run.direction() == RTL ? " RTL" : " LTR");
if (run.m_dirOverride)
diff --git a/WebCore/rendering/RenderTreeAsText.h b/WebCore/rendering/RenderTreeAsText.h
index 722736b..59a0abb 100644
--- a/WebCore/rendering/RenderTreeAsText.h
+++ b/WebCore/rendering/RenderTreeAsText.h
@@ -25,13 +25,19 @@
#ifndef RenderTreeAsText_h
#define RenderTreeAsText_h
+#include "TextStream.h"
#include <wtf/Forward.h>
+#include <wtf/MathExtras.h>
namespace WebCore {
class Element;
+class FloatPoint;
+class FloatSize;
class Frame;
+class IntPoint;
+class IntRect;
class RenderObject;
class TextStream;
@@ -59,6 +65,27 @@ public:
static void writeRenderObject(TextStream& ts, const RenderObject& o, RenderAsTextBehavior behavior);
};
+TextStream& operator<<(TextStream&, const IntPoint&);
+TextStream& operator<<(TextStream&, const IntRect&);
+TextStream& operator<<(TextStream&, const FloatPoint&);
+TextStream& operator<<(TextStream&, const FloatSize&);
+
+template<typename Item>
+TextStream& operator<<(TextStream& ts, const Vector<Item>& vector)
+{
+ ts << "[";
+
+ unsigned size = vector.size();
+ for (unsigned i = 0; i < size; ++i) {
+ ts << vector[i];
+ if (i < size - 1)
+ ts << ", ";
+ }
+
+ ts << "]";
+ return ts;
+}
+
// Helper function shared with SVGRenderTreeAsText
String quoteAndEscapeNonPrintables(const String&);
@@ -66,6 +93,8 @@ String counterValueForElement(Element*);
String markerTextForListItem(Element*);
+bool hasFractions(double val);
+
} // namespace WebCore
#endif // RenderTreeAsText_h
diff --git a/WebCore/rendering/RenderVideo.cpp b/WebCore/rendering/RenderVideo.cpp
index 3dfee7b..470499a 100644
--- a/WebCore/rendering/RenderVideo.cpp
+++ b/WebCore/rendering/RenderVideo.cpp
@@ -90,7 +90,7 @@ void RenderVideo::updateIntrinsicSize()
return;
setIntrinsicSize(size);
- setPrefWidthsDirty(true);
+ setPreferredLogicalWidthsDirty(true);
setNeedsLayout(true);
}
@@ -246,14 +246,14 @@ void RenderVideo::updatePlayer()
mediaPlayer->setVisible(true);
}
-int RenderVideo::calcReplacedWidth(bool includeMaxWidth) const
+int RenderVideo::computeReplacedWidth(bool includeMaxWidth) const
{
- return RenderReplaced::calcReplacedWidth(includeMaxWidth);
+ return RenderReplaced::computeReplacedWidth(includeMaxWidth);
}
-int RenderVideo::calcReplacedHeight() const
+int RenderVideo::computeReplacedHeight() const
{
- return RenderReplaced::calcReplacedHeight();
+ return RenderReplaced::computeReplacedHeight();
}
int RenderVideo::minimumReplacedHeight() const
diff --git a/WebCore/rendering/RenderVideo.h b/WebCore/rendering/RenderVideo.h
index 2c47471..24f473d 100644
--- a/WebCore/rendering/RenderVideo.h
+++ b/WebCore/rendering/RenderVideo.h
@@ -70,8 +70,8 @@ private:
virtual void layout();
- virtual int calcReplacedWidth(bool includeMaxWidth = true) const;
- virtual int calcReplacedHeight() const;
+ virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
+ virtual int computeReplacedHeight() const;
virtual int minimumReplacedHeight() const;
void updatePlayer();
diff --git a/WebCore/rendering/RenderView.cpp b/WebCore/rendering/RenderView.cpp
index edee4f6..439ed76 100644
--- a/WebCore/rendering/RenderView.cpp
+++ b/WebCore/rendering/RenderView.cpp
@@ -64,10 +64,10 @@ RenderView::RenderView(Node* node, FrameView* view)
// init RenderObject attributes
setInline(false);
- m_minPrefWidth = 0;
- m_maxPrefWidth = 0;
+ m_minPreferredLogicalWidth = 0;
+ m_maxPreferredLogicalWidth = 0;
- setPrefWidthsDirty(true, false);
+ setPreferredLogicalWidthsDirty(true, false);
setPositioned(true); // to 0,0 :)
}
@@ -76,15 +76,16 @@ RenderView::~RenderView()
{
}
-void RenderView::calcHeight()
+void RenderView::computeLogicalHeight()
{
if (!printing() && m_frameView)
- setHeight(viewHeight());
+ setLogicalHeight(viewLogicalHeight());
}
-void RenderView::calcWidth()
+void RenderView::computeLogicalWidth()
{
if (!printing() && m_frameView)
+<<<<<<< HEAD
setWidth(viewWidth());
#ifdef ANDROID_LAYOUT
setVisibleWidth(m_frameView->textWrapWidth());
@@ -95,15 +96,18 @@ void RenderView::calcWidth()
#endif
m_marginLeft = 0;
m_marginRight = 0;
+=======
+ setLogicalWidth(viewLogicalWidth());
+>>>>>>> webkit.org at r68651
}
-void RenderView::calcPrefWidths()
+void RenderView::computePreferredLogicalWidths()
{
- ASSERT(prefWidthsDirty());
+ ASSERT(preferredLogicalWidthsDirty());
- RenderBlock::calcPrefWidths();
+ RenderBlock::computePreferredLogicalWidths();
- m_maxPrefWidth = m_minPrefWidth;
+ m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth;
}
void RenderView::layout()
@@ -112,14 +116,14 @@ void RenderView::layout()
setPageHeight(0);
if (printing())
- m_minPrefWidth = m_maxPrefWidth = width();
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = width();
// Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account.
bool relayoutChildren = !printing() && (!m_frameView || width() != viewWidth() || height() != viewHeight());
if (relayoutChildren) {
setChildNeedsLayout(true, false);
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->style()->height().isPercent() || child->style()->minHeight().isPercent() || child->style()->maxHeight().isPercent())
+ if (child->style()->logicalHeight().isPercent() || child->style()->logicalMinHeight().isPercent() || child->style()->logicalMaxHeight().isPercent())
child->setChildNeedsLayout(true, false);
}
}
diff --git a/WebCore/rendering/RenderView.h b/WebCore/rendering/RenderView.h
index 55aa3b4..b03312f 100644
--- a/WebCore/rendering/RenderView.h
+++ b/WebCore/rendering/RenderView.h
@@ -47,13 +47,15 @@ public:
virtual bool requiresLayer() const { return true; }
virtual void layout();
- virtual void calcWidth();
- virtual void calcHeight();
- virtual void calcPrefWidths();
+ virtual void computeLogicalWidth();
+ virtual void computeLogicalHeight();
+ virtual void computePreferredLogicalWidths();
// The same as the FrameView's layoutHeight/layoutWidth but with null check guards.
int viewHeight() const;
int viewWidth() const;
+ int viewLogicalWidth() const { return style()->isVerticalBlockFlow() ? viewWidth() : viewHeight(); }
+ int viewLogicalHeight() const { return style()->isVerticalBlockFlow() ? viewHeight() : viewWidth(); }
float zoomFactor() const;
diff --git a/WebCore/rendering/RootInlineBox.cpp b/WebCore/rendering/RootInlineBox.cpp
index e8f24b5..52586c5 100644
--- a/WebCore/rendering/RootInlineBox.cpp
+++ b/WebCore/rendering/RootInlineBox.cpp
@@ -39,6 +39,18 @@ namespace WebCore {
typedef WTF::HashMap<const RootInlineBox*, EllipsisBox*> EllipsisBoxMap;
static EllipsisBoxMap* gEllipsisBoxMap = 0;
+RootInlineBox::RootInlineBox(RenderBlock* block)
+ : InlineFlowBox(block)
+ , m_lineBreakObj(0)
+ , m_lineBreakPos(0)
+ , m_lineTop(0)
+ , m_lineBottom(0)
+ , m_paginationStrut(0)
+{
+ setIsVertical(!block->style()->isVerticalBlockFlow());
+}
+
+
void RootInlineBox::destroy(RenderArena* arena)
{
detachEllipsisBox(arena);
@@ -72,7 +84,7 @@ bool RootInlineBox::canAccommodateEllipsis(bool ltr, int blockEdge, int lineBoxE
{
// First sanity-check the unoverflowed width of the whole line to see if there is sufficient room.
int delta = ltr ? lineBoxEdge - blockEdge : blockEdge - lineBoxEdge;
- if (width() - delta < ellipsisWidth)
+ if (logicalWidth() - delta < ellipsisWidth)
return false;
// Next iterate over all the line boxes on the line. If we find a replaced element that intersects
@@ -85,9 +97,8 @@ void RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr, bool ltr, in
{
// Create an ellipsis box.
EllipsisBox* ellipsisBox = new (renderer()->renderArena()) EllipsisBox(renderer(), ellipsisStr, this,
- ellipsisWidth - (markupBox ? markupBox->width() : 0), height(),
- y(), !prevRootBox(),
- markupBox);
+ ellipsisWidth - (markupBox ? markupBox->logicalWidth() : 0), logicalHeight(),
+ y(), !prevRootBox(), isVertical(), markupBox);
if (!gEllipsisBoxMap)
gEllipsisBoxMap = new EllipsisBoxMap();
@@ -95,8 +106,8 @@ void RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr, bool ltr, in
setHasEllipsisBox(true);
// FIXME: Do we need an RTL version of this?
- if (ltr && (x() + width() + ellipsisWidth) <= blockRightEdge) {
- ellipsisBox->m_x = x() + width();
+ if (ltr && (x() + logicalWidth() + ellipsisWidth) <= blockRightEdge) {
+ ellipsisBox->m_x = x() + logicalWidth();
return;
}
@@ -134,10 +145,10 @@ void RootInlineBox::addHighlightOverflow()
return;
// Highlight acts as a selection inflation.
- FloatRect rootRect(0, selectionTop(), width(), selectionHeight());
+ FloatRect rootRect(0, selectionTop(), logicalWidth(), selectionHeight());
IntRect inflatedRect = enclosingIntRect(page->chrome()->client()->customHighlightRect(renderer()->node(), renderer()->style()->highlight(), rootRect));
- setHorizontalOverflowPositions(leftLayoutOverflow(), rightLayoutOverflow(), min(leftVisualOverflow(), inflatedRect.x()), max(rightVisualOverflow(), inflatedRect.right()));
- setVerticalOverflowPositions(topLayoutOverflow(), bottomLayoutOverflow(), min(topVisualOverflow(), inflatedRect.y()), max(bottomVisualOverflow(), inflatedRect.bottom()), height());
+ setInlineDirectionOverflowPositions(leftLayoutOverflow(), rightLayoutOverflow(), min(leftVisualOverflow(), inflatedRect.x()), max(rightVisualOverflow(), inflatedRect.right()));
+ setBlockDirectionOverflowPositions(topLayoutOverflow(), bottomLayoutOverflow(), min(topVisualOverflow(), inflatedRect.y()), max(bottomVisualOverflow(), inflatedRect.bottom()), logicalHeight());
}
void RootInlineBox::paintCustomHighlight(PaintInfo& paintInfo, int tx, int ty, const AtomicString& highlightType)
@@ -153,7 +164,7 @@ void RootInlineBox::paintCustomHighlight(PaintInfo& paintInfo, int tx, int ty, c
return;
// Get the inflated rect so that we can properly hit test.
- FloatRect rootRect(tx + x(), ty + selectionTop(), width(), selectionHeight());
+ FloatRect rootRect(tx + x(), ty + selectionTop(), logicalWidth(), selectionHeight());
FloatRect inflatedRect = page->chrome()->client()->customHighlightRect(renderer()->node(), highlightType, rootRect);
if (inflatedRect.intersects(paintInfo.rect))
page->chrome()->client()->paintCustomHighlight(renderer()->node(), highlightType, rootRect, rootRect, false, true);
@@ -202,7 +213,7 @@ void RootInlineBox::childRemoved(InlineBox* box)
}
}
-int RootInlineBox::verticallyAlignBoxes(int heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
+int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
{
#if ENABLE(SVG)
// SVG will handle vertical alignment on its own.
@@ -226,8 +237,8 @@ int RootInlineBox::verticallyAlignBoxes(int heightOfBlock, GlyphOverflowAndFallb
int maxHeight = maxAscent + maxDescent;
int lineTop = heightOfBlock;
int lineBottom = heightOfBlock;
- placeBoxesVertically(heightOfBlock, maxHeight, maxAscent, noQuirksMode, lineTop, lineBottom);
- computeVerticalOverflow(lineTop, lineBottom, noQuirksMode, textBoxDataMap);
+ placeBoxesInBlockDirection(heightOfBlock, maxHeight, maxAscent, noQuirksMode, lineTop, lineBottom);
+ computeBlockDirectionOverflow(lineTop, lineBottom, noQuirksMode, textBoxDataMap);
setLineTopBottomPositions(lineTop, lineBottom);
heightOfBlock += maxHeight;
@@ -253,7 +264,7 @@ GapRects RootInlineBox::fillLineSelectionGap(int selTop, int selHeight, RenderBl
rootBlock, blockX, blockY, tx, ty, paintInfo));
if (rightGap)
result.uniteRight(block()->fillRightSelectionGap(lastBox->parent()->renderer(),
- lastBox->x() + lastBox->width(), selTop, selHeight,
+ lastBox->x() + lastBox->logicalWidth(), selTop, selHeight,
rootBlock, blockX, blockY, tx, ty, paintInfo));
// When dealing with bidi text, a non-contiguous selection region is possible.
@@ -265,7 +276,7 @@ GapRects RootInlineBox::fillLineSelectionGap(int selTop, int selHeight, RenderBl
// We can see that the |bbb| run is not part of the selection while the runs around it are.
if (firstBox && firstBox != lastBox) {
// Now fill in any gaps on the line that occurred between two selected elements.
- int lastX = firstBox->x() + firstBox->width();
+ int lastX = firstBox->x() + firstBox->logicalWidth();
bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject::SelectionNone;
for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLeafChild()) {
if (box->selectionState() != RenderObject::SelectionNone) {
@@ -273,7 +284,7 @@ GapRects RootInlineBox::fillLineSelectionGap(int selTop, int selHeight, RenderBl
result.uniteCenter(block()->fillHorizontalSelectionGap(box->parent()->renderer(),
lastX + tx, selTop + ty,
box->x() - lastX, selHeight, paintInfo));
- lastX = box->x() + box->width();
+ lastX = box->x() + box->logicalWidth();
}
if (box == lastBox)
break;
@@ -342,10 +353,10 @@ int RootInlineBox::selectionTop() const
// This line has actually been moved further down, probably from a large line-height, but possibly because the
// line was forced to clear floats. If so, let's check the offsets, and only be willing to use the previous
// line's bottom overflow if the offsets are greater on both sides.
- int prevLeft = block()->leftOffset(prevBottom, !prevRootBox());
- int prevRight = block()->rightOffset(prevBottom, !prevRootBox());
- int newLeft = block()->leftOffset(selectionTop, !prevRootBox());
- int newRight = block()->rightOffset(selectionTop, !prevRootBox());
+ int prevLeft = block()->logicalLeftOffsetForLine(prevBottom, !prevRootBox());
+ int prevRight = block()->logicalRightOffsetForLine(prevBottom, !prevRootBox());
+ int newLeft = block()->logicalLeftOffsetForLine(selectionTop, !prevRootBox());
+ int newRight = block()->logicalRightOffsetForLine(selectionTop, !prevRootBox());
if (prevLeft > newLeft || prevRight < newRight)
return selectionTop;
}
@@ -376,7 +387,7 @@ InlineBox* RootInlineBox::closestLeafChildForXPos(int x, bool onlyEditableLeaves
// Return it.
return firstLeaf;
- if (x >= lastLeaf->m_x + lastLeaf->m_width && !lastLeaf->renderer()->isListMarker() && (!onlyEditableLeaves || isEditableLeaf(lastLeaf)))
+ if (x >= lastLeaf->m_x + lastLeaf->m_logicalWidth && !lastLeaf->renderer()->isListMarker() && (!onlyEditableLeaves || isEditableLeaf(lastLeaf)))
// The x coordinate is greater or equal to right edge of the lastLeaf.
// Return it.
return lastLeaf;
@@ -385,7 +396,7 @@ InlineBox* RootInlineBox::closestLeafChildForXPos(int x, bool onlyEditableLeaves
for (InlineBox* leaf = firstLeaf; leaf; leaf = leaf->nextLeafChild()) {
if (!leaf->renderer()->isListMarker() && (!onlyEditableLeaves || isEditableLeaf(leaf))) {
closestLeaf = leaf;
- if (x < leaf->m_x + leaf->m_width)
+ if (x < leaf->m_x + leaf->m_logicalWidth)
// The x coordinate is less than the right edge of the box.
// Return it.
return leaf;
diff --git a/WebCore/rendering/RootInlineBox.h b/WebCore/rendering/RootInlineBox.h
index d97d0b1..8c75072 100644
--- a/WebCore/rendering/RootInlineBox.h
+++ b/WebCore/rendering/RootInlineBox.h
@@ -34,15 +34,7 @@ struct GapRects;
class RootInlineBox : public InlineFlowBox {
public:
- RootInlineBox(RenderObject* obj)
- : InlineFlowBox(obj)
- , m_lineBreakObj(0)
- , m_lineBreakPos(0)
- , m_lineTop(0)
- , m_lineBottom(0)
- , m_paginationStrut(0)
- {
- }
+ RootInlineBox(RenderBlock* block);
virtual void destroy(RenderArena*);
@@ -65,7 +57,7 @@ public:
int selectionBottom() const { return lineBottom(); }
int selectionHeight() const { return max(0, selectionBottom() - selectionTop()); }
- int verticallyAlignBoxes(int heightOfBlock, GlyphOverflowAndFallbackFontsMap&);
+ int alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAndFallbackFontsMap&);
void setLineTopBottomPositions(int top, int bottom);
virtual RenderLineBoxList* rendererLineBoxes() const;
diff --git a/WebCore/rendering/SVGInlineFlowBox.h b/WebCore/rendering/SVGInlineFlowBox.h
index ab26297..80600f7 100644
--- a/WebCore/rendering/SVGInlineFlowBox.h
+++ b/WebCore/rendering/SVGInlineFlowBox.h
@@ -33,12 +33,12 @@ class SVGInlineFlowBox : public InlineFlowBox {
public:
SVGInlineFlowBox(RenderObject* obj)
: InlineFlowBox(obj)
- , m_height(0)
+ , m_logicalHeight(0)
{
}
- virtual int virtualHeight() const { return m_height; }
- void setHeight(int h) { m_height = h; }
+ virtual int virtualLogicalHeight() const { return m_logicalHeight; }
+ void setLogicalHeight(int h) { m_logicalHeight = h; }
virtual void paint(PaintInfo&, int tx, int ty);
@@ -46,7 +46,7 @@ public:
void layoutFlowBox();
private:
- int m_height;
+ int m_logicalHeight;
};
} // namespace WebCore
diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp
index ccba5b4..c367598 100644
--- a/WebCore/rendering/SVGInlineTextBox.cpp
+++ b/WebCore/rendering/SVGInlineTextBox.cpp
@@ -40,7 +40,7 @@ namespace WebCore {
SVGInlineTextBox::SVGInlineTextBox(RenderObject* object)
: InlineTextBox(object)
- , m_height(0)
+ , m_logicalHeight(0)
, m_paintingResource(0)
, m_paintingResourceMode(ApplyToDefaultMode)
{
diff --git a/WebCore/rendering/SVGInlineTextBox.h b/WebCore/rendering/SVGInlineTextBox.h
index 7711db4..24957cf 100644
--- a/WebCore/rendering/SVGInlineTextBox.h
+++ b/WebCore/rendering/SVGInlineTextBox.h
@@ -42,11 +42,11 @@ public:
virtual bool isSVGInlineTextBox() const { return true; }
- virtual int virtualHeight() const { return m_height; }
- void setHeight(int height) { m_height = height; }
+ virtual int virtualLogicalHeight() const { return m_logicalHeight; }
+ void setLogicalHeight(int height) { m_logicalHeight = height; }
virtual int selectionTop() { return m_y; }
- virtual int selectionHeight() { return m_height; }
+ virtual int selectionHeight() { return m_logicalHeight; }
virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const;
virtual int positionForOffset(int offset) const;
@@ -91,7 +91,7 @@ private:
FloatRect selectionRectForTextChunkPart(const SVGTextChunkPart&, int partStartPos, int partEndPos, RenderStyle*);
private:
- int m_height;
+ int m_logicalHeight;
AffineTransform m_chunkTransformation;
Vector<SVGTextChunkPart> m_svgTextChunkParts;
mutable SVGTextChunkPart m_currentChunkPart;
diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp
index 20d7220..4e26f52 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.cpp
+++ b/WebCore/rendering/SVGRenderTreeAsText.cpp
@@ -124,24 +124,6 @@ static void writeIfNotDefault(TextStream& ts, const char* name, ValueType value,
writeNameValuePair(ts, name, value);
}
-TextStream& operator<<(TextStream& ts, const IntPoint& p)
-{
- return ts << "(" << p.x() << "," << p.y() << ")";
-}
-
-TextStream& operator<<(TextStream& ts, const IntRect& r)
-{
- return ts << "at (" << r.x() << "," << r.y() << ") size " << r.width() << "x" << r.height();
-}
-
-static bool hasFractions(double val)
-{
- double epsilon = 0.0001;
- int ival = static_cast<int>(val);
- double dval = static_cast<double>(ival);
- return fabs(val - dval) > epsilon;
-}
-
TextStream& operator<<(TextStream& ts, const FloatRect &r)
{
ts << "at (";
@@ -167,36 +149,6 @@ TextStream& operator<<(TextStream& ts, const FloatRect &r)
return ts;
}
-TextStream& operator<<(TextStream& ts, const FloatPoint& p)
-{
- ts << "(";
- if (hasFractions(p.x()))
- ts << p.x();
- else
- ts << int(p.x());
- ts << ",";
- if (hasFractions(p.y()))
- ts << p.y();
- else
- ts << int(p.y());
- return ts << ")";
-}
-
-TextStream& operator<<(TextStream& ts, const FloatSize& s)
-{
- ts << "width=";
- if (hasFractions(s.width()))
- ts << s.width();
- else
- ts << int(s.width());
- ts << " height=";
- if (hasFractions(s.height()))
- ts << s.height();
- else
- ts << int(s.height());
- return ts;
-}
-
TextStream& operator<<(TextStream& ts, const AffineTransform& transform)
{
if (transform.isIdentity())
@@ -440,7 +392,7 @@ static void writeRenderSVGTextBox(TextStream& ts, const RenderBlock& text)
return;
Vector<SVGTextChunk>& chunks = const_cast<Vector<SVGTextChunk>& >(box->svgTextChunks());
- ts << " at (" << text.x() << "," << text.y() << ") size " << box->width() << "x" << box->height() << " contains " << chunks.size() << " chunk(s)";
+ ts << " at (" << text.x() << "," << text.y() << ") size " << box->logicalWidth() << "x" << box->logicalHeight() << " contains " << chunks.size() << " chunk(s)";
if (text.parent() && (text.parent()->style()->visitedDependentColor(CSSPropertyColor) != text.style()->visitedDependentColor(CSSPropertyColor)))
writeNameValuePair(ts, "color", text.style()->visitedDependentColor(CSSPropertyColor).name());
diff --git a/WebCore/rendering/SVGRenderTreeAsText.h b/WebCore/rendering/SVGRenderTreeAsText.h
index d4aeaac..e279cfe 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.h
+++ b/WebCore/rendering/SVGRenderTreeAsText.h
@@ -33,11 +33,8 @@
namespace WebCore {
class Color;
- class FloatPoint;
class FloatRect;
class FloatSize;
- class IntPoint;
- class IntRect;
class Node;
class RenderBlock;
class RenderImage;
@@ -63,12 +60,8 @@ void writeResources(TextStream&, const RenderObject&, int indent);
// helper operators defined used in various classes to dump the render tree.
TextStream& operator<<(TextStream&, const AffineTransform&);
-TextStream& operator<<(TextStream&, const IntRect&);
TextStream& operator<<(TextStream&, const Color&);
-TextStream& operator<<(TextStream&, const IntPoint&);
-TextStream& operator<<(TextStream&, const FloatSize&);
TextStream& operator<<(TextStream&, const FloatRect&);
-TextStream& operator<<(TextStream&, const FloatPoint&);
// helper operators specific to dumping the render tree. these are used in various classes to dump the render tree
// these could be defined in separate namespace to avoid matching these generic signatures unintentionally.
@@ -88,21 +81,6 @@ TextStream& operator<<(TextStream& ts, const Vector<Item*>& v)
return ts;
}
-template<typename Item>
-TextStream& operator<<(TextStream& ts, const Vector<Item>& v)
-{
- ts << "[";
-
- for (unsigned i = 0; i < v.size(); i++) {
- ts << v[i];
- if (i < v.size() - 1)
- ts << ", ";
- }
-
- ts << "]";
- return ts;
-}
-
template<typename Pointer>
TextStream& operator<<(TextStream& ts, Pointer* t)
{
diff --git a/WebCore/rendering/SVGRootInlineBox.cpp b/WebCore/rendering/SVGRootInlineBox.cpp
index 6afdd99..715003f 100644
--- a/WebCore/rendering/SVGRootInlineBox.cpp
+++ b/WebCore/rendering/SVGRootInlineBox.cpp
@@ -196,8 +196,8 @@ void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start)
IntRect boxRect = textBox->calculateBoundaries();
textBox->setX(boxRect.x());
textBox->setY(boxRect.y());
- textBox->setWidth(boxRect.width());
- textBox->setHeight(boxRect.height());
+ textBox->setLogicalWidth(boxRect.width());
+ textBox->setLogicalHeight(boxRect.height());
} else {
ASSERT(child->isInlineFlowBox());
@@ -211,8 +211,8 @@ void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start)
IntRect boxRect = flowBox->calculateBoundaries();
flowBox->setX(boxRect.x());
flowBox->setY(boxRect.y());
- flowBox->setWidth(boxRect.width());
- flowBox->setHeight(boxRect.height());
+ flowBox->setLogicalWidth(boxRect.width());
+ flowBox->setLogicalHeight(boxRect.height());
}
}
}
@@ -251,8 +251,8 @@ void SVGRootInlineBox::layoutRootBox()
// Position ourselves.
setX(0);
setY(0);
- setWidth(widthBlock);
- setHeight(heightBlock);
+ setLogicalWidth(widthBlock);
+ setLogicalHeight(heightBlock);
setBlockHeight(heightBlock);
setLineTopBottomPositions(0, heightBlock);
}
diff --git a/WebCore/rendering/SVGRootInlineBox.h b/WebCore/rendering/SVGRootInlineBox.h
index 4e61190..77e7fcb 100644
--- a/WebCore/rendering/SVGRootInlineBox.h
+++ b/WebCore/rendering/SVGRootInlineBox.h
@@ -37,16 +37,16 @@ class SVGInlineTextBox;
class SVGRootInlineBox : public RootInlineBox {
public:
- SVGRootInlineBox(RenderObject* obj)
- : RootInlineBox(obj)
- , m_height(0)
+ SVGRootInlineBox(RenderBlock* block)
+ : RootInlineBox(block)
+ , m_logicalHeight(0)
{
}
virtual bool isSVGRootInlineBox() const { return true; }
- virtual int virtualHeight() const { return m_height; }
- void setHeight(int height) { m_height = height; }
+ virtual int virtualLogicalHeight() const { return m_logicalHeight; }
+ void setLogicalHeight(int height) { m_logicalHeight = height; }
virtual void paint(PaintInfo&, int tx, int ty);
@@ -66,7 +66,7 @@ private:
void layoutChildBoxes(InlineFlowBox* start);
private:
- int m_height;
+ int m_logicalHeight;
Vector<SVGChar> m_svgChars;
Vector<SVGTextChunk> m_svgTextChunks;
};
diff --git a/WebCore/rendering/TableLayout.h b/WebCore/rendering/TableLayout.h
index 10d6e26..e0fa8ee 100644
--- a/WebCore/rendering/TableLayout.h
+++ b/WebCore/rendering/TableLayout.h
@@ -36,7 +36,7 @@ public:
virtual ~TableLayout() { }
- virtual void calcPrefWidths(int& minWidth, int& maxWidth) = 0;
+ virtual void computePreferredLogicalWidths(int& minWidth, int& maxWidth) = 0;
virtual void layout() = 0;
protected:
diff --git a/WebCore/rendering/TrailingFloatsRootInlineBox.h b/WebCore/rendering/TrailingFloatsRootInlineBox.h
index 68bf637..6629857 100644
--- a/WebCore/rendering/TrailingFloatsRootInlineBox.h
+++ b/WebCore/rendering/TrailingFloatsRootInlineBox.h
@@ -32,15 +32,14 @@ namespace WebCore {
class TrailingFloatsRootInlineBox : public RootInlineBox {
public:
- TrailingFloatsRootInlineBox(RenderObject* object) : RootInlineBox(object)
+ TrailingFloatsRootInlineBox(RenderBlock* block)
+ : RootInlineBox(block)
{
-#if ENABLE(SVG)
- setHasVirtualHeight();
-#endif
+ setHasVirtualLogicalHeight();
}
private:
- virtual int virtualHeight() const { return 0; }
+ virtual int virtualLogicalHeight() const { return 0; }
};
} // namespace WebCore
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp
index 4b77d6b..623a298 100644
--- a/WebCore/rendering/style/RenderStyle.cpp
+++ b/WebCore/rendering/style/RenderStyle.cpp
@@ -323,8 +323,8 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) {
if (rareNonInheritedData->m_appearance != other->rareNonInheritedData->m_appearance ||
- rareNonInheritedData->marginTopCollapse != other->rareNonInheritedData->marginTopCollapse ||
- rareNonInheritedData->marginBottomCollapse != other->rareNonInheritedData->marginBottomCollapse ||
+ rareNonInheritedData->marginBeforeCollapse != other->rareNonInheritedData->marginBeforeCollapse ||
+ rareNonInheritedData->marginAfterCollapse != other->rareNonInheritedData->marginAfterCollapse ||
rareNonInheritedData->lineClamp != other->rareNonInheritedData->lineClamp ||
rareNonInheritedData->textOverflow != other->rareNonInheritedData->textOverflow)
return StyleDifferenceLayout;
@@ -789,7 +789,7 @@ CounterDirectiveMap& RenderStyle::accessCounterDirectives()
const AtomicString& RenderStyle::hyphenString() const
{
- ASSERT(hyphens() == HyphensAuto);
+ ASSERT(hyphens() != HyphensNone);
const AtomicString& hyphenationString = rareInheritedData.get()->hyphenationString;
if (!hyphenationString.isNull())
@@ -1184,6 +1184,38 @@ Length RenderStyle::marginAfter() const
return marginBottom();
}
+Length RenderStyle::marginBeforeUsing(const RenderStyle* otherStyle) const
+{
+ switch (otherStyle->blockFlow()) {
+ case TopToBottomBlockFlow:
+ return marginTop();
+ case BottomToTopBlockFlow:
+ return marginBottom();
+ case LeftToRightBlockFlow:
+ return marginLeft();
+ case RightToLeftBlockFlow:
+ return marginRight();
+ }
+ ASSERT_NOT_REACHED();
+ return marginTop();
+}
+
+Length RenderStyle::marginAfterUsing(const RenderStyle* otherStyle) const
+{
+ switch (otherStyle->blockFlow()) {
+ case TopToBottomBlockFlow:
+ return marginBottom();
+ case BottomToTopBlockFlow:
+ return marginTop();
+ case LeftToRightBlockFlow:
+ return marginRight();
+ case RightToLeftBlockFlow:
+ return marginLeft();
+ }
+ ASSERT_NOT_REACHED();
+ return marginBottom();
+}
+
Length RenderStyle::marginStart() const
{
if (isVerticalBlockFlow())
@@ -1198,6 +1230,20 @@ Length RenderStyle::marginEnd() const
return direction() == LTR ? marginBottom() : marginTop();
}
+Length RenderStyle::marginStartUsing(const RenderStyle* otherStyle) const
+{
+ if (otherStyle->isVerticalBlockFlow())
+ return otherStyle->direction() == LTR ? marginLeft() : marginRight();
+ return otherStyle->direction() == LTR ? marginTop() : marginBottom();
+}
+
+Length RenderStyle::marginEndUsing(const RenderStyle* otherStyle) const
+{
+ if (otherStyle->isVerticalBlockFlow())
+ return otherStyle->direction() == LTR ? marginRight() : marginLeft();
+ return otherStyle->direction() == LTR ? marginBottom() : marginTop();
+}
+
Length RenderStyle::paddingBefore() const
{
switch (blockFlow()) {
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index e6e6318..6ecbd56 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -598,6 +598,10 @@ public:
Length marginAfter() const;
Length marginStart() const;
Length marginEnd() const;
+ Length marginStartUsing(const RenderStyle* otherStyle) const;
+ Length marginEndUsing(const RenderStyle* otherStyle) const;
+ Length marginBeforeUsing(const RenderStyle* otherStyle) const;
+ Length marginAfterUsing(const RenderStyle* otherStyle) const;
LengthBox paddingBox() const { return surround->padding; }
Length paddingTop() const { return surround->padding.top(); }
@@ -661,8 +665,8 @@ public:
EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); }
EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); }
bool textOverflow() const { return rareNonInheritedData->textOverflow; }
- EMarginCollapse marginTopCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginTopCollapse); }
- EMarginCollapse marginBottomCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBottomCollapse); }
+ EMarginCollapse marginBeforeCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBeforeCollapse); }
+ EMarginCollapse marginAfterCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginAfterCollapse); }
EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); }
EWordWrap wordWrap() const { return static_cast<EWordWrap>(rareInheritedData->wordWrap); }
ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(rareInheritedData->nbspMode); }
@@ -1018,8 +1022,8 @@ public:
void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); }
void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); }
void setTextOverflow(bool b) { SET_VAR(rareNonInheritedData, textOverflow, b); }
- void setMarginTopCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginTopCollapse, c); }
- void setMarginBottomCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBottomCollapse, c); }
+ void setMarginBeforeCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBeforeCollapse, c); }
+ void setMarginAfterCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginAfterCollapse, c); }
void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); }
void setWordWrap(EWordWrap b) { SET_VAR(rareInheritedData, wordWrap, b); }
void setNBSPMode(ENBSPMode b) { SET_VAR(rareInheritedData, nbspMode, b); }
@@ -1250,8 +1254,8 @@ public:
static EUserDrag initialUserDrag() { return DRAG_AUTO; }
static EUserSelect initialUserSelect() { return SELECT_TEXT; }
static bool initialTextOverflow() { return false; }
- static EMarginCollapse initialMarginTopCollapse() { return MCOLLAPSE; }
- static EMarginCollapse initialMarginBottomCollapse() { return MCOLLAPSE; }
+ static EMarginCollapse initialMarginBeforeCollapse() { return MCOLLAPSE; }
+ static EMarginCollapse initialMarginAfterCollapse() { return MCOLLAPSE; }
static EWordBreak initialWordBreak() { return NormalWordBreak; }
static EWordWrap initialWordWrap() { return NormalWordWrap; }
static ENBSPMode initialNBSPMode() { return NBNORMAL; }
diff --git a/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/WebCore/rendering/style/StyleRareNonInheritedData.cpp
index e293984..e0f7f7a 100644
--- a/WebCore/rendering/style/StyleRareNonInheritedData.cpp
+++ b/WebCore/rendering/style/StyleRareNonInheritedData.cpp
@@ -37,8 +37,8 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
, m_counterDirectives(0)
, userDrag(RenderStyle::initialUserDrag())
, textOverflow(RenderStyle::initialTextOverflow())
- , marginTopCollapse(MCOLLAPSE)
- , marginBottomCollapse(MCOLLAPSE)
+ , marginBeforeCollapse(MCOLLAPSE)
+ , marginAfterCollapse(MCOLLAPSE)
, matchNearestMailBlockquoteColor(RenderStyle::initialMatchNearestMailBlockquoteColor())
, m_appearance(RenderStyle::initialAppearance())
, m_borderFit(RenderStyle::initialBorderFit())
@@ -73,8 +73,8 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
, m_counterDirectives(0)
, userDrag(o.userDrag)
, textOverflow(o.textOverflow)
- , marginTopCollapse(o.marginTopCollapse)
- , marginBottomCollapse(o.marginBottomCollapse)
+ , marginBeforeCollapse(o.marginBeforeCollapse)
+ , marginAfterCollapse(o.marginAfterCollapse)
, matchNearestMailBlockquoteColor(o.matchNearestMailBlockquoteColor)
, m_appearance(o.m_appearance)
, m_borderFit(o.m_borderFit)
@@ -118,8 +118,8 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& m_counterDirectives == o.m_counterDirectives
&& userDrag == o.userDrag
&& textOverflow == o.textOverflow
- && marginTopCollapse == o.marginTopCollapse
- && marginBottomCollapse == o.marginBottomCollapse
+ && marginBeforeCollapse == o.marginBeforeCollapse
+ && marginAfterCollapse == o.marginAfterCollapse
&& matchNearestMailBlockquoteColor == o.matchNearestMailBlockquoteColor
&& m_appearance == o.m_appearance
&& m_borderFit == o.m_borderFit
diff --git a/WebCore/rendering/style/StyleRareNonInheritedData.h b/WebCore/rendering/style/StyleRareNonInheritedData.h
index 6003ea4..3f693f9 100644
--- a/WebCore/rendering/style/StyleRareNonInheritedData.h
+++ b/WebCore/rendering/style/StyleRareNonInheritedData.h
@@ -98,8 +98,8 @@ public:
unsigned userDrag : 2; // EUserDrag
bool textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
- unsigned marginTopCollapse : 2; // EMarginCollapse
- unsigned marginBottomCollapse : 2; // EMarginCollapse
+ unsigned marginBeforeCollapse : 2; // EMarginCollapse
+ unsigned marginAfterCollapse : 2; // EMarginCollapse
unsigned matchNearestMailBlockquoteColor : 1; // EMatchNearestMailBlockquoteColor, FIXME: This property needs to be eliminated. It should never have been added.
unsigned m_appearance : 6; // EAppearance
unsigned m_borderFit : 1; // EBorderFit