Commit c382f5ba authored by andersca's avatar andersca

WebCore:

2006-06-06  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Darin.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=9325
        clientWidth/clientHeight on document element in strict mode should return visible frame size
        
        * dom/Element.cpp:
        (WebCore::Element::clientWidth):
        (WebCore::Element::clientHeight):
        If we're the document element, and in strict mode, return the visible size of the frame.
        
LayoutTests:

2006-06-06  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Darin.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=9325
        clientWidth/clientHeight on document element in strict mode should return visible frame size

        * fast/dom/client-width-height-expected.txt: Added.
        * fast/dom/client-width-height.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14744 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a70ccbc8
2006-06-06 Anders Carlsson <acarlsson@apple.com>
Reviewed by Darin.
http://bugzilla.opendarwin.org/show_bug.cgi?id=9325
clientWidth/clientHeight on document element in strict mode should return visible frame size
* fast/dom/client-width-height-expected.txt: Added.
* fast/dom/client-width-height.html: Added.
2006-06-05 Rob Buis <buis@kde.org> 2006-06-05 Rob Buis <buis@kde.org>
Reviewed by mjs. Reviewed by mjs.
This tests that clientWidth/clientHeight on the document element in strict mode returns the visible size of the frame.
SUCCESS!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script>
function debug(str) {
pre = document.getElementById('console');
pre.appendChild(document.createTextNode(str + '\n'));
}
function runTests() {
if (window.layoutTestController)
layoutTestController.dumpAsText();
if (document.documentElement.clientWidth == window.innerWidth &&
document.documentElement.clientHeight == window.innerHeight)
debug("SUCCESS!");
else
debug("FAILURE!");
}
</script>
</head>
<body onload="runTests()">
This tests that clientWidth/clientHeight on the document element in strict mode returns the visible size of the frame.
<pre id="console"></pre>
</body>
</html>
2006-06-06 Anders Carlsson <acarlsson@apple.com>
Reviewed by Darin.
http://bugzilla.opendarwin.org/show_bug.cgi?id=9325
clientWidth/clientHeight on document element in strict mode should return visible frame size
* dom/Element.cpp:
(WebCore::Element::clientWidth):
(WebCore::Element::clientHeight):
If we're the document element, and in strict mode, return the visible size of the frame.
2006-06-06 Anders Carlsson <acarlsson@apple.com> 2006-06-06 Anders Carlsson <acarlsson@apple.com>
Reviewed by John. Reviewed by John.
......
...@@ -223,6 +223,12 @@ Element* Element::offsetParent() ...@@ -223,6 +223,12 @@ Element* Element::offsetParent()
int Element::clientWidth() int Element::clientWidth()
{ {
document()->updateLayoutIgnorePendingStylesheets(); document()->updateLayoutIgnorePendingStylesheets();
// When in strict mode, clientWidth for the document
// element should return the width of the containing frame.
if (!document()->inCompatMode() && document()->documentElement() == this)
return document()->frame()->view()->visibleWidth();
if (RenderObject* rend = renderer()) if (RenderObject* rend = renderer())
return rend->clientWidth(); return rend->clientWidth();
return 0; return 0;
...@@ -231,6 +237,12 @@ int Element::clientWidth() ...@@ -231,6 +237,12 @@ int Element::clientWidth()
int Element::clientHeight() int Element::clientHeight()
{ {
document()->updateLayoutIgnorePendingStylesheets(); document()->updateLayoutIgnorePendingStylesheets();
// When in strict mode, clientHeight for the document
// element should return the height of the containing frame.
if (!document()->inCompatMode() && document()->documentElement() == this)
return document()->frame()->view()->visibleHeight();
if (RenderObject* rend = renderer()) if (RenderObject* rend = renderer())
return rend->clientHeight(); return rend->clientHeight();
return 0; return 0;
......
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