From: venu.musham Date: Wed, 8 Feb 2023 10:42:53 +0000 (+0530) Subject: [M108 Migration][Compatibility] Support HTMLDocument width and height. X-Git-Tag: submit/tizen/20230227.160252~60 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F91%2F287191%2F4;p=platform%2Fframework%2Fweb%2Fchromium-efl.git [M108 Migration][Compatibility] Support HTMLDocument width and height. 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 --- diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index c33b310..63dfac2 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc @@ -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()) diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index 2498c9f..f509ac1 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h @@ -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; diff --git a/third_party/blink/renderer/core/dom/document.idl b/third_party/blink/renderer/core/dom/document.idl index ffde41e..d4d198e 100644 --- a/third_party/blink/renderer/core/dom/document.idl +++ b/third_party/blink/renderer/core/dom/document.idl @@ -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;