Commit 25a1cdf3 authored by eric@webkit.org's avatar eric@webkit.org

Reviewed by beth.

        Rename Frame::renderer() to contentRenderer() and fix uses.

        * WebCore.base.exp:
        * editing/Editor.cpp:
        (WebCore::Editor::respondToChangedContents):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::gotoAnchor):
        * page/DragController.cpp:
        (WebCore::DragController::canProcessDrag):
        (WebCore::DragController::mayStartDragAtEventLocation):
        (WebCore::DragController::startDrag):
        * page/EventHandler.cpp:
        (WebCore::EventHandler::eventMayStartDrag):
        (WebCore::EventHandler::updateSelectionForMouseDrag):
        (WebCore::EventHandler::hitTestResultAtPoint):
        (WebCore::EventHandler::hoverTimerFired):
        (WebCore::EventHandler::handleDrag):
        * page/Frame.cpp:
        (WebCore::Frame::selectionLayoutChanged):
        (WebCore::Frame::contentRenderer):
        (WebCore::Frame::paint):
        (WebCore::Frame::markAllMatchesForText):
        (WebCore::Frame::documentAtPoint):
        * page/Frame.h:
        * page/FrameView.cpp:
        (WebCore::FrameView::~FrameView):
        (WebCore::FrameView::adjustViewSize):
        (WebCore::FrameView::layout):
        (WebCore::FrameView::scheduleRelayoutOfSubtree):
        (WebCore::FrameView::needsLayout):
        (WebCore::FrameView::setNeedsLayout):
        (WebCore::FrameView::updateControlTints):
        * rendering/RenderTreeAsText.cpp:
        (WebCore::write):
        * svg/graphics/SVGImage.cpp:
        (WebCore::SVGImage::nativeImageForCurrentFrame):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@32231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2061b9a3
