summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp
blob: bd4e7c85c0dceac7cb8c958edfb638899370c7e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "config.h"
#include "core/frame/RemoteFrameView.h"

#include "core/frame/RemoteFrame.h"
#include "core/rendering/RenderPart.h"

namespace WebCore {

RemoteFrameView::RemoteFrameView(RemoteFrame* remoteFrame)
    : m_remoteFrame(remoteFrame)
{
    ASSERT(remoteFrame);
}

RemoteFrameView::~RemoteFrameView()
{
}

PassRefPtr<RemoteFrameView> RemoteFrameView::create(RemoteFrame* remoteFrame)
{
    RefPtr<RemoteFrameView> view = adoptRef(new RemoteFrameView(remoteFrame));
    view->show();
    return view.release();
}

void RemoteFrameView::invalidateRect(const IntRect& rect)
{
    RenderPart* renderer = m_remoteFrame->ownerRenderer();
    if (!renderer)
        return;

    IntRect repaintRect = rect;
    repaintRect.move(renderer->borderLeft() + renderer->paddingLeft(),
        renderer->borderTop() + renderer->paddingTop());
    renderer->invalidatePaintRectangle(repaintRect);
}

void RemoteFrameView::setFrameRect(const IntRect& newRect)
{
    IntRect oldRect = frameRect();

    if (newRect == oldRect)
        return;

    Widget::setFrameRect(newRect);

    frameRectsChanged();
}

void RemoteFrameView::frameRectsChanged()
{
    // FIXME: Notify embedder via WebLocalFrameClient when that is possible.
}

} // namespace WebCore