diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-26 11:37:00 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-26 11:36:36 +0100 |
commit | f474b2b60ec57205facd4eec2181ebe69b686772 (patch) | |
tree | 42a132541a82c97039ea8a98b40e5012187ede28 /Source/WebCore/dom/NodeRenderingContext.cpp | |
parent | 061d58bc0fa016cfeed744fd3e4663460635d69b (diff) | |
download | qtwebkit-f474b2b60ec57205facd4eec2181ebe69b686772.tar.gz |
Imported WebKit commit 76dac539db7ece7079963adfcfe878d8e2f7d861 (http://svn.webkit.org/repository/webkit/trunk@135696)
New snapshot that fixes build after QMacStyle removal
Change-Id: Idea95c96c73b49158d52861db2a4b8d2c51766b0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebCore/dom/NodeRenderingContext.cpp')
-rw-r--r-- | Source/WebCore/dom/NodeRenderingContext.cpp | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/Source/WebCore/dom/NodeRenderingContext.cpp b/Source/WebCore/dom/NodeRenderingContext.cpp index 9aeeacfe1..9bbf60aba 100644 --- a/Source/WebCore/dom/NodeRenderingContext.cpp +++ b/Source/WebCore/dom/NodeRenderingContext.cpp @@ -38,9 +38,11 @@ #include "RenderFullScreen.h" #include "RenderNamedFlowThread.h" #include "RenderObject.h" +#include "RenderText.h" #include "RenderView.h" #include "ShadowRoot.h" #include "StyleInheritedData.h" +#include "Text.h" #if ENABLE(SVG) #include "SVGNames.h" @@ -146,11 +148,12 @@ bool NodeRenderingContext::shouldCreateRenderer() const void NodeRenderingContext::moveToFlowThreadIfNeeded() { + ASSERT(m_node->isElementNode()); ASSERT(m_style); if (!m_node->document()->cssRegionsEnabled()) return; - if (!m_node->isElementNode() || m_style->flowThread().isEmpty()) + if (m_style->flowThread().isEmpty()) return; // FIXME: Do not collect elements if they are in shadow tree. @@ -201,21 +204,21 @@ static void adjustInsertionPointForTopLayerElement(Element* element, RenderObjec } #endif -void NodeRenderingContext::createRendererIfNeeded() +void NodeRenderingContext::createRendererForElementIfNeeded() { ASSERT(!m_node->renderer()); + Element* element = toElement(m_node); + if (!shouldCreateRenderer()) return; - Element* element = m_node->isElementNode() ? toElement(m_node) : 0; - - m_style = element ? element->styleForRenderer() : parentRenderer()->style(); + m_style = element->styleForRenderer(); ASSERT(m_style); moveToFlowThreadIfNeeded(); - if (!m_node->rendererIsNeeded(*this)) { - if (element && m_style->affectedByEmpty()) + if (!element->rendererIsNeeded(*this)) { + if (m_style->affectedByEmpty()) element->setStyleAffectedByEmpty(); return; } @@ -223,23 +226,23 @@ void NodeRenderingContext::createRendererIfNeeded() RenderObject* nextRenderer = this->nextRenderer(); #if ENABLE(DIALOG_ELEMENT) - if (element && element->isInTopLayer()) + if (element->isInTopLayer()) adjustInsertionPointForTopLayerElement(element, parentRenderer, nextRenderer); #endif - Document* document = m_node->document(); - RenderObject* newRenderer = m_node->createRenderer(document->renderArena(), m_style.get()); + Document* document = element->document(); + RenderObject* newRenderer = element->createRenderer(document->renderArena(), m_style.get()); if (!newRenderer) return; if (!parentRenderer->isChildAllowed(newRenderer, m_style.get())) { newRenderer->destroy(); return; } - m_node->setRenderer(newRenderer); + element->setRenderer(newRenderer); newRenderer->setAnimatableStyle(m_style.release()); // setAnimatableStyle() can depend on renderer() already being set. #if ENABLE(FULLSCREEN_API) - if (document->webkitIsFullScreen() && document->webkitCurrentFullScreenElement() == m_node) { + if (document->webkitIsFullScreen() && document->webkitCurrentFullScreenElement() == element) { newRenderer = RenderFullScreen::wrapRenderer(newRenderer, parentRenderer, document); if (!newRenderer) return; @@ -249,4 +252,33 @@ void NodeRenderingContext::createRendererIfNeeded() parentRenderer->addChild(newRenderer, nextRenderer); } +void NodeRenderingContext::createRendererForTextIfNeeded() +{ + ASSERT(!m_node->renderer()); + + Text* textNode = toText(m_node); + + if (!shouldCreateRenderer()) + return; + RenderObject* parentRenderer = this->parentRenderer(); + ASSERT(parentRenderer); + m_style = parentRenderer->style(); + + if (!textNode->textRendererIsNeeded(*this)) + return; + Document* document = textNode->document(); + RenderText* newRenderer = textNode->createTextRenderer(document->renderArena(), m_style.get()); + if (!newRenderer) + return; + if (!parentRenderer->isChildAllowed(newRenderer, m_style.get())) { + newRenderer->destroy(); + return; + } + RenderObject* nextRenderer = this->nextRenderer(); + textNode->setRenderer(newRenderer); + // Parent takes care of the animations, no need to call setAnimatableStyle. + newRenderer->setStyle(m_style.release()); + parentRenderer->addChild(newRenderer, nextRenderer); +} + } |