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

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

Issue 1814013002: Visual viewport API initial implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make visualviewportchanged per frame + other review feedback Created 4 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 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 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 1221
1222 return body; 1222 return body;
1223 } 1223 }
1224 1224
1225 return documentElement(); 1225 return documentElement();
1226 } 1226 }
1227 1227
1228 return body(); 1228 return body();
1229 } 1229 }
1230 1230
1231 VisualViewport* Document::visualViewport()
1232 {
1233 if (FrameHost* host = frameHost())
1234 return &host->visualViewport();
esprehn 2016/03/31 05:15:37 does your spec say that a document without a view
bokan 2016/03/31 15:23:54 That seems correct to me. I've added the wording i
1235 return nullptr;
1236 }
1237
1231 /* 1238 /*
1232 * Performs three operations: 1239 * Performs three operations:
1233 * 1. Convert control characters to spaces 1240 * 1. Convert control characters to spaces
1234 * 2. Trim leading and trailing spaces 1241 * 2. Trim leading and trailing spaces
1235 * 3. Collapse internal whitespace. 1242 * 3. Collapse internal whitespace.
1236 */ 1243 */
1237 template <typename CharacterType> 1244 template <typename CharacterType>
1238 static inline String canonicalizedTitle(Document* document, const String& title) 1245 static inline String canonicalizedTitle(Document* document, const String& title)
1239 { 1246 {
1240 unsigned length = title.length(); 1247 unsigned length = title.length();
(...skipping 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after
3999 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::resize); 4006 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::resize);
4000 event->setTarget(domWindow()); 4007 event->setTarget(domWindow());
4001 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release()); 4008 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release());
4002 } 4009 }
4003 4010
4004 void Document::enqueueMediaQueryChangeListeners(WillBeHeapVector<RefPtrWillBeMem ber<MediaQueryListListener>>& listeners) 4011 void Document::enqueueMediaQueryChangeListeners(WillBeHeapVector<RefPtrWillBeMem ber<MediaQueryListListener>>& listeners)
4005 { 4012 {
4006 ensureScriptedAnimationController().enqueueMediaQueryChangeListeners(listene rs); 4013 ensureScriptedAnimationController().enqueueMediaQueryChangeListeners(listene rs);
4007 } 4014 }
4008 4015
4016 void Document::enqueueVisualViewportChangedEvent()
4017 {
4018 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::visualviewpo rtchanged);
4019 event->setTarget(this);
4020 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release());
4021 }
4022
4009 void Document::dispatchEventsForPrinting() 4023 void Document::dispatchEventsForPrinting()
4010 { 4024 {
4011 if (!m_scriptedAnimationController) 4025 if (!m_scriptedAnimationController)
4012 return; 4026 return;
4013 m_scriptedAnimationController->dispatchEventsAndCallbacksForPrinting(); 4027 m_scriptedAnimationController->dispatchEventsAndCallbacksForPrinting();
4014 } 4028 }
4015 4029
4016 Document::EventFactorySet& Document::eventFactories() 4030 Document::EventFactorySet& Document::eventFactories()
4017 { 4031 {
4018 DEFINE_STATIC_LOCAL(EventFactorySet, s_eventFactory, ()); 4032 DEFINE_STATIC_LOCAL(EventFactorySet, s_eventFactory, ());
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after
6034 #ifndef NDEBUG 6048 #ifndef NDEBUG
6035 using namespace blink; 6049 using namespace blink;
6036 void showLiveDocumentInstances() 6050 void showLiveDocumentInstances()
6037 { 6051 {
6038 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 6052 Document::WeakDocumentSet& set = Document::liveDocumentSet();
6039 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6053 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6040 for (Document* document : set) 6054 for (Document* document : set)
6041 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6055 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6042 } 6056 }
6043 #endif 6057 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698