diff options
Diffstat (limited to 'WebCore/page/FrameView.cpp')
-rw-r--r-- | WebCore/page/FrameView.cpp | 92 |
1 files changed, 70 insertions, 22 deletions
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index 944f215..87d2d6c 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -107,13 +107,14 @@ static const double deferredRepaintDelayIncrementDuringLoading = 0; // The maximum number of updateWidgets iterations that should be done before returning. static const unsigned maxUpdateWidgetsIterations = 2; -struct ScheduledEvent { +struct ScheduledEvent : Noncopyable { RefPtr<Event> m_event; RefPtr<Node> m_eventTarget; }; FrameView::FrameView(Frame* frame) : m_frame(frame) + , m_canHaveScrollbars(true) , m_slowRepaintObjectCount(0) , m_layoutTimer(this, &FrameView::layoutTimerFired) , m_layoutRoot(0) @@ -206,7 +207,7 @@ void FrameView::reset() m_deferredRepaintDelay = initialDeferredRepaintDelayDuringLoading; m_deferredRepaintTimer.stop(); m_lastPaintTime = 0; - m_paintRestriction = PaintRestrictionNone; + m_paintBehavior = PaintBehaviorNormal; m_isPainting = false; m_isVisuallyNonEmpty = false; m_firstVisuallyNonEmptyLayoutCallbackPending = true; @@ -228,7 +229,10 @@ void FrameView::resetScrollbars() // Reset the document's scrollbars back to our defaults before we yield the floor. m_firstLayout = true; setScrollbarsSuppressed(true); - setScrollbarModes(ScrollbarAuto, ScrollbarAuto); + if (m_canHaveScrollbars) + setScrollbarModes(ScrollbarAuto, ScrollbarAuto); + else + setScrollbarModes(ScrollbarAlwaysOff, ScrollbarAlwaysOff); setScrollbarsSuppressed(false); } @@ -325,6 +329,23 @@ void FrameView::setMarginHeight(int h) m_margins.setHeight(h); } +void FrameView::setCanHaveScrollbars(bool canHaveScrollbars) +{ + m_canHaveScrollbars = canHaveScrollbars; + ScrollView::setCanHaveScrollbars(canHaveScrollbars); +} + +void FrameView::updateCanHaveScrollbars() +{ + ScrollbarMode hMode; + ScrollbarMode vMode; + scrollbarModes(hMode, vMode); + if (hMode == ScrollbarAlwaysOff && vMode == ScrollbarAlwaysOff) + m_canHaveScrollbars = false; + else + m_canHaveScrollbars = true; +} + PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation) { // FIXME: We need to update the scrollbar dynamically as documents change (or as doc elements and bodies get discovered that have custom styles). @@ -351,6 +372,9 @@ PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientatio void FrameView::setContentsSize(const IntSize& size) { + if (size == contentsSize()) + return; + m_deferSetNeedsLayouts++; ScrollView::setContentsSize(size); @@ -423,7 +447,7 @@ void FrameView::updateCompositingLayers() return; // This call will make sure the cached hasAcceleratedCompositing is updated from the pref - view->compositor()->cacheAcceleratedCompositingEnabledFlag(); + view->compositor()->cacheAcceleratedCompositingFlags(); if (!view->usesCompositing()) return; @@ -466,8 +490,9 @@ bool FrameView::syncCompositingStateRecursive() } } return allSubframesSynced; -#endif // USE(ACCELERATED_COMPOSITING) +#else // USE(ACCELERATED_COMPOSITING) return true; +#endif } void FrameView::didMoveOnscreen() @@ -513,9 +538,8 @@ void FrameView::layout(bool allowSubtree) if (isPainting()) return; -#if ENABLE(INSPECTOR) - InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent(); - if (timelineAgent) +#if ENABLE(INSPECTOR) + if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent()) timelineAgent->willLayout(); #endif @@ -577,7 +601,13 @@ void FrameView::layout(bool allowSubtree) ScrollbarMode hMode; ScrollbarMode vMode; - scrollbarModes(hMode, vMode); + if (m_canHaveScrollbars) { + hMode = ScrollbarAuto; + vMode = ScrollbarAuto; + } else { + hMode = ScrollbarAlwaysOff; + vMode = ScrollbarAlwaysOff; + } if (!subtree) { RenderObject* rootRenderer = document->documentElement() ? document->documentElement()->renderer() : 0; @@ -714,7 +744,7 @@ void FrameView::layout(bool allowSubtree) } #if ENABLE(INSPECTOR) - if (timelineAgent) + if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent()) timelineAgent->didLayout(); #endif @@ -756,6 +786,11 @@ bool FrameView::useSlowRepaints() const return m_useSlowRepaints || m_slowRepaintObjectCount > 0 || m_isOverlapped || !m_contentIsOpaque; } +bool FrameView::useSlowRepaintsIfNotOverlapped() const +{ + return m_useSlowRepaints || m_slowRepaintObjectCount > 0 || !m_contentIsOpaque; +} + void FrameView::setUseSlowRepaints() { m_useSlowRepaints = true; @@ -939,6 +974,7 @@ void FrameView::repaintContentRectangle(const IntRect& r, bool immediate) double delay = adjustedDeferredRepaintDelay(); if ((m_deferringRepaints || m_deferredRepaintTimer.isActive() || delay) && !immediate) { +<<<<<<< HEAD:WebCore/page/FrameView.cpp IntRect visibleContent = visibleContentRect(); #ifdef ANDROID_CAPTURE_OFFSCREEN_PAINTS IntRect fullVis = visibleContent; @@ -949,6 +985,12 @@ void FrameView::repaintContentRectangle(const IntRect& r, bool immediate) ScrollView::platformOffscreenContentRectangle(fullVis, r); #endif if (visibleContent.isEmpty()) +======= + IntRect paintRect = r; + if (!paintsEntireContents()) + paintRect.intersect(visibleContentRect()); + if (paintRect.isEmpty()) +>>>>>>> webkit.org at r51976:WebCore/page/FrameView.cpp return; if (m_repaintCount == cRepaintRectUnionThreshold) { IntRect unionedRect; @@ -958,9 +1000,9 @@ void FrameView::repaintContentRectangle(const IntRect& r, bool immediate) m_repaintRects.append(unionedRect); } if (m_repaintCount < cRepaintRectUnionThreshold) - m_repaintRects.append(visibleContent); + m_repaintRects.append(paintRect); else - m_repaintRects[0].unite(visibleContent); + m_repaintRects[0].unite(paintRect); m_repaintCount++; if (!m_deferringRepaints && !m_deferredRepaintTimer.isActive()) @@ -1491,6 +1533,7 @@ void FrameView::valueChanged(Scrollbar* bar) ScrollView::valueChanged(bar); if (offset != scrollOffset()) frame()->eventHandler()->sendScrollEvent(); + frame()->loader()->client()->didChangeScrollOffset(); } void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) @@ -1655,9 +1698,8 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) return; #if ENABLE(INSPECTOR) - InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent(); - if (timelineAgent) - timelineAgent->willPaint(); + if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent()) + timelineAgent->willPaint(rect); #endif Document* document = frame()->document(); @@ -1670,7 +1712,7 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) fillWithRed = false; // Subframe, don't fill with red. else if (isTransparent()) fillWithRed = false; // Transparent, don't fill with red. - else if (m_paintRestriction == PaintRestrictionSelectionOnly || m_paintRestriction == PaintRestrictionSelectionOnlyBlackText) + else if (m_paintBehavior & PaintBehaviorSelectionOnly) fillWithRed = false; // Selections are transparent, don't fill with red. else if (m_nodeToDraw) fillWithRed = false; // Element images are transparent, don't fill with red. @@ -1678,7 +1720,7 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) fillWithRed = true; if (fillWithRed) - p->fillRect(rect, Color(0xFF, 0, 0)); + p->fillRect(rect, Color(0xFF, 0, 0), DeviceColorSpace); #endif bool isTopLevelPainter = !sCurrentPaintTimeStamp; @@ -1708,9 +1750,15 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) // m_nodeToDraw is used to draw only one element (and its descendants) RenderObject* eltRenderer = m_nodeToDraw ? m_nodeToDraw->renderer() : 0; - if (m_paintRestriction == PaintRestrictionNone) + + PaintBehavior paintBehavior = m_paintBehavior; + if (paintBehavior == PaintBehaviorNormal) document->invalidateRenderedRectsForMarkersInRect(rect); - contentRenderer->layer()->paint(p, rect, m_paintRestriction, eltRenderer); + + if (document->printing()) + paintBehavior |= PaintBehaviorFlattenCompositingLayers; + + contentRenderer->layer()->paint(p, rect, paintBehavior, eltRenderer); m_isPainting = false; m_lastPaintTime = currentTime(); @@ -1725,14 +1773,14 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) sCurrentPaintTimeStamp = 0; #if ENABLE(INSPECTOR) - if (timelineAgent) + if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent()) timelineAgent->didPaint(); #endif } -void FrameView::setPaintRestriction(PaintRestriction pr) +void FrameView::setPaintBehavior(PaintBehavior behavior) { - m_paintRestriction = pr; + m_paintBehavior = behavior; } bool FrameView::isPainting() const |