| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "sky/engine/bindings/core/v8/ExceptionState.h" | 34 #include "sky/engine/bindings/core/v8/ExceptionState.h" |
| 35 #include "sky/engine/bindings/core/v8/ExceptionStatePlaceholder.h" | 35 #include "sky/engine/bindings/core/v8/ExceptionStatePlaceholder.h" |
| 36 #include "sky/engine/bindings/core/v8/ScriptCallStackFactory.h" | 36 #include "sky/engine/bindings/core/v8/ScriptCallStackFactory.h" |
| 37 #include "sky/engine/bindings/core/v8/ScriptController.h" | 37 #include "sky/engine/bindings/core/v8/ScriptController.h" |
| 38 #include "sky/engine/bindings/core/v8/SerializedScriptValue.h" | 38 #include "sky/engine/bindings/core/v8/SerializedScriptValue.h" |
| 39 #include "sky/engine/core/app/Application.h" | 39 #include "sky/engine/core/app/Application.h" |
| 40 #include "sky/engine/core/css/CSSComputedStyleDeclaration.h" | 40 #include "sky/engine/core/css/CSSComputedStyleDeclaration.h" |
| 41 #include "sky/engine/core/css/DOMWindowCSS.h" | 41 #include "sky/engine/core/css/DOMWindowCSS.h" |
| 42 #include "sky/engine/core/css/MediaQueryList.h" | 42 #include "sky/engine/core/css/MediaQueryList.h" |
| 43 #include "sky/engine/core/css/MediaQueryMatcher.h" | 43 #include "sky/engine/core/css/MediaQueryMatcher.h" |
| 44 #include "sky/engine/core/css/StyleMedia.h" | |
| 45 #include "sky/engine/core/css/resolver/StyleResolver.h" | 44 #include "sky/engine/core/css/resolver/StyleResolver.h" |
| 46 #include "sky/engine/core/dom/Document.h" | 45 #include "sky/engine/core/dom/Document.h" |
| 47 #include "sky/engine/core/dom/Element.h" | 46 #include "sky/engine/core/dom/Element.h" |
| 48 #include "sky/engine/core/dom/ExceptionCode.h" | 47 #include "sky/engine/core/dom/ExceptionCode.h" |
| 49 #include "sky/engine/core/dom/ExecutionContext.h" | 48 #include "sky/engine/core/dom/ExecutionContext.h" |
| 50 #include "sky/engine/core/dom/RequestAnimationFrameCallback.h" | 49 #include "sky/engine/core/dom/RequestAnimationFrameCallback.h" |
| 51 #include "sky/engine/core/editing/Editor.h" | 50 #include "sky/engine/core/editing/Editor.h" |
| 52 #include "sky/engine/core/events/DOMWindowEventQueue.h" | 51 #include "sky/engine/core/events/DOMWindowEventQueue.h" |
| 53 #include "sky/engine/core/events/EventListener.h" | 52 #include "sky/engine/core/events/EventListener.h" |
| 54 #include "sky/engine/core/events/HashChangeEvent.h" | 53 #include "sky/engine/core/events/HashChangeEvent.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 resetDOMWindowProperties(); | 374 resetDOMWindowProperties(); |
| 376 } | 375 } |
| 377 | 376 |
| 378 void LocalDOMWindow::resetDOMWindowProperties() | 377 void LocalDOMWindow::resetDOMWindowProperties() |
| 379 { | 378 { |
| 380 m_properties.clear(); | 379 m_properties.clear(); |
| 381 | 380 |
| 382 m_screen = nullptr; | 381 m_screen = nullptr; |
| 383 m_console = nullptr; | 382 m_console = nullptr; |
| 384 m_location = nullptr; | 383 m_location = nullptr; |
| 385 m_media = nullptr; | |
| 386 #if ENABLE(ASSERT) | 384 #if ENABLE(ASSERT) |
| 387 m_hasBeenReset = true; | 385 m_hasBeenReset = true; |
| 388 #endif | 386 #endif |
| 389 } | 387 } |
| 390 | 388 |
| 391 int LocalDOMWindow::orientation() const | 389 int LocalDOMWindow::orientation() const |
| 392 { | 390 { |
| 393 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled()); | 391 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled()); |
| 394 | 392 |
| 395 int orientation = screenOrientationAngle(m_frame->view()); | 393 int orientation = screenOrientationAngle(m_frame->view()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 return; | 440 return; |
| 443 | 441 |
| 444 host->chrome().focus(); | 442 host->chrome().focus(); |
| 445 | 443 |
| 446 if (!m_frame) | 444 if (!m_frame) |
| 447 return; | 445 return; |
| 448 | 446 |
| 449 m_frame->eventHandler().focusDocumentView(); | 447 m_frame->eventHandler().focusDocumentView(); |
| 450 } | 448 } |
| 451 | 449 |
| 452 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar
ds, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/)
const | |
| 453 { | |
| 454 // |m_frame| can be destructed during |Editor::findString()| via | |
| 455 // |Document::updateLayou()|, e.g. event handler removes a frame. | |
| 456 RefPtr<LocalFrame> protectFrame(m_frame); | |
| 457 | |
| 458 // FIXME (13016): Support wholeWord, searchInFrames and showDialog | |
| 459 return m_frame->editor().findString(string, !backwards, caseSensitive, wrap,
false); | |
| 460 } | |
| 461 | |
| 462 int LocalDOMWindow::outerHeight() const | 450 int LocalDOMWindow::outerHeight() const |
| 463 { | 451 { |
| 464 if (!m_frame) | 452 if (!m_frame) |
| 465 return 0; | 453 return 0; |
| 466 | 454 |
| 467 FrameHost* host = m_frame->host(); | 455 FrameHost* host = m_frame->host(); |
| 468 if (!host) | 456 if (!host) |
| 469 return 0; | 457 return 0; |
| 470 | 458 |
| 471 return static_cast<int>(host->chrome().windowRect().height()); | 459 return static_cast<int>(host->chrome().windowRect().height()); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 return 0; | 525 return 0; |
| 538 | 526 |
| 539 return m_frame->domWindow(); | 527 return m_frame->domWindow(); |
| 540 } | 528 } |
| 541 | 529 |
| 542 Document* LocalDOMWindow::document() const | 530 Document* LocalDOMWindow::document() const |
| 543 { | 531 { |
| 544 return m_document.get(); | 532 return m_document.get(); |
| 545 } | 533 } |
| 546 | 534 |
| 547 StyleMedia& LocalDOMWindow::styleMedia() const | |
| 548 { | |
| 549 if (!m_media) | |
| 550 m_media = StyleMedia::create(m_frame); | |
| 551 return *m_media; | |
| 552 } | |
| 553 | |
| 554 PassRefPtr<CSSStyleDeclaration> LocalDOMWindow::getComputedStyle(Element* elt) c
onst | 535 PassRefPtr<CSSStyleDeclaration> LocalDOMWindow::getComputedStyle(Element* elt) c
onst |
| 555 { | 536 { |
| 556 if (!elt) | 537 if (!elt) |
| 557 return nullptr; | 538 return nullptr; |
| 558 | 539 |
| 559 return CSSComputedStyleDeclaration::create(elt, false); | 540 return CSSComputedStyleDeclaration::create(elt, false); |
| 560 } | 541 } |
| 561 | 542 |
| 562 double LocalDOMWindow::devicePixelRatio() const | 543 double LocalDOMWindow::devicePixelRatio() const |
| 563 { | 544 { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 { | 723 { |
| 743 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<LocalDOMWin
dow>::lifecycleNotifier()); | 724 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<LocalDOMWin
dow>::lifecycleNotifier()); |
| 744 } | 725 } |
| 745 | 726 |
| 746 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo
tifier() | 727 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo
tifier() |
| 747 { | 728 { |
| 748 return DOMWindowLifecycleNotifier::create(this); | 729 return DOMWindowLifecycleNotifier::create(this); |
| 749 } | 730 } |
| 750 | 731 |
| 751 } // namespace blink | 732 } // namespace blink |
| OLD | NEW |