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

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 2215333002: Fix element visibility check for validation bubbles and SELECT popups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename to visibleBoundsInVisualViewport(), etc. Created 4 years, 4 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 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 #include "core/events/EventDispatcher.h" 88 #include "core/events/EventDispatcher.h"
89 #include "core/events/FocusEvent.h" 89 #include "core/events/FocusEvent.h"
90 #include "core/frame/FrameHost.h" 90 #include "core/frame/FrameHost.h"
91 #include "core/frame/FrameView.h" 91 #include "core/frame/FrameView.h"
92 #include "core/frame/HostsUsingFeatures.h" 92 #include "core/frame/HostsUsingFeatures.h"
93 #include "core/frame/LocalDOMWindow.h" 93 #include "core/frame/LocalDOMWindow.h"
94 #include "core/frame/LocalFrame.h" 94 #include "core/frame/LocalFrame.h"
95 #include "core/frame/ScrollToOptions.h" 95 #include "core/frame/ScrollToOptions.h"
96 #include "core/frame/Settings.h" 96 #include "core/frame/Settings.h"
97 #include "core/frame/UseCounter.h" 97 #include "core/frame/UseCounter.h"
98 #include "core/frame/VisualViewport.h"
98 #include "core/frame/csp/ContentSecurityPolicy.h" 99 #include "core/frame/csp/ContentSecurityPolicy.h"
99 #include "core/html/ClassList.h" 100 #include "core/html/ClassList.h"
100 #include "core/html/HTMLCanvasElement.h" 101 #include "core/html/HTMLCanvasElement.h"
101 #include "core/html/HTMLCollection.h" 102 #include "core/html/HTMLCollection.h"
102 #include "core/html/HTMLDocument.h" 103 #include "core/html/HTMLDocument.h"
103 #include "core/html/HTMLElement.h" 104 #include "core/html/HTMLElement.h"
104 #include "core/html/HTMLFormControlsCollection.h" 105 #include "core/html/HTMLFormControlsCollection.h"
105 #include "core/html/HTMLFrameElementBase.h" 106 #include "core/html/HTMLFrameElementBase.h"
106 #include "core/html/HTMLFrameOwnerElement.h" 107 #include "core/html/HTMLFrameOwnerElement.h"
107 #include "core/html/HTMLOptionsCollection.h" 108 #include "core/html/HTMLOptionsCollection.h"
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 if (quads.isEmpty()) 1009 if (quads.isEmpty())
1009 return IntRect(); 1010 return IntRect();
1010 1011
1011 IntRect result = quads[0].enclosingBoundingBox(); 1012 IntRect result = quads[0].enclosingBoundingBox();
1012 for (size_t i = 1; i < quads.size(); ++i) 1013 for (size_t i = 1; i < quads.size(); ++i)
1013 result.unite(quads[i].enclosingBoundingBox()); 1014 result.unite(quads[i].enclosingBoundingBox());
1014 1015
1015 return view->contentsToViewport(result); 1016 return view->contentsToViewport(result);
1016 } 1017 }
1017 1018
1019 IntRect Element::visibleBoundsInVisualViewport() const
1020 {
1021 if (!layoutObject() || !document().page())
1022 return IntRect();
1023 // TODO(tkent): Can we check invisibility by scrollable non-frame elements?
1024
1025 IntSize viewportSize = document().page()->frameHost().visualViewport().size( );
1026 IntRect rect(0, 0, viewportSize.width(), viewportSize.height());
1027 // We don't use absoluteBoundingBoxRect() because it can return an IntRect
1028 // larger the actual size by 1px. crbug.com/470503
1029 rect.intersect(document().view()->contentsToViewport(roundedIntRect(layoutOb ject()->absoluteBoundingBoxFloatRect())));
1030 return rect;
1031 }
1032
1018 ClientRectList* Element::getClientRects() 1033 ClientRectList* Element::getClientRects()
1019 { 1034 {
1020 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); 1035 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
1021 1036
1022 LayoutObject* elementLayoutObject = layoutObject(); 1037 LayoutObject* elementLayoutObject = layoutObject();
1023 if (!elementLayoutObject || (!elementLayoutObject->isBoxModelObject() && !el ementLayoutObject->isBR())) 1038 if (!elementLayoutObject || (!elementLayoutObject->isBoxModelObject() && !el ementLayoutObject->isBR()))
1024 return ClientRectList::create(); 1039 return ClientRectList::create();
1025 1040
1026 // FIXME: Handle SVG elements. 1041 // FIXME: Handle SVG elements.
1027 // FIXME: Handle table/inline-table with a caption. 1042 // FIXME: Handle table/inline-table with a caption.
(...skipping 2756 matching lines...) Expand 10 before | Expand all | Expand 10 after
3784 3799
3785 DEFINE_TRACE_WRAPPERS(Element) 3800 DEFINE_TRACE_WRAPPERS(Element)
3786 { 3801 {
3787 if (hasRareData()) { 3802 if (hasRareData()) {
3788 visitor->traceWrappers(elementRareData()); 3803 visitor->traceWrappers(elementRareData());
3789 } 3804 }
3790 ContainerNode::traceWrappers(visitor); 3805 ContainerNode::traceWrappers(visitor);
3791 } 3806 }
3792 3807
3793 } // namespace blink 3808 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/html/HTMLSelectElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698