Reviewed by Maciej.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Jan 2006 08:59:24 +0000 (08:59 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Jan 2006 08:59:24 +0000 (08:59 +0000)
        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6402
          Implement frameElement.width and frameElement.height

        Test case: fast/frames/frameElement-widthheight.html

        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLElement::frameGetter):
        * khtml/ecma/kjs_html.h:
        Add FrameWidth, FrameHeight

        * khtml/html/html_baseimpl.cpp:
        (HTMLFrameElementImpl::frameWidth):
        (HTMLFrameElementImpl::frameHeight):
        * khtml/html/html_baseimpl.h:
        Add frameWidth, frameHeight

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@11952 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/frames/frameElement-widthheight-expected.txt [new file with mode: 0644]
LayoutTests/fast/frames/frameElement-widthheight.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/khtml/ecma/kjs_html.cpp
WebCore/khtml/ecma/kjs_html.h
WebCore/khtml/html/html_baseimpl.cpp
WebCore/khtml/html/html_baseimpl.h

index 29ec327db89911278ac2975362d60d533f7a97d3..7719d07794549e50e4891ff4952af7a8c8e1d62c 100644 (file)
@@ -1,3 +1,13 @@
+2006-01-09  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Maciej.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=6402
+          Implement frameElement.width and frameElement.height
+
+        * fast/frames/frameElement-widthheight.html: Added.
+        * fast/frames/frameElement-widthheight-expected.txt: Added.
+
 2006-01-09  Mitz Pettel  <opendarwin.org@mitzpettel.com>
         
         Reviewed by Maciej, landed by ap.
diff --git a/LayoutTests/fast/frames/frameElement-widthheight-expected.txt b/LayoutTests/fast/frames/frameElement-widthheight-expected.txt
new file mode 100644 (file)
index 0000000..1f3f871
--- /dev/null
@@ -0,0 +1,2 @@
+ALERT: Success
+
diff --git a/LayoutTests/fast/frames/frameElement-widthheight.html b/LayoutTests/fast/frames/frameElement-widthheight.html
new file mode 100644 (file)
index 0000000..2aeb5f7
Binary files /dev/null and b/LayoutTests/fast/frames/frameElement-widthheight.html differ
index 1d8ebc205b697befc71bd004bbebb3384091f644..bd1c9b078df65cbd6f64e5810ad4af8fb4ea047e 100644 (file)
@@ -1,3 +1,23 @@
+2006-01-09  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Maciej.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6402
+          Implement frameElement.width and frameElement.height
+
+        Test case: fast/frames/frameElement-widthheight.html
+
+        * khtml/ecma/kjs_html.cpp:
+        (KJS::HTMLElement::frameGetter):
+        * khtml/ecma/kjs_html.h:
+        Add FrameWidth, FrameHeight
+
+        * khtml/html/html_baseimpl.cpp:
+        (HTMLFrameElementImpl::frameWidth):
+        (HTMLFrameElementImpl::frameHeight):
+        * khtml/html/html_baseimpl.h:
+        Add frameWidth, frameHeight
+
 2006-01-09  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Maciej, landed by ap.
index 09d92d6190f846ed081906fcaa508ec6ad65551f..33806b0284f060f38f05ae796778f181f2a86b00 100644 (file)
@@ -1153,6 +1153,8 @@ const HTMLElement::Accessors* HTMLElement::accessors() const
   marginWidth    KJS::HTMLElement::FrameMarginWidth            DontDelete
   name           KJS::HTMLElement::FrameName                   DontDelete
   noResize       KJS::HTMLElement::FrameNoResize               DontDelete
+  width                  KJS::HTMLElement::FrameWidth                  DontDelete|ReadOnly
+  height         KJS::HTMLElement::FrameHeight                 DontDelete|ReadOnly
   scrolling      KJS::HTMLElement::FrameScrolling              DontDelete
   src            KJS::HTMLElement::FrameSrc                    DontDelete
   location       KJS::HTMLElement::FrameLocation               DontDelete
@@ -2117,6 +2119,8 @@ JSValue *HTMLElement::frameGetter(ExecState* exec, int token) const
         case FrameMarginWidth:     return jsString(frameElement.marginWidth());
         case FrameName:            return jsString(frameElement.name());
         case FrameNoResize:        return jsBoolean(frameElement.noResize());
+        case FrameWidth:           return jsNumber(frameElement.frameWidth());
+        case FrameHeight:          return jsNumber(frameElement.frameHeight());
         case FrameScrolling:       return jsString(frameElement.scrolling());
         case FrameSrc:
         case FrameLocation:        return jsString(frameElement.src());
index 5f53d3b735e3cbf29b88e1f1bbd2e75c25fe0eb3..4c29a8ad47c29c1dae1b78376c6cc40b5e77c239 100644 (file)
@@ -276,7 +276,7 @@ namespace KJS {
            TableCellAlign, TableCellAxis, TableCellScope, FrameSetCols,
            FrameSetRows, FrameSrc, FrameLocation, FrameFrameBorder, FrameScrolling,
            FrameMarginWidth, FrameLongDesc, FrameMarginHeight, FrameName, FrameContentDocument, FrameContentWindow, 
-           FrameNoResize, IFrameLongDesc, IFrameDocument, IFrameAlign,
+           FrameNoResize, FrameWidth, FrameHeight, IFrameLongDesc, IFrameDocument, IFrameAlign,
            IFrameFrameBorder, IFrameSrc, IFrameName, IFrameHeight,
            IFrameMarginHeight, IFrameMarginWidth, IFrameScrolling, IFrameWidth, IFrameContentDocument, IFrameContentWindow,
            MarqueeStart, MarqueeStop,
index 1b12de8e8a851a03fdc8ddd4dd0940ce604bdb27..7e22da8aeaf96a73147a22e83ca38e085a2ab06e 100644 (file)
@@ -632,6 +632,26 @@ void HTMLFrameElementImpl::setSrc(const DOMString &value)
     setAttribute(srcAttr, value);
 }
 
+int HTMLFrameElementImpl::frameWidth() const
+{
+    DocumentImpl* d = getDocument();
+    if (!d || !m_render)
+        return 0;
+    
+    d->updateLayoutIgnorePendingStylesheets();
+    return m_render->width();
+}
+
+int HTMLFrameElementImpl::frameHeight() const
+{
+    DocumentImpl* d = getDocument();
+    if (!d || !m_render)
+        return 0;
+    
+    d->updateLayoutIgnorePendingStylesheets();
+    return m_render->height();
+}
+
 // -------------------------------------------------------------------------
 
 HTMLFrameSetElementImpl::HTMLFrameSetElementImpl(DocumentImpl *doc)
index f29b01ca8c4f4f05bb0babf74857ed98b15935e1..e201e2a59279104c03178d613a8ba7fec1b5c1ce 100644 (file)
@@ -147,6 +147,9 @@ public:
     virtual DOMString src() const;
     void setSrc(const DOMString &);
 
+    int frameWidth() const;
+    int frameHeight() const;
+
 protected:
     bool isURLAllowed(const AtomicString &) const;
     virtual void openURL();