Diff
Modified: trunk/Source/WebCore/ChangeLog (113221 => 113222)
--- trunk/Source/WebCore/ChangeLog 2012-04-04 18:54:38 UTC (rev 113221)
+++ trunk/Source/WebCore/ChangeLog 2012-04-04 19:04:15 UTC (rev 113222)
@@ -1,5 +1,56 @@
2012-04-04 Emil A Eklund <e...@chromium.org>
+ Fix types for location, size and rect calculations for render objects
+ https://bugs.webkit.org/show_bug.cgi?id=83089
+
+ Reviewed by Eric Seidel.
+
+ Fix usage of LayoutUnits and rounding for a couple of different render
+ object classes.
+
+ No new tests, no change in functionality.
+
+ * rendering/RenderDetailsMarker.cpp:
+ (WebCore::RenderDetailsMarker::getPath):
+ Change getPath to take a LayoutPoint as the transform has subpixel
+ precision already.
+
+ * rendering/RenderFlowThread.cpp:
+ (WebCore::RenderFlowThread::computeLogicalHeight):
+ Change logicalHeight to LayoutUnit as it is computed from subpixel
+ values.
+
+ * rendering/RenderInputSpeech.cpp:
+ (WebCore::RenderInputSpeech::paintInputFieldSpeechButton):
+ Change button rect computation to LayoutRect and pixel snap just before
+ painting to preserve precision.
+
+ * rendering/RenderLineBoxList.cpp:
+ (WebCore::RenderLineBoxList::rangeIntersectsRect):
+ (WebCore::RenderLineBoxList::lineIntersectsDirtyRect):
+ (WebCore::RenderLineBoxList::paint):
+ Change range calculations to LayoutUnits to preserve precision.
+
+ * rendering/RenderMarquee.cpp:
+ (WebCore::RenderMarquee::computePosition):
+ Change width calculations to LayoutUnits to preserve precision.
+
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::layoutCaption):
+ Change table captions to LayoutUnits as the values are computed from
+ subpixel componenets.
+
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::getRoundedBorderFor):
+ Snap border rect as RoundedRects use ints for crisp rendering.
+
+ * rendering/style/ShadowData.cpp:
+ (WebCore::ShadowData::adjustRectForShadow):
+ Change adjustRectForShadow to take a LayoutRect as it already uses
+ LayoutUnits.
+
+2012-04-04 Emil A Eklund <e...@chromium.org>
+
Convert RootInlineBox to LayoutUnits in preparation for turning on subpixel layout
https://bugs.webkit.org/show_bug.cgi?id=83054
Modified: trunk/Source/WebCore/rendering/RenderDetailsMarker.cpp (113221 => 113222)
--- trunk/Source/WebCore/rendering/RenderDetailsMarker.cpp 2012-04-04 18:54:38 UTC (rev 113221)
+++ trunk/Source/WebCore/rendering/RenderDetailsMarker.cpp 2012-04-04 19:04:15 UTC (rev 113222)
@@ -105,7 +105,7 @@
return Path();
}
-Path RenderDetailsMarker::getPath(const IntPoint& origin) const
+Path RenderDetailsMarker::getPath(const LayoutPoint& origin) const
{
Path result = getCanonicalPath();
result.transform(AffineTransform().scale(logicalHeight()));
Modified: trunk/Source/WebCore/rendering/RenderDetailsMarker.h (113221 => 113222)
--- trunk/Source/WebCore/rendering/RenderDetailsMarker.h 2012-04-04 18:54:38 UTC (rev 113221)
+++ trunk/Source/WebCore/rendering/RenderDetailsMarker.h 2012-04-04 19:04:15 UTC (rev 113222)
@@ -42,7 +42,7 @@
bool isOpen() const;
Path getCanonicalPath() const;
- Path getPath(const IntPoint& origin) const;
+ Path getPath(const LayoutPoint& origin) const;
};
inline RenderDetailsMarker* toRenderDetailsMarker(RenderObject* object)
Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (113221 => 113222)
--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp 2012-04-04 18:54:38 UTC (rev 113221)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp 2012-04-04 19:04:15 UTC (rev 113222)
@@ -254,7 +254,7 @@
void RenderFlowThread::computeLogicalHeight()
{
- int logicalHeight = 0;
+ LayoutUnit logicalHeight = 0;
for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
Modified: trunk/Source/WebCore/rendering/RenderInputSpeech.cpp (113221 => 113222)
--- trunk/Source/WebCore/rendering/RenderInputSpeech.cpp 2012-04-04 18:54:38 UTC (rev 113221)
+++ trunk/Source/WebCore/rendering/RenderInputSpeech.cpp 2012-04-04 19:04:15 UTC (rev 113222)
@@ -66,19 +66,19 @@
if (!input->renderer()->isBox())
return false;
RenderBox* inputRenderBox = toRenderBox(input->renderer());
- IntRect inputContentBox = inputRenderBox->contentBoxRect();
+ LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
// Make sure the scaled button stays square and will fit in its parent's box.
- int buttonSize = std::min(inputContentBox.width(), std::min(inputContentBox.height(), rect.height()));
+ LayoutUnit buttonSize = std::min(inputContentBox.width(), std::min<LayoutUnit>(inputContentBox.height(), rect.height()));
// Calculate button's coordinates relative to the input element.
// Center the button vertically. Round up though, so if it has to be one pixel off-center, it will
// be one pixel closer to the bottom of the field. This tends to look better with the text.
- IntRect buttonRect(object->offsetFromAncestorContainer(inputRenderBox).width(),
- inputContentBox.y() + (inputContentBox.height() - buttonSize + 1) / 2,
- buttonSize, buttonSize);
+ LayoutRect buttonRect(object->offsetFromAncestorContainer(inputRenderBox).width(),
+ inputContentBox.y() + (inputContentBox.height() - buttonSize + 1) / 2,
+ buttonSize, buttonSize);
// Compute an offset between the part renderer and the input renderer.
- IntSize offsetFromInputRenderer = -(object->offsetFromAncestorContainer(inputRenderBox));
+ LayoutSize offsetFromInputRenderer = -(object->offsetFromAncestorContainer(inputRenderBox));
// Move the rect into partRenderer's coords.
buttonRect.move(offsetFromInputRenderer);
// Account for the local drawing offset.
@@ -94,7 +94,7 @@
image = imageStateRecording.get();
else if (speechButton->state() == InputFieldSpeechButtonElement::Recognizing)
image = imageStateWaiting.get();
- paintInfo.context->drawImage(image, object->style()->colorSpace(), buttonRect);
+ paintInfo.context->drawImage(image, object->style()->colorSpace(), pixelSnappedIntRect(buttonRect));
return false;
}
Modified: trunk/Source/WebCore/rendering/RenderLineBoxList.cpp (113221 => 113222)
--- trunk/Source/WebCore/rendering/RenderLineBoxList.cpp 2012-04-04 18:54:38 UTC (rev 113221)
+++ trunk/Source/WebCore/rendering/RenderLineBoxList.cpp 2012-04-04 19:04:15 UTC (rev 113222)
@@ -146,16 +146,16 @@
curr->dirtyLineBoxes();
}
-bool RenderLineBoxList::rangeIntersectsRect(RenderBoxModelObject* renderer, int logicalTop, int logicalBottom, const IntRect& rect, const IntPoint& offset) const
+bool RenderLineBoxList::rangeIntersectsRect(RenderBoxModelObject* renderer, LayoutUnit logicalTop, LayoutUnit logicalBottom, const LayoutRect& rect, const LayoutPoint& offset) const
{
RenderBox* block;
if (renderer->isBox())
block = toRenderBox(renderer);
else
block = renderer->containingBlock();
- int physicalStart = block->flipForWritingMode(logicalTop);
- int physicalEnd = block->flipForWritingMode(logicalBottom);
- int physicalExtent = abs(physicalEnd - physicalStart);
+ LayoutUnit physicalStart = block->flipForWritingMode(logicalTop);
+ LayoutUnit physicalEnd = block->flipForWritingMode(logicalBottom);
+ LayoutUnit physicalExtent = abs(physicalEnd - physicalStart);
physicalStart = min(physicalStart, physicalEnd);
if (renderer->style()->isHorizontalWritingMode()) {
@@ -191,11 +191,11 @@
return rangeIntersectsRect(renderer, logicalTop, logicalBottom, rect, offset);
}
-bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, const PaintInfo& paintInfo, const IntPoint& offset) const
+bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const
{
RootInlineBox* root = box->root();
- int logicalTop = min(box->logicalTopVisualOverflow(root->lineTop()), root->selectionTop()) - renderer->maximalOutlineSize(paintInfo.phase);
- int logicalBottom = box->logicalBottomVisualOverflow(root->lineBottom()) + renderer->maximalOutlineSize(paintInfo.phase);
+ LayoutUnit logicalTop = min<LayoutUnit>(box->logicalTopVisualOverflow(root->lineTop()), root->selectionTop()) - renderer->maximalOutlineSize(paintInfo.phase);
+ LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root->lineBottom()) + renderer->maximalOutlineSize(paintInfo.phase);
return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.rect, offset);
}
@@ -245,7 +245,7 @@
if (bottomForPaginationCheck - topForPaginationCheck <= v->printRect().height()) {
if (paintOffset.y() + bottomForPaginationCheck > v->printRect().maxY()) {
if (RootInlineBox* nextRootBox = curr->root()->nextRootBox())
- bottomForPaginationCheck = min(bottomForPaginationCheck, min(nextRootBox->logicalTopVisualOverflow(), nextRootBox->lineTop()));
+ bottomForPaginationCheck = min(bottomForPaginationCheck, min<LayoutUnit>(nextRootBox->logicalTopVisualOverflow(), nextRootBox->lineTop()));
}
if (paintOffset.y() + bottomForPaginationCheck > v->printRect().maxY()) {
if (paintOffset.y() + topForPaginationCheck < v->truncatedAt())
Modified: trunk/Source/WebCore/rendering/RenderMarquee.cpp (113221 => 113222)
--- trunk/Source/WebCore/rendering/RenderMarquee.cpp 2012-04-04 18:54:38 UTC (rev 113221)
+++ trunk/Source/WebCore/rendering/RenderMarquee.cpp 2012-04-04 19:04:15 UTC (rev 113222)
@@ -115,8 +115,8 @@
RenderStyle* s = box->style();
if (isHorizontal()) {
bool ltr = s->isLeftToRightDirection();
- int clientWidth = box->clientWidth();
- int contentWidth = ltr ? box->maxPreferredLogicalWidth() : box->minPreferredLogicalWidth();
+ LayoutUnit clientWidth = box->clientWidth();
+ LayoutUnit contentWidth = ltr ? box->maxPreferredLogicalWidth() : box->minPreferredLogicalWidth();
if (ltr)
contentWidth += (box->paddingRight() - box->borderLeft());
else {
Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (113221 => 113222)
--- trunk/Source/WebCore/rendering/RenderTable.cpp 2012-04-04 18:54:38 UTC (rev 113221)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp 2012-04-04 19:04:15 UTC (rev 113222)
@@ -282,17 +282,17 @@
void RenderTable::layoutCaption(RenderTableCaption* caption)
{
- IntRect captionRect(caption->x(), caption->y(), caption->width(), caption->height());
+ LayoutRect captionRect(caption->frameRect());
if (caption->needsLayout()) {
// The margins may not be available but ensure the caption is at least located beneath any previous sibling caption
// so that it does not mistakenly think any floats in the previous caption intrude into it.
- caption->setLogicalLocation(IntPoint(caption->marginStart(), caption->marginBefore() + logicalHeight()));
+ caption->setLogicalLocation(LayoutPoint(caption->marginStart(), caption->marginBefore() + logicalHeight()));
// If RenderTableCaption ever gets a layout() function, use it here.
caption->layoutIfNeeded();
}
// Apply the margins to the location now that they are definitely available from layout
- caption->setLogicalLocation(IntPoint(caption->marginStart(), caption->marginBefore() + logicalHeight()));
+ caption->setLogicalLocation(LayoutPoint(caption->marginStart(), caption->marginBefore() + logicalHeight()));
if (!selfNeedsLayout() && caption->checkForRepaintDuringLayout())
caption->repaintDuringLayoutIfMoved(captionRect);
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (113221 => 113222)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2012-04-04 18:54:38 UTC (rev 113221)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2012-04-04 19:04:15 UTC (rev 113222)
@@ -930,7 +930,7 @@
RoundedRect roundedRect(pixelSnappedIntRect(borderRect));
if (hasBorderRadius()) {
RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size(), renderView);
- radii.scale(calcConstraintScaleFor(borderRect, radii));
+ radii.scale(calcConstraintScaleFor(pixelSnappedIntRect(borderRect), radii));
roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
}
return roundedRect;
Modified: trunk/Source/WebCore/rendering/style/ShadowData.cpp (113221 => 113222)
--- trunk/Source/WebCore/rendering/style/ShadowData.cpp 2012-04-04 18:54:38 UTC (rev 113221)
+++ trunk/Source/WebCore/rendering/style/ShadowData.cpp 2012-04-04 19:04:15 UTC (rev 113222)
@@ -68,7 +68,7 @@
} while (shadow);
}
-void ShadowData::adjustRectForShadow(IntRect& rect, int additionalOutlineSize) const
+void ShadowData::adjustRectForShadow(LayoutRect& rect, int additionalOutlineSize) const
{
LayoutUnit shadowLeft = 0;
LayoutUnit shadowRight = 0;
Modified: trunk/Source/WebCore/rendering/style/ShadowData.h (113221 => 113222)
--- trunk/Source/WebCore/rendering/style/ShadowData.h 2012-04-04 18:54:38 UTC (rev 113221)
+++ trunk/Source/WebCore/rendering/style/ShadowData.h 2012-04-04 19:04:15 UTC (rev 113222)
@@ -79,7 +79,7 @@
const ShadowData* next() const { return m_next.get(); }
void setNext(PassOwnPtr<ShadowData> shadow) { m_next = shadow; }
- void adjustRectForShadow(IntRect&, int additionalOutlineSize = 0) const;
+ void adjustRectForShadow(LayoutRect&, int additionalOutlineSize = 0) const;
void adjustRectForShadow(FloatRect&, int additionalOutlineSize = 0) const;
private: