Commit 55bf8727 authored by mitz@apple.com's avatar mitz@apple.com

<rdar://problem/8007953> Textarea using custom font appears blank

Reviewed by Dave Hyatt.

WebCore: 

Test: fast/css/font-face-in-shadow-DOM.html

When a remote font is loaded, CSSFontSelector forces a style recalc, which replaces all
RenderSyles that have FontFallbackLists referencing the placeholder font with fresh
RenderStyles. However, it does not descend into shadow DOM trees, so those may end up with
styles that still reference the placeholder font.

The fix is to add RenderObject::requiresForcedStyleRecalcPropagation() and have it return
true from renderers that maintain shadow DOM trees or otherwise keep their own RenderStyles.

* dom/Element.cpp:
(WebCore::Element::recalcStyle): Check if forced style recalc needs to propagated.
* rendering/RenderButton.h:
(WebCore::RenderButton::requiresForcedStyleRecalcPropagation):
* rendering/RenderDataGrid.h:
(WebCore::RenderDataGrid::requiresForcedStyleRecalcPropagation):
* rendering/RenderFileUploadControl.h:
(WebCore::RenderFileUploadControl::requiresForcedStyleRecalcPropagation):
* rendering/RenderListItem.h:
(WebCore::RenderListItem::requiresForcedStyleRecalcPropagation):
* rendering/RenderMedia.h:
(WebCore::RenderMedia::requiresForcedStyleRecalcPropagation):
* rendering/RenderMenuList.h:
(WebCore::RenderMenuList::RenderMenuList::requiresForcedStyleRecalcPropagation):
* rendering/RenderObject.h:
(WebCore::RenderObject::requiresForcedStyleRecalcPropagation):
* rendering/RenderProgress.h:
(WebCore::RenderProgress::requiresForcedStyleRecalcPropagation):
* rendering/RenderSlider.h:
(WebCore::RenderSlider::requiresForcedStyleRecalcPropagation):
* rendering/RenderTextControl.h:
(WebCore::RenderTextControl::requiresForcedStyleRecalcPropagation):

LayoutTests: 

