- Revision
- 111243
- Author
- [email protected]
- Date
- 2012-03-19 14:05:07 -0700 (Mon, 19 Mar 2012)
Log Message
Correct usage of LayoutUnits in page code in preparation for turning on subpixel layout
https://bugs.webkit.org/show_bug.cgi?id=81538
Reviewed by Eric Seidel.
Fix usage of LayoutUnits and conversions between types in page code.
No new tests.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::innerHeight):
(WebCore::DOMWindow::innerWidth):
Explicitly cast long to int. InspectorInstrumentation requires a long and
FractionalLayoutUnit has no constructor that takes long.
* page/EventHandler.cpp:
(WebCore::EventHandler::sendContextMenuEventForKey):
Pixel snap overflow rect as selection rects are integer based.
* page/FrameView.cpp:
(WebCore::FrameView::scrollContentsFastPath):
Pixel snap repaint rects when computing update rect as all scrolling is
done on integer bounds.
* page/GestureTapHighlighter.cpp:
Change rects vector to IntRect as addFocusRingRects operates on IntRects.
* page/Page.cpp:
(WebCore::Page::addRelevantRepaintedObject):
(WebCore::Page::addRelevantUnpaintedObject):
Change paint methods to take a LayoutRect paint rect.
* page/SpatialNavigation.cpp:
(WebCore::distanceDataForNode):
Change distance calculation to use floats instead of converting to float
at the end.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (111242 => 111243)
--- trunk/Source/WebCore/ChangeLog 2012-03-19 21:02:34 UTC (rev 111242)
+++ trunk/Source/WebCore/ChangeLog 2012-03-19 21:05:07 UTC (rev 111243)
@@ -1,3 +1,42 @@
+2012-03-19 Emil A Eklund <[email protected]>
+
+ Correct usage of LayoutUnits in page code in preparation for turning on subpixel layout
+ https://bugs.webkit.org/show_bug.cgi?id=81538
+
+ Reviewed by Eric Seidel.
+
+ Fix usage of LayoutUnits and conversions between types in page code.
+
+ No new tests.
+
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::innerHeight):
+ (WebCore::DOMWindow::innerWidth):
+ Explicitly cast long to int. InspectorInstrumentation requires a long and
+ FractionalLayoutUnit has no constructor that takes long.
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::sendContextMenuEventForKey):
+ Pixel snap overflow rect as selection rects are integer based.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::scrollContentsFastPath):
+ Pixel snap repaint rects when computing update rect as all scrolling is
+ done on integer bounds.
+
+ * page/GestureTapHighlighter.cpp:
+ Change rects vector to IntRect as addFocusRingRects operates on IntRects.
+
+ * page/Page.cpp:
+ (WebCore::Page::addRelevantRepaintedObject):
+ (WebCore::Page::addRelevantUnpaintedObject):
+ Change paint methods to take a LayoutRect paint rect.
+
+ * page/SpatialNavigation.cpp:
+ (WebCore::distanceDataForNode):
+ Change distance calculation to use floats instead of converting to float
+ at the end.
+
2012-03-19 David Hyatt <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=81553
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (111242 => 111243)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2012-03-19 21:02:34 UTC (rev 111242)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2012-03-19 21:05:07 UTC (rev 111243)
@@ -1135,7 +1135,7 @@
long height = view->visibleContentRect(/* includeScrollbars */ true).height();
InspectorInstrumentation::applyScreenHeightOverride(m_frame, &height);
- return view->mapFromLayoutToCSSUnits(height);
+ return view->mapFromLayoutToCSSUnits(static_cast<int>(height));
}
int DOMWindow::innerWidth() const
@@ -1149,7 +1149,7 @@
long width = view->visibleContentRect(/* includeScrollbars */ true).width();
InspectorInstrumentation::applyScreenWidthOverride(m_frame, &width);
- return view->mapFromLayoutToCSSUnits(width);
+ return view->mapFromLayoutToCSSUnits(static_cast<int>(width));
}
int DOMWindow::screenX() const
Modified: trunk/Source/WebCore/page/EventHandler.cpp (111242 => 111243)
--- trunk/Source/WebCore/page/EventHandler.cpp 2012-03-19 21:02:34 UTC (rev 111242)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2012-03-19 21:05:07 UTC (rev 111243)
@@ -2535,7 +2535,7 @@
RenderBoxModelObject* box = focusedNode->renderBoxModelObject();
if (!box)
return false;
- IntRect clippedRect = box->absoluteClippedOverflowRect();
+ IntRect clippedRect = box->pixelSnappedAbsoluteClippedOverflowRect();
location = IntPoint(clippedRect.x(), clippedRect.maxY() - 1);
} else {
location = IntPoint(
Modified: trunk/Source/WebCore/page/FrameView.cpp (111242 => 111243)
--- trunk/Source/WebCore/page/FrameView.cpp 2012-03-19 21:02:34 UTC (rev 111242)
+++ trunk/Source/WebCore/page/FrameView.cpp 2012-03-19 21:05:07 UTC (rev 111243)
@@ -1456,7 +1456,7 @@
if (renderBox->layer()->isComposited())
continue;
#endif
- IntRect updateRect = renderBox->layer()->repaintRectIncludingDescendants();
+ IntRect updateRect = pixelSnappedIntRect(renderBox->layer()->repaintRectIncludingDescendants());
updateRect = contentsToRootView(updateRect);
if (!isCompositedContentLayer && clipsRepaints())
updateRect.intersect(rectToScroll);
Modified: trunk/Source/WebCore/page/GestureTapHighlighter.cpp (111242 => 111243)
--- trunk/Source/WebCore/page/GestureTapHighlighter.cpp 2012-03-19 21:02:34 UTC (rev 111242)
+++ trunk/Source/WebCore/page/GestureTapHighlighter.cpp 2012-03-19 21:05:07 UTC (rev 111243)
@@ -138,7 +138,7 @@
ASSERT(o);
Path path;
- Vector<LayoutRect> rects;
+ Vector<IntRect> rects;
o->addFocusRingRects(rects, /* acc. offset */ ownerFrameToMainFrameOffset(o));
// The basic idea is to allow up to three different boxes in order to highlight
Modified: trunk/Source/WebCore/page/Page.cpp (111242 => 111243)
--- trunk/Source/WebCore/page/Page.cpp 2012-03-19 21:02:34 UTC (rev 111242)
+++ trunk/Source/WebCore/page/Page.cpp 2012-03-19 21:05:07 UTC (rev 111243)
@@ -1041,7 +1041,7 @@
m_relevantUnpaintedRegion = Region();
}
-void Page::addRelevantRepaintedObject(RenderObject* object, const IntRect& objectPaintRect)
+void Page::addRelevantRepaintedObject(RenderObject* object, const LayoutRect& objectPaintRect)
{
if (!isCountingRelevantRepaintedObjects())
return;
@@ -1052,14 +1052,16 @@
return;
}
+ IntRect snappedPaintRect = pixelSnappedIntRect(objectPaintRect);
+
// If this object was previously counted as an unpainted object, remove it from that HashSet
// and corresponding Region. FIXME: This doesn't do the right thing if the objects overlap.
if (m_relevantUnpaintedRenderObjects.contains(object)) {
m_relevantUnpaintedRenderObjects.remove(object);
- m_relevantUnpaintedRegion.subtract(objectPaintRect);
+ m_relevantUnpaintedRegion.subtract(snappedPaintRect);
}
- m_relevantPaintedRegion.unite(objectPaintRect);
+ m_relevantPaintedRegion.unite(snappedPaintRect);
RenderView* view = object->view();
if (!view)
@@ -1077,7 +1079,7 @@
}
}
-void Page::addRelevantUnpaintedObject(RenderObject* object, const IntRect& objectPaintRect)
+void Page::addRelevantUnpaintedObject(RenderObject* object, const LayoutRect& objectPaintRect)
{
if (!isCountingRelevantRepaintedObjects())
return;
@@ -1089,7 +1091,7 @@
}
m_relevantUnpaintedRenderObjects.add(object);
- m_relevantUnpaintedRegion.unite(objectPaintRect);
+ m_relevantUnpaintedRegion.unite(pixelSnappedIntRect(objectPaintRect));
}
void Page::suspendActiveDOMObjectsAndAnimations()
Modified: trunk/Source/WebCore/page/Page.h (111242 => 111243)
--- trunk/Source/WebCore/page/Page.h 2012-03-19 21:02:34 UTC (rev 111242)
+++ trunk/Source/WebCore/page/Page.h 2012-03-19 21:05:07 UTC (rev 111243)
@@ -325,8 +325,8 @@
void setRelevantRepaintedObjectsCounterThreshold(uint64_t);
void startCountingRelevantRepaintedObjects();
void resetRelevantPaintedObjectCounter();
- void addRelevantRepaintedObject(RenderObject*, const IntRect& objectPaintRect);
- void addRelevantUnpaintedObject(RenderObject*, const IntRect& objectPaintRect);
+ void addRelevantRepaintedObject(RenderObject*, const LayoutRect& objectPaintRect);
+ void addRelevantUnpaintedObject(RenderObject*, const LayoutRect& objectPaintRect);
void suspendActiveDOMObjectsAndAnimations();
void resumeActiveDOMObjectsAndAnimations();
Modified: trunk/Source/WebCore/page/SpatialNavigation.cpp (111242 => 111243)
--- trunk/Source/WebCore/page/SpatialNavigation.cpp 2012-03-19 21:02:34 UTC (rev 111242)
+++ trunk/Source/WebCore/page/SpatialNavigation.cpp 2012-03-19 21:05:07 UTC (rev 111243)
@@ -664,10 +664,10 @@
return;
}
- LayoutUnit x = (entryPoint.x() - exitPoint.x()) * (entryPoint.x() - exitPoint.x());
- LayoutUnit y = (entryPoint.y() - exitPoint.y()) * (entryPoint.y() - exitPoint.y());
+ float x = (entryPoint.x() - exitPoint.x()) * (entryPoint.x() - exitPoint.x());
+ float y = (entryPoint.y() - exitPoint.y()) * (entryPoint.y() - exitPoint.y());
- float euclidianDistance = sqrt((x + y) * 1.0f);
+ float euclidianDistance = sqrt(x + y);
// Loosely based on http://www.w3.org/TR/WICD/#focus-handling
// df = dotDist + dx + dy + 2 * (xdisplacement + ydisplacement) - sqrt(Overlap)