Diff
Modified: trunk/Source/WebCore/ChangeLog (210435 => 210436)
--- trunk/Source/WebCore/ChangeLog 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/ChangeLog 2017-01-06 14:05:29 UTC (rev 210436)
@@ -1,3 +1,140 @@
+2017-01-06 Andreas Kling <[email protected]>
+
+ Give RenderObject a Page& getter.
+ <https://webkit.org/b/166735>
+
+ Reviewed by Darin Adler.
+
+ The render tree should now only ever be live while in a Frame that's connected to a Page.
+ Hence we can give RenderObject a Page& getter and simplify a lot of code that previously
+ had to get the Page from Document (or Frame) and perform null checks on it.
+
+ * dom/Document.cpp:
+ (WebCore::Document::destroyRenderTree): Assert that the Page is present when we tear the render tree down.
+
+ * page/Frame.cpp:
+ (WebCore::Frame::willDetachPage): Assert that there's no render tree when we're about to detach from the Page.
+ Also added a comment explaining the two main ways that render trees die.
+
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::page): Added. So neat!
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::estimatedLoadingProgress):
+ * rendering/ImageQualityController.cpp:
+ (WebCore::ImageQualityController::chooseInterpolationQuality):
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paint):
+ * rendering/RenderAttachment.cpp:
+ (WebCore::RenderAttachment::layout):
+ (WebCore::RenderAttachment::baselinePosition):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::paintCaret):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::styleDidChange):
+ (WebCore::setupWheelEventTestTrigger):
+ (WebCore::RenderBox::setScrollLeft):
+ (WebCore::RenderBox::setScrollTop):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::paintFocusRing):
+ * rendering/RenderEmbeddedObject.cpp:
+ (WebCore::shouldUnavailablePluginMessageBeButton):
+ (WebCore::RenderEmbeddedObject::paint):
+ (WebCore::RenderEmbeddedObject::paintReplaced):
+ (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
+ (WebCore::RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent):
+ (WebCore::RenderEmbeddedObject::getCursor):
+ * rendering/RenderHTMLCanvas.cpp:
+ (WebCore::RenderHTMLCanvas::paintReplaced):
+ * rendering/RenderIFrame.cpp:
+ (WebCore::RenderIFrame::flattenFrame):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::paintReplaced):
+ (WebCore::RenderImage::paintAreaElementFocusRing):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::~RenderLayer):
+ (WebCore::RenderLayer::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
+ (WebCore::RenderLayer::scrollRectToVisible):
+ (WebCore::RenderLayer::isActive):
+ (WebCore::RenderLayer::didStartScroll):
+ (WebCore::RenderLayer::didEndScroll):
+ (WebCore::RenderLayer::didUpdateScroll):
+ (WebCore::RenderLayer::createScrollbar):
+ (WebCore::RenderLayer::setupFontSubpixelQuantization):
+ (WebCore::RenderLayer::calculateClipRects):
+ * rendering/RenderLayer.h:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::RenderLayerBacking):
+ (WebCore::RenderLayerBacking::createGraphicsLayer):
+ (WebCore::RenderLayerBacking::updateOverflowControlsLayers):
+ (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
+ (WebCore::RenderLayerBacking::paintContents):
+ (WebCore::RenderLayerBacking::shouldAggressivelyRetainTiles):
+ (WebCore::RenderLayerBacking::shouldTemporarilyRetainTileCohorts):
+ (WebCore::RenderLayerBacking::useGiantTiles):
+ (WebCore::RenderLayerBacking::verifyNotPainting):
+ (WebCore::RenderLayerBacking::startAnimation):
+ (WebCore::scrollingCoordinatorFromLayer): Deleted.
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
+ (WebCore::RenderLayerCompositor::scheduleLayerFlushNow):
+ (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
+ (WebCore::updateScrollingLayerWithClient):
+ (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush):
+ (WebCore::RenderLayerCompositor::notifyFlushBeforeDisplayRefresh):
+ (WebCore::RenderLayerCompositor::layerTiledBackingUsageChanged):
+ (WebCore::RenderLayerCompositor::updateCompositingLayers):
+ (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
+ (WebCore::RenderLayerCompositor::layerBecameNonComposited):
+ (WebCore::RenderLayerCompositor::updateBacking):
+ (WebCore::RenderLayerCompositor::pageScaleFactor):
+ (WebCore::RenderLayerCompositor::zoomedOutPageScaleFactor):
+ (WebCore::RenderLayerCompositor::contentsScaleMultiplierForNewTiles):
+ (WebCore::RenderLayerCompositor::updateLayerForHeader):
+ (WebCore::RenderLayerCompositor::updateLayerForFooter):
+ (WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor):
+ (WebCore::RenderLayerCompositor::attachRootLayer):
+ (WebCore::RenderLayerCompositor::detachRootLayer):
+ (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
+ (WebCore::RenderLayerCompositor::registerAllScrollingLayers):
+ (WebCore::RenderLayerCompositor::scrollingCoordinator):
+ (WebCore::RenderLayerCompositor::graphicsLayerFactory):
+ (WebCore::RenderLayerCompositor::createDisplayRefreshMonitor):
+ (WebCore::RenderLayerCompositor::page):
+ * rendering/RenderLayerCompositor.h:
+ * rendering/RenderListBox.cpp:
+ (WebCore::setupWheelEventTestTrigger):
+ (WebCore::RenderListBox::setScrollTop):
+ (WebCore::RenderListBox::isActive):
+ (WebCore::RenderListBox::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
+ (WebCore::RenderListBox::createScrollbar):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::theme):
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::page):
+ * rendering/RenderSearchField.cpp:
+ (WebCore::RenderSearchField::addSearchResult):
+ (WebCore::RenderSearchField::showPopup):
+ (WebCore::RenderSearchField::valueChanged):
+ * rendering/RenderSnapshottedPlugIn.cpp:
+ (WebCore::RenderSnapshottedPlugIn::updateSnapshot):
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::paint):
+ (WebCore::RenderTheme::updateControlStatesForRenderer):
+ (WebCore::RenderTheme::isActive):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
+ (WebCore::RenderThemeMac::paintSliderThumb):
+ * rendering/RenderVideo.cpp:
+ (WebCore::RenderVideo::paintReplaced):
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::pageNumberForBlockProgressionOffset):
+ (WebCore::RenderView::pageCount):
+ * rendering/svg/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::paintReplaced):
+ * style/StyleResolveForDocument.cpp:
+ (WebCore::Style::resolveForDocument):
+
2017-01-05 Zalan Bujtas <[email protected]>
TextFragmentIterator::runWidth does not need typename CharacterType<> anymore.
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (210435 => 210436)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -1421,11 +1421,7 @@
if (isLoaded())
return 1.0;
- Page* page = m_renderer->document().page();
- if (!page)
- return 0;
-
- return page->progress().estimatedProgress();
+ return m_renderer->page().progress().estimatedProgress();
}
int AccessibilityRenderObject::layoutCount() const
Modified: trunk/Source/WebCore/dom/Document.cpp (210435 => 210436)
--- trunk/Source/WebCore/dom/Document.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/dom/Document.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -2195,6 +2195,8 @@
void Document::destroyRenderTree()
{
ASSERT(hasLivingRenderTree());
+ ASSERT(frame());
+ ASSERT(page());
// Prevent Widget tree changes from committing until the RenderView is dead and gone.
WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
Modified: trunk/Source/WebCore/page/Frame.cpp (210435 => 210436)
--- trunk/Source/WebCore/page/Frame.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/page/Frame.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -787,6 +787,17 @@
script().clearScriptObjects();
script().updatePlatformScriptObjects();
+
+ // We promise that the Frame is always connected to a Page while the render tree is live.
+ //
+ // The render tree can be torn down in a few different ways, but the two important ones are:
+ //
+ // - When calling Frame::setView() with a null FrameView*. This is always done before calling
+ // Frame::willDetachPage (this function.) Hence the assertion below.
+ //
+ // - When adding a document to the page cache, the tree is torn down before instantiating
+ // the CachedPage+CachedFrame object tree.
+ ASSERT(!document() || !document()->renderView());
}
void Frame::disconnectOwnerElement()
Modified: trunk/Source/WebCore/rendering/ImageQualityController.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/ImageQualityController.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/ImageQualityController.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -161,7 +161,7 @@
}
// There is no need to hash scaled images that always use low quality mode when the page demands it. This is the iChat case.
- if (m_renderView.frame().page()->inLowQualityImageInterpolationMode()) {
+ if (m_renderView.page().inLowQualityImageInterpolationMode()) {
double totalPixels = static_cast<double>(image.width()) * static_cast<double>(image.height());
if (totalPixels > cInterpolationCutoff)
return InterpolationLow;
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -497,14 +497,12 @@
paintSelection(context, boxOrigin, lineStyle, font, selectionPaintStyle.fillColor);
}
- if (Page* page = renderer().frame().page()) {
- // FIXME: Right now, InlineTextBoxes never call addRelevantUnpaintedObject() even though they might
- // legitimately be unpainted if they are waiting on a slow-loading web font. We should fix that, and
- // when we do, we will have to account for the fact the InlineTextBoxes do not always have unique
- // renderers and Page currently relies on each unpainted object having a unique renderer.
- if (paintInfo.phase == PaintPhaseForeground)
- page->addRelevantRepaintedObject(&renderer(), IntRect(boxOrigin.x(), boxOrigin.y(), logicalWidth(), logicalHeight()));
- }
+ // FIXME: Right now, InlineTextBoxes never call addRelevantUnpaintedObject() even though they might
+ // legitimately be unpainted if they are waiting on a slow-loading web font. We should fix that, and
+ // when we do, we will have to account for the fact the InlineTextBoxes do not always have unique
+ // renderers and Page currently relies on each unpainted object having a unique renderer.
+ if (paintInfo.phase == PaintPhaseForeground)
+ renderer().page().addRelevantRepaintedObject(&renderer(), IntRect(boxOrigin.x(), boxOrigin.y(), logicalWidth(), logicalHeight()));
// 2. Now paint the foreground, including text and decorations like underline/overline (in quirks mode only).
String alternateStringToRender;
Modified: trunk/Source/WebCore/rendering/RenderAttachment.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderAttachment.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderAttachment.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -53,7 +53,7 @@
void RenderAttachment::layout()
{
- LayoutSize newIntrinsicSize = document().page()->theme().attachmentIntrinsicSize(*this);
+ LayoutSize newIntrinsicSize = theme().attachmentIntrinsicSize(*this);
m_minimumIntrinsicWidth = std::max(m_minimumIntrinsicWidth, newIntrinsicSize.width());
newIntrinsicSize.setWidth(m_minimumIntrinsicWidth);
setIntrinsicSize(newIntrinsicSize);
@@ -69,7 +69,7 @@
int RenderAttachment::baselinePosition(FontBaseline, bool, LineDirectionMode, LinePositionMode) const
{
- return document().page()->theme().attachmentBaseline(*this);
+ return theme().attachmentBaseline(*this);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -1643,8 +1643,8 @@
caretPainter = frame().selection().caretRendererWithoutUpdatingLayout();
isContentEditable = frame().selection().selection().hasEditableStyle();
} else {
- caretPainter = frame().page()->dragCaretController().caretRenderer();
- isContentEditable = frame().page()->dragCaretController().isContentEditable();
+ caretPainter = page().dragCaretController().caretRenderer();
+ isContentEditable = page().dragCaretController().isContentEditable();
}
if (caretPainter == this && (isContentEditable || caretBrowsing)) {
@@ -1651,7 +1651,7 @@
if (type == CursorCaret)
frame().selection().paintCaret(paintInfo.context(), paintOffset, paintInfo.rect);
else
- frame().page()->dragCaretController().paintDragCaret(&frame(), paintInfo.context(), paintOffset, paintInfo.rect);
+ page().dragCaretController().paintDragCaret(&frame(), paintInfo.context(), paintOffset, paintInfo.rect);
}
}
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -435,7 +435,7 @@
if (rootStyleChanged && is<RenderBlockFlow>(rootRenderer) && downcast<RenderBlockFlow>(*rootRenderer).multiColumnFlowThread())
downcast<RenderBlockFlow>(*rootRenderer).updateStylesForColumnChildren();
- if (isBodyRenderer && pagination.mode != Pagination::Unpaginated && frame().page()->paginationLineGridEnabled()) {
+ if (isBodyRenderer && pagination.mode != Pagination::Unpaginated && page().paginationLineGridEnabled()) {
// Propagate the body font back up to the RenderView and use it as
// the basis of the grid.
if (newStyle.fontDescription() != view().style().fontDescription()) {
@@ -599,16 +599,12 @@
return hasOverflowClip() && layer() ? layer()->scrollPosition().y() : 0;
}
-static void setupWheelEventTestTrigger(RenderLayer& layer, Frame* frame)
+static void setupWheelEventTestTrigger(RenderLayer& layer)
{
- if (!frame)
+ Page& page = layer.renderer().page();
+ if (!page.expectsWheelEventTriggers())
return;
-
- Page* page = frame->page();
- if (!page || !page->expectsWheelEventTriggers())
- return;
-
- layer.scrollAnimator().setWheelEventTestTrigger(page->testTrigger());
+ layer.scrollAnimator().setWheelEventTestTrigger(page.testTrigger());
}
void RenderBox::setScrollLeft(int newLeft)
@@ -615,7 +611,7 @@
{
if (!hasOverflowClip() || !layer())
return;
- setupWheelEventTestTrigger(*layer(), document().frame());
+ setupWheelEventTestTrigger(*layer());
layer()->scrollToXPosition(newLeft, RenderLayer::ScrollOffsetClamped);
}
@@ -623,7 +619,7 @@
{
if (!hasOverflowClip() || !layer())
return;
- setupWheelEventTestTrigger(*layer(), document().frame());
+ setupWheelEventTestTrigger(*layer());
layer()->scrollToYPosition(newTop, RenderLayer::ScrollOffsetClamped);
}
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -2034,11 +2034,11 @@
for (auto rect : pixelSnappedFocusRingRects)
path.addRect(rect);
}
- paintInfo.context().drawFocusRing(path, document().page()->focusController().timeSinceFocusWasSet(), needsRepaint);
+ paintInfo.context().drawFocusRing(path, page().focusController().timeSinceFocusWasSet(), needsRepaint);
} else
- paintInfo.context().drawFocusRing(pixelSnappedFocusRingRects, document().page()->focusController().timeSinceFocusWasSet(), needsRepaint);
+ paintInfo.context().drawFocusRing(pixelSnappedFocusRingRects, page().focusController().timeSinceFocusWasSet(), needsRepaint);
if (needsRepaint)
- document().page()->focusController().setFocusedElementNeedsRepaint();
+ page().focusController().setFocusedElementNeedsRepaint();
#else
paintInfo.context().drawFocusRing(pixelSnappedFocusRingRects, style.outlineWidth(), style.outlineOffset(), style.visitedDependentColor(CSSPropertyOutlineColor));
#endif
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -155,10 +155,9 @@
}
#endif
-static bool shouldUnavailablePluginMessageBeButton(Document& document, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason)
+static bool shouldUnavailablePluginMessageBeButton(Page& page, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason)
{
- Page* page = document.page();
- return page && page->chrome().client().shouldUnavailablePluginMessageBeButton(pluginUnavailabilityReason);
+ return page.chrome().client().shouldUnavailablePluginMessageBeButton(pluginUnavailabilityReason);
}
void RenderEmbeddedObject::setPluginUnavailabilityReason(PluginUnavailabilityReason pluginUnavailabilityReason)
@@ -239,20 +238,18 @@
void RenderEmbeddedObject::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- Page* page = frame().page();
-
// The relevant repainted object heuristic is not tuned for plugin documents.
- bool countsTowardsRelevantObjects = page && !document().isPluginDocument() && paintInfo.phase == PaintPhaseForeground;
+ bool countsTowardsRelevantObjects = !document().isPluginDocument() && paintInfo.phase == PaintPhaseForeground;
if (isPluginUnavailable()) {
if (countsTowardsRelevantObjects)
- page->addRelevantUnpaintedObject(this, visualOverflowRect());
+ page().addRelevantUnpaintedObject(this, visualOverflowRect());
RenderReplaced::paint(paintInfo, paintOffset);
return;
}
if (countsTowardsRelevantObjects)
- page->addRelevantRepaintedObject(this, visualOverflowRect());
+ page().addRelevantRepaintedObject(this, visualOverflowRect());
RenderWidget::paint(paintInfo, paintOffset);
}
@@ -325,7 +322,7 @@
context.setFillColor(replacementTextColor());
context.drawBidiText(font, run, FloatPoint(labelX, labelY));
- if (shouldUnavailablePluginMessageBeButton(document(), m_pluginUnavailabilityReason)) {
+ if (shouldUnavailablePluginMessageBeButton(page(), m_pluginUnavailabilityReason)) {
arrowRect.inflate(-replacementArrowCirclePadding);
context.beginTransparencyLayer(1.0);
@@ -349,7 +346,7 @@
bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, FloatRect& indicatorRect, FloatRect& replacementTextRect, FloatRect& arrowRect, FontCascade& font, TextRun& run, float& textWidth) const
{
- bool includesArrow = shouldUnavailablePluginMessageBeButton(document(), m_pluginUnavailabilityReason);
+ bool includesArrow = shouldUnavailablePluginMessageBeButton(page(), m_pluginUnavailabilityReason);
contentRect = contentBoxRect();
contentRect.moveBy(roundedIntPoint(accumulatedOffset));
@@ -596,7 +593,7 @@
void RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent(Event* event)
{
- if (!shouldUnavailablePluginMessageBeButton(document(), m_pluginUnavailabilityReason))
+ if (!shouldUnavailablePluginMessageBeButton(page(), m_pluginUnavailabilityReason))
return;
if (!is<MouseEvent>(*event))
@@ -620,8 +617,7 @@
setUnavailablePluginIndicatorIsPressed(false);
}
if (m_mouseDownWasInUnavailablePluginIndicator && isInUnavailablePluginIndicator(mouseEvent)) {
- if (Page* page = document().page())
- page->chrome().client().unavailablePluginButtonClicked(&element, m_pluginUnavailabilityReason);
+ page().chrome().client().unavailablePluginButtonClicked(&element, m_pluginUnavailabilityReason);
}
m_mouseDownWasInUnavailablePluginIndicator = false;
event->setDefaultHandled();
@@ -634,7 +630,7 @@
CursorDirective RenderEmbeddedObject::getCursor(const LayoutPoint& point, Cursor& cursor) const
{
- if (showsUnavailablePluginIndicator() && shouldUnavailablePluginMessageBeButton(document(), m_pluginUnavailabilityReason) && isInUnavailablePluginIndicator(point)) {
+ if (showsUnavailablePluginIndicator() && shouldUnavailablePluginMessageBeButton(page(), m_pluginUnavailabilityReason) && isInUnavailablePluginIndicator(point)) {
cursor = handCursor();
return SetCursor;
}
Modified: trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -80,10 +80,8 @@
if (clip)
paintInfo.context().clip(snappedIntRect(contentBoxRect));
- if (Page* page = frame().page()) {
- if (paintInfo.phase == PaintPhaseForeground)
- page->addRelevantRepaintedObject(this, intersection(replacedContentRect, contentBoxRect));
- }
+ if (paintInfo.phase == PaintPhaseForeground)
+ page().addRelevantRepaintedObject(this, intersection(replacedContentRect, contentBoxRect));
InterpolationQualityMaintainer interpolationMaintainer(context, ImageQualityController::interpolationQualityFromStyle(style()));
canvasElement().paint(context, replacedContentRect);
Modified: trunk/Source/WebCore/rendering/RenderIFrame.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderIFrame.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderIFrame.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -72,11 +72,9 @@
bool RenderIFrame::flattenFrame() const
{
- Frame* frame = iframeElement().document().frame();
+ bool enabled = frame().settings().frameFlatteningEnabled();
- bool enabled = frame && frame->settings().frameFlatteningEnabled();
-
- if (!enabled || !frame->page())
+ if (!enabled)
return false;
if (style().width().isFixed() && style().height().isFixed()) {
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -361,14 +361,12 @@
GraphicsContext& context = paintInfo.context();
float deviceScaleFactor = document().deviceScaleFactor();
- Page* page = frame().page();
-
if (!imageResource().hasImage() || imageResource().errorOccurred()) {
if (paintInfo.phase == PaintPhaseSelection)
return;
- if (page && paintInfo.phase == PaintPhaseForeground)
- page->addRelevantUnpaintedObject(this, visualOverflowRect());
+ if (paintInfo.phase == PaintPhaseForeground)
+ page().addRelevantUnpaintedObject(this, visualOverflowRect());
if (cWidth > 2 && cHeight > 2) {
LayoutUnit borderWidth = LayoutUnit(1 / deviceScaleFactor);
@@ -434,8 +432,8 @@
} else if (imageResource().hasImage() && cWidth > 0 && cHeight > 0) {
RefPtr<Image> img = imageResource().image(cWidth, cHeight);
if (!img || img->isNull()) {
- if (page && paintInfo.phase == PaintPhaseForeground)
- page->addRelevantUnpaintedObject(this, visualOverflowRect());
+ if (paintInfo.phase == PaintPhaseForeground)
+ page().addRelevantUnpaintedObject(this, visualOverflowRect());
return;
}
@@ -450,14 +448,14 @@
paintIntoRect(context, snapRectToDevicePixels(replacedContentRect, deviceScaleFactor));
- if (cachedImage() && page && paintInfo.phase == PaintPhaseForeground) {
+ if (cachedImage() && paintInfo.phase == PaintPhaseForeground) {
// For now, count images as unpainted if they are still progressively loading. We may want
// to refine this in the future to account for the portion of the image that has painted.
LayoutRect visibleRect = intersection(replacedContentRect, contentBoxRect);
if (cachedImage()->isLoading())
- page->addRelevantUnpaintedObject(this, visibleRect);
+ page().addRelevantUnpaintedObject(this, visibleRect);
else
- page->addRelevantRepaintedObject(this, visibleRect);
+ page().addRelevantRepaintedObject(this, visibleRect);
}
}
}
@@ -482,9 +480,6 @@
if (paintInfo.context().paintingDisabled() && !paintInfo.context().updatingControlTints())
return;
- if (!document().page())
- return;
-
Element* focusedElement = document().focusedElement();
if (!is<HTMLAreaElement>(focusedElement))
return;
@@ -517,9 +512,9 @@
#if PLATFORM(MAC)
bool needsRepaint;
- paintInfo.context().drawFocusRing(path, document().page()->focusController().timeSinceFocusWasSet(), needsRepaint);
+ paintInfo.context().drawFocusRing(path, page().focusController().timeSinceFocusWasSet(), needsRepaint);
if (needsRepaint)
- document().page()->focusController().setFocusedElementNeedsRepaint();
+ page().focusController().setFocusedElementNeedsRepaint();
#else
paintInfo.context().drawFocusRing(path, outlineWidth, areaElementStyle->outlineOffset(), areaElementStyle->visitedDependentColor(CSSPropertyOutlineColor));
#endif
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -365,10 +365,8 @@
destroyScrollbar(HorizontalScrollbar);
destroyScrollbar(VerticalScrollbar);
- if (renderer().frame().page()) {
- if (ScrollingCoordinator* scrollingCoordinator = renderer().frame().page()->scrollingCoordinator())
- scrollingCoordinator->willDestroyScrollableArea(*this);
- }
+ if (auto* scrollingCoordinator = renderer().page().scrollingCoordinator())
+ scrollingCoordinator->willDestroyScrollableArea(*this);
if (m_reflection)
removeReflection();
@@ -1525,8 +1523,7 @@
bool RenderLayer::forceUpdateScrollbarsOnMainThreadForPerformanceTesting() const
{
- Page* page = renderer().frame().page();
- return page && page->settings().forceUpdateScrollbarsOnMainThreadForPerformanceTesting();
+ return renderer().frame().settings().forceUpdateScrollbarsOnMainThreadForPerformanceTesting();
}
RenderLayer* RenderLayer::enclosingTransformedAncestor() const
@@ -2586,8 +2583,7 @@
// This only has an effect on the Mac platform in applications
// that put web views into scrolling containers, such as Mac OS X Mail.
// The canAutoscroll function in EventHandler also knows about this.
- if (Page* page = frameView.frame().page())
- page->chrome().scrollRectIntoView(snappedIntRect(absoluteRect));
+ page().chrome().scrollRectIntoView(snappedIntRect(absoluteRect));
}
}
@@ -2850,8 +2846,7 @@
bool RenderLayer::isActive() const
{
- Page* page = renderer().frame().page();
- return page && page->focusController().isActive();
+ return page().focusController().isActive();
}
static int cornerStart(const RenderLayer& layer, int minX, int maxX, int thickness)
@@ -3000,21 +2995,18 @@
#if PLATFORM(IOS)
void RenderLayer::didStartScroll()
{
- if (Page* page = renderer().frame().page())
- page->chrome().client().didStartOverflowScroll();
+ page().chrome().client().didStartOverflowScroll();
}
void RenderLayer::didEndScroll()
{
- if (Page* page = renderer().frame().page())
- page->chrome().client().didEndOverflowScroll();
+ page().chrome().client().didEndOverflowScroll();
}
void RenderLayer::didUpdateScroll()
{
// Send this notification when we scroll, since this is how we keep selection updated.
- if (Page* page = renderer().frame().page())
- page->chrome().client().didLayout(ChromeClient::Scroll);
+ page().chrome().client().didLayout(ChromeClient::Scroll);
}
#endif
@@ -3158,10 +3150,8 @@
else {
widget = Scrollbar::createNativeScrollbar(*this, orientation, RegularScrollbar);
didAddScrollbar(widget.get(), orientation);
- if (Page* page = renderer().frame().page()) {
- if (page->expectsWheelEventTriggers())
- scrollAnimator().setWheelEventTestTrigger(page->testTrigger());
- }
+ if (page().expectsWheelEventTriggers())
+ scrollAnimator().setWheelEventTestTrigger(page().testTrigger());
}
renderer().view().frameView().addChild(widget.get());
return widget.releaseNonNull();
@@ -4081,18 +4071,14 @@
bool scrollingOnMainThread = true;
#if ENABLE(ASYNC_SCROLLING)
- if (Page* page = renderer().frame().page()) {
- if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
- scrollingOnMainThread = scrollingCoordinator->shouldUpdateScrollLayerPositionSynchronously(renderer().view().frameView());
- }
+ if (ScrollingCoordinator* scrollingCoordinator = page().scrollingCoordinator())
+ scrollingOnMainThread = scrollingCoordinator->shouldUpdateScrollLayerPositionSynchronously(renderer().view().frameView());
#endif
// FIXME: We shouldn't have to disable subpixel quantization for overflow clips or subframes once we scroll those
// things on the scrolling thread.
bool contentsScrollByPainting = (renderer().hasOverflowClip() && !usesCompositedScrolling()) || (renderer().frame().ownerElement());
- bool isZooming = false;
- if (Page* page = renderer().frame().page())
- isZooming = !page->chrome().client().hasStablePageScaleFactor();
+ bool isZooming = !page().chrome().client().hasStablePageScaleFactor();
if (scrollingOnMainThread || contentsScrollByPainting || isZooming) {
didQuantizeFonts = context.shouldSubpixelQuantizeFonts();
context.setShouldSubpixelQuantizeFonts(false);
@@ -7008,14 +6994,14 @@
Frame& frame = renderer().frame();
if (!filterInfo.renderer()) {
RefPtr<FilterEffectRenderer> filterRenderer = FilterEffectRenderer::create();
- filterRenderer->setFilterScale(frame.page()->deviceScaleFactor());
+ filterRenderer->setFilterScale(page().deviceScaleFactor());
filterRenderer->setRenderingMode(frame.settings().acceleratedFiltersEnabled() ? Accelerated : Unaccelerated);
filterInfo.setRenderer(WTFMove(filterRenderer));
// We can optimize away code paths in other places if we know that there are no software filters.
renderer().view().setHasSoftwareFilters(true);
- } else if (filterInfo.renderer()->filterScale() != frame.page()->deviceScaleFactor()) {
- filterInfo.renderer()->setFilterScale(frame.page()->deviceScaleFactor());
+ } else if (filterInfo.renderer()->filterScale() != page().deviceScaleFactor()) {
+ filterInfo.renderer()->setFilterScale(page().deviceScaleFactor());
filterInfo.renderer()->clearIntermediateResults();
}
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2017-01-06 14:05:29 UTC (rev 210436)
@@ -134,6 +134,8 @@
void addChild(RenderLayer* newChild, RenderLayer* beforeChild = nullptr);
RenderLayer* removeChild(RenderLayer*);
+ Page& page() const { return renderer().page(); }
+
void removeOnlyThisLayer();
void insertOnlyThisLayer();
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -91,16 +91,6 @@
#endif
}
-// Get the scrolling coordinator in a way that works inside RenderLayerBacking's destructor.
-static ScrollingCoordinator* scrollingCoordinatorFromLayer(RenderLayer& layer)
-{
- Page* page = layer.renderer().frame().page();
- if (!page)
- return 0;
-
- return page->scrollingCoordinator();
-}
-
RenderLayerBacking::RenderLayerBacking(RenderLayer& layer)
: m_owningLayer(layer)
, m_viewportConstrainedNodeID(0)
@@ -115,24 +105,22 @@
#endif
, m_backgroundLayerPaintsFixedRootBackground(false)
{
- Page* page = renderer().frame().page();
-
- if (layer.isRootLayer() && page) {
+ if (layer.isRootLayer()) {
m_isMainFrameRenderViewLayer = renderer().frame().isMainFrame();
- m_usingTiledCacheLayer = page->chrome().client().shouldUseTiledBackingForFrameView(renderer().frame().view());
+ m_usingTiledCacheLayer = renderer().page().chrome().client().shouldUseTiledBackingForFrameView(renderer().frame().view());
}
createPrimaryGraphicsLayer();
- if (m_usingTiledCacheLayer && page) {
+ if (m_usingTiledCacheLayer) {
TiledBacking* tiledBacking = this->tiledBacking();
- tiledBacking->setIsInWindow(page->isInWindow());
+ tiledBacking->setIsInWindow(renderer().page().isInWindow());
if (m_isMainFrameRenderViewLayer)
tiledBacking->setUnparentsOffscreenTiles(true);
- tiledBacking->setScrollingPerformanceLoggingEnabled(page->settings().scrollingPerformanceLoggingEnabled());
+ tiledBacking->setScrollingPerformanceLoggingEnabled(renderer().page().settings().scrollingPerformanceLoggingEnabled());
adjustTiledBackingCoverage();
}
}
@@ -159,9 +147,7 @@
std::unique_ptr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String& name, GraphicsLayer::Type layerType)
{
- GraphicsLayerFactory* graphicsLayerFactory = 0;
- if (Page* page = renderer().frame().page())
- graphicsLayerFactory = page->chrome().client().graphicsLayerFactory();
+ auto* graphicsLayerFactory = renderer().page().chrome().client().graphicsLayerFactory();
std::unique_ptr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFactory, *this, layerType);
@@ -1421,7 +1407,7 @@
scrollCornerLayerChanged = true;
}
- if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
+ if (auto* scrollingCoordinator = m_owningLayer.page().scrollingCoordinator()) {
if (horizontalScrollbarLayerChanged)
scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owningLayer, HorizontalScrollbar);
if (verticalScrollbarLayerChanged)
@@ -1675,7 +1661,7 @@
if (!m_scrollingNodeID && !m_viewportConstrainedNodeID)
return;
- ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer);
+ auto* scrollingCoordinator = m_owningLayer.page().scrollingCoordinator();
if (!scrollingCoordinator)
return;
@@ -2409,8 +2395,7 @@
void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const FloatRect& clip)
{
#ifndef NDEBUG
- if (Page* page = renderer().frame().page())
- page->setIsPainting(true);
+ renderer().page().setIsPainting(true);
#endif
// The dirtyRect is in the coords of the painting root.
@@ -2448,8 +2433,7 @@
context.restore();
}
#ifndef NDEBUG
- if (Page* page = renderer().frame().page())
- page->setIsPainting(false);
+ renderer().page().setIsPainting(false);
#endif
}
@@ -2538,27 +2522,23 @@
if (!m_isMainFrameRenderViewLayer)
return false;
- if (Page* page = renderer().frame().page())
- return page->settings().aggressiveTileRetentionEnabled();
- return false;
+ return renderer().frame().settings().aggressiveTileRetentionEnabled();
}
bool RenderLayerBacking::shouldTemporarilyRetainTileCohorts(const GraphicsLayer*) const
{
- if (Page* page = renderer().frame().page())
- return page->settings().temporaryTileCohortRetentionEnabled();
- return true;
+ return renderer().frame().settings().temporaryTileCohortRetentionEnabled();
}
bool RenderLayerBacking::useGiantTiles() const
{
- return renderer().frame().page()->settings().useGiantTiles();
+ return renderer().frame().settings().useGiantTiles();
}
#ifndef NDEBUG
void RenderLayerBacking::verifyNotPainting()
{
- ASSERT(!renderer().frame().page() || !renderer().frame().page()->isPainting());
+ ASSERT(!renderer().page().isPainting());
}
#endif
@@ -2610,7 +2590,7 @@
#endif
}
- if (renderer().frame().page() && !renderer().frame().page()->settings().acceleratedCompositedAnimationsEnabled())
+ if (!renderer().frame().settings().acceleratedCompositedAnimationsEnabled())
return false;
bool didAnimate = false;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -314,10 +314,8 @@
// We allow the chrome to override the settings, in case the page is rendered
// on a chrome that doesn't allow accelerated compositing.
if (hasAcceleratedCompositing) {
- if (Page* page = this->page()) {
- m_compositingTriggers = page->chrome().client().allowedCompositingTriggers();
- hasAcceleratedCompositing = m_compositingTriggers;
- }
+ m_compositingTriggers = page().chrome().client().allowedCompositingTriggers();
+ hasAcceleratedCompositing = m_compositingTriggers;
}
showDebugBorders = settings.showDebugBorders();
@@ -399,8 +397,7 @@
void RenderLayerCompositor::scheduleLayerFlushNow()
{
m_hasPendingLayerFlush = false;
- if (Page* page = this->page())
- page->chrome().client().scheduleCompositingLayerFlush();
+ page().chrome().client().scheduleCompositingLayerFlush();
}
void RenderLayerCompositor::scheduleLayerFlush(bool canThrottle)
@@ -417,16 +414,6 @@
scheduleLayerFlushNow();
}
-#if PLATFORM(IOS)
-ChromeClient* RenderLayerCompositor::chromeClient() const
-{
- Page* page = m_renderView.frameView().frame().page();
- if (!page)
- return nullptr;
- return &page->chrome().client();
-}
-#endif
-
void RenderLayerCompositor::flushPendingLayerChanges(bool isFlushRoot)
{
// FrameView::flushCompositingStateIncludingSubframes() flushes each subframe,
@@ -473,9 +460,8 @@
updateScrollCoordinatedLayersAfterFlushIncludingSubframes();
#if PLATFORM(IOS)
- ChromeClient* client = this->chromeClient();
- if (client && isFlushRoot)
- client->didFlushCompositingLayers();
+ if (isFlushRoot)
+ page().chrome().client().didFlushCompositingLayers();
#endif
++m_layerFlushCount;
@@ -519,17 +505,14 @@
}
// FIXME: Can we make |layer| const RenderLayer&?
-static void updateScrollingLayerWithClient(RenderLayer& layer, ChromeClient* client)
+static void updateScrollingLayerWithClient(RenderLayer& layer, ChromeClient& client)
{
- if (!client)
- return;
-
RenderLayerBacking* backing = layer.backing();
ASSERT(backing);
bool allowHorizontalScrollbar = !scrollbarHasDisplayNone(layer.horizontalScrollbar());
bool allowVerticalScrollbar = !scrollbarHasDisplayNone(layer.verticalScrollbar());
- client->addOrUpdateScrollingLayer(layer.renderer().element(), backing->scrollingLayer()->platformLayer(), backing->scrollingContentsLayer()->platformLayer(),
+ client.addOrUpdateScrollingLayer(layer.renderer().element(), backing->scrollingLayer()->platformLayer(), backing->scrollingContentsLayer()->platformLayer(),
layer.scrollableContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
}
@@ -538,10 +521,8 @@
registerAllViewportConstrainedLayers();
if (!m_scrollingLayersNeedingUpdate.isEmpty()) {
- ChromeClient* chromeClient = this->chromeClient();
-
for (auto* layer : m_scrollingLayersNeedingUpdate)
- updateScrollingLayerWithClient(*layer, chromeClient);
+ updateScrollingLayerWithClient(*layer, page().chrome().client());
m_scrollingLayersNeedingUpdate.clear();
}
m_scrollingLayersNeedingUpdate.clear();
@@ -592,10 +573,7 @@
void RenderLayerCompositor::notifyFlushBeforeDisplayRefresh(const GraphicsLayer*)
{
if (!m_layerUpdater) {
- PlatformDisplayID displayID = 0;
- if (Page* page = this->page())
- displayID = page->chrome().displayID();
-
+ PlatformDisplayID displayID = page().chrome().displayID();
m_layerUpdater = std::make_unique<GraphicsLayerUpdater>(*this, displayID);
}
@@ -611,9 +589,7 @@
{
if (usingTiledBacking) {
++m_layersWithTiledBackingCount;
-
- if (Page* page = this->page())
- graphicsLayer->tiledBacking()->setIsInWindow(page->isInWindow());
+ graphicsLayer->tiledBacking()->setIsInWindow(page().isInWindow());
} else {
ASSERT(m_layersWithTiledBackingCount > 0);
--m_layersWithTiledBackingCount;
@@ -789,7 +765,7 @@
enableCompositingMode(false);
// Inform the inspector that the layer tree has changed.
- InspectorInstrumentation::layerTreeDidChange(page());
+ InspectorInstrumentation::layerTreeDidChange(&page());
return true;
}
@@ -800,10 +776,6 @@
return;
Frame& frame = m_renderView.frameView().frame();
- Page* page = frame.page();
- if (!page)
- return;
-
PageOverlayController& pageOverlayController = frame.mainFrame().pageOverlayController();
pageOverlayController.willAttachRootLayer();
childList.append(&pageOverlayController.documentOverlayRootLayer());
@@ -812,7 +784,7 @@
void RenderLayerCompositor::layerBecameNonComposited(const RenderLayer& layer)
{
// Inform the inspector that the given RenderLayer was destroyed.
- InspectorInstrumentation::renderLayerDestroyed(page(), layer);
+ InspectorInstrumentation::renderLayerDestroyed(&page(), layer);
ASSERT(m_compositedLayerCount > 0);
--m_compositedLayerCount;
@@ -1010,10 +982,8 @@
if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
#if ENABLE(RUBBER_BANDING)
- if (Page* page = this->page()) {
- updateLayerForHeader(page->headerHeight());
- updateLayerForFooter(page->footerHeight());
- }
+ updateLayerForHeader(page().headerHeight());
+ updateLayerForFooter(page().footerHeight());
#endif
if (m_renderView.frameView().frame().settings().backgroundShouldExtendBeyondPage())
m_rootContentLayer->setMasksToBounds(false);
@@ -2939,14 +2909,12 @@
float RenderLayerCompositor::pageScaleFactor() const
{
- Page* page = this->page();
- return page ? page->pageScaleFactor() : 1;
+ return page().pageScaleFactor();
}
float RenderLayerCompositor::zoomedOutPageScaleFactor() const
{
- Page* page = this->page();
- return page ? page->zoomedOutPageScaleFactor() : 0;
+ return page().zoomedOutPageScaleFactor();
}
float RenderLayerCompositor::contentsScaleMultiplierForNewTiles(const GraphicsLayer*) const
@@ -2953,10 +2921,8 @@
{
#if PLATFORM(IOS)
LegacyTileCache* tileCache = nullptr;
- if (Page* page = this->page()) {
- if (FrameView* frameView = page->mainFrame().view())
- tileCache = frameView->legacyTileCache();
- }
+ if (FrameView* frameView = page().mainFrame().view())
+ tileCache = frameView->legacyTileCache();
if (!tileCache)
return 1;
@@ -3139,8 +3105,7 @@
if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
- if (Page* page = this->page())
- page->chrome().client().didAddHeaderLayer(m_layerForHeader.get());
+ page().chrome().client().didAddHeaderLayer(m_layerForHeader.get());
return m_layerForHeader.get();
}
@@ -3178,8 +3143,7 @@
if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
- if (Page* page = this->page())
- page->chrome().client().didAddFooterLayer(m_layerForFooter.get());
+ page().chrome().client().didAddFooterLayer(m_layerForFooter.get());
return m_layerForFooter.get();
}
@@ -3250,8 +3214,7 @@
m_rootExtendedBackgroundColor = color;
- if (Page* page = this->page())
- page->chrome().client().pageExtendedBackgroundColorDidChange(color);
+ page().chrome().client().pageExtendedBackgroundColorDidChange(color);
#if ENABLE(RUBBER_BANDING)
if (!m_layerForOverhangAreas)
@@ -3502,15 +3465,11 @@
break;
case RootLayerAttachedViaChromeClient: {
Frame& frame = m_renderView.frameView().frame();
- Page* page = frame.page();
- if (!page)
- return;
-
- page->chrome().client().attachRootGraphicsLayer(&frame, rootGraphicsLayer());
+ page().chrome().client().attachRootGraphicsLayer(&frame, rootGraphicsLayer());
if (frame.isMainFrame()) {
PageOverlayController& pageOverlayController = frame.mainFrame().pageOverlayController();
pageOverlayController.willAttachRootLayer();
- page->chrome().client().attachViewOverlayGraphicsLayer(&frame, &pageOverlayController.viewOverlayRootLayer());
+ page().chrome().client().attachViewOverlayGraphicsLayer(&frame, &pageOverlayController.viewOverlayRootLayer());
}
break;
}
@@ -3551,13 +3510,9 @@
}
case RootLayerAttachedViaChromeClient: {
Frame& frame = m_renderView.frameView().frame();
- Page* page = frame.page();
- if (!page)
- return;
-
- page->chrome().client().attachRootGraphicsLayer(&frame, 0);
+ page().chrome().client().attachRootGraphicsLayer(&frame, 0);
if (frame.isMainFrame())
- page->chrome().client().attachViewOverlayGraphicsLayer(&frame, 0);
+ page().chrome().client().attachViewOverlayGraphicsLayer(&frame, 0);
}
break;
case RootLayerUnattached:
@@ -3582,9 +3537,6 @@
return;
Frame& frame = m_renderView.frameView().frame();
- Page* page = frame.page();
- if (!page)
- return;
// The attachment can affect whether the RenderView layer's paintsIntoWindow() behavior,
// so call updateDrawsContent() to update that.
@@ -4007,8 +3959,7 @@
layerMap.add(layer->backing()->graphicsLayer()->platformLayer(), WTFMove(constraints));
}
- if (ChromeClient* client = this->chromeClient())
- client->updateViewportConstrainedLayers(layerMap, stickyContainerMap);
+ page().chrome().client().updateViewportConstrainedLayers(layerMap, stickyContainerMap);
}
void RenderLayerCompositor::unregisterAllViewportConstrainedLayers()
@@ -4020,33 +3971,23 @@
if (scrollingCoordinator())
return;
- if (ChromeClient* client = this->chromeClient()) {
- LayerMap layerMap;
- StickyContainerMap stickyContainerMap;
- client->updateViewportConstrainedLayers(layerMap, stickyContainerMap);
- }
+ LayerMap layerMap;
+ StickyContainerMap stickyContainerMap;
+ page().chrome().client().updateViewportConstrainedLayers(layerMap, stickyContainerMap);
}
void RenderLayerCompositor::registerAllScrollingLayers()
{
- ChromeClient* client = this->chromeClient();
- if (!client)
- return;
-
for (auto* layer : m_scrollingLayers)
- updateScrollingLayerWithClient(*layer, client);
+ updateScrollingLayerWithClient(*layer, page().chrome().client());
}
void RenderLayerCompositor::unregisterAllScrollingLayers()
{
- ChromeClient* client = this->chromeClient();
- if (!client)
- return;
-
for (auto* layer : m_scrollingLayers) {
RenderLayerBacking* backing = layer->backing();
ASSERT(backing);
- client->removeScrollingLayer(layer->renderer().element(), backing->scrollingLayer()->platformLayer(), backing->scrollingContentsLayer()->platformLayer());
+ page().chrome().client().removeScrollingLayer(layer->renderer().element(), backing->scrollingLayer()->platformLayer(), backing->scrollingContentsLayer()->platformLayer());
}
}
#endif
@@ -4068,11 +4009,9 @@
if (m_renderView.document().pageCacheState() != Document::NotInPageCache)
return;
- if (ChromeClient* client = this->chromeClient()) {
- PlatformLayer* scrollingLayer = backing.scrollingLayer()->platformLayer();
- PlatformLayer* contentsLayer = backing.scrollingContentsLayer()->platformLayer();
- client->removeScrollingLayer(layer.renderer().element(), scrollingLayer, contentsLayer);
- }
+ PlatformLayer* scrollingLayer = backing.scrollingLayer()->platformLayer();
+ PlatformLayer* contentsLayer = backing.scrollingContentsLayer()->platformLayer();
+ page().chrome().client().removeScrollingLayer(layer.renderer().element(), scrollingLayer, contentsLayer);
#endif
}
@@ -4100,25 +4039,14 @@
ScrollingCoordinator* RenderLayerCompositor::scrollingCoordinator() const
{
- if (Page* page = this->page())
- return page->scrollingCoordinator();
-
- return nullptr;
+ return page().scrollingCoordinator();
}
GraphicsLayerFactory* RenderLayerCompositor::graphicsLayerFactory() const
{
- if (Page* page = this->page())
- return page->chrome().client().graphicsLayerFactory();
-
- return nullptr;
+ return page().chrome().client().graphicsLayerFactory();
}
-Page* RenderLayerCompositor::page() const
-{
- return m_renderView.frameView().frame().page();
-}
-
void RenderLayerCompositor::setLayerFlushThrottlingEnabled(bool enabled)
{
m_layerFlushThrottlingEnabled = enabled;
@@ -4176,12 +4104,7 @@
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
RefPtr<DisplayRefreshMonitor> RenderLayerCompositor::createDisplayRefreshMonitor(PlatformDisplayID displayID) const
{
- Frame& frame = m_renderView.frameView().frame();
- Page* page = frame.page();
- if (!page)
- return nullptr;
-
- if (auto monitor = page->chrome().client().createDisplayRefreshMonitor(displayID))
+ if (auto monitor = page().chrome().client().createDisplayRefreshMonitor(displayID))
return monitor;
return DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor(displayID);
@@ -4216,4 +4139,9 @@
}
#endif
+Page& RenderLayerCompositor::page() const
+{
+ return m_renderView.page();
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2017-01-06 14:05:29 UTC (rev 210436)
@@ -410,7 +410,7 @@
void updateScrollCoordinatedLayersAfterFlushIncludingSubframes();
void updateScrollCoordinatedLayersAfterFlush();
- Page* page() const;
+ Page& page() const;
GraphicsLayerFactory* graphicsLayerFactory() const;
ScrollingCoordinator* scrollingCoordinator() const;
@@ -437,9 +437,6 @@
bool requiresCompositingForScrolling(const RenderLayer&) const;
void updateCustomLayersAfterFlush();
-
- ChromeClient* chromeClient() const;
-
#endif
void updateScrollCoordinationForThisFrame(ScrollingNodeID);
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -734,16 +734,12 @@
return m_indexOffset * itemHeight();
}
-static void setupWheelEventTestTrigger(RenderListBox& renderer, Frame* frame)
+static void setupWheelEventTestTrigger(RenderListBox& renderer)
{
- if (!frame)
+ if (!renderer.page().expectsWheelEventTriggers())
return;
- Page* page = frame->page();
- if (!page || !page->expectsWheelEventTriggers())
- return;
-
- renderer.scrollAnimator().setWheelEventTestTrigger(page->testTrigger());
+ renderer.scrollAnimator().setWheelEventTestTrigger(renderer.page().testTrigger());
}
void RenderListBox::setScrollTop(int newTop)
@@ -752,7 +748,7 @@
int index = newTop / itemHeight();
if (index < 0 || index >= numItems() || index == m_indexOffset)
return;
- setupWheelEventTestTrigger(*this, document().frame());
+ setupWheelEventTestTrigger(*this);
scrollToOffsetWithoutAnimation(VerticalScrollbar, index);
}
@@ -792,8 +788,7 @@
bool RenderListBox::isActive() const
{
- Page* page = frame().page();
- return page && page->focusController().isActive();
+ return page().focusController().isActive();
}
void RenderListBox::invalidateScrollbarRect(Scrollbar& scrollbar, const IntRect& rect)
@@ -861,8 +856,7 @@
bool RenderListBox::forceUpdateScrollbarsOnMainThreadForPerformanceTesting() const
{
- Page* page = frame().page();
- return page && page->settings().forceUpdateScrollbarsOnMainThreadForPerformanceTesting();
+ return frame().settings().forceUpdateScrollbarsOnMainThreadForPerformanceTesting();
}
ScrollableArea* RenderListBox::enclosingScrollableArea() const
@@ -905,10 +899,8 @@
else {
widget = Scrollbar::createNativeScrollbar(*this, VerticalScrollbar, theme().scrollbarControlSizeForPart(ListboxPart));
didAddScrollbar(widget.get(), VerticalScrollbar);
- if (Page* page = frame().page()) {
- if (page->expectsWheelEventTriggers())
- scrollAnimator().setWheelEventTestTrigger(page->testTrigger());
- }
+ if (page().expectsWheelEventTriggers())
+ scrollAnimator().setWheelEventTestTrigger(page().testTrigger());
}
view().frameView().addChild(widget.get());
return widget.releaseNonNull();
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -142,8 +142,7 @@
RenderTheme& RenderObject::theme() const
{
- ASSERT(document().page());
- return document().page()->theme();
+ return page().theme();
}
bool RenderObject::isDescendantOf(const RenderObject* ancestor) const
Modified: trunk/Source/WebCore/rendering/RenderObject.h (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderObject.h 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2017-01-06 14:05:29 UTC (rev 210436)
@@ -515,6 +515,7 @@
Document& document() const { return m_node.document(); }
Frame& frame() const;
+ Page& page() const;
// Returns the object containing this one. Can be different from parent for positioned elements.
// If repaintContainer and repaintContainerSkipped are not null, on return *repaintContainerSkipped
@@ -1007,6 +1008,14 @@
return *document().frame();
}
+inline Page& RenderObject::page() const
+{
+ // The render tree will always be torn down before Frame is disconnected from Page,
+ // so it's safe to assume Frame::page() is non-null as long as there are live RenderObjects.
+ ASSERT(frame().page());
+ return *frame().page();
+}
+
inline AnimationController& RenderObject::animation() const
{
return frame().animation();
Modified: trunk/Source/WebCore/rendering/RenderSearchField.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderSearchField.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderSearchField.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -83,7 +83,7 @@
if (value.isEmpty())
return;
- if (frame().page()->usesEphemeralSession())
+ if (page().usesEphemeralSession())
return;
m_recentSearches.removeAllMatching([value] (const RecentSearch& recentSearch) {
@@ -97,7 +97,7 @@
const AtomicString& name = autosaveName();
if (!m_searchPopup)
- m_searchPopup = document().page()->chrome().createSearchPopupMenu(this);
+ m_searchPopup = page().chrome().createSearchPopupMenu(this);
m_searchPopup->saveRecentSearches(name, m_recentSearches);
}
@@ -108,7 +108,7 @@
return;
if (!m_searchPopup)
- m_searchPopup = document().page()->chrome().createSearchPopupMenu(this);
+ m_searchPopup = page().chrome().createSearchPopupMenu(this);
if (!m_searchPopup->enabled())
return;
@@ -201,7 +201,7 @@
const AtomicString& name = autosaveName();
if (!name.isEmpty()) {
if (!m_searchPopup)
- m_searchPopup = document().page()->chrome().createSearchPopupMenu(this);
+ m_searchPopup = page().chrome().createSearchPopupMenu(this);
m_searchPopup->saveRecentSearches(name, m_recentSearches);
}
}
Modified: trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -88,7 +88,7 @@
if (!image)
return;
- m_snapshotResource->setCachedImage(new CachedImage(image, view().frameView().frame().page()->sessionID()));
+ m_snapshotResource->setCachedImage(new CachedImage(image, page().sessionID()));
repaint();
}
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -287,7 +287,7 @@
FloatRect devicePixelSnappedRect = snapRectToDevicePixels(rect, deviceScaleFactor);
#if USE(NEW_THEME)
- float pageScaleFactor = box.document().page() ? box.document().page()->pageScaleFactor() : 1.0f;
+ float pageScaleFactor = box.page().pageScaleFactor();
switch (part) {
case CheckboxPart:
@@ -753,7 +753,7 @@
ControlStates newStates = extractControlStatesForRenderer(box);
controlStates.setStates(newStates.states());
if (isFocused(box))
- controlStates.setTimeSinceControlWasFocused(box.document().page()->focusController().timeSinceFocusWasSet());
+ controlStates.setTimeSinceControlWasFocused(box.page().focusController().timeSinceFocusWasSet());
}
ControlStates::States RenderTheme::extractControlStatesForRenderer(const RenderObject& o) const
@@ -784,13 +784,9 @@
return states;
}
-bool RenderTheme::isActive(const RenderObject& o) const
+bool RenderTheme::isActive(const RenderObject& renderer) const
{
- Page* page = o.document().page();
- if (!page)
- return false;
-
- return page->focusController().isActive();
+ return renderer.page().focusController().isActive();
}
bool RenderTheme::isChecked(const RenderObject& o) const
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2017-01-06 14:05:29 UTC (rev 210436)
@@ -1475,12 +1475,11 @@
void RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary(NSCell* cell, const RenderObject& renderer, const PaintInfo& paintInfo, const FloatRect& rect)
{
- Page* page = renderer.document().page();
bool shouldDrawFocusRing = isFocused(renderer) && renderer.style().outlineStyleIsAuto();
- bool shouldUseImageBuffer = renderer.style().effectiveZoom() != 1 || page->pageScaleFactor() != 1;
+ bool shouldUseImageBuffer = renderer.style().effectiveZoom() != 1 || renderer.page().pageScaleFactor() != 1;
bool shouldDrawCell = true;
- if (ThemeMac::drawCellOrFocusRingWithViewIntoContext(cell, paintInfo.context(), rect, documentViewFor(renderer), shouldDrawCell, shouldDrawFocusRing, shouldUseImageBuffer, page->deviceScaleFactor()))
- page->focusController().setFocusedElementNeedsRepaint();
+ if (ThemeMac::drawCellOrFocusRingWithViewIntoContext(cell, paintInfo.context(), rect, documentViewFor(renderer), shouldDrawCell, shouldDrawFocusRing, shouldUseImageBuffer, renderer.page().deviceScaleFactor()))
+ renderer.page().focusController().setFocusedElementNeedsRepaint();
}
const IntSize* RenderThemeMac::menuListSizes() const
@@ -1607,7 +1606,7 @@
bool shouldDrawCell = true;
bool shouldDrawFocusRing = false;
- float deviceScaleFactor = o.document().page()->deviceScaleFactor();
+ float deviceScaleFactor = o.page().deviceScaleFactor();
bool shouldUseImageBuffer = deviceScaleFactor != 1 || zoomLevel != 1;
ThemeMac::drawCellOrFocusRingWithViewIntoContext(sliderThumbCell, paintInfo.context(), unzoomedRect, view, shouldDrawCell, shouldDrawFocusRing, shouldUseImageBuffer, deviceScaleFactor);
[sliderThumbCell setControlView:nil];
Modified: trunk/Source/WebCore/rendering/RenderVideo.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderVideo.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderVideo.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -160,24 +160,22 @@
MediaPlayer* mediaPlayer = videoElement().player();
bool displayingPoster = videoElement().shouldDisplayPosterImage();
- Page* page = frame().page();
-
if (!displayingPoster && !mediaPlayer) {
- if (page && paintInfo.phase == PaintPhaseForeground)
- page->addRelevantUnpaintedObject(this, visualOverflowRect());
+ if (paintInfo.phase == PaintPhaseForeground)
+ page().addRelevantUnpaintedObject(this, visualOverflowRect());
return;
}
LayoutRect rect = videoBox();
if (rect.isEmpty()) {
- if (page && paintInfo.phase == PaintPhaseForeground)
- page->addRelevantUnpaintedObject(this, visualOverflowRect());
+ if (paintInfo.phase == PaintPhaseForeground)
+ page().addRelevantUnpaintedObject(this, visualOverflowRect());
return;
}
rect.moveBy(paintOffset);
- if (page && paintInfo.phase == PaintPhaseForeground)
- page->addRelevantRepaintedObject(this, rect);
+ if (paintInfo.phase == PaintPhaseForeground)
+ page().addRelevantRepaintedObject(this, rect);
LayoutRect contentRect = contentBoxRect();
contentRect.moveBy(paintOffset);
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -1434,7 +1434,7 @@
unsigned RenderView::pageNumberForBlockProgressionOffset(int offset) const
{
int columnNumber = 0;
- const Pagination& pagination = frameView().frame().page()->pagination();
+ const Pagination& pagination = page().pagination();
if (pagination.mode == Pagination::Unpaginated)
return columnNumber;
@@ -1459,7 +1459,7 @@
unsigned RenderView::pageCount() const
{
- const Pagination& pagination = frameView().frame().page()->pagination();
+ const Pagination& pagination = page().pagination();
if (pagination.mode == Pagination::Unpaginated)
return 0;
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (210435 => 210436)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -241,20 +241,18 @@
if (svgSVGElement().hasEmptyViewBox())
return;
- Page* page = frame().page();
-
// Don't paint if we don't have kids, except if we have filters we should paint those.
if (!firstChild()) {
auto* resources = SVGResourcesCache::cachedResourcesForRenderer(*this);
if (!resources || !resources->filter()) {
- if (page && paintInfo.phase == PaintPhaseForeground)
- page->addRelevantUnpaintedObject(this, visualOverflowRect());
+ if (paintInfo.phase == PaintPhaseForeground)
+ page().addRelevantUnpaintedObject(this, visualOverflowRect());
return;
}
}
- if (page && paintInfo.phase == PaintPhaseForeground)
- page->addRelevantRepaintedObject(this, visualOverflowRect());
+ if (paintInfo.phase == PaintPhaseForeground)
+ page().addRelevantRepaintedObject(this, visualOverflowRect());
// Make a copy of the PaintInfo because applyTransform will modify the damage rect.
PaintInfo childPaintInfo(paintInfo);
Modified: trunk/Source/WebCore/style/StyleResolveForDocument.cpp (210435 => 210436)
--- trunk/Source/WebCore/style/StyleResolveForDocument.cpp 2017-01-06 09:47:25 UTC (rev 210435)
+++ trunk/Source/WebCore/style/StyleResolveForDocument.cpp 2017-01-06 14:05:29 UTC (rev 210436)
@@ -95,7 +95,7 @@
documentStyle.setColumnGap(pagination.gap);
if (renderView.multiColumnFlowThread())
renderView.updateColumnProgressionFromStyle(documentStyle);
- if (renderView.frame().page()->paginationLineGridEnabled()) {
+ if (renderView.page().paginationLineGridEnabled()) {
documentStyle.setLineGrid("-webkit-default-pagination-grid");
documentStyle.setLineSnap(LineSnapContain);
}