OLD | NEW |
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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 , m_hasXMLDeclaration(0) | 448 , m_hasXMLDeclaration(0) |
449 , m_designMode(false) | 449 , m_designMode(false) |
450 , m_hasAnnotatedRegions(false) | 450 , m_hasAnnotatedRegions(false) |
451 , m_annotatedRegionsDirty(false) | 451 , m_annotatedRegionsDirty(false) |
452 , m_useSecureKeyboardEntryWhenActive(false) | 452 , m_useSecureKeyboardEntryWhenActive(false) |
453 , m_documentClasses(documentClasses) | 453 , m_documentClasses(documentClasses) |
454 , m_isViewSource(false) | 454 , m_isViewSource(false) |
455 , m_sawElementsInKnownNamespaces(false) | 455 , m_sawElementsInKnownNamespaces(false) |
456 , m_isSrcdocDocument(false) | 456 , m_isSrcdocDocument(false) |
457 , m_isMobileDocument(false) | 457 , m_isMobileDocument(false) |
458 , m_isTransitionDocument(false) | |
459 , m_layoutView(0) | 458 , m_layoutView(0) |
460 #if !ENABLE(OILPAN) | 459 #if !ENABLE(OILPAN) |
461 , m_weakFactory(this) | 460 , m_weakFactory(this) |
462 #endif | 461 #endif |
463 , m_contextDocument(initializer.contextDocument()) | 462 , m_contextDocument(initializer.contextDocument()) |
464 , m_hasFullscreenSupplement(false) | 463 , m_hasFullscreenSupplement(false) |
465 , m_loadEventDelayCount(0) | 464 , m_loadEventDelayCount(0) |
466 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) | 465 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) |
467 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired) | 466 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired) |
468 , m_writeRecursionIsTooDeep(false) | 467 , m_writeRecursionIsTooDeep(false) |
(...skipping 4992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5461 m_taskRunner->postTask(FROM_HERE, AutofocusTask::create()); | 5460 m_taskRunner->postTask(FROM_HERE, AutofocusTask::create()); |
5462 } | 5461 } |
5463 | 5462 |
5464 Element* Document::activeElement() const | 5463 Element* Document::activeElement() const |
5465 { | 5464 { |
5466 if (Element* element = adjustedFocusedElement()) | 5465 if (Element* element = adjustedFocusedElement()) |
5467 return element; | 5466 return element; |
5468 return body(); | 5467 return body(); |
5469 } | 5468 } |
5470 | 5469 |
5471 void Document::getTransitionElementData(Vector<TransitionElementData>& elementDa
ta) | |
5472 { | |
5473 if (!head()) | |
5474 return; | |
5475 | |
5476 for (HTMLMetaElement* metaElement = Traversal<HTMLMetaElement>::firstChild(*
head()); metaElement; metaElement = Traversal<HTMLMetaElement>::nextSibling(*met
aElement)) { | |
5477 if (metaElement->name() != "transition-elements") | |
5478 continue; | |
5479 | |
5480 const String& metaElementContents = metaElement->content().string(); | |
5481 size_t firstSemicolon = metaElementContents.find(';'); | |
5482 if (firstSemicolon == kNotFound) | |
5483 continue; | |
5484 | |
5485 TrackExceptionState exceptionState; | |
5486 AtomicString selector(metaElementContents.substring(0, firstSemicolon)); | |
5487 RefPtrWillBeRawPtr<StaticElementList> elementList = querySelectorAll(sel
ector, exceptionState); | |
5488 if (!elementList || exceptionState.hadException()) | |
5489 continue; | |
5490 | |
5491 unsigned nodeListLength = elementList->length(); | |
5492 if (!nodeListLength) | |
5493 continue; | |
5494 | |
5495 TransitionElementData newElements; | |
5496 StringBuilder markup; | |
5497 for (unsigned nodeIndex = 0; nodeIndex < nodeListLength; ++nodeIndex) { | |
5498 Element* element = elementList->item(nodeIndex); | |
5499 markup.append(createStyledMarkupForNavigationTransition(element)); | |
5500 TransitionElement transitionElement; | |
5501 if (element->hasID()) | |
5502 transitionElement.id = element->getIdAttribute().string(); | |
5503 else | |
5504 transitionElement.id = ""; | |
5505 transitionElement.rect = element->boundsInViewportSpace(); | |
5506 newElements.elements.append(transitionElement); | |
5507 } | |
5508 | |
5509 newElements.scope = metaElementContents.substring(firstSemicolon + 1).st
ripWhiteSpace(); | |
5510 newElements.selector = selector; | |
5511 newElements.markup = markup.toString(); | |
5512 elementData.append(newElements); | |
5513 } | |
5514 } | |
5515 | |
5516 void Document::updateElementOpacity(const AtomicString& cssSelector, double opac
ity) | |
5517 { | |
5518 TrackExceptionState exceptionState; | |
5519 RefPtrWillBeRawPtr<StaticElementList> elementList = querySelectorAll(cssSele
ctor, exceptionState); | |
5520 if (elementList && !exceptionState.hadException()) { | |
5521 unsigned nodeListLength = elementList->length(); | |
5522 | |
5523 for (unsigned nodeIndex = 0; nodeIndex < nodeListLength; ++nodeIndex) { | |
5524 Element* element = elementList->item(nodeIndex); | |
5525 element->setInlineStyleProperty(CSSPropertyOpacity, opacity, CSSPrim
itiveValue::CSS_NUMBER); | |
5526 } | |
5527 } | |
5528 } | |
5529 | |
5530 void Document::hideTransitionElements(const AtomicString& cssSelector) | |
5531 { | |
5532 updateElementOpacity(cssSelector, 0.0); | |
5533 } | |
5534 | |
5535 void Document::showTransitionElements(const AtomicString& cssSelector) | |
5536 { | |
5537 updateElementOpacity(cssSelector, 1.0); | |
5538 } | |
5539 | |
5540 bool Document::hasFocus() const | 5470 bool Document::hasFocus() const |
5541 { | 5471 { |
5542 Page* page = this->page(); | 5472 Page* page = this->page(); |
5543 if (!page) | 5473 if (!page) |
5544 return false; | 5474 return false; |
5545 if (!page->focusController().isActive() || !page->focusController().isFocuse
d()) | 5475 if (!page->focusController().isActive() || !page->focusController().isFocuse
d()) |
5546 return false; | 5476 return false; |
5547 Frame* focusedFrame = page->focusController().focusedFrame(); | 5477 Frame* focusedFrame = page->focusController().focusedFrame(); |
5548 if (focusedFrame && focusedFrame->isLocalFrame()) { | 5478 if (focusedFrame && focusedFrame->isLocalFrame()) { |
5549 if (toLocalFrame(focusedFrame)->tree().isDescendantOf(frame())) | 5479 if (toLocalFrame(focusedFrame)->tree().isDescendantOf(frame())) |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5757 #ifndef NDEBUG | 5687 #ifndef NDEBUG |
5758 using namespace blink; | 5688 using namespace blink; |
5759 void showLiveDocumentInstances() | 5689 void showLiveDocumentInstances() |
5760 { | 5690 { |
5761 WeakDocumentSet& set = liveDocumentSet(); | 5691 WeakDocumentSet& set = liveDocumentSet(); |
5762 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5692 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5763 for (Document* document : set) | 5693 for (Document* document : set) |
5764 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5694 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
5765 } | 5695 } |
5766 #endif | 5696 #endif |
OLD | NEW |