From d76194290e3b67ed971fad440fb77ead65136177 Mon Sep 17 00:00:00 2001 From: "av%netscape.com" Date: Wed, 8 Sep 1999 00:12:26 +0000 Subject: [PATCH] Fixing bug 7509 git-svn-id: svn://10.0.0.236/trunk@46264 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsObjectFrame.cpp | 36 +++++++++++++++++-- .../layout/html/base/src/nsObjectFrame.cpp | 36 +++++++++++++++++-- 2 files changed, 68 insertions(+), 4 deletions(-) diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index d7777ff36f9..00a1f8044dd 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -2068,7 +2068,23 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetWidth(PRUint32 *result) if (NS_OK == rv) { if (*result != 0) - *result = (PRUint32)atol(width); + { + PRUint32 attr = (PRUint32)atol(width); + + if(nsnull == strchr(width, '%')) + *result = attr; + else + { + attr = (attr > 100) ? 100 : attr; + attr = (attr < 0) ? 0 : attr; + + float t2p; + mContext->GetTwipsToPixels(&t2p); + nsRect rect; + mContext->GetVisibleArea(rect); + *result = NSTwipsToIntPixels(attr*rect.width/100, t2p); + } + } else *result = 0; } @@ -2088,7 +2104,23 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetHeight(PRUint32 *result) if (NS_OK == rv) { if (*result != 0) - *result = (PRUint32)atol(height); + { + PRUint32 attr = (PRUint32)atol(height); + + if(nsnull == strchr(height, '%')) + *result = attr; + else + { + attr = (attr > 100) ? 100 : attr; + attr = (attr < 0) ? 0 : attr; + + float t2p; + mContext->GetTwipsToPixels(&t2p); + nsRect rect; + mContext->GetVisibleArea(rect); + *result = NSTwipsToIntPixels(attr*rect.height/100, t2p); + } + } else *result = 0; } diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index d7777ff36f9..00a1f8044dd 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -2068,7 +2068,23 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetWidth(PRUint32 *result) if (NS_OK == rv) { if (*result != 0) - *result = (PRUint32)atol(width); + { + PRUint32 attr = (PRUint32)atol(width); + + if(nsnull == strchr(width, '%')) + *result = attr; + else + { + attr = (attr > 100) ? 100 : attr; + attr = (attr < 0) ? 0 : attr; + + float t2p; + mContext->GetTwipsToPixels(&t2p); + nsRect rect; + mContext->GetVisibleArea(rect); + *result = NSTwipsToIntPixels(attr*rect.width/100, t2p); + } + } else *result = 0; } @@ -2088,7 +2104,23 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetHeight(PRUint32 *result) if (NS_OK == rv) { if (*result != 0) - *result = (PRUint32)atol(height); + { + PRUint32 attr = (PRUint32)atol(height); + + if(nsnull == strchr(height, '%')) + *result = attr; + else + { + attr = (attr > 100) ? 100 : attr; + attr = (attr < 0) ? 0 : attr; + + float t2p; + mContext->GetTwipsToPixels(&t2p); + nsRect rect; + mContext->GetVisibleArea(rect); + *result = NSTwipsToIntPixels(attr*rect.height/100, t2p); + } + } else *result = 0; }