[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
rjw
rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:11:55 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 96296fc3d902f4a94497b3da71c97e9844450ab9
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Dec 6 00:18:57 2002 +0000
Fixed two issues relating to font sizes. Fixes any page
that specifies font size in device independent units, i.e.
www.abcnews.com.
1. Change dpi to 72. Mac OS X does appear to assume 72, not 96!
2. Don't appply DPI adjustments to font selections, instead
normalize values to points. OS X takes care of device scaling.
Reviewed by: gramps
* khtml/css/css_valueimpl.cpp:
(CSSPrimitiveValueImpl::computeLengthFloat):
(CSSPrimitiveValueImpl::computePointFloat):
* khtml/css/css_valueimpl.h:
* khtml/css/cssstyleselector.cpp:
* kwq/KWQPaintDeviceMetrics.mm:
(QPaintDeviceMetrics::logicalDpiY):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2949 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 3b0e7f1..c464116 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,23 @@
+2002-12-05 Richard Williamson <rjw at apple.com>
+
+ Fixed two issues relating to font sizes. Fixes any page
+ that specifies font size in device independent units, i.e.
+ www.abcnews.com.
+
+ 1. Change dpi to 72. Mac OS X does appear to assume 72, not 96!
+ 2. Don't appply DPI adjustments to font selections, instead
+ normalize values to points. OS X takes care of device scaling.
+
+ Reviewed by: gramps
+
+ * khtml/css/css_valueimpl.cpp:
+ (CSSPrimitiveValueImpl::computeLengthFloat):
+ (CSSPrimitiveValueImpl::computePointFloat):
+ * khtml/css/css_valueimpl.h:
+ * khtml/css/cssstyleselector.cpp:
+ * kwq/KWQPaintDeviceMetrics.mm:
+ (QPaintDeviceMetrics::logicalDpiY):
+
2002-12-05 David Hyatt <hyatt at apple.com>
Make sure that blocks with block children compute their
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 3b0e7f1..c464116 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,23 @@
+2002-12-05 Richard Williamson <rjw at apple.com>
+
+ Fixed two issues relating to font sizes. Fixes any page
+ that specifies font size in device independent units, i.e.
+ www.abcnews.com.
+
+ 1. Change dpi to 72. Mac OS X does appear to assume 72, not 96!
+ 2. Don't appply DPI adjustments to font selections, instead
+ normalize values to points. OS X takes care of device scaling.
+
+ Reviewed by: gramps
+
+ * khtml/css/css_valueimpl.cpp:
+ (CSSPrimitiveValueImpl::computeLengthFloat):
+ (CSSPrimitiveValueImpl::computePointFloat):
+ * khtml/css/css_valueimpl.h:
+ * khtml/css/cssstyleselector.cpp:
+ * kwq/KWQPaintDeviceMetrics.mm:
+ (QPaintDeviceMetrics::logicalDpiY):
+
2002-12-05 David Hyatt <hyatt at apple.com>
Make sure that blocks with block children compute their
diff --git a/WebCore/khtml/css/css_valueimpl.cpp b/WebCore/khtml/css/css_valueimpl.cpp
index a30cd98..753c565 100644
--- a/WebCore/khtml/css/css_valueimpl.cpp
+++ b/WebCore/khtml/css/css_valueimpl.cpp
@@ -384,57 +384,107 @@ int CSSPrimitiveValueImpl::computeLength( khtml::RenderStyle *style, QPaintDevic
return ( int ) computeLengthFloat( style, devMetrics );
}
-float CSSPrimitiveValueImpl::computeLengthFloat( khtml::RenderStyle *style, QPaintDeviceMetrics *devMetrics )
+float CSSPrimitiveValueImpl::computeLengthFloat( khtml::RenderStyle *style, QPaintDeviceMetrics *devMetrics)
{
unsigned short type = primitiveType();
float dpiY = 72.; // fallback
if ( devMetrics )
dpiY = devMetrics->logicalDpiY();
- if ( !khtml::printpainter && dpiY < 96 )
- dpiY = 96.;
+ if ( !khtml::printpainter && dpiY < 72 )
+ dpiY = 72.;
float factor = 1.;
switch(type)
{
- case CSSPrimitiveValue::CSS_EMS:
- factor = style->font().pixelSize();
- break;
- case CSSPrimitiveValue::CSS_EXS:
- {
- QFontMetrics fm = style->fontMetrics();
+ case CSSPrimitiveValue::CSS_EMS:
+ factor = style->font().pixelSize();
+ break;
+ case CSSPrimitiveValue::CSS_EXS:
+ {
+ QFontMetrics fm = style->fontMetrics();
#if APPLE_CHANGES
- factor = fm.xHeight();
+ factor = fm.xHeight();
#else
- QRect b = fm.boundingRect('x');
- factor = b.height();
+ QRect b = fm.boundingRect('x');
+ factor = b.height();
#endif
- break;
- }
- case CSSPrimitiveValue::CSS_PX:
- break;
- case CSSPrimitiveValue::CSS_CM:
- factor = dpiY/2.54; //72dpi/(2.54 cm/in)
- break;
- case CSSPrimitiveValue::CSS_MM:
- factor = dpiY/25.4;
- break;
- case CSSPrimitiveValue::CSS_IN:
+ break;
+ }
+ case CSSPrimitiveValue::CSS_PX:
+ break;
+ case CSSPrimitiveValue::CSS_CM:
+ factor = dpiY/2.54; //72dpi/(2.54 cm/in)
+ break;
+ case CSSPrimitiveValue::CSS_MM:
+ factor = dpiY/25.4;
+ break;
+ case CSSPrimitiveValue::CSS_IN:
factor = dpiY;
- break;
- case CSSPrimitiveValue::CSS_PT:
+ break;
+ case CSSPrimitiveValue::CSS_PT:
factor = dpiY/72.;
- break;
- case CSSPrimitiveValue::CSS_PC:
+ break;
+ case CSSPrimitiveValue::CSS_PC:
// 1 pc == 12 pt
factor = dpiY*12./72.;
- break;
- default:
- return -1;
+ break;
+ default:
+ return -1;
}
return getFloatValue(type)*factor;
}
+#ifdef APPLE_CHANGES
+// Compute point equivalent size for each unit type. OS X fonts are all specified in
+// device independent point size, so don't apply DPI corrections.
+float CSSPrimitiveValueImpl::computePointFloat( khtml::RenderStyle *style, QPaintDeviceMetrics *devMetrics)
+{
+ unsigned short type = primitiveType();
+
+ float dpiY = 72.; // fallback
+ if ( devMetrics )
+ dpiY = devMetrics->logicalDpiY();
+ if ( !khtml::printpainter && dpiY < 72 )
+ dpiY = 72.;
+
+ float factor = 1.;
+ switch(type)
+ {
+ case CSSPrimitiveValue::CSS_EMS:
+ factor = style->font().pixelSize();
+ break;
+ case CSSPrimitiveValue::CSS_EXS:
+ {
+ QFontMetrics fm = style->fontMetrics();
+ factor = fm.xHeight();
+ break;
+ }
+ case CSSPrimitiveValue::CSS_PX:
+ factor = 72./dpiY;
+ break;
+ case CSSPrimitiveValue::CSS_CM:
+ factor = 72./2.54; //(2.54 cm/in)
+ break;
+ case CSSPrimitiveValue::CSS_MM:
+ factor = 72./25.4; //(25.4 cm/in)
+ break;
+ case CSSPrimitiveValue::CSS_IN:
+ factor = 72.;
+ break;
+ case CSSPrimitiveValue::CSS_PT:
+ break;
+ case CSSPrimitiveValue::CSS_PC:
+ // 1 pc == 12 pt
+ factor = 12.;
+ break;
+ default:
+ return -1;
+ }
+ return getFloatValue(type)*factor;
+}
+#endif
+
void CSSPrimitiveValueImpl::setFloatValue( unsigned short unitType, float floatValue, int &exceptioncode )
{
exceptioncode = 0;
diff --git a/WebCore/khtml/css/css_valueimpl.h b/WebCore/khtml/css/css_valueimpl.h
index 4040272..acf78f5 100644
--- a/WebCore/khtml/css/css_valueimpl.h
+++ b/WebCore/khtml/css/css_valueimpl.h
@@ -174,7 +174,9 @@ public:
int computeLength( khtml::RenderStyle *style, QPaintDeviceMetrics *devMetrics );
float computeLengthFloat( khtml::RenderStyle *style, QPaintDeviceMetrics *devMetrics );
-
+#ifdef APPLE_CHANGES
+ float computePointFloat( khtml::RenderStyle *style, QPaintDeviceMetrics *devMetrics);
+#endif
// use with care!!!
void setPrimitiveType(unsigned short type) { m_type = type; }
diff --git a/WebCore/khtml/css/cssstyleselector.cpp b/WebCore/khtml/css/cssstyleselector.cpp
index 1f5fb0f..1230979 100644
--- a/WebCore/khtml/css/cssstyleselector.cpp
+++ b/WebCore/khtml/css/cssstyleselector.cpp
@@ -2332,11 +2332,22 @@ void CSSStyleSelector::applyRule( DOM::CSSProperty *prop )
} else {
int type = primitiveValue->primitiveType();
+#ifndef APPLE_CHANGES
if(type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG) {
size = primitiveValue->computeLengthFloat(parentStyle, paintDeviceMetrics);
if (!khtml::printpainter && element && element->getDocument()->view())
size *= element->getDocument()->view()->part()->zoomFactor() / 100.0;
- } else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
+ }
+#else
+ // OS X will always provide device independent font size, so we don't want to adjust
+ // the device indepent sizes.
+ if(type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG) {
+ size = primitiveValue->computePointFloat(parentStyle, paintDeviceMetrics);
+ if (!khtml::printpainter && element && element->getDocument()->view())
+ size *= element->getDocument()->view()->part()->zoomFactor() / 100.0;
+ }
+#endif
+ else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
size = (primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE)
* parentStyle->font().pixelSize()) / 100;
else
diff --git a/WebCore/kwq/KWQPaintDeviceMetrics.mm b/WebCore/kwq/KWQPaintDeviceMetrics.mm
index c486ff2..0e41b48 100644
--- a/WebCore/kwq/KWQPaintDeviceMetrics.mm
+++ b/WebCore/kwq/KWQPaintDeviceMetrics.mm
@@ -33,7 +33,7 @@ QPaintDeviceMetrics::QPaintDeviceMetrics(const QPaintDevice *)
int QPaintDeviceMetrics::logicalDpiY() const
{
- return 96;
+ return 72;
}
int QPaintDeviceMetrics::depth() const
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list