Commit 54df3f5f authored by philipj@opera.com's avatar philipj@opera.com

Remove HTMLFrameElement.width/height

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

BUG=398351

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

git-svn-id: svn://svn.chromium.org/blink/trunk@179130 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ca877338
......@@ -12,9 +12,10 @@
if (success)
frame.document.write('<p>Success!</p>');
else {
var rect = frame.frameElement.getBoundingClientRect();
frame.document.write('<p>Resize until ');
frame.document.write(isWidth ? 'width:' : 'height:');
frame.document.write(isWidth ? frame.frameElement.width : frame.frameElement.height);
frame.document.write(isWidth ? rect.width : rect.height);
frame.document.write(' = ' + size + '</p>');
}
}
......@@ -75,14 +76,14 @@
}
}
function checkSuccess() {
log(One, One.frameElement.width == 100, true, 100)
log(Two, Two.frameElement.height == 80, false, 80)
log(Three, Three.frameElement.height == 50, false, 50)
log(Four, Four.frameElement.height == 143, false, 143)
log(Five, Five.frameElement.height == 111, false, 111)
log(Six, Six.frameElement.height == 192, false, 192)
log(Seven, Seven.frameElement.width == 100, true, 100)
log(Eight, Eight.frameElement.width == 100, true, 100)
log(One, One.frameElement.getBoundingClientRect().width == 100, true, 100)
log(Two, Two.frameElement.getBoundingClientRect().height == 80, false, 80)
log(Three, Three.frameElement.getBoundingClientRect().height == 50, false, 50)
log(Four, Four.frameElement.getBoundingClientRect().height == 143, false, 143)
log(Five, Five.frameElement.getBoundingClientRect().height == 111, false, 111)
log(Six, Six.frameElement.getBoundingClientRect().height == 192, false, 192)
log(Seven, Seven.frameElement.getBoundingClientRect().width == 100, true, 100)
log(Eight, Eight.frameElement.getBoundingClientRect().width == 100, true, 100)
}
window.onload = init;
......
......@@ -10,5 +10,5 @@ Frame: 'results'
--------
This tests that a frame inherits the noresize attribute of its parent frameset by default. Note, this behavior doesn't seem to conform to any W3C spec or MSDN documentation. See WebKit Bug 57604.
PASS document.getElementById("testFrame").width is 200
PASS document.getElementById("testFrame").getBoundingClientRect().width is 200
ALERT: This page tests whether an iframe correctly reports renderer-dependent values when executing a javascript: load. If the test passes, you'll see a series of 'PASS' messages below.
ALERT: PASS: frame.frameElement.width should be 250 and is.
ALERT: PASS: frame.frameElement.getBoundingClientRect().width should be 250 and is.
ALERT: PASS: frame.frameElement.clientWidth should be 250 and is.
ALERT: PASS: frame.frameElement.height should be 250 and is.
ALERT: PASS: frame.frameElement.getBoundingClientRect().height should be 250 and is.
ALERT: PASS: frame.frameElement.clientHeight should be 250 and is.
......
......@@ -35,9 +35,9 @@ function shouldBe(a, b)
'when executing a javascript: load. If the test passes, you\'ll see a series of ' +
'\'PASS\' messages below.\n'
);
top.shouldBe('frame.frameElement.width', 250);
top.shouldBe('frame.frameElement.getBoundingClientRect().width', 250);
top.shouldBe('frame.frameElement.clientWidth', 250);
top.shouldBe('frame.frameElement.height', 250);
top.shouldBe('frame.frameElement.getBoundingClientRect().height', 250);
top.shouldBe('frame.frameElement.clientHeight', 250);
"
>
......
......@@ -11,25 +11,25 @@ Frame: 'results'
This tests that frame resizing is allowed and disallowed when programmatically removing and adding the noresize attribute, respectively.
Test disallow frame resize via noResize IDL attribute:
PASS document.getElementById("testFrame").width is 200
PASS document.getElementById("testFrame").getBoundingClientRect().width is 200
Test allow frame resize when noResize IDL attribute has value undefined:
PASS document.getElementById("testFrame").width is 210
PASS document.getElementById("testFrame").getBoundingClientRect().width is 210
Test allow frame resize when noResize IDL attribute has value null:
PASS document.getElementById("testFrame").width is 220
PASS document.getElementById("testFrame").getBoundingClientRect().width is 220
Test disallow frame resize via noresize content attribute:
PASS document.getElementById("testFrame").width is 220
PASS document.getElementById("testFrame").width is 220
PASS document.getElementById("testFrame").width is 220
PASS document.getElementById("testFrame").width is 220
PASS document.getElementById("testFrame").getBoundingClientRect().width is 220
PASS document.getElementById("testFrame").getBoundingClientRect().width is 220
PASS document.getElementById("testFrame").getBoundingClientRect().width is 220
PASS document.getElementById("testFrame").getBoundingClientRect().width is 220
Test disallow then allow frame resize via noResize IDL attribute (i.e. increase frame width by 10 pixels):
PASS document.getElementById("testFrame").width is 220
PASS document.getElementById("testFrame").width is 230
PASS document.getElementById("testFrame").getBoundingClientRect().width is 220
PASS document.getElementById("testFrame").getBoundingClientRect().width is 230
Test disallow then allow frame resize via noresize content attribute (i.e. increase frame width by 10 pixels):
PASS document.getElementById("testFrame").width is 230
PASS document.getElementById("testFrame").width is 240
PASS document.getElementById("testFrame").getBoundingClientRect().width is 230
PASS document.getElementById("testFrame").getBoundingClientRect().width is 240
......@@ -10,5 +10,5 @@ Frame: 'results'
--------
This tests that a frame with a source code-specified noresize attribute can be resized after programmatically removing its noresize attribute.
PASS document.getElementById("testFrame").width is 210
PASS document.getElementById("testFrame").getBoundingClientRect().width is 210
......@@ -10,5 +10,5 @@ Frame: 'results'
--------
This tests that a frame with a source code-specified noresize attribute can be resized after setting frame.noResize to false.
PASS document.getElementById("testFrame").width is 210
PASS document.getElementById("testFrame").getBoundingClientRect().width is 210
<html>
<head>
<title>frameElement.width, frameElement.height</title>
<frameset id="frameset" border="1" cols="50%,25%,25%" style='border: solid 1px;'>
<frame name="frame2" src="about:blank">
<frame name="frame1" src="javascript:
function log(s)
{
if (window.testRunner)
alert(s);
else
top.frame1.document.write('<p>' + s + '</p>');
}
if (window.testRunner)
testRunner.dumpAsText();
top.frame1.document.write('<p>Test for the presence of frameElement.width and frameElement.height <a href=\'https://bugs.webkit.org/show_bug.cgi?id=6402\'>(bug 6402)</a></p>');
try {
if (typeof(window.frameElement.width) != 'number' || typeof(window.frameElement.height) != 'number') {
log('Incorrect type: ' + typeof(window.frameElement.width) + ', ' + typeof(window.frameElement.height));
throw '';
}
ref = top.frame2.frameElement;
top.frameset.removeChild(top.frame2.frameElement);
if (ref.width != 0 || ref.height != 0) {
log('Incorrect deleted frame size: ' + ref.width + 'x' + ref.height);
throw '';
}
if (window.frameElement.width != 399 || window.frameElement.height != 600)
log('Frame size: ' + window.frameElement.width + 'x' + window.frameElement.height);
else
log('Success');
} catch (e) {
if (e.description)
log(e.description);
}
">
<frame name="frame3" src="about:blank">
</frameset>
</html>
......@@ -10,9 +10,10 @@
if (success)
frame.document.write('<p>Success!</p>');
else {
var rect = frame.frameElement.getBoundingClientRect();
frame.document.write('<p>Resize until ');
frame.document.write(isWidth ? 'width:' : 'height:');
frame.document.write(isWidth ? frame.frameElement.width : frame.frameElement.height);
frame.document.write(isWidth ? rect.width : rect.height);
frame.document.write(' = ' + size + '</p>');
}
}
......@@ -50,8 +51,8 @@
}
function checkSuccess() {
log(One, One.frameElement.width == 100, true, 100)
log(Two, Two.frameElement.height == 80, false, 80)
log(One, One.frameElement.getBoundingClientRect().width == 100, true, 100)
log(Two, Two.frameElement.getBoundingClientRect().height == 80, false, 80)
}
window.onload = run;
......
......@@ -24,7 +24,7 @@ function shouldDisallowFrameResize()
function shouldDisallowFrameResizeAfterProcessingFrame(processFrameFunction)
{
var expectedWidth = _testFrame.width;
var expectedWidth = _testFrame.getBoundingClientRect().width;
processFrameFunction(_testFrame);
resizeTestFrameBy(deltaWidth());
checkTestFrameWidthEquals(expectedWidth);
......@@ -32,7 +32,7 @@ function shouldDisallowFrameResizeAfterProcessingFrame(processFrameFunction)
function shouldAllowFrameResizeAfterProcessingFrame(processFrameFunction)
{
var expectedWidth = _testFrame.width + deltaWidth();
var expectedWidth = _testFrame.getBoundingClientRect().width + deltaWidth();
processFrameFunction(_testFrame);
resizeTestFrameBy(deltaWidth());
checkTestFrameWidthEquals(expectedWidth);
......@@ -40,10 +40,10 @@ function shouldAllowFrameResizeAfterProcessingFrame(processFrameFunction)
function checkTestFrameWidthEquals(expectedWidth)
{
if (_testFrame.width === expectedWidth)
log('PASS document.getElementById("' + _testFrameId + '").width is ' + expectedWidth);
if (_testFrame.getBoundingClientRect().width === expectedWidth)
log('PASS document.getElementById("' + _testFrameId + '").getBoundingClientRect().width is ' + expectedWidth);
else
log('FAIL document.getElementById("' + _testFrameId + '").width should be ' + expectedWidth + '. Was ' + _testFrame.width + '.');
log('FAIL document.getElementById("' + _testFrameId + '").getBoundingClientRect().width should be ' + expectedWidth + '. Was ' + _testFrame.getBoundingClientRect().width + '.');
}
function resizeTestFrameBy(deltaWidthInPixels)
......
......@@ -388,8 +388,6 @@ public:
ElementScrollByPages = 391,
RangeCompareNode = 392,
RangeExpand = 393,
HTMLFrameElementWidth = 394,
HTMLFrameElementHeight = 395,
HTMLImageElementX = 396,
HTMLImageElementY = 397,
HTMLOptionsCollectionRemoveElement = 398,
......
......@@ -36,7 +36,4 @@ interface HTMLFrameElement : HTMLElement {
readonly attribute Window contentWindow;
[CheckSecurity=Node, RaisesException] Document getSVGDocument();
[MeasureAs=HTMLFrameElementWidth] readonly attribute long width;
[MeasureAs=HTMLFrameElementHeight] readonly attribute long height;
};
......@@ -207,22 +207,6 @@ bool HTMLFrameElementBase::isHTMLContentAttribute(const Attribute& attribute) co
return attribute.name() == srcdocAttr || HTMLFrameOwnerElement::isHTMLContentAttribute(attribute);
}
int HTMLFrameElementBase::width()
{
document().updateLayoutIgnorePendingStylesheets();
if (!renderBox())
return 0;
return renderBox()->width();
}
int HTMLFrameElementBase::height()
{
document().updateLayoutIgnorePendingStylesheets();
if (!renderBox())
return 0;
return renderBox()->height();
}
// FIXME: Remove this code once we have input routing in the browser
// process. See http://crbug.com/339659.
void HTMLFrameElementBase::defaultEventHandler(Event* event)
......
......@@ -36,9 +36,6 @@ public:
int marginWidth() const { return m_marginWidth; }
int marginHeight() const { return m_marginHeight; }
int width();
int height();
virtual bool canContainRangeEndPoint() const OVERRIDE FINAL { return false; }
protected:
......
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