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

Side by Side Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp

Issue 2389633002: reflow comments in web/ (Closed)
Patch Set: . Created 4 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 LocalFrame* frame = m_element->document().frame(); 495 LocalFrame* frame = m_element->document().frame();
496 if (!frame || !frame->loader().documentLoader()) 496 if (!frame || !frame->loader().documentLoader())
497 return; // FIXME: send a notification in this case? 497 return; // FIXME: send a notification in this case?
498 498
499 FrameLoadRequest frameRequest(frame->document(), request.toResourceRequest(), 499 FrameLoadRequest frameRequest(frame->document(), request.toResourceRequest(),
500 target); 500 target);
501 frame->loader().load(frameRequest); 501 frame->loader().load(frameRequest);
502 } 502 }
503 503
504 bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) { 504 bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) {
505 // Disallow access to the frame during dispose(), because it is not guaranteed to 505 // Disallow access to the frame during dispose(), because it is not guaranteed
506 // be valid memory once this object has started disposal. In particular, we mi ght be being 506 // to be valid memory once this object has started disposal. In particular,
507 // disposed because the frame has already be deleted and then something else d ropped the 507 // we might be being disposed because the frame has already be deleted and
508 // then something else dropped the
508 // last reference to the this object. 509 // last reference to the this object.
509 if (m_isDisposed || !m_element) 510 if (m_isDisposed || !m_element)
510 return false; 511 return false;
511 512
512 LocalFrame* frame = m_element->document().frame(); 513 LocalFrame* frame = m_element->document().frame();
513 if (!frame) 514 if (!frame)
514 return false; 515 return false;
515 516
516 IntRect documentRect(x() + rect.x, y() + rect.y, rect.width, rect.height); 517 IntRect documentRect(x() + rect.x, y() + rect.y, rect.width, rect.height);
517 // hitTestResultAtPoint() takes a padding rectangle. 518 // hitTestResultAtPoint() takes a padding rectangle.
518 // FIXME: We'll be off by 1 when the width or height is even. 519 // FIXME: We'll be off by 1 when the width or height is even.
519 LayoutPoint center = documentRect.center(); 520 LayoutPoint center = documentRect.center();
520 // Make the rect we're checking (the point surrounded by padding rects) contai ned inside the requested rect. (Note that -1/2 is 0.) 521 // Make the rect we're checking (the point surrounded by padding rects)
522 // contained inside the requested rect. (Note that -1/2 is 0.)
521 LayoutSize padding((documentRect.width() - 1) / 2, 523 LayoutSize padding((documentRect.width() - 1) / 2,
522 (documentRect.height() - 1) / 2); 524 (documentRect.height() - 1) / 2);
523 HitTestResult result = frame->eventHandler().hitTestResultAtPoint( 525 HitTestResult result = frame->eventHandler().hitTestResultAtPoint(
524 center, HitTestRequest::ReadOnly | HitTestRequest::Active | 526 center, HitTestRequest::ReadOnly | HitTestRequest::Active |
525 HitTestRequest::ListBased, 527 HitTestRequest::ListBased,
526 padding); 528 padding);
527 const HitTestResult::NodeSet& nodes = result.listBasedTestResult(); 529 const HitTestResult::NodeSet& nodes = result.listBasedTestResult();
528 if (nodes.size() != 1) 530 if (nodes.size() != 1)
529 return false; 531 return false;
530 return nodes.first().get() == m_element; 532 return nodes.first().get() == m_element;
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 unclippedIntLocalRect = IntRect(); 908 unclippedIntLocalRect = IntRect();
907 return; 909 return;
908 } 910 }
909 911
910 LayoutView* rootView = m_element->document().view()->layoutView(); 912 LayoutView* rootView = m_element->document().view()->layoutView();
911 while (rootView->frame()->ownerLayoutObject()) 913 while (rootView->frame()->ownerLayoutObject())
912 rootView = rootView->frame()->ownerLayoutObject()->view(); 914 rootView = rootView->frame()->ownerLayoutObject()->view();
913 915
914 LayoutBox* box = toLayoutBox(ownerElement->layoutObject()); 916 LayoutBox* box = toLayoutBox(ownerElement->layoutObject());
915 917
916 // Note: frameRect() for this plugin is equal to contentBoxRect, mapped to the containing view space, and rounded off. 918 // Note: frameRect() for this plugin is equal to contentBoxRect, mapped to the
917 // See LayoutPart.cpp::updateWidgetGeometryInternal. To remove the lossy effec t of rounding off, use contentBoxRect directly. 919 // containing view space, and rounded off.
920 // See LayoutPart.cpp::updateWidgetGeometryInternal. To remove the lossy
921 // effect of rounding off, use contentBoxRect directly.
918 LayoutRect unclippedAbsoluteRect(box->contentBoxRect()); 922 LayoutRect unclippedAbsoluteRect(box->contentBoxRect());
919 box->mapToVisualRectInAncestorSpace(rootView, unclippedAbsoluteRect); 923 box->mapToVisualRectInAncestorSpace(rootView, unclippedAbsoluteRect);
920 924
921 // The frameRect is already in absolute space of the local frame to the plugin . 925 // The frameRect is already in absolute space of the local frame to the
926 // plugin.
922 windowRect = frameRect(); 927 windowRect = frameRect();
923 // Map up to the root frame. 928 // Map up to the root frame.
924 LayoutRect layoutWindowRect = 929 LayoutRect layoutWindowRect =
925 LayoutRect(m_element->document() 930 LayoutRect(m_element->document()
926 .view() 931 .view()
927 ->layoutViewItem() 932 ->layoutViewItem()
928 .localToAbsoluteQuad(FloatQuad(FloatRect(frameRect())), 933 .localToAbsoluteQuad(FloatQuad(FloatRect(frameRect())),
929 TraverseDocumentBoundaries) 934 TraverseDocumentBoundaries)
930 .boundingBox()); 935 .boundingBox());
931 // Finally, adjust for scrolling of the root frame, which the above does not t ake into account. 936 // Finally, adjust for scrolling of the root frame, which the above does not
937 // take into account.
932 layoutWindowRect.moveBy(-rootView->viewRect().location()); 938 layoutWindowRect.moveBy(-rootView->viewRect().location());
933 windowRect = pixelSnappedIntRect(layoutWindowRect); 939 windowRect = pixelSnappedIntRect(layoutWindowRect);
934 940
935 LayoutRect layoutClippedLocalRect = unclippedAbsoluteRect; 941 LayoutRect layoutClippedLocalRect = unclippedAbsoluteRect;
936 LayoutRect unclippedLayoutLocalRect = layoutClippedLocalRect; 942 LayoutRect unclippedLayoutLocalRect = layoutClippedLocalRect;
937 layoutClippedLocalRect.intersect( 943 layoutClippedLocalRect.intersect(
938 LayoutRect(rootView->frameView()->visibleContentRect())); 944 LayoutRect(rootView->frameView()->visibleContentRect()));
939 945
940 unclippedIntLocalRect = 946 unclippedIntLocalRect =
941 box->absoluteToLocalQuad(FloatRect(unclippedLayoutLocalRect), 947 box->absoluteToLocalQuad(FloatRect(unclippedLayoutLocalRect),
942 TraverseDocumentBoundaries | UseTransforms) 948 TraverseDocumentBoundaries | UseTransforms)
943 .enclosingBoundingBox(); 949 .enclosingBoundingBox();
944 // As a performance optimization, map the clipped rect separately if is differ ent than the unclipped rect. 950 // As a performance optimization, map the clipped rect separately if is
951 // different than the unclipped rect.
945 if (layoutClippedLocalRect != unclippedLayoutLocalRect) 952 if (layoutClippedLocalRect != unclippedLayoutLocalRect)
946 clippedLocalRect = 953 clippedLocalRect =
947 box->absoluteToLocalQuad(FloatRect(layoutClippedLocalRect), 954 box->absoluteToLocalQuad(FloatRect(layoutClippedLocalRect),
948 TraverseDocumentBoundaries | UseTransforms) 955 TraverseDocumentBoundaries | UseTransforms)
949 .enclosingBoundingBox(); 956 .enclosingBoundingBox();
950 else 957 else
951 clippedLocalRect = unclippedIntLocalRect; 958 clippedLocalRect = unclippedIntLocalRect;
952 } 959 }
953 960
954 void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, 961 void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect,
955 IntRect& clipRect, 962 IntRect& clipRect,
956 IntRect& unobscuredRect, 963 IntRect& unobscuredRect,
957 Vector<IntRect>& cutOutRects) { 964 Vector<IntRect>& cutOutRects) {
958 // document().layoutView() can be null when we receive messages from the 965 // document().layoutView() can be null when we receive messages from the
959 // plugins while we are destroying a frame. 966 // plugins while we are destroying a frame.
960 // FIXME: Can we just check m_element->document().isActive() ? 967 // FIXME: Can we just check m_element->document().isActive() ?
961 if (!m_element->layoutObject()->document().layoutViewItem().isNull()) { 968 if (!m_element->layoutObject()->document().layoutViewItem().isNull()) {
962 // Take our element and get the clip rect from the enclosing layer and 969 // Take our element and get the clip rect from the enclosing layer and
963 // frame view. 970 // frame view.
964 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); 971 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect);
965 } 972 }
966 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); 973 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects);
967 // Convert to the plugin position. 974 // Convert to the plugin position.
968 for (size_t i = 0; i < cutOutRects.size(); i++) 975 for (size_t i = 0; i < cutOutRects.size(); i++)
969 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); 976 cutOutRects[i].move(-frameRect().x(), -frameRect().y());
970 } 977 }
971 978
972 } // namespace blink 979 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebPluginContainerImpl.h ('k') | third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698