Title: [154927] trunk/Source/WebCore
- Revision
- 154927
- Author
- [email protected]
- Date
- 2013-08-31 07:07:05 -0700 (Sat, 31 Aug 2013)
Log Message
Don't do document style recalc unless there's a RenderView.
<https://webkit.org/b/120558>
Reviewed by Antti Koivisto.
There's no sense in computing style for a Document that has no RenderView.
Checking this before continuing also lets us know that there's a Frame & FrameView
present, simplifying some things later on.
* dom/Document.cpp:
(WebCore::Document::recalcStyle):
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (154926 => 154927)
--- trunk/Source/WebCore/ChangeLog 2013-08-31 13:04:33 UTC (rev 154926)
+++ trunk/Source/WebCore/ChangeLog 2013-08-31 14:07:05 UTC (rev 154927)
@@ -1,3 +1,19 @@
+2013-08-31 Andreas Kling <[email protected]>
+
+ Don't do document style recalc unless there's a RenderView.
+ <https://webkit.org/b/120558>
+
+ Reviewed by Antti Koivisto.
+
+ There's no sense in computing style for a Document that has no RenderView.
+ Checking this before continuing also lets us know that there's a Frame & FrameView
+ present, simplifying some things later on.
+
+ * dom/Document.cpp:
+ (WebCore::Document::recalcStyle):
+ * style/StyleResolveForDocument.cpp:
+ (WebCore::Style::resolveForDocument):
+
2013-08-31 Antti Koivisto <[email protected]>
Add common base for element iterators
Modified: trunk/Source/WebCore/dom/Document.cpp (154926 => 154927)
--- trunk/Source/WebCore/dom/Document.cpp 2013-08-31 13:04:33 UTC (rev 154926)
+++ trunk/Source/WebCore/dom/Document.cpp 2013-08-31 14:07:05 UTC (rev 154927)
@@ -1734,10 +1734,15 @@
void Document::recalcStyle(Style::Change change)
{
- // we should not enter style recalc while painting
ASSERT(!view() || !view()->isPainting());
- if (view() && view()->isPainting())
+
+ // NOTE: XSL code seems to be the only client stumbling in here without a RenderView.
+ if (!m_renderView)
return;
+
+ FrameView& frameView = m_renderView->frameView();
+ if (frameView.isPainting())
+ return;
if (m_inStyleRecalc)
return; // Guard against re-entrancy. -dwh
@@ -1761,16 +1766,9 @@
PostAttachCallbackDisabler disabler(this);
WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
- RefPtr<FrameView> frameView = view();
- if (frameView) {
- frameView->pauseScheduledEvents();
- frameView->beginDeferredRepaints();
- }
+ frameView.pauseScheduledEvents();
+ frameView.beginDeferredRepaints();
- ASSERT(!renderer() || renderArena());
- if (!renderer() || !renderArena())
- goto bailOut;
-
if (m_pendingStyleRecalcShouldForce)
change = Style::Force;
@@ -1782,11 +1780,9 @@
Style::resolveTree(*this, change);
#if USE(ACCELERATED_COMPOSITING)
- if (view())
- view()->updateCompositingLayersAfterStyleChange();
+ frameView.updateCompositingLayersAfterStyleChange();
#endif
- bailOut:
clearNeedsStyleRecalc();
clearChildNeedsStyleRecalc();
unscheduleStyleRecalc();
@@ -1797,10 +1793,8 @@
if (m_styleResolver)
m_styleSheetCollection->resetCSSFeatureFlags();
- if (frameView) {
- frameView->resumeScheduledEvents();
- frameView->endDeferredRepaints();
- }
+ frameView.resumeScheduledEvents();
+ frameView.endDeferredRepaints();
}
// If we wanted to call implicitClose() during recalcStyle, do so now that we're finished.
@@ -1814,8 +1808,8 @@
// As a result of the style recalculation, the currently hovered element might have been
// detached (for example, by setting display:none in the :hover style), schedule another mouseMove event
// to check if any other elements ended up under the mouse pointer due to re-layout.
- if (m_hoveredElement && !m_hoveredElement->renderer() && frame())
- frame()->eventHandler().dispatchFakeMouseMoveEventSoon();
+ if (m_hoveredElement && !m_hoveredElement->renderer())
+ frameView.frame().eventHandler().dispatchFakeMouseMoveEventSoon();
}
void Document::updateStyleIfNeeded()
Modified: trunk/Source/WebCore/style/StyleResolveForDocument.cpp (154926 => 154927)
--- trunk/Source/WebCore/style/StyleResolveForDocument.cpp 2013-08-31 13:04:33 UTC (rev 154926)
+++ trunk/Source/WebCore/style/StyleResolveForDocument.cpp 2013-08-31 14:07:05 UTC (rev 154927)
@@ -49,8 +49,11 @@
PassRefPtr<RenderStyle> resolveForDocument(const Document& document)
{
- Frame* frame = document.frame();
+ if (!document.renderView())
+ return 0;
+ RenderView& renderView = *document.renderView();
+
// HTML5 states that seamless iframes should replace default CSS values
// with values inherited from the containing iframe element. However,
// some values (such as the case of designMode = "on") still need to
@@ -67,8 +70,8 @@
documentStyle->setDisplay(BLOCK);
if (!seamlessWithParent) {
documentStyle->setRTLOrdering(document.visuallyOrdered() ? VisualOrder : LogicalOrder);
- documentStyle->setZoom(frame && !document.printing() ? frame->pageZoomFactor() : 1);
- documentStyle->setPageScaleTransform(frame ? frame->frameScaleFactor() : 1);
+ documentStyle->setZoom(!document.printing() ? renderView.frame().pageZoomFactor() : 1);
+ documentStyle->setPageScaleTransform(renderView.frame().frameScaleFactor());
documentStyle->setLocale(document.contentLanguage());
}
// This overrides any -webkit-user-modify inherited from the parent iframe.
@@ -91,41 +94,34 @@
documentStyle->setDirection(docElementRenderer->style()->direction());
}
- if (frame) {
- if (FrameView* frameView = frame->view()) {
- const Pagination& pagination = frameView->pagination();
- if (pagination.mode != Pagination::Unpaginated) {
- documentStyle->setColumnStylesFromPaginationMode(pagination.mode);
- documentStyle->setColumnGap(pagination.gap);
- if (RenderView* view = document.renderView()) {
- if (view->hasColumns())
- view->updateColumnInfoFromStyle(documentStyle.get());
- }
- }
- }
+ const Pagination& pagination = renderView.frameView().pagination();
+ if (pagination.mode != Pagination::Unpaginated) {
+ documentStyle->setColumnStylesFromPaginationMode(pagination.mode);
+ documentStyle->setColumnGap(pagination.gap);
+ if (renderView.hasColumns())
+ renderView.updateColumnInfoFromStyle(documentStyle.get());
}
// Seamless iframes want to inherit their font from their parent iframe, so early return before setting the font.
if (seamlessWithParent)
return documentStyle.release();
+ const Settings& settings = renderView.frame().settings();
+
FontDescription fontDescription;
fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->locale()));
- if (Settings* settings = document.settings()) {
- fontDescription.setUsePrinterFont(document.printing() || !settings->screenFontSubstitutionEnabled());
- fontDescription.setRenderingMode(settings->fontRenderingMode());
- const AtomicString& standardFont = settings->standardFontFamily(fontDescription.script());
- if (!standardFont.isEmpty()) {
- fontDescription.setGenericFamily(FontDescription::StandardFamily);
- fontDescription.setOneFamily(standardFont);
- }
- fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
- int size = fontSizeForKeyword(CSSValueMedium, false, document);
- fontDescription.setSpecifiedSize(size);
- bool useSVGZoomRules = document.isSVGDocument();
- fontDescription.setComputedSize(computedFontSizeFromSpecifiedSize(size, fontDescription.isAbsoluteSize(), useSVGZoomRules, documentStyle.get(), document));
- } else
- fontDescription.setUsePrinterFont(document.printing());
+ fontDescription.setUsePrinterFont(document.printing() || !settings.screenFontSubstitutionEnabled());
+ fontDescription.setRenderingMode(settings.fontRenderingMode());
+ const AtomicString& standardFont = settings.standardFontFamily(fontDescription.script());
+ if (!standardFont.isEmpty()) {
+ fontDescription.setGenericFamily(FontDescription::StandardFamily);
+ fontDescription.setOneFamily(standardFont);
+ }
+ fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
+ int size = fontSizeForKeyword(CSSValueMedium, false, document);
+ fontDescription.setSpecifiedSize(size);
+ bool useSVGZoomRules = document.isSVGDocument();
+ fontDescription.setComputedSize(computedFontSizeFromSpecifiedSize(size, fontDescription.isAbsoluteSize(), useSVGZoomRules, documentStyle.get(), document));
FontOrientation fontOrientation;
NonCJKGlyphOrientation glyphOrientation;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes