Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(613)

Unified Diff: Source/core/dom/Element.cpp

Issue 340903002: Revert "Subpixel precision for clientWidth, offsetWidth, scrollTop et al" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/Element.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index fad08767c93d475220a829c864908f7755aaa2cd..2c719b4d6064e5571af50cc8919ef056ec108776 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -525,35 +525,35 @@ static double adjustForLocalZoom(LayoutUnit value, RenderObject& renderer)
return value.toDouble() / zoomFactor;
}
-double Element::offsetLeft()
+int Element::offsetLeft()
{
document().updateLayoutIgnorePendingStylesheets();
if (RenderBoxModelObject* renderer = renderBoxModelObject())
- return adjustForLocalZoom(renderer->offsetLeft(), *renderer);
+ return lroundf(adjustForLocalZoom(renderer->offsetLeft(), *renderer));
return 0;
}
-double Element::offsetTop()
+int Element::offsetTop()
{
document().updateLayoutIgnorePendingStylesheets();
if (RenderBoxModelObject* renderer = renderBoxModelObject())
- return adjustForLocalZoom(renderer->offsetTop(), *renderer);
+ return lroundf(adjustForLocalZoom(renderer->pixelSnappedOffsetTop(), *renderer));
return 0;
}
-double Element::offsetWidth()
+int Element::offsetWidth()
{
document().updateLayoutIgnorePendingStylesheets();
if (RenderBoxModelObject* renderer = renderBoxModelObject())
- return adjustLayoutUnitForAbsoluteZoom(renderer->offsetWidth(), *renderer).toFloat();
+ return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedOffsetWidth(), *renderer).round();
return 0;
}
-double Element::offsetHeight()
+int Element::offsetHeight()
{
document().updateLayoutIgnorePendingStylesheets();
if (RenderBoxModelObject* renderer = renderBoxModelObject())
- return adjustLayoutUnitForAbsoluteZoom(renderer->offsetHeight(), *renderer).toFloat();
+ return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedOffsetHeight(), *renderer).round();
return 0;
}
@@ -573,25 +573,25 @@ Element* Element::offsetParent()
return 0;
}
-double Element::clientLeft()
+int Element::clientLeft()
{
document().updateLayoutIgnorePendingStylesheets();
if (RenderBox* renderer = renderBox())
- return adjustLayoutUnitForAbsoluteZoom(renderer->clientLeft(), *renderer);
+ return adjustLayoutUnitForAbsoluteZoom(roundToInt(renderer->clientLeft()), *renderer);
return 0;
}
-double Element::clientTop()
+int Element::clientTop()
{
document().updateLayoutIgnorePendingStylesheets();
if (RenderBox* renderer = renderBox())
- return adjustLayoutUnitForAbsoluteZoom(renderer->clientTop(), *renderer);
+ return adjustLayoutUnitForAbsoluteZoom(roundToInt(renderer->clientTop()), *renderer);
return 0;
}
-double Element::clientWidth()
+int Element::clientWidth()
{
document().updateLayoutIgnorePendingStylesheets();
@@ -607,11 +607,11 @@ double Element::clientWidth()
}
if (RenderBox* renderer = renderBox())
- return adjustLayoutUnitForAbsoluteZoom(renderer->clientWidth(), *renderer).toFloat();
+ return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedClientWidth(), *renderer).round();
return 0;
}
-double Element::clientHeight()
+int Element::clientHeight()
{
document().updateLayoutIgnorePendingStylesheets();
@@ -628,11 +628,11 @@ double Element::clientHeight()
}
if (RenderBox* renderer = renderBox())
- return adjustLayoutUnitForAbsoluteZoom(renderer->clientHeight(), *renderer).toFloat();
+ return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedClientHeight(), *renderer).round();
return 0;
}
-double Element::scrollLeft()
+int Element::scrollLeft()
{
document().updateLayoutIgnorePendingStylesheets();
@@ -655,7 +655,7 @@ double Element::scrollLeft()
return 0;
}
-double Element::scrollTop()
+int Element::scrollTop()
{
document().updateLayoutIgnorePendingStylesheets();
@@ -678,7 +678,7 @@ double Element::scrollTop()
return 0;
}
-void Element::setScrollLeft(double newLeft)
+void Element::setScrollLeft(int newLeft)
{
document().updateLayoutIgnorePendingStylesheets();
@@ -724,7 +724,7 @@ void Element::setScrollLeft(const Dictionary& scrollOptionsHorizontal, Exception
setScrollLeft(position);
}
-void Element::setScrollTop(double newTop)
+void Element::setScrollTop(int newTop)
{
document().updateLayoutIgnorePendingStylesheets();
@@ -770,7 +770,7 @@ void Element::setScrollTop(const Dictionary& scrollOptionsVertical, ExceptionSta
setScrollTop(position);
}
-double Element::scrollWidth()
+int Element::scrollWidth()
{
document().updateLayoutIgnorePendingStylesheets();
if (RenderBox* rend = renderBox())
@@ -778,7 +778,7 @@ double Element::scrollWidth()
return 0;
}
-double Element::scrollHeight()
+int Element::scrollHeight()
{
document().updateLayoutIgnorePendingStylesheets();
if (RenderBox* rend = renderBox())
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/Element.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698