2008-04-17 Eric Seidel <eric@webkit.org>
Reviewed by beth.
Rename Frame::renderer() to contentRenderer() and fix uses.
* WebCore.base.exp:
* editing/Editor.cpp:
(WebCore::Editor::respondToChangedContents):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::gotoAnchor):
* page/DragController.cpp:
(WebCore::DragController::canProcessDrag):
(WebCore::DragController::mayStartDragAtEventLocation):
(WebCore::DragController::startDrag):
* page/EventHandler.cpp:
(WebCore::EventHandler::eventMayStartDrag):
(WebCore::EventHandler::updateSelectionForMouseDrag):
(WebCore::EventHandler::hitTestResultAtPoint):
(WebCore::EventHandler::hoverTimerFired):
(WebCore::EventHandler::handleDrag):
* page/Frame.cpp:
(WebCore::Frame::selectionLayoutChanged):
(WebCore::Frame::contentRenderer):
(WebCore::Frame::paint):
(WebCore::Frame::markAllMatchesForText):
(WebCore::Frame::documentAtPoint):
* page/Frame.h:
* page/FrameView.cpp:
(WebCore::FrameView::~FrameView):
(WebCore::FrameView::adjustViewSize):
(WebCore::FrameView::layout):
(WebCore::FrameView::scheduleRelayoutOfSubtree):
(WebCore::FrameView::needsLayout):
(WebCore::FrameView::setNeedsLayout):
(WebCore::FrameView::updateControlTints):
* rendering/RenderTreeAsText.cpp:
(WebCore::write):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::nativeImageForCurrentFrame):
2008-04-18 Antti Koivisto <antti@apple.com>
Reviewed by Oliver.
......@@ -437,7 +437,6 @@ __ZN7WebCore5Frame10findStringERKNS_6StringEbbbb
__ZN7WebCore5Frame11forceLayoutEb
__ZN7WebCore5Frame11scriptProxyEv
__ZN7WebCore5Frame11shouldCloseEv
__ZN7WebCore5Frame13ownerRendererEv
__ZN7WebCore5Frame13reapplyStylesEv
__ZN7WebCore5Frame13setZoomFactorEfb
__ZN7WebCore5Frame15sendScrollEventEv
......@@ -731,8 +730,10 @@ __ZNK7WebCore5Frame11typingStyleEv
__ZNK7WebCore5Frame12eventHandlerEv
__ZNK7WebCore5Frame12ownerElementEv
__ZNK7WebCore5Frame12selectedTextEv
__ZNK7WebCore5Frame13ownerRendererEv
__ZNK7WebCore5Frame13selectionRectEb
__ZNK7WebCore5Frame14selectionImageEb
__ZNK7WebCore5Frame15contentRendererEv
__ZNK7WebCore5Frame15revealSelectionERKNS_11RenderLayer15ScrollAlignmentE
__ZNK7WebCore5Frame16inViewSourceModeEv
__ZNK7WebCore5Frame17firstRectForRangeEPNS_5RangeE
......@@ -754,7 +755,6 @@ __ZNK7WebCore5Frame4viewEv
__ZNK7WebCore5Frame6editorEv
__ZNK7WebCore5Frame6loaderEv
__ZNK7WebCore5Frame8documentEv
__ZNK7WebCore5Frame8rendererEv
__ZNK7WebCore5Frame8settingsEv
__ZNK7WebCore5Range11startOffsetERi
__ZNK7WebCore5Range12endContainerERi
......
......@@ -401,7 +401,7 @@ void Editor::respondToChangedContents(const Selection& endingSelection)
if (AXObjectCache::accessibilityEnabled()) {
Node* node = endingSelection.start().node();
if (node)
m_frame->renderer()->document()->axObjectCache()->postNotification(node->renderer(), "AXValueChanged");
m_frame->document()->axObjectCache()->postNotification(node->renderer(), "AXValueChanged");
}
if (client())
......
......@@ -74,6 +74,7 @@
#include "ProgressTracker.h"
#include "RenderPart.h"
#include "RenderWidget.h"
#include "RenderView.h"
#include "ResourceHandle.h"
#include "ResourceRequest.h"
#include "SecurityOrigin.h"
......@@ -1619,8 +1620,8 @@ bool FrameLoader::gotoAnchor(const String& name)
// really mess things up if an anchor scroll comes at a bad moment.
if (m_frame->document()) {
m_frame->document()->updateRendering();
// Only do a layout if changes have occurred that make it necessary.
if (m_frame->view() && m_frame->document()->renderer() && m_frame->document()->renderer()->needsLayout())
// Only do a layout if changes have occurred that make it necessary.
if (m_frame->view() && m_frame->contentRenderer() && m_frame->contentRenderer()->needsLayout())
m_frame->view()->layout();
}
......
......@@ -434,7 +434,7 @@ bool DragController::canProcessDrag(DragData* dragData)
IntPoint point = m_page->mainFrame()->view()->windowToContents(dragData->clientPosition());
HitTestResult result = HitTestResult(point);
if (!m_page->mainFrame()->renderer())
if (!m_page->mainFrame()->contentRenderer())
return false;
result = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(point, true);
......@@ -498,7 +498,7 @@ bool DragController::mayStartDragAtEventLocation(const Frame* frame, const IntPo
ASSERT(frame);
ASSERT(frame->settings());
if (!frame->view() || !frame->renderer())
if (!frame->view() || !frame->contentRenderer())
return false;
HitTestResult mouseDownTarget = HitTestResult(framePos);
......@@ -593,7 +593,7 @@ bool DragController::startDrag(Frame* src, Clipboard* clipboard, DragOperation s
ASSERT(src);
ASSERT(clipboard);
if (!src->view() || !src->renderer())
if (!src->view() || !src->contentRenderer())
return false;
HitTestResult dragSource = HitTestResult(dragOrigin);
......
......@@ -56,6 +56,7 @@
#include "PlatformWheelEvent.h"
#include "RenderFrameSet.h"
#include "RenderWidget.h"
#include "RenderView.h"
#include "SelectionController.h"
#include "Settings.h"
#include "TextEvent.h"
......@@ -387,7 +388,7 @@ bool EventHandler::eventMayStartDrag(const PlatformMouseEvent& event) const
// that its logic needs to stay in sync with handleMouseMoveEvent() and the way we setMouseDownMayStartDrag
// in handleMousePressEvent
if (!m_frame->renderer() || !m_frame->renderer()->hasLayer()
if (!m_frame->contentRenderer() || !m_frame->contentRenderer()->hasLayer()
|| event.button() != LeftButton || event.clickCount() != 1)
return false;
......@@ -399,7 +400,7 @@ bool EventHandler::eventMayStartDrag(const PlatformMouseEvent& event) const
HitTestRequest request(true, false);
HitTestResult result(m_frame->view()->windowToContents(event.pos()));
m_frame->renderer()->layer()->hitTest(request, result);
m_frame->contentRenderer()->layer()->hitTest(request, result);
bool srcIsDHTML;
return result.innerNode() && result.innerNode()->renderer()->draggableNode(DHTMLFlag, UAFlag, result.point().x(), result.point().y(), srcIsDHTML);
}
......@@ -409,7 +410,7 @@ void EventHandler::updateSelectionForMouseDrag()
FrameView* view = m_frame->view();
if (!view)
return;
RenderObject* renderer = m_frame->renderer();
RenderObject* renderer = m_frame->contentRenderer();
if (!renderer)
return;
RenderLayer* layer = renderer->layer();
......@@ -570,9 +571,9 @@ void EventHandler::allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const
HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent)
{
HitTestResult result(point);
if (!m_frame->renderer())
if (!m_frame->contentRenderer())
return result;
m_frame->renderer()->layer()->hitTest(HitTestRequest(true, true), result);
m_frame->contentRenderer()->layer()->hitTest(HitTestRequest(true, true), result);
while (true) {
Node* n = result.innerNode();
......@@ -582,13 +583,13 @@ HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool all
if (!widget || !widget->isFrameView())
break;
Frame* frame = static_cast<HTMLFrameElementBase*>(n)->contentFrame();
if (!frame || !frame->renderer())
if (!frame || !frame->contentRenderer())
break;
FrameView* view = static_cast<FrameView*>(widget);
IntPoint widgetPoint(result.localPoint().x() + view->contentsX() - n->renderer()->borderLeft() - n->renderer()->paddingLeft(),
result.localPoint().y() + view->contentsY() - n->renderer()->borderTop() - n->renderer()->paddingTop());
HitTestResult widgetHitTestResult(widgetPoint);
frame->renderer()->layer()->hitTest(HitTestRequest(true, true), widgetHitTestResult);
frame->contentRenderer()->layer()->hitTest(HitTestRequest(true, true), widgetHitTestResult);
result = widgetHitTestResult;
}
......@@ -1449,7 +1450,7 @@ void EventHandler::hoverTimerFired(Timer<EventHandler>*)
ASSERT(m_frame);
ASSERT(m_frame->document());
if (RenderObject* renderer = m_frame->renderer()) {
if (RenderObject* renderer = m_frame->contentRenderer()) {
HitTestResult result(m_frame->view()->windowToContents(m_currentMousePosition));
renderer->layer()->hitTest(HitTestRequest(false, false, true), result);
m_frame->document()->updateRendering();
......@@ -1685,7 +1686,7 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event)
// try to find an element that wants to be dragged
HitTestRequest request(true, false);
HitTestResult result(m_mouseDownPos);
m_frame->renderer()->layer()->hitTest(request, result);
m_frame->contentRenderer()->layer()->hitTest(request, result);
Node* node = result.innerNode();
if (node && node->renderer())
dragState().m_dragSrc = node->renderer()->draggableNode(dragState().m_dragSrcMayBeDHTML, dragState().m_dragSrcMayBeUA,
......
......@@ -592,9 +592,9 @@ void Frame::selectionLayoutChanged()
}
}
if (!renderer())
RenderView* canvas = contentRenderer();
if (!canvas)
return;
RenderView* canvas = static_cast<RenderView*>(renderer());
Selection selection = selectionController()->selection();
......@@ -1163,10 +1163,14 @@ void Frame::clearScriptObjects()
clearPlatformScriptObjects();
}
RenderObject *Frame::renderer() const
RenderView* Frame::contentRenderer() const
{
Document *doc = document();
return doc ? doc->renderer() : 0;
Document* doc = document();
if (!doc)
return 0;
RenderObject* object = doc->renderer();
ASSERT(object->isRenderView());
return static_cast<RenderView*>(object);
}
HTMLFrameOwnerElement* Frame::ownerElement() const
......@@ -1174,7 +1178,7 @@ HTMLFrameOwnerElement* Frame::ownerElement() const
return d->m_ownerElement;
}
RenderPart* Frame::ownerRenderer()
RenderPart* Frame::ownerRenderer() const
{
HTMLFrameOwnerElement* ownerElement = d->m_ownerElement;
if (!ownerElement)
......@@ -1185,7 +1189,7 @@ RenderPart* Frame::ownerRenderer()
// returns FloatRect because going through IntRect would truncate any floats
FloatRect Frame::selectionRect(bool clipToVisibleContent) const
{
RenderView *root = static_cast<RenderView*>(renderer());
RenderView* root = contentRenderer();
if (!root)
return IntRect();
......@@ -1195,7 +1199,7 @@ FloatRect Frame::selectionRect(bool clipToVisibleContent) const
void Frame::selectionTextRects(Vector<FloatRect>& rects, bool clipToVisibleContent) const
{
RenderView *root = static_cast<RenderView*>(renderer());
RenderView* root = contentRenderer();
if (!root)
return;
......@@ -1333,23 +1337,23 @@ void Frame::paint(GraphicsContext* p, const IntRect& rect)
if (isTopLevelPainter)
s_currentPaintTimeStamp = currentTime();
if (renderer()) {
if (contentRenderer()) {
ASSERT(d->m_view && !d->m_view->needsLayout());
ASSERT(!d->m_isPainting);
d->m_isPainting = true;
// d->m_elementToDraw is used to draw only one element
RenderObject *eltRenderer = d->m_elementToDraw ? d->m_elementToDraw->renderer() : 0;
RenderObject* eltRenderer = d->m_elementToDraw ? d->m_elementToDraw->renderer() : 0;
if (d->m_paintRestriction == PaintRestrictionNone)
renderer()->document()->invalidateRenderedRectsForMarkersInRect(rect);
renderer()->layer()->paint(p, rect, d->m_paintRestriction, eltRenderer);
document()->invalidateRenderedRectsForMarkersInRect(rect);
contentRenderer()->layer()->paint(p, rect, d->m_paintRestriction, eltRenderer);
d->m_isPainting = false;
// Regions may have changed as a result of the visibility/z-index of element changing.
if (renderer()->document()->dashboardRegionsDirty())
renderer()->view()->frameView()->updateDashboardRegions();
if (document()->dashboardRegionsDirty())
view()->updateDashboardRegions();
} else
LOG_ERROR("called Frame::paint with nil renderer");
......@@ -1369,7 +1373,7 @@ bool Frame::isPainting() const
void Frame::adjustPageHeight(float *newBottom, float oldTop, float oldBottom, float bottomLimit)
{
RenderView *root = static_cast<RenderView*>(document()->renderer());
RenderView* root = contentRenderer();
if (root) {
// Use a context with painting disabled.
GraphicsContext context((PlatformGraphicsContext*)0);
......@@ -1646,7 +1650,7 @@ unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag, unsig
// Do a "fake" paint in order to execute the code that computes the rendered rect for
// each text match.
Document* doc = document();
if (doc && d->m_view && renderer()) {
if (doc && d->m_view && contentRenderer()) {
doc->updateLayout(); // Ensure layout is up to date.
IntRect visibleRect(enclosingIntRect(d->m_view->visibleContentRect()));
GraphicsContext context((PlatformGraphicsContext*)0);
......@@ -1876,7 +1880,7 @@ Document* Frame::documentAtPoint(const IntPoint& point)
IntPoint pt = view()->windowToContents(point);
HitTestResult result = HitTestResult(pt);
if (renderer())
if (contentRenderer())
result = eventHandler()->hitTestResultAtPoint(pt, false);
return result.innerNode() ? result.innerNode()->document() : 0;
}
......
......@@ -104,9 +104,8 @@ public:
AnimationController* animationController() const;
KJSProxy* scriptProxy();
// FIXME: Rename to contentRenderer and change type to RenderView.
RenderObject* renderer() const; // root renderer for the document contained in this frame
RenderPart* ownerRenderer(); // renderer for the element that contains this frame
RenderView* contentRenderer() const; // root renderer for the document contained in this frame
RenderPart* ownerRenderer() const; // renderer for the element that contains this frame
friend class FramePrivate;
......
......@@ -180,7 +180,7 @@ FrameView::~FrameView()
ASSERT(!d->m_enqueueEvents);
if (m_frame) {
ASSERT(m_frame->view() != this || !m_frame->document() || !m_frame->document()->renderer());
ASSERT(m_frame->view() != this || !m_frame->document() || !m_frame->contentRenderer());
RenderPart* renderer = m_frame->ownerRenderer();
if (renderer && renderer->widget() == this)
renderer->setWidget(0);
......@@ -257,7 +257,7 @@ void FrameView::setMarginHeight(int h)
void FrameView::adjustViewSize()
{
ASSERT(m_frame->view() == this);
RenderView* root = static_cast<RenderView*>(m_frame->renderer());
RenderView* root = m_frame->contentRenderer();
if (!root)
return;
resizeContents(root->overflowWidth(), root->overflowHeight());
......@@ -810,38 +810,37 @@ static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de
return false;
}
void FrameView::scheduleRelayoutOfSubtree(RenderObject* o)
void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot)
{
ASSERT(m_frame->view() == this);
if (!d->layoutSchedulingEnabled || (m_frame->document()
&& m_frame->document()->renderer()
&& m_frame->document()->renderer()->needsLayout())) {
if (o)
o->markContainingBlocksForLayout(false);
if (!d->layoutSchedulingEnabled || (m_frame->contentRenderer()
&& m_frame->contentRenderer()->needsLayout())) {
if (relayoutRoot)
relayoutRoot->markContainingBlocksForLayout(false);
return;
}
if (layoutPending()) {
if (d->layoutRoot != o) {
if (isObjectAncestorContainerOf(d->layoutRoot, o)) {
if (d->layoutRoot != relayoutRoot) {
if (isObjectAncestorContainerOf(d->layoutRoot, relayoutRoot)) {
// Keep the current root
o->markContainingBlocksForLayout(false, d->layoutRoot);
} else if (d->layoutRoot && isObjectAncestorContainerOf(o, d->layoutRoot)) {
// Re-root at o
d->layoutRoot->markContainingBlocksForLayout(false, o);
d->layoutRoot = o;
relayoutRoot->markContainingBlocksForLayout(false, d->layoutRoot);
} else if (d->layoutRoot && isObjectAncestorContainerOf(relayoutRoot, d->layoutRoot)) {
// Re-root at relayoutRoot
d->layoutRoot->markContainingBlocksForLayout(false, relayoutRoot);
d->layoutRoot = relayoutRoot;
} else {
// Just do a full relayout
if (d->layoutRoot)
d->layoutRoot->markContainingBlocksForLayout(false);
d->layoutRoot = 0;
o->markContainingBlocksForLayout(false);
relayoutRoot->markContainingBlocksForLayout(false);
}
}
} else {
int delay = m_frame->document()->minimumLayoutDelay();
d->layoutRoot = o;
d->layoutRoot = relayoutRoot;
d->delayedLayout = delay != 0;
d->layoutTimer.startOneShot(delay * 0.001);
}
......@@ -858,7 +857,7 @@ bool FrameView::needsLayout() const
// then we are not allowed to schedule layouts yet, so we won't be pending layout.
if (!m_frame)
return false;
RenderView* root = static_cast<RenderView*>(m_frame->renderer());
RenderView* root = m_frame->contentRenderer();
Document * doc = m_frame->document();
// doc->hasChangedChild() condition can occur when using WebKit ObjC interface
return layoutPending() || (root && root->needsLayout()) || d->layoutRoot || (doc && doc->hasChangedChild()) || m_frame->needsReapplyStyles();
......@@ -866,8 +865,9 @@ bool FrameView::needsLayout() const
void FrameView::setNeedsLayout()
{
if (m_frame->renderer())
m_frame->renderer()->setNeedsLayout(true);
RenderView* root = m_frame->contentRenderer();
if (root)
root->setNeedsLayout(true);
}
void FrameView::unscheduleRelayout()
......@@ -937,7 +937,7 @@ void FrameView::resumeScheduledEvents()
void FrameView::performPostLayoutTasks()
{
RenderView* root = static_cast<RenderView*>(m_frame->document()->renderer());
RenderView* root = m_frame->contentRenderer();
root->updateWidgetPositions();
if (m_widgetUpdateSet && d->nestedLayoutCount <= 1) {
......@@ -1097,7 +1097,7 @@ void FrameView::updateControlTints()
if (!m_frame || m_frame->loader()->url().isEmpty())
return;
if (theme()->supportsControlTints() && m_frame->renderer()) {
if (theme()->supportsControlTints() && m_frame->contentRenderer()) {
if (needsLayout())
layout();
PlatformGraphicsContext* const noContext = 0;
......
......@@ -361,7 +361,7 @@ void write(TextStream& ts, const RenderObject& o, int indent)
Widget* widget = static_cast<const RenderWidget&>(o).widget();
if (widget && widget->isFrameView()) {
FrameView* view = static_cast<FrameView*>(widget);
RenderObject* root = view->frame()->renderer();
RenderObject* root = view->frame()->contentRenderer();
if (root) {
view->layout();
RenderLayer* l = root->layer();
......
......@@ -39,6 +39,7 @@
#include "ImageObserver.h"
#include "NotImplemented.h"
#include "Page.h"
#include "RenderView.h"
#include "ResourceError.h"
#include "SVGDocument.h"
#include "SVGLength.h"
......@@ -167,7 +168,7 @@ NativeImagePtr SVGImage::nativeImageForCurrentFrame()
m_frameCache.set(ImageBuffer::create(size(), false).release());
if (!m_frameCache) // failed to allocate image
return 0;
renderSubtreeToImage(m_frameCache.get(), m_frame->renderer());
renderSubtreeToImage(m_frameCache.get(), m_frame->contentRenderer());
}
#if PLATFORM(CG)
return m_frameCache->cgImage();
......
2008-04-17 Eric Seidel <eric@webkit.org>
Reviewed by beth.
Rename Frame::renderer() to contentRenderer() and fix uses.
* Misc/WebCoreStatistics.mm:
* WebView/WebRenderNode.mm:
(-[WebRenderNode initWithWebFrameView:]):
2008-04-17 Jon Honeycutt <jhoneycutt@apple.com>
Reviewed by mrowe.
......
......@@ -35,6 +35,7 @@
#import <WebCore/GCController.h>
#import <WebCore/IconDatabase.h>
#import <WebCore/RenderTreeAsText.h>
#import <WebCore/RenderView.h>
using namespace KJS;
using namespace WebCore;
......@@ -180,7 +181,7 @@ using namespace WebCore;
- (NSString *)renderTreeAsExternalRepresentation
{
return externalRepresentation(_private->coreFrame->renderer());
return externalRepresentation(_private->coreFrame->contentRenderer());
}
@end
......@@ -33,6 +33,7 @@
#import "WebHTMLView.h"
#import <WebCore/Frame.h>
#import <WebCore/RenderWidget.h>
#import <WebCore/RenderView.h>
#import <WebCore/Widget.h>
using namespace WebCore;
......@@ -104,7 +105,7 @@ static WebRenderNode *copyRenderNode(RenderObject* node)
if (![[view documentView] isMemberOfClass:[WebHTMLView class]])
return nil;
RenderObject* renderer = core([view webFrame])->renderer();
RenderObject* renderer = core([view webFrame])->contentRenderer();
if (!renderer)
return nil;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment