[M108 Migration][Compatibility] Support HTMLDocument width and height. 91/287191/4
authorvenu.musham <venu.musham@samsung.com>
Wed, 8 Feb 2023 10:42:53 +0000 (16:12 +0530)
committerBot Blink <blinkbot@samsung.com>
Thu, 16 Feb 2023 02:10:36 +0000 (02:10 +0000)
According to W3C spec document.width and height are deprecated.
For Tizen next version's, to support backward compatibility implement
document.width and document.height.

Reference: https://review.tizen.org/gerrit/278684

Change-Id: I0d656e980d814138683d0cac987b8e77cf609888
Signed-off-by: venu.musham <venu.musham@samsung.com>
third_party/blink/renderer/core/dom/document.cc
third_party/blink/renderer/core/dom/document.h
third_party/blink/renderer/core/dom/document.idl

index c33b310..63dfac2 100644 (file)
@@ -8293,6 +8293,22 @@ bool Document::hasFocus() const {
   return GetPage() && GetPage()->GetFocusController().IsDocumentFocused(*this);
 }
 
+int Document::width() {
+  UpdateStyleAndLayout(DocumentUpdateReason::kBeginMainFrame);
+  if (!GetLayoutView())
+    return 0;
+
+  return GetLayoutView()->DocumentRect().Width().ToInt();
+}
+
+int Document::height() {
+  UpdateStyleAndLayout(DocumentUpdateReason::kBeginMainFrame);
+  if (!GetLayoutView())
+    return 0;
+
+  return GetLayoutView()->DocumentRect().Height().ToInt();
+}
+
 const AtomicString& Document::BodyAttributeValue(
     const QualifiedName& name) const {
   if (auto* bodyElement = body())
index 2498c9f..f509ac1 100644 (file)
@@ -1673,6 +1673,9 @@ class CORE_EXPORT Document : public ContainerNode,
   // May return nullptr when PerformanceManager instrumentation is disabled.
   DocumentResourceCoordinator* GetResourceCoordinator();
 
+  int width();
+  int height();
+
   const AtomicString& bgColor() const;
   void setBgColor(const AtomicString&);
   const AtomicString& fgColor() const;
index ffde41e..d4d198e 100644 (file)
@@ -136,6 +136,9 @@ typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement;
     // HTML obsolete features
     // https://html.spec.whatwg.org/C/#Document-partial
 
+    readonly attribute long width;
+    readonly attribute long height;
+
     [Measure] readonly attribute HTMLCollection anchors;
     [Measure] readonly attribute HTMLCollection applets;