Diff
Modified: branches/subpixellayout/Source/WebCore/rendering/InlineFlowBox.cpp (98400 => 98401)
--- branches/subpixellayout/Source/WebCore/rendering/InlineFlowBox.cpp 2011-10-25 22:45:48 UTC (rev 98400)
+++ branches/subpixellayout/Source/WebCore/rendering/InlineFlowBox.cpp 2011-10-25 22:51:34 UTC (rev 98401)
@@ -576,12 +576,12 @@
void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHeight, LayoutUnit maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, bool& setLineTop,
LayoutUnit& lineTopIncludingMargins, LayoutUnit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasAnnotationsAfter, FontBaseline baselineType)
{
- // We need to use an integer top for positioning inline boxes because we can't round in painting in the inline box tree
- int roundedTop = top.round();
+ // We need to snap the top to pixel bounds for positioning inline boxes because we can't round in painting in the inline box tree
+ LayoutUnit pixelSnappedTop = top.round();
bool isRootBox = isRootInlineBox();
if (isRootBox) {
const FontMetrics& fontMetrics = renderer()->style(m_firstLine)->fontMetrics();
- setLogicalTop(roundedTop + maxAscent - fontMetrics.ascent(baselineType));
+ setLogicalTop(pixelSnappedTop + maxAscent - fontMetrics.ascent(baselineType));
}
LayoutUnit adjustmentForChildrenWithSameLineHeightAndBaseline = 0;
@@ -603,15 +603,15 @@
InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox(curr) : 0;
bool childAffectsTopBottomPos = true;
if (curr->verticalAlign() == TOP)
- curr->setLogicalTop(roundedTop);
+ curr->setLogicalTop(pixelSnappedTop);
else if (curr->verticalAlign() == BOTTOM)
- curr->setLogicalTop(roundedTop + maxHeight - curr->lineHeight());
+ curr->setLogicalTop(pixelSnappedTop + maxHeight - curr->lineHeight());
else {
if (!strictMode && inlineFlowBox && !inlineFlowBox->hasTextChildren() && !curr->boxModelObject()->hasInlineDirectionBordersOrPadding()
&& !(inlineFlowBox->descendantsHaveSameLineHeightAndBaseline() && inlineFlowBox->hasTextDescendants()))
childAffectsTopBottomPos = false;
LayoutUnit posAdjust = maxAscent - curr->baselinePosition(baselineType);
- curr->setLogicalTop(curr->logicalTop() + roundedTop + posAdjust);
+ curr->setLogicalTop(curr->logicalTop() + pixelSnappedTop + posAdjust);
}
LayoutUnit newLogicalTop = curr->logicalTop();
@@ -683,7 +683,7 @@
// Adjust boxes to use their real box y/height and not the logical height (as dictated by
// line-height).
if (inlineFlowBox)
- inlineFlowBox->placeBoxesInBlockDirection(roundedTop, maxHeight, maxAscent, strictMode, lineTop, lineBottom, setLineTop,
+ inlineFlowBox->placeBoxesInBlockDirection(pixelSnappedTop, maxHeight, maxAscent, strictMode, lineTop, lineBottom, setLineTop,
lineTopIncludingMargins, lineBottomIncludingMargins, hasAnnotationsBefore, hasAnnotationsAfter, baselineType);
}
Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp (98400 => 98401)
--- branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp 2011-10-25 22:45:48 UTC (rev 98400)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp 2011-10-25 22:51:34 UTC (rev 98401)
@@ -3570,18 +3570,18 @@
const FloatingObject* r = interval.data();
if (r->type() == FloatTypeValue && interval.low() <= m_value && m_value < interval.high()) {
// All the objects returned from the tree should be already placed.
- ASSERT(r->isPlaced() && m_renderer->logicalTopForFloat(r).round() <= m_value && m_renderer->logicalBottomForFloat(r).round() > m_value);
+ ASSERT(r->isPlaced() && m_renderer->pixelSnappedLogicalTopForFloat(r) <= m_value && m_renderer->pixelSnappedLogicalBottomForFloat(r) > m_value);
if (FloatTypeValue == FloatingObject::FloatLeft
- && m_renderer->logicalRightForFloat(r).round() > m_offset) {
- m_offset = m_renderer->logicalRightForFloat(r).round();
+ && m_renderer->pixelSnappedLogicalRightForFloat(r) > m_offset) {
+ m_offset = m_renderer->pixelSnappedLogicalRightForFloat(r);
if (m_heightRemaining)
*m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_value;
}
if (FloatTypeValue == FloatingObject::FloatRight
- && m_renderer->logicalLeftForFloat(r).round() < m_offset) {
- m_offset = m_renderer->logicalLeftForFloat(r).round();
+ && m_renderer->pixelSnappedLogicalRightForFloat(r) < m_offset) {
+ m_offset = m_renderer->pixelSnappedLogicalLeftForFloat(r);
if (m_heightRemaining)
*m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_value;
}
@@ -3640,7 +3640,7 @@
*heightRemaining = 1;
LayoutUnit rightFloatOffset = fixedOffset;
- FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, logicalTop.round(), rightFloatOffset, heightRemaining);
+ FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, logicalTop, rightFloatOffset, heightRemaining);
m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter);
right = min(right, rightFloatOffset);
}
@@ -6802,8 +6802,8 @@
inline RenderBlock::FloatingObjectInterval RenderBlock::FloatingObjects::intervalForFloatingObject(FloatingObject* floatingObject)
{
if (m_horizontalWritingMode)
- return RenderBlock::FloatingObjectInterval(floatingObject->y().round(), floatingObject->maxY().round(), floatingObject);
- return RenderBlock::FloatingObjectInterval(floatingObject->x().round(), floatingObject->maxX().round(), floatingObject);
+ return RenderBlock::FloatingObjectInterval(floatingObject->pixelSnappedY(), floatingObject->pixelSnappedMaxY(), floatingObject);
+ return RenderBlock::FloatingObjectInterval(floatingObject->pixelSnappedX(), floatingObject->pixelSnappedMaxX(), floatingObject);
}
void RenderBlock::FloatingObjects::addPlacedObject(FloatingObject* floatingObject)
Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBlock.h (98400 => 98401)
--- branches/subpixellayout/Source/WebCore/rendering/RenderBlock.h 2011-10-25 22:45:48 UTC (rev 98400)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBlock.h 2011-10-25 22:51:34 UTC (rev 98401)
@@ -163,6 +163,15 @@
return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine)
: logicalWidth() - logicalRightOffsetForLine(position, firstLine);
}
+
+ int pixelSnappedLogicalRightOffsetForLine(LayoutUnit position, bool firstLine) const
+ {
+ return logicalRightOffsetForLine(position, logicalRightOffsetForContent(position), firstLine, 0).round();
+ }
+ int pixelSnappedLogicalLeftOffsetForLine(LayoutUnit position, bool firstLine) const
+ {
+ return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), firstLine, 0).round();
+ }
LayoutUnit startAlignedOffsetForLine(RenderBox* child, LayoutUnit position, bool firstLine);
LayoutUnit textIndentOffset() const;
@@ -541,6 +550,13 @@
LayoutUnit width() const { return m_frameRect.width(); }
LayoutUnit height() const { return m_frameRect.height(); }
+ int pixelSnappedX() const { return x().round(); }
+ int pixelSnappedMaxX() const { return maxX().round(); }
+ int pixelSnappedY() const { return y().round(); }
+ int pixelSnappedMaxY() const { return maxY().round(); }
+ int pixelSnappedWidth() const { return width().round(); }
+ int pixelSnappedHeight() const { return height().round(); }
+
void setX(LayoutUnit x) { ASSERT(!isInPlacedTree()); m_frameRect.setX(x); }
void setY(LayoutUnit y) { ASSERT(!isInPlacedTree()); m_frameRect.setY(y); }
void setWidth(LayoutUnit width) { ASSERT(!isInPlacedTree()); m_frameRect.setWidth(width); }
@@ -574,6 +590,12 @@
LayoutUnit logicalLeftForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->x() : child->y(); }
LayoutUnit logicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxX() : child->maxY(); }
LayoutUnit logicalWidthForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->width() : child->height(); }
+
+ int pixelSnappedLogicalTopForFloat(const FloatingObject* child) const { return logicalTopForFloat(child).round(); }
+ int pixelSnappedLogicalBottomForFloat(const FloatingObject* child) const { return logicalBottomForFloat(child).round(); }
+ int pixelSnappedLogicalLeftForFloat(const FloatingObject* child) const { return logicalLeftForFloat(child).round(); }
+ int pixelSnappedLogicalRightForFloat(const FloatingObject* child) const { return logicalRightForFloat(child).round(); }
+ int pixelSnappedLogicalWidthForFloat(const FloatingObject* child) const { return logicalWidthForFloat(child).round(); }
void setLogicalTopForFloat(FloatingObject* child, LayoutUnit logicalTop)
{
if (isHorizontalWritingMode())
@@ -931,6 +953,14 @@
{
}
+ FloatIntervalSearchAdapter(const RenderBlock* renderer, LayoutUnit value, LayoutUnit& offset, LayoutUnit* heightRemaining)
+ : m_renderer(renderer)
+ , m_value(value.round())
+ , m_offset(offset)
+ , m_heightRemaining(heightRemaining)
+ {
+ }
+
inline int lowValue() const { return m_value; }
inline int highValue() const { return m_value; }
void collectIfNeeded(const IntervalType&) const;
Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBlockLineLayout.cpp (98400 => 98401)
--- branches/subpixellayout/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2011-10-25 22:45:48 UTC (rev 98400)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2011-10-25 22:51:34 UTC (rev 98401)
@@ -750,8 +750,8 @@
GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache)
{
ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWithBreak());
- float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), lineInfo.isFirstLine()).round();
- float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), lineInfo.isFirstLine()).round() - logicalLeft;
+ float logicalLeft = pixelSnappedLogicalLeftOffsetForLine(logicalHeight(), lineInfo.isFirstLine());
+ float availableLogicalWidth = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), lineInfo.isFirstLine()) - logicalLeft;
bool needsWordSpacing = false;
float totalLogicalWidth = lineBox->getFlowSpacingLogicalWidth();
Modified: branches/subpixellayout/Source/WebKit/mac/WebView/WebView.mm (98400 => 98401)
--- branches/subpixellayout/Source/WebKit/mac/WebView/WebView.mm 2011-10-25 22:45:48 UTC (rev 98400)
+++ branches/subpixellayout/Source/WebKit/mac/WebView/WebView.mm 2011-10-25 22:51:34 UTC (rev 98401)
@@ -2448,7 +2448,7 @@
if (!view || !view->isTrackingRepaints())
return nil;
- const Vector<IntRect>& repaintRects = view->trackedRepaintRects();
+ const Vector<WebCore::FixedRect>& repaintRects = view->trackedRepaintRects();
NSMutableArray* rectsArray = [[NSMutableArray alloc] initWithCapacity:repaintRects.size()];
for (unsigned i = 0; i < repaintRects.size(); ++i)
Modified: branches/subpixellayout/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp (98400 => 98401)
--- branches/subpixellayout/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp 2011-10-25 22:45:48 UTC (rev 98400)
+++ branches/subpixellayout/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp 2011-10-25 22:51:34 UTC (rev 98401)
@@ -303,7 +303,7 @@
{
GraphicsContextStateSaver stateSaver(*graphicsContext);
IntRect scrollbarDirtyRect = dirtyRect;
- scrollbarDirtyRect.moveBy(pluginView()->frameRect().location());
+ scrollbarDirtyRect.moveBy(roundedIntPoint(pluginView()->frameRect().location()));
graphicsContext->translate(-pluginView()->frameRect().x(), -pluginView()->frameRect().y());
if (m_horizontalScrollbar)
@@ -313,7 +313,7 @@
m_verticalScrollbar->paint(graphicsContext, scrollbarDirtyRect);
}
- IntRect dirtyCornerRect = intersection(scrollCornerRect(), dirtyRect);
+ IntRect dirtyCornerRect = intersection(enclosingIntRect(scrollCornerRect()), dirtyRect);
ScrollbarTheme::theme()->paintScrollCorner(0, graphicsContext, dirtyCornerRect);
}
@@ -664,10 +664,10 @@
IntPoint BuiltInPDFView::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
{
- IntPoint point = pluginView()->frame()->view()->convertToRenderer(pluginView()->renderer(), parentPoint);
+ WebCore::FixedPoint point = pluginView()->frame()->view()->convertToRenderer(pluginView()->renderer(), parentPoint);
point.move(pluginView()->location() - scrollbar->location());
- return point;
+ return roundedIntPoint(point);
}
} // namespace WebKit
Modified: branches/subpixellayout/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (98400 => 98401)
--- branches/subpixellayout/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2011-10-25 22:45:48 UTC (rev 98400)
+++ branches/subpixellayout/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2011-10-25 22:51:34 UTC (rev 98401)
@@ -574,7 +574,7 @@
paintRect = intersection(dirtyRectInWindowCoordinates, clipRectInWindowCoordinates());
} else {
// FIXME: We should try to intersect the dirty rect with the plug-in's clip rect here.
- paintRect = IntRect(IntPoint(), frameRect().size());
+ paintRect = IntRect(IntPoint(), expandedIntSize(frameRect().size()));
}
if (paintRect.isEmpty())
Modified: branches/subpixellayout/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (98400 => 98401)
--- branches/subpixellayout/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-10-25 22:45:48 UTC (rev 98400)
+++ branches/subpixellayout/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-10-25 22:51:34 UTC (rev 98401)
@@ -419,7 +419,7 @@
if (!view)
return ImmutableArray::create();
- const Vector<IntRect>& rects = view->trackedRepaintRects();
+ const Vector<WebCore::FixedRect>& rects = view->trackedRepaintRects();
size_t size = rects.size();
if (!size)
return ImmutableArray::create();