Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 648423002: Move painting code from FrameView to FramePainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed debug build. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "core/inspector/InspectorTraceEvents.h" 48 #include "core/inspector/InspectorTraceEvents.h"
49 #include "core/loader/FrameLoader.h" 49 #include "core/loader/FrameLoader.h"
50 #include "core/loader/FrameLoaderClient.h" 50 #include "core/loader/FrameLoaderClient.h"
51 #include "core/page/Chrome.h" 51 #include "core/page/Chrome.h"
52 #include "core/page/ChromeClient.h" 52 #include "core/page/ChromeClient.h"
53 #include "core/page/EventHandler.h" 53 #include "core/page/EventHandler.h"
54 #include "core/page/FocusController.h" 54 #include "core/page/FocusController.h"
55 #include "core/page/FrameTree.h" 55 #include "core/page/FrameTree.h"
56 #include "core/page/Page.h" 56 #include "core/page/Page.h"
57 #include "core/page/scrolling/ScrollingCoordinator.h" 57 #include "core/page/scrolling/ScrollingCoordinator.h"
58 #include "core/paint/LayerPainter.h" 58 #include "core/paint/FramePainter.h"
59 #include "core/paint/ScrollbarPainter.h"
60 #include "core/rendering/RenderCounter.h" 59 #include "core/rendering/RenderCounter.h"
61 #include "core/rendering/RenderEmbeddedObject.h" 60 #include "core/rendering/RenderEmbeddedObject.h"
62 #include "core/rendering/RenderLayer.h" 61 #include "core/rendering/RenderLayer.h"
63 #include "core/rendering/RenderListBox.h" 62 #include "core/rendering/RenderListBox.h"
64 #include "core/rendering/RenderPart.h" 63 #include "core/rendering/RenderPart.h"
65 #include "core/rendering/RenderScrollbar.h" 64 #include "core/rendering/RenderScrollbar.h"
66 #include "core/rendering/RenderScrollbarPart.h" 65 #include "core/rendering/RenderScrollbarPart.h"
67 #include "core/rendering/RenderTheme.h" 66 #include "core/rendering/RenderTheme.h"
68 #include "core/rendering/RenderView.h" 67 #include "core/rendering/RenderView.h"
69 #include "core/rendering/TextAutosizer.h" 68 #include "core/rendering/TextAutosizer.h"
(...skipping 19 matching lines...) Expand all
89 #include "platform/text/TextStream.h" 88 #include "platform/text/TextStream.h"
90 #include "wtf/CurrentTime.h" 89 #include "wtf/CurrentTime.h"
91 #include "wtf/StdLibExtras.h" 90 #include "wtf/StdLibExtras.h"
92 #include "wtf/TemporaryChange.h" 91 #include "wtf/TemporaryChange.h"
93 92
94 namespace blink { 93 namespace blink {
95 94
96 using namespace HTMLNames; 95 using namespace HTMLNames;
97 96
98 double FrameView::s_currentFrameTimeStamp = 0.0; 97 double FrameView::s_currentFrameTimeStamp = 0.0;
99 bool FrameView::s_inPaintContents = false;
100 98
101 // The maximum number of updateWidgets iterations that should be done before ret urning. 99 // The maximum number of updateWidgets iterations that should be done before ret urning.
102 static const unsigned maxUpdateWidgetsIterations = 2; 100 static const unsigned maxUpdateWidgetsIterations = 2;
103 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; 101 static const double resourcePriorityUpdateDelayAfterScroll = 0.250;
104 102
105 FrameView::FrameView(LocalFrame* frame) 103 FrameView::FrameView(LocalFrame* frame)
106 : m_frame(frame) 104 : m_frame(frame)
107 , m_canHaveScrollbars(true) 105 , m_canHaveScrollbars(true)
108 , m_slowRepaintObjectCount(0) 106 , m_slowRepaintObjectCount(0)
109 , m_hasPendingLayout(false) 107 , m_hasPendingLayout(false)
(...skipping 20 matching lines...) Expand all
130 #if ENABLE(OILPAN) && ENABLE(ASSERT) 128 #if ENABLE(OILPAN) && ENABLE(ASSERT)
131 , m_hasBeenDisposed(false) 129 , m_hasBeenDisposed(false)
132 #endif 130 #endif
133 , m_horizontalScrollbarMode(ScrollbarAuto) 131 , m_horizontalScrollbarMode(ScrollbarAuto)
134 , m_verticalScrollbarMode(ScrollbarAuto) 132 , m_verticalScrollbarMode(ScrollbarAuto)
135 , m_horizontalScrollbarLock(false) 133 , m_horizontalScrollbarLock(false)
136 , m_verticalScrollbarLock(false) 134 , m_verticalScrollbarLock(false)
137 , m_scrollbarsAvoidingResizer(0) 135 , m_scrollbarsAvoidingResizer(0)
138 , m_scrollbarsSuppressed(false) 136 , m_scrollbarsSuppressed(false)
139 , m_inUpdateScrollbars(false) 137 , m_inUpdateScrollbars(false)
140 , m_drawPanScrollIcon(false) 138 , m_shouldDrawPanScrollIcon(false)
141 , m_clipsRepaints(true) 139 , m_clipsRepaints(true)
142 { 140 {
143 ASSERT(m_frame); 141 ASSERT(m_frame);
144 init(); 142 init();
145 143
146 if (!m_frame->isMainFrame()) 144 if (!m_frame->isMainFrame())
147 return; 145 return;
148 146
149 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); 147 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed);
150 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); 148 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed);
(...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2356 m_scrollCorner->setStyle(cornerStyle.release()); 2354 m_scrollCorner->setStyle(cornerStyle.release());
2357 invalidateScrollCorner(cornerRect); 2355 invalidateScrollCorner(cornerRect);
2358 } else if (m_scrollCorner) { 2356 } else if (m_scrollCorner) {
2359 m_scrollCorner->destroy(); 2357 m_scrollCorner->destroy();
2360 m_scrollCorner = nullptr; 2358 m_scrollCorner = nullptr;
2361 } 2359 }
2362 2360
2363 updateScrollCornerInternal(); 2361 updateScrollCornerInternal();
2364 } 2362 }
2365 2363
2366 void FrameView::paintScrollCorner(GraphicsContext* context, const IntRect& corne rRect)
2367 {
2368 if (m_scrollCorner) {
2369 bool needsBackgorund = m_frame->isMainFrame();
2370 if (needsBackgorund)
2371 context->fillRect(cornerRect, baseBackgroundColor());
2372 ScrollbarPainter::paintIntoRect(m_scrollCorner, context, cornerRect.loca tion(), cornerRect);
2373 return;
2374 }
2375
2376 paintScrollCornerInternal(context, cornerRect);
2377 }
2378
2379 void FrameView::paintScrollbar(GraphicsContext* context, Scrollbar* bar, const I ntRect& rect)
2380 {
2381 bool needsBackgorund = bar->isCustomScrollbar() && m_frame->isMainFrame();
2382 if (needsBackgorund) {
2383 IntRect toFill = bar->frameRect();
2384 toFill.intersect(rect);
2385 context->fillRect(toFill, baseBackgroundColor());
2386 }
2387
2388 paintScrollbarInternal(context, bar, rect);
2389 }
2390
2391 Color FrameView::documentBackgroundColor() const 2364 Color FrameView::documentBackgroundColor() const
2392 { 2365 {
2393 // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background c olor of 2366 // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background c olor of
2394 // the document and the body against the base background color of the frame view. 2367 // the document and the body against the base background color of the frame view.
2395 // Background images are unfortunately impractical to include. 2368 // Background images are unfortunately impractical to include.
2396 2369
2397 Color result = baseBackgroundColor(); 2370 Color result = baseBackgroundColor();
2398 if (!frame().document()) 2371 if (!frame().document())
2399 return result; 2372 return result;
2400 2373
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 } 2426 }
2454 2427
2455 void FrameView::setWasScrolledByUser(bool wasScrolledByUser) 2428 void FrameView::setWasScrolledByUser(bool wasScrolledByUser)
2456 { 2429 {
2457 if (m_inProgrammaticScroll) 2430 if (m_inProgrammaticScroll)
2458 return; 2431 return;
2459 m_maintainScrollPositionAnchor = nullptr; 2432 m_maintainScrollPositionAnchor = nullptr;
2460 m_wasScrolledByUser = wasScrolledByUser; 2433 m_wasScrolledByUser = wasScrolledByUser;
2461 } 2434 }
2462 2435
2463 void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
2464 {
2465 Document* document = m_frame->document();
2466
2467 #ifndef NDEBUG
2468 bool fillWithRed;
2469 if (document->printing())
2470 fillWithRed = false; // Printing, don't fill with red (can't remember wh y).
2471 else if (m_frame->owner())
2472 fillWithRed = false; // Subframe, don't fill with red.
2473 else if (isTransparent())
2474 fillWithRed = false; // Transparent, don't fill with red.
2475 else if (m_paintBehavior & PaintBehaviorSelectionOnly)
2476 fillWithRed = false; // Selections are transparent, don't fill with red.
2477 else if (m_nodeToDraw)
2478 fillWithRed = false; // Element images are transparent, don't fill with red.
2479 else
2480 fillWithRed = true;
2481
2482 if (fillWithRed)
2483 p->fillRect(rect, Color(0xFF, 0, 0));
2484 #endif
2485
2486 RenderView* renderView = this->renderView();
2487 if (!renderView) {
2488 WTF_LOG_ERROR("called FrameView::paint with nil renderer");
2489 return;
2490 }
2491
2492 RELEASE_ASSERT(!needsLayout());
2493 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingClean) ;
2494
2495 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Paint", "data" , InspectorPaintEvent::data(renderView, rect, 0));
2496 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack());
2497 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing.
2498 InspectorInstrumentation::willPaint(renderView, 0);
2499
2500 bool isTopLevelPainter = !s_inPaintContents;
2501 s_inPaintContents = true;
2502
2503 FontCachePurgePreventer fontCachePurgePreventer;
2504
2505 PaintBehavior oldPaintBehavior = m_paintBehavior;
2506
2507 if (FrameView* parentView = parentFrameView()) {
2508 if (parentView->paintBehavior() & PaintBehaviorFlattenCompositingLayers)
2509 m_paintBehavior |= PaintBehaviorFlattenCompositingLayers;
2510 }
2511
2512 if (m_paintBehavior == PaintBehaviorNormal)
2513 document->markers().invalidateRenderedRectsForMarkersInRect(rect);
2514
2515 if (document->printing())
2516 m_paintBehavior |= PaintBehaviorFlattenCompositingLayers;
2517
2518 ASSERT(!m_isPainting);
2519 m_isPainting = true;
2520
2521 // m_nodeToDraw is used to draw only one element (and its descendants)
2522 RenderObject* renderer = m_nodeToDraw ? m_nodeToDraw->renderer() : 0;
2523 RenderLayer* rootLayer = renderView->layer();
2524
2525 #if ENABLE(ASSERT)
2526 renderView->assertSubtreeIsLaidOut();
2527 RenderObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer- >renderer());
2528 #endif
2529
2530 LayerPainter layerPainter(*rootLayer);
2531
2532 layerPainter.paint(p, rect, m_paintBehavior, renderer);
2533
2534 if (rootLayer->containsDirtyOverlayScrollbars())
2535 layerPainter.paintOverlayScrollbars(p, rect, m_paintBehavior, renderer);
2536
2537 m_isPainting = false;
2538
2539 m_paintBehavior = oldPaintBehavior;
2540 m_lastPaintTime = currentTime();
2541
2542 // Regions may have changed as a result of the visibility/z-index of element changing.
2543 if (document->annotatedRegionsDirty())
2544 updateAnnotatedRegions();
2545
2546 if (isTopLevelPainter) {
2547 // Everything that happens after paintContents completions is considered
2548 // to be part of the next frame.
2549 s_currentFrameTimeStamp = currentTime();
2550 s_inPaintContents = false;
2551 }
2552
2553 InspectorInstrumentation::didPaint(renderView, 0, p, rect);
2554 }
2555
2556 void FrameView::setPaintBehavior(PaintBehavior behavior) 2436 void FrameView::setPaintBehavior(PaintBehavior behavior)
2557 { 2437 {
2558 m_paintBehavior = behavior; 2438 m_paintBehavior = behavior;
2559 } 2439 }
2560 2440
2561 PaintBehavior FrameView::paintBehavior() const 2441 PaintBehavior FrameView::paintBehavior() const
2562 { 2442 {
2563 return m_paintBehavior; 2443 return m_paintBehavior;
2564 } 2444 }
2565 2445
2566 bool FrameView::isPainting() const 2446 bool FrameView::isPainting() const
2567 { 2447 {
2568 return m_isPainting; 2448 return m_isPainting;
2569 } 2449 }
2570 2450
2571 void FrameView::setNodeToDraw(Node* node) 2451 void FrameView::setNodeToDraw(Node* node)
2572 { 2452 {
2573 m_nodeToDraw = node; 2453 m_nodeToDraw = node;
2574 } 2454 }
2575 2455
2576 void FrameView::paintOverhangAreas(GraphicsContext* context, const IntRect& hori zontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRec t)
2577 {
2578 if (m_frame->document()->printing())
2579 return;
2580
2581 if (m_frame->isMainFrame()) {
2582 if (m_frame->page()->chrome().client().paintCustomOverhangArea(context, horizontalOverhangArea, verticalOverhangArea, dirtyRect))
2583 return;
2584 }
2585
2586 paintOverhangAreasInternal(context, horizontalOverhangArea, verticalOverhang Area, dirtyRect);
2587 }
2588
2589 void FrameView::updateWidgetPositionsIfNeeded() 2456 void FrameView::updateWidgetPositionsIfNeeded()
2590 { 2457 {
2591 if (!m_needsUpdateWidgetPositions) 2458 if (!m_needsUpdateWidgetPositions)
2592 return; 2459 return;
2593 2460
2594 m_needsUpdateWidgetPositions = false; 2461 m_needsUpdateWidgetPositions = false;
2595 2462
2596 updateWidgetPositions(); 2463 updateWidgetPositions();
2597 } 2464 }
2598 2465
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
3632 void FrameView::scrollContents(const IntSize& scrollDelta) 3499 void FrameView::scrollContents(const IntSize& scrollDelta)
3633 { 3500 {
3634 HostWindow* window = hostWindow(); 3501 HostWindow* window = hostWindow();
3635 if (!window) 3502 if (!window)
3636 return; 3503 return;
3637 3504
3638 IntRect clipRect = windowClipRect(); 3505 IntRect clipRect = windowClipRect();
3639 IntRect updateRect = clipRect; 3506 IntRect updateRect = clipRect;
3640 updateRect.intersect(rectToCopyOnScroll()); 3507 updateRect.intersect(rectToCopyOnScroll());
3641 3508
3642 if (m_drawPanScrollIcon) { 3509 if (m_shouldDrawPanScrollIcon) {
3643 // FIXME: the pan icon is broken when accelerated compositing is on, sin ce it will draw under the compositing layers. 3510 // FIXME: the pan icon is broken when accelerated compositing is on, sin ce it will draw under the compositing layers.
3644 // https://bugs.webkit.org/show_bug.cgi?id=47837 3511 // https://bugs.webkit.org/show_bug.cgi?id=47837
3645 int panIconDirtySquareSizeLength = 2 * (panIconSizeLength + std::max(abs (scrollDelta.width()), abs(scrollDelta.height()))); // We only want to repaint w hat's necessary 3512 int panIconDirtySquareSizeLength = 2 * (panIconSizeLength + std::max(abs (scrollDelta.width()), abs(scrollDelta.height()))); // We only want to repaint w hat's necessary
3646 IntPoint panIconDirtySquareLocation = IntPoint(m_panScrollIconPoint.x() - (panIconDirtySquareSizeLength / 2), m_panScrollIconPoint.y() - (panIconDirtySq uareSizeLength / 2)); 3513 IntPoint panIconDirtySquareLocation = IntPoint(m_panScrollIconPoint.x() - (panIconDirtySquareSizeLength / 2), m_panScrollIconPoint.y() - (panIconDirtySq uareSizeLength / 2));
3647 IntRect panScrollIconDirtyRect = IntRect(panIconDirtySquareLocation, Int Size(panIconDirtySquareSizeLength, panIconDirtySquareSizeLength)); 3514 IntRect panScrollIconDirtyRect = IntRect(panIconDirtySquareLocation, Int Size(panIconDirtySquareSizeLength, panIconDirtySquareSizeLength));
3648 panScrollIconDirtyRect.intersect(clipRect); 3515 panScrollIconDirtyRect.intersect(clipRect);
3649 window->invalidateContentsAndRootView(panScrollIconDirtyRect); 3516 window->invalidateContentsAndRootView(panScrollIconDirtyRect);
3650 } 3517 }
3651 3518
3652 if (!scrollContentsFastPath(-scrollDelta)) 3519 if (!scrollContentsFastPath(-scrollDelta))
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
3918 adjustScrollbarOpacity(); 3785 adjustScrollbarOpacity();
3919 contentsResized(); 3786 contentsResized();
3920 updateScrollbars(scrollOffsetDouble()); 3787 updateScrollbars(scrollOffsetDouble());
3921 positionScrollbarLayers(); 3788 positionScrollbarLayers();
3922 } 3789 }
3923 3790
3924 void FrameView::updateScrollCornerInternal() 3791 void FrameView::updateScrollCornerInternal()
3925 { 3792 {
3926 } 3793 }
3927 3794
3928 void FrameView::paintScrollCornerInternal(GraphicsContext* context, const IntRec t& cornerRect)
3929 {
3930 ScrollbarTheme::theme()->paintScrollCorner(context, cornerRect);
3931 }
3932
3933 void FrameView::paintScrollbarInternal(GraphicsContext* context, Scrollbar* bar, const IntRect& rect)
3934 {
3935 bar->paint(context, rect);
3936 }
3937
3938 void FrameView::invalidateScrollCornerRect(const IntRect& rect) 3795 void FrameView::invalidateScrollCornerRect(const IntRect& rect)
3939 { 3796 {
3940 invalidateRect(rect); 3797 invalidateRect(rect);
3941 } 3798 }
3942 3799
3943 void FrameView::paintScrollbars(GraphicsContext* context, const IntRect& rect)
3944 {
3945 if (m_horizontalScrollbar && !layerForHorizontalScrollbar())
3946 paintScrollbar(context, m_horizontalScrollbar.get(), rect);
3947 if (m_verticalScrollbar && !layerForVerticalScrollbar())
3948 paintScrollbar(context, m_verticalScrollbar.get(), rect);
3949
3950 if (layerForScrollCorner())
3951 return;
3952 paintScrollCorner(context, scrollCornerRect());
3953 }
3954
3955 void FrameView::paintPanScrollIcon(GraphicsContext* context) 3800 void FrameView::paintPanScrollIcon(GraphicsContext* context)
3956 { 3801 {
3957 DEFINE_STATIC_REF(Image, panScrollIcon, (Image::loadPlatformResource("panIco n"))); 3802 DEFINE_STATIC_REF(Image, panScrollIcon, (Image::loadPlatformResource("panIco n")));
3958 IntPoint iconGCPoint = m_panScrollIconPoint; 3803 IntPoint iconGCPoint = m_panScrollIconPoint;
3959 if (parent()) 3804 if (parent())
3960 iconGCPoint = toFrameView(parent())->windowToContents(iconGCPoint); 3805 iconGCPoint = toFrameView(parent())->windowToContents(iconGCPoint);
3961 context->drawImage(panScrollIcon, iconGCPoint); 3806 context->drawImage(panScrollIcon, iconGCPoint);
3962 } 3807 }
3963 3808
3964 void FrameView::paint(GraphicsContext* context, const IntRect& rect) 3809 void FrameView::paint(GraphicsContext* context, const IntRect& rect)
3965 { 3810 {
3966 notifyPageThatContentAreaWillPaint(); 3811 FramePainter(*this).paint(context, rect);
3812 }
3967 3813
3968 IntRect documentDirtyRect = rect; 3814 void FrameView::paintContents(GraphicsContext* context, const IntRect& damageRec t)
3969 IntRect visibleAreaWithoutScrollbars(location(), visibleContentRect().size() ); 3815 {
3970 documentDirtyRect.intersect(visibleAreaWithoutScrollbars); 3816 FramePainter(*this).paintContents(context, damageRect);
3971
3972 if (!documentDirtyRect.isEmpty()) {
3973 GraphicsContextStateSaver stateSaver(*context);
3974
3975 context->translate(x() - scrollX(), y() - scrollY());
3976 context->clip(visibleContentRect());
3977
3978 documentDirtyRect.moveBy(-location() + scrollPosition());
3979 paintContents(context, documentDirtyRect);
3980 }
3981
3982 calculateAndPaintOverhangAreas(context, rect);
3983
3984 // Now paint the scrollbars.
3985 if (!m_scrollbarsSuppressed && (m_horizontalScrollbar || m_verticalScrollbar )) {
3986 GraphicsContextStateSaver stateSaver(*context);
3987 IntRect scrollViewDirtyRect = rect;
3988 IntRect visibleAreaWithScrollbars(location(), visibleContentRect(Include Scrollbars).size());
3989 scrollViewDirtyRect.intersect(visibleAreaWithScrollbars);
3990 context->translate(x(), y());
3991 scrollViewDirtyRect.moveBy(-location());
3992 context->clip(IntRect(IntPoint(), visibleAreaWithScrollbars.size()));
3993
3994 paintScrollbars(context, scrollViewDirtyRect);
3995 }
3996
3997 // Paint the panScroll Icon
3998 if (m_drawPanScrollIcon)
3999 paintPanScrollIcon(context);
4000 } 3817 }
4001 3818
4002 void FrameView::calculateOverhangAreasForPainting(IntRect& horizontalOverhangRec t, IntRect& verticalOverhangRect) 3819 void FrameView::calculateOverhangAreasForPainting(IntRect& horizontalOverhangRec t, IntRect& verticalOverhangRect)
4003 { 3820 {
4004 int verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->i sOverlayScrollbar()) 3821 int verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->i sOverlayScrollbar())
4005 ? verticalScrollbar()->width() : 0; 3822 ? verticalScrollbar()->width() : 0;
4006 int horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollb ar()->isOverlayScrollbar()) 3823 int horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollb ar()->isOverlayScrollbar())
4007 ? horizontalScrollbar()->height() : 0; 3824 ? horizontalScrollbar()->height() : 0;
4008 3825
4009 int physicalScrollY = scrollPosition().y() + scrollOrigin().y(); 3826 int physicalScrollY = scrollPosition().y() + scrollOrigin().y();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
4048 3865
4049 IntRect horizontalOverhangRect; 3866 IntRect horizontalOverhangRect;
4050 IntRect verticalOverhangRect; 3867 IntRect verticalOverhangRect;
4051 calculateOverhangAreasForPainting(horizontalOverhangRect, verticalOverhangRe ct); 3868 calculateOverhangAreasForPainting(horizontalOverhangRect, verticalOverhangRe ct);
4052 if (!horizontalOverhangRect.isEmpty()) 3869 if (!horizontalOverhangRect.isEmpty())
4053 window->invalidateContentsAndRootView(horizontalOverhangRect); 3870 window->invalidateContentsAndRootView(horizontalOverhangRect);
4054 if (!verticalOverhangRect.isEmpty()) 3871 if (!verticalOverhangRect.isEmpty())
4055 window->invalidateContentsAndRootView(verticalOverhangRect); 3872 window->invalidateContentsAndRootView(verticalOverhangRect);
4056 } 3873 }
4057 3874
4058 void FrameView::paintOverhangAreasInternal(GraphicsContext* context, const IntRe ct& horizontalOverhangRect, const IntRect& verticalOverhangRect, const IntRect& dirtyRect)
4059 {
4060 ScrollbarTheme::theme()->paintOverhangBackground(context, horizontalOverhang Rect, verticalOverhangRect, dirtyRect);
4061 ScrollbarTheme::theme()->paintOverhangShadows(context, scrollOffset(), horiz ontalOverhangRect, verticalOverhangRect, dirtyRect);
4062 }
4063
4064 void FrameView::calculateAndPaintOverhangAreas(GraphicsContext* context, const I ntRect& dirtyRect)
4065 {
4066 IntRect horizontalOverhangRect;
4067 IntRect verticalOverhangRect;
4068 calculateOverhangAreasForPainting(horizontalOverhangRect, verticalOverhangRe ct);
4069
4070 if (dirtyRect.intersects(horizontalOverhangRect) || dirtyRect.intersects(ver ticalOverhangRect))
4071 paintOverhangAreas(context, horizontalOverhangRect, verticalOverhangRect , dirtyRect);
4072 }
4073
4074 void FrameView::calculateAndPaintOverhangBackground(GraphicsContext* context, co nst IntRect& dirtyRect)
4075 {
4076 IntRect horizontalOverhangRect;
4077 IntRect verticalOverhangRect;
4078 calculateOverhangAreasForPainting(horizontalOverhangRect, verticalOverhangRe ct);
4079
4080 if (dirtyRect.intersects(horizontalOverhangRect) || dirtyRect.intersects(ver ticalOverhangRect))
4081 ScrollbarTheme::theme()->paintOverhangBackground(context, horizontalOver hangRect, verticalOverhangRect, dirtyRect);
4082 }
4083
4084 bool FrameView::isPointInScrollbarCorner(const IntPoint& windowPoint) 3875 bool FrameView::isPointInScrollbarCorner(const IntPoint& windowPoint)
4085 { 3876 {
4086 if (!scrollbarCornerPresent()) 3877 if (!scrollbarCornerPresent())
4087 return false; 3878 return false;
4088 3879
4089 IntPoint viewPoint = convertFromContainingWindow(windowPoint); 3880 IntPoint viewPoint = convertFromContainingWindow(windowPoint);
4090 3881
4091 if (m_horizontalScrollbar) { 3882 if (m_horizontalScrollbar) {
4092 int horizontalScrollbarYMin = m_horizontalScrollbar->frameRect().y(); 3883 int horizontalScrollbarYMin = m_horizontalScrollbar->frameRect().y();
4093 int horizontalScrollbarYMax = m_horizontalScrollbar->frameRect().y() + m _horizontalScrollbar->frameRect().height(); 3884 int horizontalScrollbarYMax = m_horizontalScrollbar->frameRect().y() + m _horizontalScrollbar->frameRect().height();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
4183 } 3974 }
4184 3975
4185 Widget::hide(); 3976 Widget::hide();
4186 } 3977 }
4187 3978
4188 void FrameView::addPanScrollIcon(const IntPoint& iconPosition) 3979 void FrameView::addPanScrollIcon(const IntPoint& iconPosition)
4189 { 3980 {
4190 HostWindow* window = hostWindow(); 3981 HostWindow* window = hostWindow();
4191 if (!window) 3982 if (!window)
4192 return; 3983 return;
4193 m_drawPanScrollIcon = true; 3984 m_shouldDrawPanScrollIcon = true;
4194 m_panScrollIconPoint = IntPoint(iconPosition.x() - panIconSizeLength / 2 , i conPosition.y() - panIconSizeLength / 2); 3985 m_panScrollIconPoint = IntPoint(iconPosition.x() - panIconSizeLength / 2 , i conPosition.y() - panIconSizeLength / 2);
4195 window->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, IntSize( panIconSizeLength, panIconSizeLength))); 3986 window->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, IntSize( panIconSizeLength, panIconSizeLength)));
4196 } 3987 }
4197 3988
4198 void FrameView::removePanScrollIcon() 3989 void FrameView::removePanScrollIcon()
4199 { 3990 {
4200 HostWindow* window = hostWindow(); 3991 HostWindow* window = hostWindow();
4201 if (!window) 3992 if (!window)
4202 return; 3993 return;
4203 m_drawPanScrollIcon = false; 3994 m_shouldDrawPanScrollIcon = false;
4204 window->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, IntSize( panIconSizeLength, panIconSizeLength))); 3995 window->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, IntSize( panIconSizeLength, panIconSizeLength)));
4205 } 3996 }
4206 3997
4207 void FrameView::setScrollOrigin(const IntPoint& origin, bool updatePositionAtAll , bool updatePositionSynchronously) 3998 void FrameView::setScrollOrigin(const IntPoint& origin, bool updatePositionAtAll , bool updatePositionSynchronously)
4208 { 3999 {
4209 if (scrollOrigin() == origin) 4000 if (scrollOrigin() == origin)
4210 return; 4001 return;
4211 4002
4212 ScrollableArea::setScrollOrigin(origin); 4003 ScrollableArea::setScrollOrigin(origin);
4213 4004
4214 // Update if the scroll origin changes, since our position will be different if the content size did not change. 4005 // Update if the scroll origin changes, since our position will be different if the content size did not change.
4215 if (updatePositionAtAll && updatePositionSynchronously) 4006 if (updatePositionAtAll && updatePositionSynchronously)
4216 updateScrollbars(scrollOffsetDouble()); 4007 updateScrollbars(scrollOffsetDouble());
4217 } 4008 }
4218 4009
4219 } // namespace blink 4010 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698