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

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

Issue 1814013002: Visual viewport API initial implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 return adjustLayoutUnitForAbsoluteZoom(layoutView->overflowClipR ect(LayoutPoint()).height(), layoutView->styleRef()).round(); 714 return adjustLayoutUnitForAbsoluteZoom(layoutView->overflowClipR ect(LayoutPoint()).height(), layoutView->styleRef()).round();
715 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutView->layout Size().height()), layoutView->styleRef()).round(); 715 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutView->layout Size().height()), layoutView->styleRef()).round();
716 } 716 }
717 } 717 }
718 718
719 if (LayoutBox* layoutObject = layoutBox()) 719 if (LayoutBox* layoutObject = layoutBox())
720 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedClientHeight()), layoutObject->styleRef()).round(); 720 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedClientHeight()), layoutObject->styleRef()).round();
721 return 0; 721 return 0;
722 } 722 }
723 723
724 VisualViewport* Element::viewport()
725 {
726 if (this != document().documentElement())
727 return nullptr;
728
729 document().updateLayoutIgnorePendingStylesheets();
bokan 2016/03/18 16:05:07 You don't need this here. Having a VisualViewport
ymalik 2016/03/22 16:35:06 Done.
730
731 LocalFrame* frame = document().frame();
732 if (!frame)
733 return nullptr;
734 FrameHost* host = frame->host();
735 if (!host)
736 return nullptr;
737 return &host->visualViewport();
738 }
739
724 double Element::scrollLeft() 740 double Element::scrollLeft()
725 { 741 {
726 document().updateLayoutIgnorePendingStylesheets(); 742 document().updateLayoutIgnorePendingStylesheets();
727 743
728 if (document().scrollingElement() == this) { 744 if (document().scrollingElement() == this) {
729 if (document().domWindow()) 745 if (document().domWindow())
730 return document().domWindow()->scrollX(); 746 return document().domWindow()->scrollX();
731 return 0; 747 return 0;
732 } 748 }
733 749
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
2502 dispatchScopedEvent(FocusEvent::create(eventType, true, false, document().do mWindow(), 0, oldFocusedElement, sourceCapabilities)); 2518 dispatchScopedEvent(FocusEvent::create(eventType, true, false, document().do mWindow(), 0, oldFocusedElement, sourceCapabilities));
2503 } 2519 }
2504 2520
2505 void Element::dispatchFocusOutEvent(const AtomicString& eventType, Element* newF ocusedElement, InputDeviceCapabilities* sourceCapabilities) 2521 void Element::dispatchFocusOutEvent(const AtomicString& eventType, Element* newF ocusedElement, InputDeviceCapabilities* sourceCapabilities)
2506 { 2522 {
2507 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); 2523 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden());
2508 ASSERT(eventType == EventTypeNames::focusout || eventType == EventTypeNames: :DOMFocusOut); 2524 ASSERT(eventType == EventTypeNames::focusout || eventType == EventTypeNames: :DOMFocusOut);
2509 dispatchScopedEvent(FocusEvent::create(eventType, true, false, document().do mWindow(), 0, newFocusedElement, sourceCapabilities)); 2525 dispatchScopedEvent(FocusEvent::create(eventType, true, false, document().do mWindow(), 0, newFocusedElement, sourceCapabilities));
2510 } 2526 }
2511 2527
2528 void Element::dispatchViewportChangedEvent()
2529 {
2530 dispatchEvent(Event::create(EventTypeNames::viewportchanged));
2531 }
2532
2512 String Element::innerHTML() const 2533 String Element::innerHTML() const
2513 { 2534 {
2514 return createMarkup(this, ChildrenOnly); 2535 return createMarkup(this, ChildrenOnly);
2515 } 2536 }
2516 2537
2517 String Element::outerHTML() const 2538 String Element::outerHTML() const
2518 { 2539 {
2519 return createMarkup(this); 2540 return createMarkup(this);
2520 } 2541 }
2521 2542
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
3670 { 3691 {
3671 #if ENABLE(OILPAN) 3692 #if ENABLE(OILPAN)
3672 if (hasRareData()) 3693 if (hasRareData())
3673 visitor->trace(elementRareData()); 3694 visitor->trace(elementRareData());
3674 visitor->trace(m_elementData); 3695 visitor->trace(m_elementData);
3675 #endif 3696 #endif
3676 ContainerNode::trace(visitor); 3697 ContainerNode::trace(visitor);
3677 } 3698 }
3678 3699
3679 } // namespace blink 3700 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698