diff options
author | Feng Qian <fqian@google.com> | 2009-06-17 12:12:20 -0700 |
---|---|---|
committer | Feng Qian <fqian@google.com> | 2009-06-17 12:12:20 -0700 |
commit | 5f1ab04193ad0130ca8204aadaceae083aca9881 (patch) | |
tree | 5a92cd389e2cfe7fb67197ce14b38469462379f8 /WebCore/rendering/RenderWidget.cpp | |
parent | 194315e5a908cc8ed67d597010544803eef1ac59 (diff) | |
download | external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.zip external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.tar.gz external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.tar.bz2 |
Get WebKit r44544.
Diffstat (limited to 'WebCore/rendering/RenderWidget.cpp')
-rw-r--r-- | WebCore/rendering/RenderWidget.cpp | 70 |
1 files changed, 41 insertions, 29 deletions
diff --git a/WebCore/rendering/RenderWidget.cpp b/WebCore/rendering/RenderWidget.cpp index 2f30c59..ec2ee6a 100644 --- a/WebCore/rendering/RenderWidget.cpp +++ b/WebCore/rendering/RenderWidget.cpp @@ -1,9 +1,7 @@ -/** - * This file is part of the HTML widget for KDE. - * +/* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2006 Apple Computer, Inc. + * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -27,13 +25,8 @@ #include "AnimationController.h" #include "AXObjectCache.h" -#include "Document.h" -#include "Element.h" -#include "Event.h" -#include "FrameView.h" #include "GraphicsContext.h" #include "HitTestResult.h" -#include "RenderLayer.h" #include "RenderView.h" using namespace std; @@ -47,14 +40,11 @@ static HashMap<const Widget*, RenderWidget*>& widgetRendererMap() } RenderWidget::RenderWidget(Node* node) - : RenderReplaced(node) - , m_widget(0) - , m_refCount(0) + : RenderReplaced(node) + , m_widget(0) + , m_frameView(node->document()->view()) + , m_refCount(0) { - // a replaced element doesn't support being anonymous - ASSERT(node); - m_view = node->document()->view(); - view()->addWidget(this); // Reference counting is used to prevent the widget from being @@ -82,8 +72,8 @@ void RenderWidget::destroy() remove(); if (m_widget) { - if (m_view) - m_view->removeChild(m_widget); + if (m_frameView) + m_frameView->removeChild(m_widget); widgetRendererMap().remove(m_widget); } @@ -96,6 +86,7 @@ void RenderWidget::destroy() if (hasLayer()) { layer()->clearClipRects(); + setHasLayer(false); destroyLayer(); } @@ -109,7 +100,7 @@ void RenderWidget::destroy() RenderWidget::~RenderWidget() { ASSERT(m_refCount <= 0); - deleteWidget(); + clearWidget(); } void RenderWidget::setWidgetGeometry(const IntRect& frame) @@ -128,7 +119,7 @@ void RenderWidget::setWidget(Widget* widget) if (m_widget) { m_widget->removeFromParent(); widgetRendererMap().remove(m_widget); - deleteWidget(); + clearWidget(); } m_widget = widget; if (m_widget) { @@ -144,7 +135,7 @@ void RenderWidget::setWidget(Widget* widget) else m_widget->show(); } - m_view->addChild(m_widget); + m_frameView->addChild(m_widget); } } } @@ -183,7 +174,7 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty) return; } - if (!m_view || paintInfo.phase != PaintPhaseForeground || style()->visibility() != VISIBLE) + if (!m_frameView || paintInfo.phase != PaintPhaseForeground || style()->visibility() != VISIBLE) return; #if PLATFORM(MAC) @@ -195,11 +186,12 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty) if (clipToBorderRadius) { // Push a clip if we have a border radius, since we want to round the foreground content that gets painted. paintInfo.context->save(); - paintInfo.context->addRoundedRectClip(IntRect(tx, ty, width(), height()), - style()->borderTopLeftRadius(), - style()->borderTopRightRadius(), - style()->borderBottomLeftRadius(), - style()->borderBottomRightRadius()); + + IntSize topLeft, topRight, bottomLeft, bottomRight; + IntRect borderRect = IntRect(tx, ty, width(), height()); + style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); + + paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); } if (m_widget) { @@ -211,6 +203,11 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty) // Tell the widget to paint now. This is the only time the widget is allowed // to paint itself. That way it will composite properly with z-indexed layers. m_widget->paint(paintInfo.context, paintInfo.rect); + + if (m_widget->isFrameView() && paintInfo.overlapTestRequests && !static_cast<FrameView*>(m_widget)->useSlowRepaints()) { + ASSERT(!paintInfo.overlapTestRequests->contains(this)); + paintInfo.overlapTestRequests->set(this, m_widget->frameRect()); + } } if (clipToBorderRadius) @@ -223,6 +220,13 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty) } } +void RenderWidget::setOverlapTestResult(bool isOverlapped) +{ + ASSERT(m_widget); + ASSERT(m_widget->isFrameView()); + static_cast<FrameView*>(m_widget)->setIsOverlapped(isOverlapped); +} + void RenderWidget::deref(RenderArena *arena) { if (--m_refCount <= 0) @@ -270,9 +274,17 @@ void RenderWidget::setSelectionState(SelectionState state) } } -void RenderWidget::deleteWidget() +void RenderWidget::clearWidget() +{ + Widget* widget = m_widget; + m_widget = 0; + if (widget) + deleteWidget(widget); +} + +void RenderWidget::deleteWidget(Widget* widget) { - delete m_widget; + delete widget; } RenderWidget* RenderWidget::find(const Widget* widget) |