Commit 3d332f7f authored by philipj@opera.com's avatar philipj@opera.com

Remove Element.scrollByLines() and Element.scrollByPages()

Intent to Deprecate and Remove:
https://groups.google.com/a/chromium.org/d/msg/blink-dev/KYJoVzmi_tw/OsTpm27Ty9YJ

BUG=398356

Review URL: https://codereview.chromium.org/416403013

git-svn-id: svn://svn.chromium.org/blink/trunk@179134 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b0c08c52
......@@ -22,8 +22,6 @@ PASS nonNumericPolicy('createCSSStyleSheet().removeRule(x)') is 'any type allowe
PASS nonNumericPolicy('createCSSValueList().item(x)') is 'any type allowed (but not omitted)'
PASS nonNumericPolicy('document.elementFromPoint(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('document.elementFromPoint(0, x)') is 'any type allowed'
PASS nonNumericPolicy('document.body.scrollByLines(x)') is 'any type allowed'
PASS nonNumericPolicy('document.body.scrollByPages(x)') is 'any type allowed'
PASS nonNumericPolicy('document.body.scrollLeft = x') is 'mixed'
PASS nonNumericPolicy('document.body.scrollTop = x') is 'mixed'
PASS nonNumericPolicy('document.images.item(x)') is 'any type allowed'
......
......@@ -219,8 +219,6 @@ shouldBe("nonNumericPolicy('document.elementFromPoint(0, x)')", "'any type allow
// Element
shouldBe("nonNumericPolicy('document.body.scrollByLines(x)')", "'any type allowed'");
shouldBe("nonNumericPolicy('document.body.scrollByPages(x)')", "'any type allowed'");
shouldBe("nonNumericPolicy('document.body.scrollLeft = x')", "'mixed'");
shouldBe("nonNumericPolicy('document.body.scrollTop = x')", "'mixed'");
......
......@@ -34,7 +34,7 @@ function runTest() {
div.onscroll = divScrolled;
window.onscroll = windowScrolled;
div.scrollByLines(1);
div.scrollTop = 1;
}
</script>
......
......@@ -12,14 +12,13 @@
if (window.testRunner)
testRunner.dumpAsText();
function testScrollByLine()
function testScroll()
{
var overflowDiv = document.getElementById("overflow");
overflowDiv.scrollByLines(10);
overflowDiv.scrollByPages(10);
overflowDiv.scrollTop = 100;
overflowDiv.innerHTML = "PASSED: The test did not crash!";
}
window.addEventListener("load", testScrollByLine, false);
window.addEventListener("load", testScroll, false);
</script>
</head>
<body>
......
......@@ -470,34 +470,6 @@ void Element::scrollIntoViewIfNeeded(bool centerIfNeeded)
renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
}
void Element::scrollByUnits(int units, ScrollGranularity granularity)
{
document().updateLayoutIgnorePendingStylesheets();
if (!renderer())
return;
if (!renderer()->hasOverflowClip())
return;
ScrollDirection direction = ScrollDown;
if (units < 0) {
direction = ScrollUp;
units = -units;
}
toRenderBox(renderer())->scroll(direction, granularity, units);
}
void Element::scrollByLines(int lines)
{
scrollByUnits(lines, ScrollByLine);
}
void Element::scrollByPages(int pages)
{
scrollByUnits(pages, ScrollByPage);
}
static float localZoomForRenderer(RenderObject& renderer)
{
// FIXME: This does the wrong thing if two opposing zooms are in effect and canceled each
......
......@@ -35,7 +35,6 @@
#include "core/html/CollectionType.h"
#include "core/page/FocusType.h"
#include "platform/heap/Handle.h"
#include "platform/scroll/ScrollTypes.h"
namespace blink {
......@@ -176,9 +175,6 @@ public:
void scrollIntoView(bool alignToTop = true);
void scrollIntoViewIfNeeded(bool centerIfNeeded = true);
void scrollByLines(int lines);
void scrollByPages(int pages);
int offsetLeft();
int offsetTop();
int offsetWidth();
......@@ -603,8 +599,6 @@ private:
void updateId(TreeScope&, const AtomicString& oldId, const AtomicString& newId);
void updateName(const AtomicString& oldName, const AtomicString& newName);
void scrollByUnits(int units, ScrollGranularity);
virtual NodeType nodeType() const OVERRIDE FINAL;
virtual bool childTypeAllowed(NodeType) const OVERRIDE FINAL;
......
......@@ -87,8 +87,6 @@
// WebKit extensions
[MeasureAs=ElementScrollIntoViewIfNeeded] void scrollIntoViewIfNeeded(optional boolean centerIfNeeded);
[MeasureAs=ElementScrollByLines] void scrollByLines([Default=Undefined] optional long lines);
[MeasureAs=ElementScrollByPages] void scrollByPages([Default=Undefined] optional long pages);
// HTML 5
HTMLCollection getElementsByClassName(DOMString classNames);
......
......@@ -384,8 +384,6 @@ public:
DocumentCaretRangeFromPoint = 387,
DocumentGetCSSCanvasContext = 388,
ElementScrollIntoViewIfNeeded = 389,
ElementScrollByLines = 390,
ElementScrollByPages = 391,
RangeCompareNode = 392,
RangeExpand = 393,
HTMLImageElementX = 396,
......
......@@ -24,6 +24,7 @@
#include "core/dom/Document.h"
#include "core/frame/FrameOwner.h"
#include "core/html/HTMLElement.h"
#include "platform/scroll/ScrollTypes.h"
#include "wtf/HashCountedSet.h"
namespace blink {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment