summaryrefslogtreecommitdiffstats
path: root/WebCore/css
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-04-27 16:23:55 +0100
committerSteve Block <steveblock@google.com>2010-04-27 17:07:03 +0100
commit692e5dbf12901edacf14812a6fae25462920af42 (patch)
treed62802373a429e0a9dc093b6046c166b2c514285 /WebCore/css
parente24bea4efef1c414137d36a9778aa4e142e10c7d (diff)
downloadexternal_webkit-692e5dbf12901edacf14812a6fae25462920af42.zip
external_webkit-692e5dbf12901edacf14812a6fae25462920af42.tar.gz
external_webkit-692e5dbf12901edacf14812a6fae25462920af42.tar.bz2
Merge webkit.org at r55033 : Initial merge by git
Change-Id: I98a4af828067cc243ec3dc5e5826154dd88074b5
Diffstat (limited to 'WebCore/css')
-rw-r--r--WebCore/css/CSSStyleSelector.cpp36
-rw-r--r--WebCore/css/CSSStyleSelector.h2
-rw-r--r--WebCore/css/SVGCSSStyleSelector.cpp11
-rw-r--r--WebCore/css/mediaControlsGtk.css2
4 files changed, 33 insertions, 18 deletions
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index 8f00d2a..f7f2707 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -1119,7 +1119,8 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document)
fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
int size = CSSStyleSelector::fontSizeForKeyword(document, CSSValueMedium, false);
fontDescription.setSpecifiedSize(size);
- fontDescription.setComputedSize(CSSStyleSelector::getComputedSizeFromSpecifiedSize(document, fontDescription.isAbsoluteSize(), size, documentStyle->effectiveZoom()));
+ bool useSVGZoomRules = document->isSVGDocument();
+ fontDescription.setComputedSize(CSSStyleSelector::getComputedSizeFromSpecifiedSize(document, documentStyle.get(), fontDescription.isAbsoluteSize(), size, useSVGZoomRules));
}
documentStyle->setFontDescription(fontDescription);
@@ -2983,6 +2984,16 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
float zoomFactor = m_style->effectiveZoom();
+ // SVG handles zooming in a different way compared to CSS. The whole document is scaled instead
+ // of each individual length value in the render style / tree. CSSPrimitiveValue::computeLength*()
+ // multiplies each resolved length with the zoom multiplier - so for SVG we need to disable that.
+ // Though all CSS values that can be applied to outermost <svg> elements (width/height/border/padding...)
+ // need to respect the scaling. RenderBox (the parent class of RenderSVGRoot) grabs values like
+ // width/height/border/padding/... from the RenderStyle -> for SVG these values would never scale,
+ // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1.0 for specific
+ // properties that are NOT allowed to scale within a zoomed SVG document (letter/word-spacing/font-size).
+ bool useSVGZoomRules = m_element && m_element->isSVGElement();
+
Length l;
bool apply = false;
@@ -3624,7 +3635,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
} else {
if (!primitiveValue)
return;
- width = primitiveValue->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
+ width = primitiveValue->computeLengthInt(style(), m_rootElementStyle, useSVGZoomRules ? 1.0f : zoomFactor);
}
switch (id) {
case CSSPropertyLetterSpacing:
@@ -4034,7 +4045,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
if (primitiveValue->getIdent() == CSSValueNormal)
lineHeight = Length(-100.0, Percent);
else if (CSSPrimitiveValue::isUnitTypeLength(type)) {
- double multiplier = m_style->effectiveZoom();
+ double multiplier = zoomFactor;
if (m_style->textSizeAdjust() && m_checker.m_document->frame() && m_checker.m_document->frame()->shouldApplyTextZoom())
multiplier *= m_checker.m_document->frame()->textZoomFactor();
lineHeight = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, multiplier), Fixed);
@@ -4516,7 +4527,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
fontDescription.setUsePrinterFont(m_checker.m_document->printing());
// Handle the zoom factor.
- fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(m_checker.m_document, fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), m_style->effectiveZoom()));
+ fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(m_checker.m_document, m_style.get(), fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), useSVGZoomRules));
if (m_style->setFontDescription(fontDescription))
m_fontDirty = true;
}
@@ -5868,11 +5879,20 @@ void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderSty
void CSSStyleSelector::setFontSize(FontDescription& fontDescription, float size)
{
fontDescription.setSpecifiedSize(size);
- fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(m_checker.m_document, fontDescription.isAbsoluteSize(), size, m_style->effectiveZoom()));
+
+ bool useSVGZoomRules = m_element && m_element->isSVGElement();
+ fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(m_checker.m_document, m_style.get(), fontDescription.isAbsoluteSize(), size, useSVGZoomRules));
}
-float CSSStyleSelector::getComputedSizeFromSpecifiedSize(Document* document, bool isAbsoluteSize, float specifiedSize, float zoomFactor)
+float CSSStyleSelector::getComputedSizeFromSpecifiedSize(Document* document, RenderStyle* style, bool isAbsoluteSize, float specifiedSize, bool useSVGZoomRules)
{
+ float zoomFactor = 1.0f;
+ if (!useSVGZoomRules) {
+ zoomFactor = style->effectiveZoom();
+ if (document->frame() && document->frame()->shouldApplyTextZoom())
+ zoomFactor *= document->frame()->textZoomFactor();
+ }
+
// We support two types of minimum font size. The first is a hard override that applies to
// all fonts. This is "minSize." The second type of minimum font size is a "smart minimum"
// that is applied only when the Web page can't know what size it really asked for, e.g.,
@@ -5889,10 +5909,6 @@ float CSSStyleSelector::getComputedSizeFromSpecifiedSize(Document* document, boo
int minSize = settings->minimumFontSize();
int minLogicalSize = settings->minimumLogicalFontSize();
-
- if (document->frame() && document->frame()->shouldApplyTextZoom())
- zoomFactor *= document->frame()->textZoomFactor();
-
float zoomedSize = specifiedSize * zoomFactor;
// Apply the hard minimum first. We only apply the hard minimum if after zooming we're still too small.
diff --git a/WebCore/css/CSSStyleSelector.h b/WebCore/css/CSSStyleSelector.h
index aac1bae..644051c 100644
--- a/WebCore/css/CSSStyleSelector.h
+++ b/WebCore/css/CSSStyleSelector.h
@@ -131,7 +131,7 @@ public:
void applyPropertyToStyle(int id, CSSValue*, RenderStyle*);
private:
- static float getComputedSizeFromSpecifiedSize(Document*, bool isAbsoluteSize, float specifiedSize, float zoomFactor = 1.0f);
+ static float getComputedSizeFromSpecifiedSize(Document*, RenderStyle*, bool isAbsoluteSize, float specifiedSize, bool useSVGZoomRules);
public:
Color getColorFromPrimitiveValue(CSSPrimitiveValue*);
diff --git a/WebCore/css/SVGCSSStyleSelector.cpp b/WebCore/css/SVGCSSStyleSelector.cpp
index 5ba7344..5651a0a 100644
--- a/WebCore/css/SVGCSSStyleSelector.cpp
+++ b/WebCore/css/SVGCSSStyleSelector.cpp
@@ -534,14 +534,12 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
if (!value->isValueList())
return;
- float zoomFactor = m_style->effectiveZoom();
-
CSSValueList *list = static_cast<CSSValueList*>(value);
ASSERT(list->length() == 1);
ShadowValue* item = static_cast<ShadowValue*>(list->itemWithoutBoundsCheck(0));
- int x = item->x->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
- int y = item->y->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
- int blur = item->blur ? item->blur->computeLengthInt(style(), m_rootElementStyle, zoomFactor) : 0;
+ int x = item->x->computeLengthInt(style(), m_rootElementStyle);
+ int y = item->y->computeLengthInt(style(), m_rootElementStyle);
+ int blur = item->blur ? item->blur->computeLengthInt(style(), m_rootElementStyle) : 0;
Color color;
if (item->color)
color = getColorFromPrimitiveValue(item->color.get());
@@ -564,5 +562,4 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
}
-// vim:ts=4:noet
-#endif // ENABLE(SVG)
+#endif
diff --git a/WebCore/css/mediaControlsGtk.css b/WebCore/css/mediaControlsGtk.css
index 8e98ab1..cc6da14 100644
--- a/WebCore/css/mediaControlsGtk.css
+++ b/WebCore/css/mediaControlsGtk.css
@@ -41,6 +41,8 @@ audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-bu
audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls-timeline-container {
height: 20px;
+ border-left: 1px solid rgba(255, 255, 255, 0.2);
+ border-right: 1px solid rgba(255, 255, 255, 0.2);
}
audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {