Skip to content
Permalink
Browse files
Change WebKit/WebKit2 platform code to use pixel snapped values
https://bugs.webkit.org/show_bug.cgi?id=82549

Source/WebCore:

Reviewed by Eric Seidel.

Change WebKit and WebKit2 platform code to use rounded locations and
pixel snapped rects and sizes. This largely avoids having to expose the
fractional layout types to the platform code.

No new tests. No change in functionality.

* dom/Node.h:
(WebCore::Node::pixelSnappedRenderRect):
Add pixel snapped version of renderRect

* rendering/RenderBox.h:
(WebCore::RenderBox::pixelSnappedFrameRect):
Add pixel snapped version of frameRect

Source/WebKit/chromium:

Reviewed by Eric Seidel.

* src/WebAccessibilityObject.cpp:
(WebKit::WebAccessibilityObject::boundingBoxRect):
Use pixelSnappedBoundingBoxRect instead of boundingBoxRect which returns
a LayoutRect.

* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::characterIndexForPoint):
Use roundedPoint instead of point for hit testing as ranges use screen
cordinates which are represented with pixel accuracy.

Source/WebKit/mac:

Change WebKit and WebKit2 platform code to use rounded locations and
pixel snapped rects and sizes. This largely avoids having to expose the
fractional layout types to the platform code.

Reviewed by Eric Seidel.

* DOM/WebDOMOperations.mm:
(-[DOMNode _renderRect:]):

Source/WebKit/qt:

Reviewed by Eric Seidel.

* Api/qwebelement.cpp:
(QWebElement::geometry):
Replace getRect with getPixelSnappedRect to avoid having to expose
subpixel types to the platform layer.

* Api/qwebpage.cpp:
(QWebPagePrivate::TouchAdjuster::findCandidatePointForTouch):
Use pixel snapped element rect when comparing with the touch rect as the
touch rect use screen cordinates which are represented with pixel
accuracy.

* WebCoreSupport/ChromeClientQt.h:
(WebCore::ChromeClientQt::scrollRectIntoView):
Change scrollRectIntoView to take a LayoutRect to match base class
interface.

Source/WebKit2:

Change WebKit and WebKit2 platform code to use rounded locations and
pixel snapped rects and sizes. This largely avoids having to expose the
fractional layout types to the platform code.

Reviewed by Eric Seidel.

* Shared/WebRenderObject.cpp:
(WebKit::WebRenderObject::WebRenderObject):
* UIProcess/win/WebPopupMenuProxyWin.cpp:
(WebKit::WebPopupMenuProxyWin::calculatePositionAndSize):
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::InjectedBundleNodeHandle::renderRect):
* WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
(WebKit::BuiltInPDFView::invalidateScrollbarRect):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::characterIndexForPoint):


Canonical link: https://commits.webkit.org/100134@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112758 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eaenet committed Mar 31, 2012
1 parent e560c37 commit d587070a5a84453b25db3be2b0cddb7161212603
Showing 18 changed files with 110 additions and 11 deletions.
@@ -1,3 +1,24 @@
2012-03-30 Emil A Eklund <eae@chromium.org>

Change WebKit/WebKit2 platform code to use pixel snapped values
https://bugs.webkit.org/show_bug.cgi?id=82549

Reviewed by Eric Seidel.

Change WebKit and WebKit2 platform code to use rounded locations and
pixel snapped rects and sizes. This largely avoids having to expose the
fractional layout types to the platform code.

No new tests. No change in functionality.

* dom/Node.h:
(WebCore::Node::pixelSnappedRenderRect):
Add pixel snapped version of renderRect

* rendering/RenderBox.h:
(WebCore::RenderBox::pixelSnappedFrameRect):
Add pixel snapped version of frameRect

2012-03-30 Simon Fraser <simon.fraser@apple.com>

https://bugs.webkit.org/show_bug.cgi?id=82761
@@ -379,6 +379,7 @@ class Node : public EventTarget, public ScriptWrappable, public TreeShared<Conta
virtual LayoutRect getRect() const;
IntRect getPixelSnappedRect() const { return pixelSnappedIntRect(getRect()); }
LayoutRect renderRect(bool* isReplaced);
IntRect pixelSnappedRenderRect(bool* isReplaced) { return pixelSnappedIntRect(renderRect(isReplaced)); }

