Diff
Modified: trunk/Source/WebCore/ChangeLog (107295 => 107296)
--- trunk/Source/WebCore/ChangeLog 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/ChangeLog 2012-02-09 23:09:38 UTC (rev 107296)
@@ -1,3 +1,56 @@
+2012-02-09 Levi Weintraub <[email protected]>
+
+ Add roundedIntPoint method for LayoutPoints
+ https://bugs.webkit.org/show_bug.cgi?id=78262
+
+ Reviewed by Eric Seidel.
+
+ Adding a roundedIntPoint method that operates on a LayoutPoint. Currently, this does
+ nothing as LayoutPoint is a typedef to IntPoint. When we enable sub-pixel LayoutUnits,
+ this is a critical part in our pixel snapping strategy, where we round the logical top-
+ left point, then snap the right and bottom edges.
+
+ Also using this new method where we wish to convert LayoutPoints to IntPoints, which
+ we're currently doing implicitly (since they're the same thing).
+
+ No new tests. No change in functionality.
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::visiblePositionForPoint):
+ (WebCore::AccessibilityRenderObject::accessibilityHitTest):
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::eventMayStartDrag):
+ (WebCore::EventHandler::hitTestResultAtPoint):
+ (WebCore::EventHandler::selectCursor):
+ * rendering/LayoutTypes.h:
+ (WebCore::roundedIntPoint):
+ (WebCore):
+ * rendering/RenderEmbeddedObject.cpp:
+ (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
+ * rendering/RenderFlowThread.cpp:
+ (WebCore::RenderFlowThread::paintIntoRegion):
+ * rendering/RenderFrameSet.cpp:
+ (WebCore::RenderFrameSet::getCursor):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::paintReplaced):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::scrollRectToVisible):
+ (WebCore::RenderLayer::offsetFromResizeCorner):
+ (WebCore::RenderLayer::isPointInResizeControl):
+ (WebCore::RenderLayer::paintLayerContents):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::paintContents):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::paintContents):
+ * rendering/mathml/RenderMathMLBlock.cpp:
+ (WebCore::RenderMathMLBlock::paint):
+ * rendering/mathml/RenderMathMLFraction.cpp:
+ (WebCore::RenderMathMLFraction::paint):
+ * rendering/mathml/RenderMathMLRoot.cpp:
+ (WebCore::RenderMathMLRoot::paint):
+ * rendering/mathml/RenderMathMLSquareRoot.cpp:
+ (WebCore::RenderMathMLSquareRoot::paint):
+
2012-02-09 John Bates <[email protected]>
[Chromium] Add chromium-style tracing support
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (107295 => 107296)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -2675,7 +2675,7 @@
while (1) {
LayoutPoint ourpoint;
#if PLATFORM(MAC)
- ourpoint = frameView->screenToContents(point);
+ ourpoint = frameView->screenToContents(roundedIntPoint(point));
#else
ourpoint = point;
#endif
@@ -2854,7 +2854,7 @@
Node* node = hitTestResult.innerNode()->shadowAncestorNode();
if (node->hasTagName(areaTag))
- return accessibilityImageMapHitTest(static_cast<HTMLAreaElement*>(node), point);
+ return accessibilityImageMapHitTest(static_cast<HTMLAreaElement*>(node), roundedIntPoint(point));
if (node->hasTagName(optionTag))
node = static_cast<HTMLOptionElement*>(node)->ownerSelectElement();
Modified: trunk/Source/WebCore/page/EventHandler.cpp (107295 => 107296)
--- trunk/Source/WebCore/page/EventHandler.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -697,7 +697,7 @@
HitTestResult result(view->windowToContents(event.position()));
m_frame->contentRenderer()->layer()->hitTest(request, result);
DragState state;
- return result.innerNode() && page->dragController()->draggableNode(m_frame, result.innerNode(), result.point(), state);
+ return result.innerNode() && page->dragController()->draggableNode(m_frame, result.innerNode(), roundedIntPoint(result.point()), state);
}
void EventHandler::updateSelectionForMouseDrag()
@@ -1031,7 +1031,7 @@
result = widgetHitTestResult;
if (testScrollbars == ShouldHitTestScrollbars) {
- Scrollbar* eventScrollbar = view->scrollbarAtPoint(point);
+ Scrollbar* eventScrollbar = view->scrollbarAtPoint(roundedIntPoint(point));
if (eventScrollbar)
result.setScrollbar(eventScrollbar);
}
@@ -1046,7 +1046,7 @@
FrameView* resultView = resultFrame->view();
FrameView* mainView = mainFrame->view();
if (resultView && mainView) {
- LayoutPoint mainFramePoint = mainView->rootViewToContents(resultView->contentsToRootView(result.point()));
+ IntPoint mainFramePoint = mainView->rootViewToContents(resultView->contentsToRootView(roundedIntPoint(result.point())));
result = mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, allowShadowContent, ignoreClipping, testScrollbars, hitType, padding);
}
}
@@ -1265,7 +1265,7 @@
if (renderer) {
Cursor overrideCursor;
- switch (renderer->getCursor(event.localPoint(), overrideCursor)) {
+ switch (renderer->getCursor(roundedIntPoint(event.localPoint()), overrideCursor)) {
case SetCursorBasedOnStyle:
break;
case SetCursor:
Modified: trunk/Source/WebCore/rendering/LayoutTypes.h (107295 => 107296)
--- trunk/Source/WebCore/rendering/LayoutTypes.h 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/LayoutTypes.h 2012-02-09 23:09:38 UTC (rev 107296)
@@ -56,6 +56,11 @@
return roundedIntSize(s);
}
+inline IntPoint roundedIntPoint(const LayoutPoint& p)
+{
+ return p;
+}
+
inline LayoutPoint roundedLayoutPoint(const FloatPoint& p)
{
return roundedIntPoint(p);
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -2440,7 +2440,7 @@
// z-index. We paint after we painted the background/border, so that the scrollbars will
// sit above the background/border.
if (hasOverflowClip() && style()->visibility() == VISIBLE && (phase == PaintPhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.shouldPaintWithinRoot(this))
- layer()->paintOverflowControls(paintInfo.context, adjustedPaintOffset, paintInfo.rect);
+ layer()->paintOverflowControls(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.rect);
}
void RenderBlock::paintColumnRules(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -190,7 +190,7 @@
bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, Path& path, FloatRect& replacementTextRect, Font& font, TextRun& run, float& textWidth) const
{
contentRect = contentBoxRect();
- contentRect.moveBy(accumulatedOffset);
+ contentRect.moveBy(roundedIntPoint(accumulatedOffset));
FontDescription fontDescription;
RenderTheme::defaultTheme()->systemFont(CSSValueWebkitSmallControl, fontDescription);
Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -464,7 +464,7 @@
renderFlowThreadOffset = LayoutPoint(paintOffset - regionRect.location());
context->translate(renderFlowThreadOffset.x(), renderFlowThreadOffset.y());
- info.rect.moveBy(-renderFlowThreadOffset);
+ info.rect.moveBy(-roundedIntPoint(renderFlowThreadOffset));
layer()->paint(context, info.rect, 0, 0, region, RenderLayer::PaintLayerTemporaryClipRects);
Modified: trunk/Source/WebCore/rendering/RenderFrameSet.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/RenderFrameSet.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/RenderFrameSet.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -802,7 +802,7 @@
CursorDirective RenderFrameSet::getCursor(const LayoutPoint& point, Cursor& cursor) const
{
- if (canResizeRow(point)) {
+ if (canResizeRow(roundedIntPoint(point))) {
cursor = rowResizeCursor();
return SetCursor;
}
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -299,7 +299,7 @@
if (centerY < 0)
centerY = 0;
imageOffset = LayoutSize(leftBorder + leftPad + centerX + 1, topBorder + topPad + centerY + 1);
- context->drawImage(image.get(), style()->colorSpace(), IntRect(paintOffset + imageOffset, imageSize));
+ context->drawImage(image.get(), style()->colorSpace(), IntRect(roundedIntPoint(paintOffset + imageOffset), imageSize));
errorPictureDrawn = true;
}
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -1578,7 +1578,7 @@
LayoutRect viewRect = frameView->visibleContentRect();
LayoutRect r = getRectToExpose(viewRect, rect, alignX, alignY);
- frameView->setScrollPosition(r.location());
+ frameView->setScrollPosition(roundedIntPoint(r.location()));
// This is the outermost view of a web page, so after scrolling this view we
// scroll its container by calling Page::scrollRectIntoView.
@@ -2135,8 +2135,8 @@
{
// Currently the resize corner is always the bottom right corner
// FIXME: This assumes the location is 0, 0. Is this guaranteed to always be the case?
- LayoutPoint bottomRight = toPoint(size());
- LayoutPoint localPoint = absoluteToContents(absolutePoint);
+ IntPoint bottomRight = toPoint(size());
+ IntPoint localPoint = roundedIntPoint(absoluteToContents(absolutePoint));
return localPoint - bottomRight;
}
@@ -2543,7 +2543,7 @@
}
}
-bool RenderLayer::isPointInResizeControl(const LayoutPoint& absolutePoint) const
+bool RenderLayer::isPointInResizeControl(const IntPoint& absolutePoint) const
{
if (!renderer()->hasOverflowClip() || renderer()->style()->resize() == RESIZE_NONE)
return false;
@@ -2551,9 +2551,9 @@
RenderBox* box = renderBox();
ASSERT(box);
- LayoutPoint localPoint = absoluteToContents(absolutePoint);
+ IntPoint localPoint = roundedIntPoint(absoluteToContents(absolutePoint));
- LayoutRect localBounds(0, 0, box->width(), box->height());
+ IntRect localBounds(0, 0, box->pixelSnappedWidth(), box->pixelSnappedHeight());
return resizerCornerRect(this, localBounds).contains(localPoint);
}
@@ -2946,7 +2946,7 @@
if (isPaintingOverlayScrollbars) {
clipToRect(rootLayer, context, paintDirtyRect, damageRect);
- paintOverflowControls(context, paintOffset, damageRect.rect(), true);
+ paintOverflowControls(context, roundedIntPoint(paintOffset), damageRect.rect(), true);
restoreClip(context, paintDirtyRect, damageRect);
}
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -1161,7 +1161,7 @@
context.save();
context.translate(-scrollCornerAndResizer.x(), -scrollCornerAndResizer.y());
LayoutRect transformedClip = clip;
- transformedClip.moveBy(scrollCornerAndResizer.location());
+ transformedClip.moveBy(roundedIntPoint(scrollCornerAndResizer.location()));
m_owningLayer->paintScrollCorner(&context, LayoutPoint(), transformedClip);
m_owningLayer->paintResizer(&context, LayoutPoint(), transformedClip);
context.restore();
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -1617,7 +1617,7 @@
context.save();
context.translate(-scrollCorner.x(), -scrollCorner.y());
LayoutRect transformedClip = clip;
- transformedClip.moveBy(scrollCorner.location());
+ transformedClip.moveBy(roundedIntPoint(scrollCorner.location()));
m_renderView->frameView()->paintScrollCorner(&context, transformedClip);
context.restore();
#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
Modified: trunk/Source/WebCore/rendering/RenderListMarker.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/RenderListMarker.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/RenderListMarker.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -1110,7 +1110,7 @@
if (style()->visibility() != VISIBLE)
return;
- LayoutPoint boxOrigin(paintOffset + location());
+ IntPoint boxOrigin(paintOffset + location());
LayoutRect overflowRect(visualOverflowRect());
overflowRect.moveBy(boxOrigin);
overflowRect.inflate(maximalOutlineSize(paintInfo.phase));
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -82,7 +82,7 @@
if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground)
return;
- LayoutPoint adjustedPaintOffset = paintOffset + location();
+ IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location());
GraphicsContextStateSaver stateSaver(*info.context);
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -153,7 +153,7 @@
verticalOffset = numerator->offsetHeight();
}
- LayoutPoint adjustedPaintOffset = paintOffset + location();
+ IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location());
adjustedPaintOffset.setY(adjustedPaintOffset.y() + verticalOffset);
GraphicsContextStateSaver stateSaver(*info.context);
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -104,7 +104,7 @@
if (!firstChild() || !lastChild())
return;
- LayoutPoint adjustedPaintOffset = paintOffset + location();
+ IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location());
RenderBoxModelObject* indexBox = toRenderBoxModelObject(lastChild());
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp (107295 => 107296)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp 2012-02-09 23:06:09 UTC (rev 107295)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp 2012-02-09 23:09:38 UTC (rev 107296)
@@ -73,7 +73,7 @@
if (info.context->paintingDisabled())
return;
- LayoutPoint adjustedPaintOffset = paintOffset + location();
+ IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location());
LayoutUnit maxHeight = 0;
LayoutUnit width = 0;