* fast/css/font-face-in-shadow-DOM.html: Added.
* platform/mac/fast/css/font-face-in-shadow-DOM-expected.checksum: Added.
* platform/mac/fast/css/font-face-in-shadow-DOM-expected.png: Added.
* platform/mac/fast/css/font-face-in-shadow-DOM-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@59876 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7ec68a55
2010-05-20 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
<rdar://problem/8007953> Textarea using custom font appears blank
* fast/css/font-face-in-shadow-DOM.html: Added.
* platform/mac/fast/css/font-face-in-shadow-DOM-expected.checksum: Added.
* platform/mac/fast/css/font-face-in-shadow-DOM-expected.png: Added.
* platform/mac/fast/css/font-face-in-shadow-DOM-expected.txt: Added.
2010-05-20 Martin Robinson <mrobinson@igalia.com>
Not reviewed.
<style>
/* a descendant rule */
p > p { }
@font-face {
font-family: 'remote';
src: url(resources/Ahem.ttf);
}
</style>
<textarea style="width: 108px; height: 102px; font-family: remote; font-size: 100px; color: green; background-color: red; padding: 0;">A</textarea>
<script>
document.body.offsetTop;
</script>
eca56f5962d9e54fd527a3eb684872b6
\ 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
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
layer at (8,8) size 108x102 clip at (9,9) size 91x100 scrollWidth 106
RenderTextControl {TEXTAREA} at (0,0) size 108x102 [color=#008000] [bgcolor=#FF0000] [border: (1px solid #008000)]
RenderBlock {DIV} at (1,1) size 106x100
RenderText {#text} at (0,0) size 100x100
text run at (0,0) width 100: "A"
2010-05-20 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
<rdar://problem/8007953> Textarea using custom font appears blank
Test: fast/css/font-face-in-shadow-DOM.html
When a remote font is loaded, CSSFontSelector forces a style recalc, which replaces all
RenderSyles that have FontFallbackLists referencing the placeholder font with fresh
RenderStyles. However, it does not descend into shadow DOM trees, so those may end up with
styles that still reference the placeholder font.
The fix is to add RenderObject::requiresForcedStyleRecalcPropagation() and have it return
true from renderers that maintain shadow DOM trees or otherwise keep their own RenderStyles.
* dom/Element.cpp:
(WebCore::Element::recalcStyle): Check if forced style recalc needs to propagated.
* rendering/RenderButton.h:
(WebCore::RenderButton::requiresForcedStyleRecalcPropagation):
* rendering/RenderDataGrid.h:
(WebCore::RenderDataGrid::requiresForcedStyleRecalcPropagation):
* rendering/RenderFileUploadControl.h:
(WebCore::RenderFileUploadControl::requiresForcedStyleRecalcPropagation):
* rendering/RenderListItem.h:
(WebCore::RenderListItem::requiresForcedStyleRecalcPropagation):
* rendering/RenderMedia.h:
(WebCore::RenderMedia::requiresForcedStyleRecalcPropagation):
* rendering/RenderMenuList.h:
(WebCore::RenderMenuList::RenderMenuList::requiresForcedStyleRecalcPropagation):
* rendering/RenderObject.h:
(WebCore::RenderObject::requiresForcedStyleRecalcPropagation):
* rendering/RenderProgress.h:
(WebCore::RenderProgress::requiresForcedStyleRecalcPropagation):
* rendering/RenderSlider.h:
(WebCore::RenderSlider::requiresForcedStyleRecalcPropagation):
* rendering/RenderTextControl.h:
(WebCore::RenderTextControl::requiresForcedStyleRecalcPropagation):
2010-05-20 Jer Noble <jer.noble@apple.com>
No review; build fix only.
......@@ -936,7 +936,7 @@ void Element::recalcStyle(StyleChange change)
newStyle->setChildrenAffectedByDirectAdjacentRules();
}
if (ch != NoChange || pseudoStyleCacheIsInvalid(currentStyle.get(), newStyle.get())) {
if (ch != NoChange || pseudoStyleCacheIsInvalid(currentStyle.get(), newStyle.get()) || change == Force && renderer() && renderer()->requiresForcedStyleRecalcPropagation()) {
setRenderStyle(newStyle);
} else if (needsStyleRecalc() && (styleChangeType() != SyntheticStyleChange) && (document()->usesSiblingRules() || document()->usesDescendantRules())) {
// Although no change occurred, we use the new style so that the cousin style sharing code won't get
......
......@@ -57,12 +57,14 @@ public:
virtual bool canHaveChildren() const;
protected:
private:
virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual bool hasLineIfEmpty() const { return true; }
virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
void timerFired(Timer<RenderButton>*);
RenderTextFragment* m_buttonText;
......
......@@ -53,6 +53,8 @@ public:
private:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
RenderStyle* columnStyle(DataGridColumn*);
RenderStyle* headerStyle(DataGridColumn*);
void recalcStyleForColumns();
......
......@@ -56,6 +56,8 @@ private:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
// FileChooserClient methods.
void valueChanged();
void repaint() { RenderBlock::repaint(); }
......
......@@ -65,6 +65,8 @@ private:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
void updateMarkerLocation();
inline int calcValue() const;
void updateValueNow() const;
......
......@@ -118,6 +118,8 @@ private:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
RefPtr<HTMLElement> m_controlsShadowRoot;
RefPtr<MediaControlElement> m_panel;
RefPtr<MediaControlMuteButtonElement> m_muteButton;
......
......@@ -78,6 +78,8 @@ private:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
// PopupMenuClient methods
virtual String itemText(unsigned listIndex) const;
virtual String itemToolTip(unsigned listIndex) const;
......
......@@ -325,6 +325,8 @@ public:
bool cellWidthChanged() const { return m_cellWidthChanged; }
void setCellWidthChanged(bool b = true) { m_cellWidthChanged = b; }
virtual bool requiresForcedStyleRecalcPropagation() const { return false; }
#if ENABLE(MATHML)
virtual bool isRenderMathMLBlock() const { return false; }
#endif // ENABLE(MATHML)
......@@ -422,7 +424,6 @@ public:
void drawArcForBoxSide(GraphicsContext*, int x, int y, float thickness, IntSize radius, int angleStart,
int angleSpan, BoxSide, Color, EBorderStyle, bool firstCorner);
public:
// The pseudo element style can be cached or uncached. Use the cached method if the pseudo element doesn't respect
// any pseudo classes (and therefore has no concept of changing state).
RenderStyle* getCachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0) const;
......
......@@ -50,6 +50,8 @@ private:
virtual void paint(PaintInfo&, int tx, int ty);
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
void animationTimerFired(Timer<RenderProgress>*);
void updateAnimationState();
void updateValuePartState();
......
......@@ -58,6 +58,8 @@ namespace WebCore {
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
PassRefPtr<RenderStyle> createThumbStyle(const RenderStyle* parentStyle);
int trackSize();
......
......@@ -105,6 +105,8 @@ private:
virtual bool canBeProgramaticallyScrolled(bool) const { return true; }
virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
String finishText(Vector<UChar>&) const;
bool m_wasChangedSinceLastChangeEvent;
......
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