Hang CSSFontSelector off Document instead of StyleResolver.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Jan 2015 18:44:22 +0000 (18:44 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Jan 2015 18:44:22 +0000 (18:44 +0000)
commitdac453abdfb5183c133c07982b235d85f2f2fdd8
tree1284c910609b8b6ecde58d59ba61e0e255ca51b5
parent21fcf10ca0a1982b59ba396d1a018e108cf01ea6
Hang CSSFontSelector off Document instead of StyleResolver.
<https://webkit.org/b/140820>

Reviewed by Antti Koivisto.

Move the CSSFontSelector from StyleResolver to Document. This is the first
step towards making the CSSFontSelector be able to survive full style recalc.

Clearing a Document's StyleResolver will still nuke the CSSFontSelector,
though that is done in Document::clearStyleResolver() now.

* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::CSSFontSelector):
* css/CSSFontSelector.h:

    Modernize CSSFontSelector construction a bit by having create() return
    a Ref and the constructor take a Document& instead of a Document*.
    Also made the constructor explicit.

(WebCore::StyleResolver::~StyleResolver):
* dom/Document.cpp:
(WebCore::Document::clearStyleResolver):

    Nuke the current CSSFontSelector in clearStyleResolver() instead of
    in ~StyleResolver. It's a minor change, but shows the way forward.
    Added a FIXME about how CSSFontSelector should eventually survive
    this operation.

(WebCore::Document::fontSelector):
* css/FontLoader.cpp:
(WebCore::FontLoader::loadFont):
(WebCore::FontLoader::checkFont):
(WebCore::FontLoader::resolveFontStyle):
* css/RuleSet.cpp:
(WebCore::RuleSet::addChildRules):
* css/StyleResolver.h:
(WebCore::StyleResolver::fontSelector): Deleted.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::appendAuthorStyleSheets):
(WebCore::StyleResolver::styleForElement):
(WebCore::StyleResolver::defaultStyleForElement):
(WebCore::StyleResolver::updateFont):
* dom/Document.h:
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setFont):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::updateFromElement):
(WebCore::RenderListBox::paintItemForeground):
* rendering/RenderMenuList.cpp:
(RenderMenuList::fontSelector):
* rendering/RenderSearchField.cpp:
(WebCore::RenderSearchField::fontSelector):
* rendering/TextAutoSizing.cpp:
(WebCore::TextAutoSizingValue::adjustNodeSizes):
(WebCore::TextAutoSizingValue::reset):
* rendering/svg/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):
* style/StyleResolveTree.cpp:
(WebCore::Style::resolveTree):

    Move CSSFontSelector ownership from StyleResolver to Document.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSFontSelector.cpp
Source/WebCore/css/CSSFontSelector.h
Source/WebCore/css/FontLoader.cpp
Source/WebCore/css/RuleSet.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderSearchField.cpp
Source/WebCore/rendering/RenderThemeSafari.cpp
Source/WebCore/rendering/TextAutoSizing.cpp
Source/WebCore/rendering/svg/RenderSVGInlineText.cpp
Source/WebCore/style/StyleResolveForDocument.cpp
Source/WebCore/style/StyleResolveTree.cpp