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

Unified Diff: third_party/WebKit/Source/platform/FrameViewBase.cpp

Issue 2843693003: Move methods from FrameViewBase to FrameView. (Closed)
Patch Set: address comments Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/FrameViewBase.cpp
diff --git a/third_party/WebKit/Source/platform/FrameViewBase.cpp b/third_party/WebKit/Source/platform/FrameViewBase.cpp
deleted file mode 100644
index a2a8f80fd5f4b108e6c7629e09b2f588c97e9d30..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/platform/FrameViewBase.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "platform/FrameViewBase.h"
-
-#include "platform/wtf/Assertions.h"
-
-namespace blink {
-
-FrameViewBase::FrameViewBase()
- : parent_(nullptr), self_visible_(false), parent_visible_(false) {}
-
-FrameViewBase::~FrameViewBase() {}
-
-DEFINE_TRACE(FrameViewBase) {
- visitor->Trace(parent_);
-}
-
-void FrameViewBase::SetParent(FrameViewBase* frame_view_base) {
- DCHECK(!frame_view_base || !parent_);
- if (!frame_view_base || !frame_view_base->IsVisible())
- SetParentVisible(false);
- parent_ = frame_view_base;
- if (frame_view_base && frame_view_base->IsVisible())
- SetParentVisible(true);
-}
-
-FrameViewBase* FrameViewBase::Root() const {
- const FrameViewBase* top = this;
- while (top->Parent())
- top = top->Parent();
- if (top->IsFrameView())
- return const_cast<FrameViewBase*>(static_cast<const FrameViewBase*>(top));
- return 0;
-}
-
-IntRect FrameViewBase::ConvertFromRootFrame(
- const IntRect& rect_in_root_frame) const {
- if (const FrameViewBase* parent_frame_view_base = Parent()) {
- IntRect parent_rect =
- parent_frame_view_base->ConvertFromRootFrame(rect_in_root_frame);
- return ConvertFromContainingFrameViewBase(parent_rect);
- }
- return rect_in_root_frame;
-}
-
-IntPoint FrameViewBase::ConvertFromRootFrame(
- const IntPoint& point_in_root_frame) const {
- if (const FrameViewBase* parent_frame_view_base = Parent()) {
- IntPoint parent_point =
- parent_frame_view_base->ConvertFromRootFrame(point_in_root_frame);
- return ConvertFromContainingFrameViewBase(parent_point);
- }
- return point_in_root_frame;
-}
-
-FloatPoint FrameViewBase::ConvertFromRootFrame(
- const FloatPoint& point_in_root_frame) const {
- // FrameViewBase / windows are required to be IntPoint aligned, but we may
- // need to convert FloatPoint values within them (eg. for event co-ordinates).
- IntPoint floored_point = FlooredIntPoint(point_in_root_frame);
- FloatPoint parent_point = ConvertFromRootFrame(floored_point);
- FloatSize window_fraction = point_in_root_frame - floored_point;
- // Use linear interpolation handle any fractional value (eg. for iframes
- // subject to a transform beyond just a simple translation).
- // FIXME: Add FloatPoint variants of all co-ordinate space conversion APIs.
- if (!window_fraction.IsEmpty()) {
- const int kFactor = 1000;
- IntPoint parent_line_end = ConvertFromRootFrame(
- floored_point + RoundedIntSize(window_fraction.ScaledBy(kFactor)));
- FloatSize parent_fraction =
- (parent_line_end - parent_point).ScaledBy(1.0f / kFactor);
- parent_point.Move(parent_fraction);
- }
- return parent_point;
-}
-
-} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698