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

Side by Side Diff: Source/core/rendering/RenderWidget.cpp

Issue 26936002: Remove Widget's dependency upon its own inheritor aka ScrollView. This was nasty from an OO design… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Fix for clang compile error Created 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved.
5 * Copyright (C) 2013 Google Inc. All rights reserved. 5 * Copyright (C) 2013 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 RenderWidget::UpdateSuspendScope::~UpdateSuspendScope() 54 RenderWidget::UpdateSuspendScope::~UpdateSuspendScope()
55 { 55 {
56 ASSERT(s_updateSuspendCount > 0); 56 ASSERT(s_updateSuspendCount > 0);
57 if (s_updateSuspendCount == 1) { 57 if (s_updateSuspendCount == 1) {
58 WidgetToParentMap map; 58 WidgetToParentMap map;
59 widgetNewParentMap().swap(map); 59 widgetNewParentMap().swap(map);
60 WidgetToParentMap::iterator end = map.end(); 60 WidgetToParentMap::iterator end = map.end();
61 for (WidgetToParentMap::iterator it = map.begin(); it != end; ++it) { 61 for (WidgetToParentMap::iterator it = map.begin(); it != end; ++it) {
62 Widget* child = it->key.get(); 62 Widget* child = it->key.get();
63 ScrollView* currentParent = child->parent(); 63 ScrollView* currentParent = toScrollView(child->parent());
64 FrameView* newParent = it->value; 64 FrameView* newParent = it->value;
65 if (newParent != currentParent) { 65 if (newParent != currentParent) {
66 if (currentParent) 66 if (currentParent)
67 currentParent->removeChild(child); 67 currentParent->removeChild(child);
68 if (newParent) 68 if (newParent)
69 newParent->addChild(child); 69 newParent->addChild(child);
70 } 70 }
71 } 71 }
72 } 72 }
73 --s_updateSuspendCount; 73 --s_updateSuspendCount;
74 } 74 }
75 75
76 static void moveWidgetToParentSoon(Widget* child, FrameView* parent) 76 static void moveWidgetToParentSoon(Widget* child, FrameView* parent)
77 { 77 {
78 if (!s_updateSuspendCount) { 78 if (!s_updateSuspendCount) {
79 if (parent) 79 if (parent)
80 parent->addChild(child); 80 parent->addChild(child);
81 else 81 else
82 child->removeFromParent(); 82 toScrollView(child->parent())->removeChild(child);
83 return; 83 return;
84 } 84 }
85 widgetNewParentMap().set(child, parent); 85 widgetNewParentMap().set(child, parent);
86 } 86 }
87 87
88 RenderWidget::RenderWidget(Element* element) 88 RenderWidget::RenderWidget(Element* element)
89 : RenderReplaced(element) 89 : RenderReplaced(element)
90 , m_widget(0) 90 , m_widget(0)
91 , m_frameView(element->document().view()) 91 , m_frameView(element->document().view())
92 // Reference counting is used to prevent the widget from being 92 // Reference counting is used to prevent the widget from being
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor ) const 373 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor ) const
374 { 374 {
375 if (widget() && widget()->isPluginView()) { 375 if (widget() && widget()->isPluginView()) {
376 // A plug-in is responsible for setting the cursor when the pointer is o ver it. 376 // A plug-in is responsible for setting the cursor when the pointer is o ver it.
377 return DoNotSetCursor; 377 return DoNotSetCursor;
378 } 378 }
379 return RenderReplaced::getCursor(point, cursor); 379 return RenderReplaced::getCursor(point, cursor);
380 } 380 }
381 381
382 } // namespace WebCore 382 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.cpp ('k') | Source/platform/scroll/ScrollbarThemeClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698