Commit f629f62a authored by hyatt@apple.com's avatar hyatt@apple.com

2008-04-15 David Hyatt <hyatt@apple.com>

        Fix the zoom property so that it works properly with font-size.

        Reviewed by John Sullivan

        Added fast/css/zoom-font-size.html

        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::updateFont):
        (WebCore::CSSStyleSelector::applyProperty):
        (WebCore::CSSStyleSelector::checkForZoomChange):
        * css/CSSStyleSelector.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31920 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 71584c44
<body style="font-size:16px">
All text below should be 32px tall.
<div style="zoom:200%">This text should be 32px tall.</div>
<div style="font-size:32px; zoom:reset">This text should be 32px tall.</div>
<div style="zoom:50%;font-size:64px">This text should be 32px tall.</div>
<div style="font-size:4px; zoom:400%; font-size:8px">This text should be 32px tall.</div>
</body>
961a87ef1ef17e141a8300899e6e7a84
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock (anonymous) at (0,0) size 784x18
RenderText {#text} at (0,0) size 218x18
text run at (0,0) width 218: "All text below should be 32px tall."
RenderBlock {DIV} at (0,18) size 784x37
RenderText {#text} at (0,0) size 373x37
text run at (0,0) width 373: "This text should be 32px tall."
RenderBlock {DIV} at (0,55) size 784x37
RenderText {#text} at (0,0) size 373x37
text run at (0,0) width 373: "This text should be 32px tall."
RenderBlock {DIV} at (0,92) size 784x37
RenderText {#text} at (0,0) size 373x37
text run at (0,0) width 373: "This text should be 32px tall."
RenderBlock {DIV} at (0,129) size 784x37
RenderText {#text} at (0,0) size 373x37
text run at (0,0) width 373: "This text should be 32px tall."
2008-04-15 David Hyatt <hyatt@apple.com>
Fix the zoom property so that it works properly with font-size.
Reviewed by John Sullivan
Added fast/css/zoom-font-size.html
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::updateFont):
(WebCore::CSSStyleSelector::applyProperty):
(WebCore::CSSStyleSelector::checkForZoomChange):
* css/CSSStyleSelector.h:
2008-04-15 Timothy Hatcher <timothy@apple.com>
Fixes the bug where a resource view could still be shown after the inspected
......@@ -1196,6 +1196,7 @@ void CSSStyleSelector::updateFont()
{
checkForTextSizeAdjust();
checkForGenericFamilyChange(m_style, m_parentStyle);
checkForZoomChange(m_style, m_parentStyle);
m_style->font().update(m_fontSelector);
m_fontDirty = false;
}
......@@ -3582,6 +3583,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
if (primitiveValue->getFloatValue())
m_style->setZoom(primitiveValue->getFloatValue());
}
m_fontDirty = true;
return;
}
// shorthand properties
......@@ -4877,6 +4880,17 @@ void CSSStyleSelector::checkForTextSizeAdjust()
m_style->setFontDescription(newFontDescription);
}
void CSSStyleSelector::checkForZoomChange(RenderStyle* style, RenderStyle* parentStyle)
{
if (style->effectiveZoom() == parentStyle->effectiveZoom())
return;
const FontDescription& childFont = style->fontDescription();
FontDescription newFontDescription(childFont);
setFontSize(newFontDescription, childFont.specifiedSize());
style->setFontDescription(newFontDescription);
}
void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderStyle* parentStyle)
{
const FontDescription& childFont = style->fontDescription();
......
......@@ -138,6 +138,7 @@ public:
// This function fixes up the default font size if it detects that the current generic font family has changed. -dwh
void checkForGenericFamilyChange(RenderStyle*, RenderStyle* parentStyle);
void checkForZoomChange(RenderStyle*, RenderStyle* parentStyle);
void checkForTextSizeAdjust();
void adjustRenderStyle(RenderStyle*, Element*);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment