2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
22 #include "RenderView.h"
26 #include "FloatQuad.h"
28 #include "FrameView.h"
29 #include "GraphicsContext.h"
30 #include "HTMLFrameOwnerElement.h"
31 #include "HitTestResult.h"
32 #include "RenderLayer.h"
33 #include "RenderSelectionInfo.h"
34 #include "RenderWidget.h"
35 #include "RenderWidgetProtector.h"
36 #include "TransformState.h"
38 #if USE(ACCELERATED_COMPOSITING)
39 #include "RenderLayerCompositor.h"
42 #if defined(ANDROID_LAYOUT) || defined(ANDROID_FIXED_ELEMENTS)
48 RenderView::RenderView(Node* node, FrameView* view)
53 , m_selectionStartPos(-1)
54 , m_selectionEndPos(-1)
55 , m_maximalOutlineSize(0)
56 , m_pageLogicalHeight(0)
57 , m_pageLogicalHeightChanged(false)
59 , m_layoutStateDisableCount(0)
61 // Clear our anonymous bit, set because RenderObject assumes
62 // any renderer with document as the node is anonymous.
63 setIsAnonymous(false);
65 // init RenderObject attributes
68 m_minPreferredLogicalWidth = 0;
69 m_maxPreferredLogicalWidth = 0;
71 setPreferredLogicalWidthsDirty(true, false);
73 setPositioned(true); // to 0,0 :)
76 RenderView::~RenderView()
80 void RenderView::computeLogicalHeight()
82 if (!printing() && m_frameView)
83 setLogicalHeight(viewLogicalHeight());
86 void RenderView::computeLogicalWidth()
88 if (!printing() && m_frameView)
89 setLogicalWidth(viewLogicalWidth());
91 setVisibleWidth(m_frameView->textWrapWidth());
95 void RenderView::computePreferredLogicalWidths()
97 ASSERT(preferredLogicalWidthsDirty());
99 RenderBlock::computePreferredLogicalWidths();
101 m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth;
104 bool RenderView::isChildAllowed(RenderObject* child, RenderStyle*) const
106 return child->isBox();
109 void RenderView::layout()
111 if (!document()->paginated())
112 setPageLogicalHeight(0);
115 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth();
117 // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account.
118 bool relayoutChildren = !printing() && (!m_frameView || width() != viewWidth() || height() != viewHeight());
119 if (relayoutChildren) {
120 setChildNeedsLayout(true, false);
121 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
122 if (child->style()->logicalHeight().isPercent() || child->style()->logicalMinHeight().isPercent() || child->style()->logicalMaxHeight().isPercent())
123 child->setChildNeedsLayout(true, false);
127 ASSERT(!m_layoutState);
129 // FIXME: May be better to push a clip and avoid issuing offscreen repaints.
130 state.m_clipped = false;
131 state.m_pageLogicalHeight = m_pageLogicalHeight;
132 state.m_pageLogicalHeightChanged = m_pageLogicalHeightChanged;
133 m_pageLogicalHeightChanged = false;
134 m_layoutState = &state;
137 RenderBlock::layout();
139 ASSERT(layoutDelta() == IntSize());
140 ASSERT(m_layoutStateDisableCount == 0);
141 ASSERT(m_layoutState == &state);
143 setNeedsLayout(false);
146 void RenderView::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState) const
148 // If a container was specified, and was not 0 or the RenderView,
149 // then we should have found it by now.
150 ASSERT_UNUSED(repaintContainer, !repaintContainer || repaintContainer == this);
152 if (useTransforms && shouldUseTransformFromContainer(0)) {
153 TransformationMatrix t;
154 getTransformFromContainer(0, IntSize(), t);
155 transformState.applyTransform(t);
158 if (fixed && m_frameView)
159 transformState.move(m_frameView->scrollOffsetForFixedPosition());
162 void RenderView::mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState& transformState) const
164 if (fixed && m_frameView)
165 transformState.move(-m_frameView->scrollOffsetForFixedPosition());
167 if (useTransforms && shouldUseTransformFromContainer(0)) {
168 TransformationMatrix t;
169 getTransformFromContainer(0, IntSize(), t);
170 transformState.applyTransform(t);
174 void RenderView::paint(PaintInfo& paintInfo, int tx, int ty)
176 // If we ever require layout but receive a paint anyway, something has gone horribly wrong.
177 ASSERT(!needsLayout());
178 paintObject(paintInfo, tx, ty);
181 static inline bool isComposited(RenderObject* object)
183 return object->hasLayer() && toRenderBoxModelObject(object)->layer()->isComposited();
186 static inline bool rendererObscuresBackground(RenderObject* object)
188 return object && object->style()->visibility() == VISIBLE
189 && object->style()->opacity() == 1
190 && !object->style()->hasTransform()
191 && !isComposited(object);
194 void RenderView::paintBoxDecorations(PaintInfo& paintInfo, int, int)
196 // Check to see if we are enclosed by a layer that requires complex painting rules. If so, we cannot blit
197 // when scrolling, and we need to use slow repaints. Examples of layers that require this are transparent layers,
198 // layers with reflections, or transformed layers.
199 // FIXME: This needs to be dynamic. We should be able to go back to blitting if we ever stop being inside
200 // a transform, transparency layer, etc.
202 for (elt = document()->ownerElement(); view() && elt && elt->renderer(); elt = elt->document()->ownerElement()) {
203 RenderLayer* layer = elt->renderer()->enclosingLayer();
204 if (layer->requiresSlowRepaints()) {
205 frameView()->setUseSlowRepaints();
209 #if USE(ACCELERATED_COMPOSITING)
210 if (RenderLayer* compositingLayer = layer->enclosingCompositingLayer()) {
211 if (!compositingLayer->backing()->paintingGoesToWindow()) {
212 frameView()->setUseSlowRepaints();
219 if (document()->ownerElement() || !view())
222 bool rootFillsViewport = false;
223 Node* documentElement = document()->documentElement();
224 if (RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0) {
225 // The document element's renderer is currently forced to be a block, but may not always be.
226 RenderBox* rootBox = rootRenderer->isBox() ? toRenderBox(rootRenderer) : 0;
227 rootFillsViewport = rootBox && !rootBox->x() && !rootBox->y() && rootBox->width() >= width() && rootBox->height() >= height();
230 float pageScaleFactor = 1;
231 if (Frame* frame = m_frameView->frame())
232 pageScaleFactor = frame->pageScaleFactor();
234 // If painting will entirely fill the view, no need to fill the background.
235 if (rootFillsViewport && rendererObscuresBackground(firstChild()) && pageScaleFactor >= 1)
238 // This code typically only executes if the root element's visibility has been set to hidden,
239 // if there is a transform on the <html>, or if there is a page scale factor less than 1.
240 // Only fill with the base background color (typically white) if we're the root document,
241 // since iframes/frames with no background in the child document should show the parent's background.
242 if (frameView()->isTransparent()) // FIXME: This needs to be dynamic. We should be able to go back to blitting if we ever stop being transparent.
243 frameView()->setUseSlowRepaints(); // The parent must show behind the child.
245 Color baseColor = frameView()->baseBackgroundColor();
246 if (baseColor.alpha() > 0) {
247 CompositeOperator previousOperator = paintInfo.context->compositeOperation();
248 paintInfo.context->setCompositeOperation(CompositeCopy);
249 paintInfo.context->fillRect(paintInfo.rect, baseColor, style()->colorSpace());
250 paintInfo.context->setCompositeOperation(previousOperator);
252 paintInfo.context->clearRect(paintInfo.rect);
256 bool RenderView::shouldRepaint(const IntRect& r) const
258 if (printing() || r.width() == 0 || r.height() == 0)
267 void RenderView::repaintViewRectangle(const IntRect& ur, bool immediate)
269 if (!shouldRepaint(ur))
272 // We always just invalidate the root view, since we could be an iframe that is clipped out
273 // or even invisible.
274 Element* elt = document()->ownerElement();
276 m_frameView->repaintContentRectangle(ur, immediate);
277 else if (RenderBox* obj = elt->renderBox()) {
278 IntRect vr = viewRect();
279 IntRect r = intersection(ur, vr);
281 // Subtract out the contentsX and contentsY offsets to get our coords within the viewing
283 r.move(-vr.x(), -vr.y());
285 // FIXME: Hardcoded offsets here are not good.
286 r.move(obj->borderLeft() + obj->paddingLeft(),
287 obj->borderTop() + obj->paddingTop());
288 obj->repaintRectangle(r, immediate);
292 void RenderView::repaintRectangleInViewAndCompositedLayers(const IntRect& ur, bool immediate)
294 if (!shouldRepaint(ur))
297 repaintViewRectangle(ur, immediate);
299 #if USE(ACCELERATED_COMPOSITING)
300 if (compositor()->inCompositingMode())
301 compositor()->repaintCompositedLayersAbsoluteRect(ur);
305 void RenderView::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& rect, bool fixed)
307 // If a container was specified, and was not 0 or the RenderView,
308 // then we should have found it by now.
309 ASSERT_UNUSED(repaintContainer, !repaintContainer || repaintContainer == this);
314 if (style()->isFlippedBlocksWritingMode()) {
315 // We have to flip by hand since the view's logical height has not been determined. We
316 // can use the viewport width and height.
317 if (style()->isHorizontalWritingMode())
318 rect.setY(viewHeight() - rect.maxY());
320 rect.setX(viewWidth() - rect.maxX());
323 if (fixed && m_frameView)
324 rect.move(m_frameView->scrollXForFixedPosition(), m_frameView->scrollYForFixedPosition());
326 // Apply our transform if we have one (because of full page zooming).
327 if (m_layer && m_layer->transform())
328 rect = m_layer->transform()->mapRect(rect);
331 void RenderView::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
333 rects.append(IntRect(tx, ty, m_layer->width(), m_layer->height()));
336 void RenderView::absoluteQuads(Vector<FloatQuad>& quads)
338 quads.append(FloatRect(0, 0, m_layer->width(), m_layer->height()));
341 static RenderObject* rendererAfterPosition(RenderObject* object, unsigned offset)
346 RenderObject* child = object->childAt(offset);
347 return child ? child : object->nextInPreOrderAfterChildren();
350 IntRect RenderView::selectionBounds(bool clipToVisibleContent) const
352 document()->updateStyleIfNeeded();
354 typedef HashMap<RenderObject*, RenderSelectionInfo*> SelectionMap;
355 SelectionMap selectedObjects;
357 RenderObject* os = m_selectionStart;
358 RenderObject* stop = rendererAfterPosition(m_selectionEnd, m_selectionEndPos);
359 while (os && os != stop) {
360 if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selectionEnd) && os->selectionState() != SelectionNone) {
361 // Blocks are responsible for painting line gaps and margin gaps. They must be examined as well.
362 selectedObjects.set(os, new RenderSelectionInfo(os, clipToVisibleContent));
363 RenderBlock* cb = os->containingBlock();
364 while (cb && !cb->isRenderView()) {
365 RenderSelectionInfo* blockInfo = selectedObjects.get(cb);
368 selectedObjects.set(cb, new RenderSelectionInfo(cb, clipToVisibleContent));
369 cb = cb->containingBlock();
373 os = os->nextInPreOrder();
376 // Now create a single bounding box rect that encloses the whole selection.
378 SelectionMap::iterator end = selectedObjects.end();
379 for (SelectionMap::iterator i = selectedObjects.begin(); i != end; ++i) {
380 RenderSelectionInfo* info = i->second;
381 // RenderSelectionInfo::rect() is in the coordinates of the repaintContainer, so map to page coordinates.
382 IntRect currRect = info->rect();
383 if (RenderBoxModelObject* repaintContainer = info->repaintContainer()) {
384 FloatQuad absQuad = repaintContainer->localToAbsoluteQuad(FloatRect(currRect));
385 currRect = absQuad.enclosingBoundingBox();
387 selRect.unite(currRect);
393 #if USE(ACCELERATED_COMPOSITING)
394 // Compositing layer dimensions take outline size into account, so we have to recompute layer
395 // bounds when it changes.
396 // FIXME: This is ugly; it would be nice to have a better way to do this.
397 void RenderView::setMaximalOutlineSize(int o)
399 if (o != m_maximalOutlineSize) {
400 m_maximalOutlineSize = o;
402 // maximalOutlineSize affects compositing layer dimensions.
403 compositor()->setCompositingLayersNeedRebuild(); // FIXME: this really just needs to be a geometry update.
408 void RenderView::setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode blockRepaintMode)
410 // Make sure both our start and end objects are defined.
411 // Check www.msnbc.com and try clicking around to find the case where this happened.
412 if ((start && !end) || (end && !start))
415 // Just return if the selection hasn't changed.
416 if (m_selectionStart == start && m_selectionStartPos == startPos &&
417 m_selectionEnd == end && m_selectionEndPos == endPos)
420 // Record the old selected objects. These will be used later
421 // when we compare against the new selected objects.
422 int oldStartPos = m_selectionStartPos;
423 int oldEndPos = m_selectionEndPos;
425 // Objects each have a single selection rect to examine.
426 typedef HashMap<RenderObject*, RenderSelectionInfo*> SelectedObjectMap;
427 SelectedObjectMap oldSelectedObjects;
428 SelectedObjectMap newSelectedObjects;
430 // Blocks contain selected objects and fill gaps between them, either on the left, right, or in between lines and blocks.
431 // In order to get the repaint rect right, we have to examine left, middle, and right rects individually, since otherwise
432 // the union of those rects might remain the same even when changes have occurred.
433 typedef HashMap<RenderBlock*, RenderBlockSelectionInfo*> SelectedBlockMap;
434 SelectedBlockMap oldSelectedBlocks;
435 SelectedBlockMap newSelectedBlocks;
437 RenderObject* os = m_selectionStart;
438 RenderObject* stop = rendererAfterPosition(m_selectionEnd, m_selectionEndPos);
439 while (os && os != stop) {
440 if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selectionEnd) && os->selectionState() != SelectionNone) {
441 // Blocks are responsible for painting line gaps and margin gaps. They must be examined as well.
442 oldSelectedObjects.set(os, new RenderSelectionInfo(os, true));
443 if (blockRepaintMode == RepaintNewXOROld) {
444 RenderBlock* cb = os->containingBlock();
445 while (cb && !cb->isRenderView()) {
446 RenderBlockSelectionInfo* blockInfo = oldSelectedBlocks.get(cb);
449 oldSelectedBlocks.set(cb, new RenderBlockSelectionInfo(cb));
450 cb = cb->containingBlock();
455 os = os->nextInPreOrder();
458 // Now clear the selection.
459 SelectedObjectMap::iterator oldObjectsEnd = oldSelectedObjects.end();
460 for (SelectedObjectMap::iterator i = oldSelectedObjects.begin(); i != oldObjectsEnd; ++i)
461 i->first->setSelectionState(SelectionNone);
463 // set selection start and end
464 m_selectionStart = start;
465 m_selectionStartPos = startPos;
466 m_selectionEnd = end;
467 m_selectionEndPos = endPos;
469 // Update the selection status of all objects between m_selectionStart and m_selectionEnd
470 if (start && start == end)
471 start->setSelectionState(SelectionBoth);
474 start->setSelectionState(SelectionStart);
476 end->setSelectionState(SelectionEnd);
479 RenderObject* o = start;
480 stop = rendererAfterPosition(end, endPos);
482 while (o && o != stop) {
483 if (o != start && o != end && o->canBeSelectionLeaf())
484 o->setSelectionState(SelectionInside);
485 o = o->nextInPreOrder();
488 m_layer->clearBlockSelectionGapsBounds();
490 // Now that the selection state has been updated for the new objects, walk them again and
491 // put them in the new objects list.
493 while (o && o != stop) {
494 if ((o->canBeSelectionLeaf() || o == start || o == end) && o->selectionState() != SelectionNone) {
495 newSelectedObjects.set(o, new RenderSelectionInfo(o, true));
496 RenderBlock* cb = o->containingBlock();
497 while (cb && !cb->isRenderView()) {
498 RenderBlockSelectionInfo* blockInfo = newSelectedBlocks.get(cb);
501 newSelectedBlocks.set(cb, new RenderBlockSelectionInfo(cb));
502 cb = cb->containingBlock();
506 o = o->nextInPreOrder();
510 // We built the maps, but we aren't going to use them.
511 // We need to delete the values, otherwise they'll all leak!
512 deleteAllValues(oldSelectedObjects);
513 deleteAllValues(newSelectedObjects);
514 deleteAllValues(oldSelectedBlocks);
515 deleteAllValues(newSelectedBlocks);
519 m_frameView->beginDeferredRepaints();
521 // Have any of the old selected objects changed compared to the new selection?
522 for (SelectedObjectMap::iterator i = oldSelectedObjects.begin(); i != oldObjectsEnd; ++i) {
523 RenderObject* obj = i->first;
524 RenderSelectionInfo* newInfo = newSelectedObjects.get(obj);
525 RenderSelectionInfo* oldInfo = i->second;
526 if (!newInfo || oldInfo->rect() != newInfo->rect() || oldInfo->state() != newInfo->state() ||
527 (m_selectionStart == obj && oldStartPos != m_selectionStartPos) ||
528 (m_selectionEnd == obj && oldEndPos != m_selectionEndPos)) {
532 newSelectedObjects.remove(obj);
539 // Any new objects that remain were not found in the old objects dict, and so they need to be updated.
540 SelectedObjectMap::iterator newObjectsEnd = newSelectedObjects.end();
541 for (SelectedObjectMap::iterator i = newSelectedObjects.begin(); i != newObjectsEnd; ++i) {
542 RenderSelectionInfo* newInfo = i->second;
547 // Have any of the old blocks changed?
548 SelectedBlockMap::iterator oldBlocksEnd = oldSelectedBlocks.end();
549 for (SelectedBlockMap::iterator i = oldSelectedBlocks.begin(); i != oldBlocksEnd; ++i) {
550 RenderBlock* block = i->first;
551 RenderBlockSelectionInfo* newInfo = newSelectedBlocks.get(block);
552 RenderBlockSelectionInfo* oldInfo = i->second;
553 if (!newInfo || oldInfo->rects() != newInfo->rects() || oldInfo->state() != newInfo->state()) {
557 newSelectedBlocks.remove(block);
564 // Any new blocks that remain were not found in the old blocks dict, and so they need to be updated.
565 SelectedBlockMap::iterator newBlocksEnd = newSelectedBlocks.end();
566 for (SelectedBlockMap::iterator i = newSelectedBlocks.begin(); i != newBlocksEnd; ++i) {
567 RenderBlockSelectionInfo* newInfo = i->second;
572 m_frameView->endDeferredRepaints();
575 void RenderView::clearSelection()
577 m_layer->repaintBlockSelectionGaps();
578 setSelection(0, -1, 0, -1, RepaintNewMinusOld);
581 void RenderView::selectionStartEnd(int& startPos, int& endPos) const
583 startPos = m_selectionStartPos;
584 endPos = m_selectionEndPos;
587 bool RenderView::printing() const
589 return document()->printing();
592 size_t RenderView::getRetainedWidgets(Vector<RenderWidget*>& renderWidgets)
594 size_t size = m_widgets.size();
596 renderWidgets.reserveCapacity(size);
598 RenderWidgetSet::const_iterator end = m_widgets.end();
599 for (RenderWidgetSet::const_iterator it = m_widgets.begin(); it != end; ++it) {
600 renderWidgets.uncheckedAppend(*it);
607 void RenderView::releaseWidgets(Vector<RenderWidget*>& renderWidgets)
609 size_t size = renderWidgets.size();
611 for (size_t i = 0; i < size; ++i)
612 renderWidgets[i]->deref(renderArena());
615 void RenderView::updateWidgetPositions()
617 // updateWidgetPosition() can possibly cause layout to be re-entered (via plug-ins running
618 // scripts in response to NPP_SetWindow, for example), so we need to keep the Widgets
619 // alive during enumeration.
621 Vector<RenderWidget*> renderWidgets;
622 size_t size = getRetainedWidgets(renderWidgets);
624 for (size_t i = 0; i < size; ++i)
625 renderWidgets[i]->updateWidgetPosition();
627 for (size_t i = 0; i < size; ++i)
628 renderWidgets[i]->widgetPositionsUpdated();
630 releaseWidgets(renderWidgets);
633 void RenderView::addWidget(RenderWidget* o)
638 void RenderView::removeWidget(RenderWidget* o)
643 void RenderView::notifyWidgets(WidgetNotification notification)
645 Vector<RenderWidget*> renderWidgets;
646 size_t size = getRetainedWidgets(renderWidgets);
648 for (size_t i = 0; i < size; ++i)
649 renderWidgets[i]->notifyWidget(notification);
651 releaseWidgets(renderWidgets);
654 IntRect RenderView::viewRect() const
657 return IntRect(0, 0, width(), height());
659 return m_frameView->visibleContentRect();
663 int RenderView::docTop() const
665 IntRect overflowRect(0, minYLayoutOverflow(), 0, maxYLayoutOverflow() - minYLayoutOverflow());
666 flipForWritingMode(overflowRect);
668 overflowRect = layer()->currentTransform().mapRect(overflowRect);
669 return overflowRect.y();
672 int RenderView::docBottom() const
674 IntRect overflowRect(layoutOverflowRect());
675 flipForWritingMode(overflowRect);
677 overflowRect = layer()->currentTransform().mapRect(overflowRect);
678 return overflowRect.maxY();
681 int RenderView::docLeft() const
683 IntRect overflowRect(layoutOverflowRect());
684 flipForWritingMode(overflowRect);
686 overflowRect = layer()->currentTransform().mapRect(overflowRect);
687 return overflowRect.x();
690 int RenderView::docRight() const
692 IntRect overflowRect(layoutOverflowRect());
693 flipForWritingMode(overflowRect);
695 overflowRect = layer()->currentTransform().mapRect(overflowRect);
696 return overflowRect.maxX();
699 int RenderView::viewHeight() const
702 if (!printing() && m_frameView) {
703 height = m_frameView->layoutHeight();
704 height = m_frameView->useFixedLayout() ? ceilf(style()->effectiveZoom() * float(height)) : height;
709 int RenderView::viewWidth() const
712 if (!printing() && m_frameView) {
713 width = m_frameView->layoutWidth();
714 width = m_frameView->useFixedLayout() ? ceilf(style()->effectiveZoom() * float(width)) : width;
719 float RenderView::zoomFactor() const
721 Frame* frame = m_frameView->frame();
722 return frame ? frame->pageZoomFactor() : 1;
725 void RenderView::pushLayoutState(RenderObject* root)
727 ASSERT(m_layoutStateDisableCount == 0);
728 ASSERT(m_layoutState == 0);
730 m_layoutState = new (renderArena()) LayoutState(root);
733 bool RenderView::shouldDisableLayoutStateForSubtree(RenderObject* renderer) const
735 RenderObject* o = renderer;
737 if (o->hasColumns() || o->hasTransform() || o->hasReflection())
744 void RenderView::updateHitTestResult(HitTestResult& result, const IntPoint& point)
746 if (result.innerNode())
749 Node* node = document()->documentElement();
751 result.setInnerNode(node);
752 if (!result.innerNonSharedNode())
753 result.setInnerNonSharedNode(node);
754 result.setLocalPoint(point);
758 // FIXME: This function is obsolete and only used by embedded WebViews inside AppKit NSViews.
759 // Do not add callers of this function!
760 // The idea here is to take into account what object is moving the pagination point, and
761 // thus choose the best place to chop it.
762 void RenderView::setBestTruncatedAt(int y, RenderBoxModelObject* forRenderer, bool forcedBreak)
764 // Nobody else can set a page break once we have a forced break.
765 if (m_legacyPrinting.m_forcedPageBreak)
768 // Forced breaks always win over unforced breaks.
770 m_legacyPrinting.m_forcedPageBreak = true;
771 m_legacyPrinting.m_bestTruncatedAt = y;
775 // Prefer the widest object that tries to move the pagination point
776 IntRect boundingBox = forRenderer->borderBoundingBox();
777 if (boundingBox.width() > m_legacyPrinting.m_truncatorWidth) {
778 m_legacyPrinting.m_truncatorWidth = boundingBox.width();
779 m_legacyPrinting.m_bestTruncatedAt = y;
783 #if USE(ACCELERATED_COMPOSITING)
784 bool RenderView::usesCompositing() const
786 return m_compositor && m_compositor->inCompositingMode();
789 RenderLayerCompositor* RenderView::compositor()
792 m_compositor.set(new RenderLayerCompositor(this));
794 return m_compositor.get();
798 void RenderView::didMoveOnscreen()
800 #if USE(ACCELERATED_COMPOSITING)
802 m_compositor->didMoveOnscreen();
806 void RenderView::willMoveOffscreen()
808 #if USE(ACCELERATED_COMPOSITING)
810 m_compositor->willMoveOffscreen();
814 } // namespace WebCore