OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All |
3 * Rights Reserved. | 3 * Rights Reserved. |
4 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. | 4 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. |
5 * (http://www.torchmobile.com/) | 5 * (http://www.torchmobile.com/) |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 m_useCounter(pageClients.chromeClient && | 111 m_useCounter(pageClients.chromeClient && |
112 pageClients.chromeClient->isSVGImageChromeClient() | 112 pageClients.chromeClient->isSVGImageChromeClient() |
113 ? UseCounter::SVGImageContext | 113 ? UseCounter::SVGImageContext |
114 : UseCounter::DefaultContext), | 114 : UseCounter::DefaultContext), |
115 m_openedByDOM(false), | 115 m_openedByDOM(false), |
116 m_tabKeyCyclesThroughElements(true), | 116 m_tabKeyCyclesThroughElements(true), |
117 m_suspended(false), | 117 m_suspended(false), |
118 m_deviceScaleFactor(1), | 118 m_deviceScaleFactor(1), |
119 m_visibilityState(PageVisibilityStateVisible), | 119 m_visibilityState(PageVisibilityStateVisible), |
120 m_isCursorVisible(true), | 120 m_isCursorVisible(true), |
| 121 m_subframeCount(0), |
121 m_frameHost(FrameHost::create(*this)) { | 122 m_frameHost(FrameHost::create(*this)) { |
122 ASSERT(m_editorClient); | 123 ASSERT(m_editorClient); |
123 | 124 |
124 ASSERT(!allPages().contains(this)); | 125 ASSERT(!allPages().contains(this)); |
125 allPages().insert(this); | 126 allPages().insert(this); |
126 } | 127 } |
127 | 128 |
128 Page::~Page() { | 129 Page::~Page() { |
129 // willBeDestroyed() must be called before Page destruction. | 130 // willBeDestroyed() must be called before Page destruction. |
130 ASSERT(!m_mainFrame); | 131 ASSERT(!m_mainFrame); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 372 } |
372 | 373 |
373 bool Page::isPageVisible() const { | 374 bool Page::isPageVisible() const { |
374 return visibilityState() == PageVisibilityStateVisible; | 375 return visibilityState() == PageVisibilityStateVisible; |
375 } | 376 } |
376 | 377 |
377 bool Page::isCursorVisible() const { | 378 bool Page::isCursorVisible() const { |
378 return m_isCursorVisible; | 379 return m_isCursorVisible; |
379 } | 380 } |
380 | 381 |
| 382 #if DCHECK_IS_ON() |
| 383 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) { |
| 384 DCHECK_GE(expectedFrameCount, 0); |
| 385 |
| 386 int actualFrameCount = 0; |
| 387 for (; frame; frame = frame->tree().traverseNext()) |
| 388 ++actualFrameCount; |
| 389 |
| 390 DCHECK_EQ(expectedFrameCount, actualFrameCount); |
| 391 } |
| 392 #endif |
| 393 |
| 394 int Page::subframeCount() const { |
| 395 #if DCHECK_IS_ON() |
| 396 checkFrameCountConsistency(m_subframeCount + 1, mainFrame()); |
| 397 #endif |
| 398 return m_subframeCount; |
| 399 } |
| 400 |
381 void Page::settingsChanged(SettingsDelegate::ChangeType changeType) { | 401 void Page::settingsChanged(SettingsDelegate::ChangeType changeType) { |
382 switch (changeType) { | 402 switch (changeType) { |
383 case SettingsDelegate::StyleChange: | 403 case SettingsDelegate::StyleChange: |
384 setNeedsRecalcStyleInAllFrames(); | 404 setNeedsRecalcStyleInAllFrames(); |
385 break; | 405 break; |
386 case SettingsDelegate::ViewportDescriptionChange: | 406 case SettingsDelegate::ViewportDescriptionChange: |
387 if (mainFrame() && mainFrame()->isLocalFrame()) { | 407 if (mainFrame() && mainFrame()->isLocalFrame()) { |
388 deprecatedLocalMainFrame()->document()->updateViewportDescription(); | 408 deprecatedLocalMainFrame()->document()->updateViewportDescription(); |
389 // The text autosizer has dependencies on the viewport. | 409 // The text autosizer has dependencies on the viewport. |
390 if (TextAutosizer* textAutosizer = | 410 if (TextAutosizer* textAutosizer = |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 : chromeClient(nullptr), | 614 : chromeClient(nullptr), |
595 contextMenuClient(nullptr), | 615 contextMenuClient(nullptr), |
596 editorClient(nullptr), | 616 editorClient(nullptr), |
597 spellCheckerClient(nullptr) {} | 617 spellCheckerClient(nullptr) {} |
598 | 618 |
599 Page::PageClients::~PageClients() {} | 619 Page::PageClients::~PageClients() {} |
600 | 620 |
601 template class CORE_TEMPLATE_EXPORT Supplement<Page>; | 621 template class CORE_TEMPLATE_EXPORT Supplement<Page>; |
602 | 622 |
603 } // namespace blink | 623 } // namespace blink |
OLD | NEW |