Use the new is<>() / downcast<>() for more Node subclasses
https://bugs.webkit.org/show_bug.cgi?id=137184

Reviewed by Ryosuke Niwa.

Use the new is<>() / downcast<>() for more Node subclasses:
CDATASection, CharacterData, Comment, DocumentType,
ProcessingInstruction, and PseudoElement.

No new tests, no behavior change.

* dom/CDATASection.h:
(WebCore::isCDATASection):
* dom/CharacterData.cpp:
(WebCore::CharacterData::setDataAndUpdate):
* dom/CharacterData.h:
(WebCore::isCharacterData):
* dom/Comment.h:
(WebCore::isComment):
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::collectActiveStyleSheets):
* dom/DocumentType.h:
(WebCore::isDocumentType):
* dom/EventDispatcher.cpp:
(WebCore::eventTargetRespectingTargetRules):
(WebCore::nodeOrHostIfPseudoElement):
* dom/Node.cpp:
(WebCore::markAncestorsWithChildNeedsStyleRecalc):
(WebCore::Node::pseudoAwarePreviousSibling):
(WebCore::Node::pseudoAwareNextSibling):
* dom/NodeTraversal.cpp:
(WebCore::NodeTraversal::previousIncludingPseudo):
(WebCore::NodeTraversal::nextIncludingPseudo):
(WebCore::NodeTraversal::nextIncludingPseudoSkippingChildren):
* dom/ProcessingInstruction.h:
(WebCore::isProcessingInstruction):
* dom/PseudoElement.h:
(WebCore::isPseudoElement):
* dom/Range.cpp:
(WebCore::lengthOfContentsInNode):
(WebCore::Range::processContentsBetweenOffsets):
(WebCore::Range::checkNodeWOffset):
* editing/Editor.cpp:
(WebCore::Editor::shouldInsertFragment):
* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::appendStartMarkup):
* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::_traverseNode):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForNode):
* inspector/InspectorLayerTreeAgent.cpp:
(WebCore::InspectorLayerTreeAgent::buildObjectForLayer):
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::setInnerNode):
(WebCore::HitTestResult::setInnerNonSharedNode):
* rendering/RenderListItem.cpp:
(WebCore::enclosingList):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::generatingPseudoHostElement):
* xml/XPathFunctions.cpp:
(WebCore::XPath::expandedNameLocalPart):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
HTMLPlugInElement::isUserObservable() is causing layout
https://bugs.webkit.org/show_bug.cgi?id=137156

Reviewed by Ryosuke Niwa.

While profiling the page load of nytimes.com, I noticed that we were
spending ~4-5% of cpu time in HTMLPlugInElement::isUserObservable().
The reason is that the function calls pluginWidget(), which causes a
layout update in HTMLObjectElement::renderWidgetForJSBindings(), to
make sure the plugin is loaded and its renderer is created.

HTMLPlugInElement::isUserObservable() shouldn't need to do a layout.
This patch does the following to address the problem:
- Rename renderWidgetForJSBindings() to renderWidgetLoadingPlugin()
  because this function is not always called from the JS Bindings
  nowadays. The new name makes it clearer that this will load the
  plugin if needed (to make sure the renderer is created, and by
  doing a layout).
- Add a PluginLoadingPolicy argument to
  HTMLPlugInElement::pluginWidget() to let the caller control if the
  plugin should be loaded or not.
- Update the call to pluginWidget() in isUserObservable() so that
  we do not attempt to load the plugin (thus not causing a layout).

No new tests, no behavior change.

* WebCore.exp.in:
* WebCore.order:
* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::renderWidgetLoadingPlugin):
(WebCore::HTMLAppletElement::renderWidgetForJSBindings): Deleted.
* html/HTMLAppletElement.h:
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::renderWidgetLoadingPlugin):
(WebCore::HTMLEmbedElement::renderWidgetForJSBindings): Deleted.
* html/HTMLEmbedElement.h:
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::renderWidgetLoadingPlugin):
(WebCore::HTMLObjectElement::renderWidgetForJSBindings): Deleted.
* html/HTMLObjectElement.h:
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::pluginWidget):
(WebCore::HTMLPlugInElement::isUserObservable):
* html/HTMLPlugInElement.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174040 268f45cc-cd09-0410-ab3c-d52691b4dbfc