// Returns true if the node has a non-empty bounding box in layout.
// This does not 100% guarantee the user can see it, but is pretty close.
@@ -130,6 +130,7 @@ class RenderBox : public RenderBoxModelObject {
void move(LayoutUnit dx, LayoutUnit dy) { m_frameRect.move(dx, dy); }

LayoutRect frameRect() const { return m_frameRect; }
IntRect pixelSnappedFrameRect() const { return pixelSnappedIntRect(m_frameRect); }
void setFrameRect(const LayoutRect& rect) { m_frameRect = rect; }

IntRect borderBoxRect() const { return IntRect(IntPoint(), IntSize(m_frameRect.pixelSnappedWidth(), m_frameRect.pixelSnappedHeight())); }
@@ -1,3 +1,20 @@
2012-03-30 Emil A Eklund <eae@chromium.org>

Change WebKit/WebKit2 platform code to use pixel snapped values
https://bugs.webkit.org/show_bug.cgi?id=82549

Reviewed by Eric Seidel.

* src/WebAccessibilityObject.cpp:
(WebKit::WebAccessibilityObject::boundingBoxRect):
Use pixelSnappedBoundingBoxRect instead of boundingBoxRect which returns
a LayoutRect.

* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::characterIndexForPoint):
Use roundedPoint instead of point for hit testing as ranges use screen
cordinates which are represented with pixel accuracy.

2012-03-30 Adam Barth <abarth@webkit.org>

https://bugs.webkit.org/show_bug.cgi?id=82582
@@ -493,7 +493,7 @@ WebRect WebAccessibilityObject::boundingBoxRect() const
return WebRect();

m_private->updateBackingStore();
return m_private->boundingBoxRect();
return m_private->pixelSnappedBoundingBoxRect();
}

double WebAccessibilityObject::estimatedLoadingProgress() const
@@ -1190,7 +1190,7 @@ size_t WebFrameImpl::characterIndexForPoint(const WebPoint& webPoint) const

IntPoint point = frame()->view()->windowToContents(webPoint);
HitTestResult result = frame()->eventHandler()->hitTestResultAtPoint(point, false);
RefPtr<Range> range = frame()->rangeForPoint(result.point());
RefPtr<Range> range = frame()->rangeForPoint(result.roundedPoint());
if (!range)
return notFound;

@@ -1,3 +1,17 @@
2012-03-30 Emil A Eklund <eae@chromium.org>

Change WebKit/WebKit2 platform code to use pixel snapped values
https://bugs.webkit.org/show_bug.cgi?id=82549

Change WebKit and WebKit2 platform code to use rounded locations and
pixel snapped rects and sizes. This largely avoids having to expose the
fractional layout types to the platform code.

Reviewed by Eric Seidel.

* DOM/WebDOMOperations.mm:
(-[DOMNode _renderRect:]):

2012-03-30 Mark Pilgrim <pilgrim@chromium.org>

GEOLOCATION should be implemented as Page Supplement
@@ -131,7 +131,7 @@ - (NSString *)markupString

- (NSRect)_renderRect:(bool *)isReplaced
{
return NSRect(core(self)->renderRect(isReplaced));
return NSRect(core(self)->pixelSnappedRenderRect(isReplaced));
}

@end
@@ -552,7 +552,7 @@ QRect QWebElement::geometry() const
{
if (!m_element)
return QRect();
return m_element->getRect();
return m_element->getPixelSnappedRect();
}

/*!
@@ -1587,7 +1587,7 @@ IntPoint QWebPagePrivate::TouchAdjuster::findCandidatePointForTouch(const IntPoi
if (!currentElement || (!isClickableElement(currentElement, 0) && !isValidFrameOwner(currentElement)))
continue;

IntRect currentElementBoundingRect = currentElement->getRect();
IntRect currentElementBoundingRect = currentElement->getPixelSnappedRect();
currentElementBoundingRect.intersect(touchRect);

if (currentElementBoundingRect.isEmpty())
@@ -1,3 +1,26 @@
2012-03-30 Emil A Eklund <eae@chromium.org>

Change WebKit/WebKit2 platform code to use pixel snapped values
https://bugs.webkit.org/show_bug.cgi?id=82549

Reviewed by Eric Seidel.

* Api/qwebelement.cpp:
(QWebElement::geometry):
Replace getRect with getPixelSnappedRect to avoid having to expose
subpixel types to the platform layer.

* Api/qwebpage.cpp:
(QWebPagePrivate::TouchAdjuster::findCandidatePointForTouch):
Use pixel snapped element rect when comparing with the touch rect as the
touch rect use screen cordinates which are represented with pixel
accuracy.

* WebCoreSupport/ChromeClientQt.h:
(WebCore::ChromeClientQt::scrollRectIntoView):
Change scrollRectIntoView to take a LayoutRect to match base class
interface.

2012-03-30 Mark Pilgrim <pilgrim@chromium.org>

GEOLOCATION should be implemented as Page Supplement
@@ -171,7 +171,7 @@ class ChromeClientQt : public ChromeClient {
virtual void setCursor(const Cursor&);
virtual void setCursorHiddenUntilMouseMoves(bool) { }

virtual void scrollRectIntoView(const IntRect&) const { }
virtual void scrollRectIntoView(const LayoutRect) const { }

virtual bool selectItemWritingDirectionIsNatural();
virtual bool selectItemAlignmentFollowsMenuWritingDirection();
@@ -1,3 +1,25 @@
2012-03-30 Emil A Eklund <eae@chromium.org>

Change WebKit/WebKit2 platform code to use pixel snapped values
https://bugs.webkit.org/show_bug.cgi?id=82549

Change WebKit and WebKit2 platform code to use rounded locations and
pixel snapped rects and sizes. This largely avoids having to expose the
fractional layout types to the platform code.

Reviewed by Eric Seidel.

* Shared/WebRenderObject.cpp:
(WebKit::WebRenderObject::WebRenderObject):
* UIProcess/win/WebPopupMenuProxyWin.cpp:
(WebKit::WebPopupMenuProxyWin::calculatePositionAndSize):
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::InjectedBundleNodeHandle::renderRect):
* WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
(WebKit::BuiltInPDFView::invalidateScrollbarRect):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::characterIndexForPoint):

2012-03-30 Anders Carlsson <andersca@apple.com>

Fix Lion build.
@@ -61,7 +61,7 @@ WebRenderObject::WebRenderObject(RenderObject* renderer)
m_absolutePosition = flooredIntPoint(renderer->localToAbsolute(FloatPoint()));

if (renderer->isBox())
m_frameRect = toRenderBox(renderer)->frameRect();
m_frameRect = toRenderBox(renderer)->pixelSnappedFrameRect();
else if (renderer->isText()) {
m_frameRect = toRenderText(renderer)->linesBoundingBox();
m_frameRect.setX(toRenderText(renderer)->firstRunX());
@@ -401,7 +401,7 @@ void WebPopupMenuProxyWin::calculatePositionAndSize(const IntRect& rect)
MONITORINFOEX monitorInfo;
monitorInfo.cbSize = sizeof(MONITORINFOEX);
::GetMonitorInfo(monitor, &monitorInfo);
FloatRect screen = monitorInfo.rcWork;
FloatRect screen = static_cast<IntRect>(monitorInfo.rcWork);

// Check that we don't go off the screen vertically
if (popupRect.maxY() > screen.height()) {
@@ -114,7 +114,7 @@ IntRect InjectedBundleNodeHandle::elementBounds() const

IntRect InjectedBundleNodeHandle::renderRect(bool* isReplaced) const
{
return m_node.get()->renderRect(isReplaced);
return m_node.get()->pixelSnappedRenderRect(isReplaced);
}

void InjectedBundleNodeHandle::setHTMLInputElementValueForUser(const String& value)
@@ -710,7 +710,7 @@ bool BuiltInPDFView::isActive() const
return false;
}

void BuiltInPDFView::invalidateScrollbarRect(Scrollbar* scrollbar, const LayoutRect& rect)
void BuiltInPDFView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
{
IntRect dirtyRect = rect;
dirtyRect.moveBy(scrollbar->location());
@@ -358,7 +358,7 @@ static String commandNameForSelectorName(const String& selectorName)
HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(point, false);
frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController()->focusedOrMainFrame();

RefPtr<Range> range = frame->rangeForPoint(result.point());
RefPtr<Range> range = frame->rangeForPoint(result.roundedPoint());
if (!range)
return;

0 comments on commit d587070

Please sign in to comment.