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 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2186 m_axObjectCache.clear(); | 2186 m_axObjectCache.clear(); |
2187 } | 2187 } |
2188 | 2188 |
2189 AXObjectCache* Document::existingAXObjectCache() const | 2189 AXObjectCache* Document::existingAXObjectCache() const |
2190 { | 2190 { |
2191 if (!AXObjectCache::accessibilityEnabled()) | 2191 if (!AXObjectCache::accessibilityEnabled()) |
2192 return 0; | 2192 return 0; |
2193 | 2193 |
2194 // If the renderer is gone then we are in the process of destruction. | 2194 // If the renderer is gone then we are in the process of destruction. |
2195 // This method will be called before m_frame = 0. | 2195 // This method will be called before m_frame = 0. |
2196 if (!topDocument()->renderView()) | 2196 if (!topDocument().renderView()) |
2197 return 0; | 2197 return 0; |
2198 | 2198 |
2199 return topDocument()->m_axObjectCache.get(); | 2199 return topDocument().m_axObjectCache.get(); |
2200 } | 2200 } |
2201 | 2201 |
2202 AXObjectCache* Document::axObjectCache() const | 2202 AXObjectCache* Document::axObjectCache() const |
2203 { | 2203 { |
2204 if (!AXObjectCache::accessibilityEnabled()) | 2204 if (!AXObjectCache::accessibilityEnabled()) |
2205 return 0; | 2205 return 0; |
2206 | 2206 |
2207 // The only document that actually has a AXObjectCache is the top-level | 2207 // The only document that actually has a AXObjectCache is the top-level |
2208 // document. This is because we need to be able to get from any WebCoreAXOb
ject | 2208 // document. This is because we need to be able to get from any WebCoreAXOb
ject |
2209 // to any other WebCoreAXObject on the same page. Using a single cache allo
ws | 2209 // to any other WebCoreAXObject on the same page. Using a single cache allo
ws |
2210 // lookups across nested webareas (i.e. multiple documents). | 2210 // lookups across nested webareas (i.e. multiple documents). |
2211 Document* topDocument = this->topDocument(); | 2211 Document& topDocument = this->topDocument(); |
2212 | 2212 |
2213 // If the document has already been detached, do not make a new axObjectCach
e. | 2213 // If the document has already been detached, do not make a new axObjectCach
e. |
2214 if (!topDocument->renderView()) | 2214 if (!topDocument.renderView()) |
2215 return 0; | 2215 return 0; |
2216 | 2216 |
2217 ASSERT(topDocument == this || !m_axObjectCache); | 2217 ASSERT(topDocument == this || !m_axObjectCache); |
2218 if (!topDocument->m_axObjectCache) | 2218 if (!topDocument.m_axObjectCache) |
2219 topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); | 2219 topDocument.m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); |
2220 return topDocument->m_axObjectCache.get(); | 2220 return topDocument.m_axObjectCache.get(); |
2221 } | 2221 } |
2222 | 2222 |
2223 PassRefPtr<DocumentParser> Document::createParser() | 2223 PassRefPtr<DocumentParser> Document::createParser() |
2224 { | 2224 { |
2225 if (isHTMLDocument()) { | 2225 if (isHTMLDocument()) { |
2226 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(
page()); | 2226 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(
page()); |
2227 return HTMLDocumentParser::create(toHTMLDocument(this), reportErrors); | 2227 return HTMLDocumentParser::create(toHTMLDocument(this), reportErrors); |
2228 } | 2228 } |
2229 // FIXME: this should probably pass the frame instead | 2229 // FIXME: this should probably pass the frame instead |
2230 return XMLDocumentParser::create(this, view()); | 2230 return XMLDocumentParser::create(this, view()); |
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3935 // FIXME: If this document came from the file system, the HTML5 | 3935 // FIXME: If this document came from the file system, the HTML5 |
3936 // specificiation tells us to read the last modification date from the file | 3936 // specificiation tells us to read the last modification date from the file |
3937 // system. | 3937 // system. |
3938 if (!foundDate) | 3938 if (!foundDate) |
3939 date.setMillisecondsSinceEpochForDateTime(currentTimeMS()); | 3939 date.setMillisecondsSinceEpochForDateTime(currentTimeMS()); |
3940 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat
e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second()); | 3940 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat
e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second()); |
3941 } | 3941 } |
3942 | 3942 |
3943 const KURL& Document::firstPartyForCookies() const | 3943 const KURL& Document::firstPartyForCookies() const |
3944 { | 3944 { |
3945 return topDocument()->url(); | 3945 return topDocument().url(); |
3946 } | 3946 } |
3947 | 3947 |
3948 static bool isValidNameNonASCII(const LChar* characters, unsigned length) | 3948 static bool isValidNameNonASCII(const LChar* characters, unsigned length) |
3949 { | 3949 { |
3950 if (!isValidNameStart(characters[0])) | 3950 if (!isValidNameStart(characters[0])) |
3951 return false; | 3951 return false; |
3952 | 3952 |
3953 for (unsigned i = 1; i < length; ++i) { | 3953 for (unsigned i = 1; i < length; ++i) { |
3954 if (!isValidNamePart(characters[i])) | 3954 if (!isValidNamePart(characters[i])) |
3955 return false; | 3955 return false; |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4303 Document* Document::parentDocument() const | 4303 Document* Document::parentDocument() const |
4304 { | 4304 { |
4305 if (!m_frame) | 4305 if (!m_frame) |
4306 return 0; | 4306 return 0; |
4307 LocalFrame* parent = m_frame->tree().parent(); | 4307 LocalFrame* parent = m_frame->tree().parent(); |
4308 if (!parent) | 4308 if (!parent) |
4309 return 0; | 4309 return 0; |
4310 return parent->document(); | 4310 return parent->document(); |
4311 } | 4311 } |
4312 | 4312 |
4313 Document* Document::topDocument() const | 4313 Document& Document::topDocument() const |
4314 { | 4314 { |
4315 Document* doc = const_cast<Document*>(this); | 4315 Document* doc = const_cast<Document*>(this); |
4316 Element* element; | 4316 Element* element; |
4317 while ((element = doc->ownerElement())) | 4317 while ((element = doc->ownerElement())) |
4318 doc = &element->document(); | 4318 doc = &element->document(); |
4319 | 4319 |
4320 return doc; | 4320 ASSERT(doc); |
| 4321 return *doc; |
4321 } | 4322 } |
4322 | 4323 |
4323 WeakPtr<Document> Document::contextDocument() | 4324 WeakPtr<Document> Document::contextDocument() |
4324 { | 4325 { |
4325 if (m_contextDocument) | 4326 if (m_contextDocument) |
4326 return m_contextDocument; | 4327 return m_contextDocument; |
4327 if (m_frame) | 4328 if (m_frame) |
4328 return m_weakFactory.createWeakPtr(); | 4329 return m_weakFactory.createWeakPtr(); |
4329 return WeakPtr<Document>(nullptr); | 4330 return WeakPtr<Document>(nullptr); |
4330 } | 4331 } |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5438 void Document::defaultEventHandler(Event* event) | 5439 void Document::defaultEventHandler(Event* event) |
5439 { | 5440 { |
5440 if (frame() && frame()->remotePlatformLayer()) { | 5441 if (frame() && frame()->remotePlatformLayer()) { |
5441 frame()->chromeClient().forwardInputEvent(this, event); | 5442 frame()->chromeClient().forwardInputEvent(this, event); |
5442 return; | 5443 return; |
5443 } | 5444 } |
5444 Node::defaultEventHandler(event); | 5445 Node::defaultEventHandler(event); |
5445 } | 5446 } |
5446 | 5447 |
5447 } // namespace WebCore | 5448 } // namespace WebCore |
OLD | NEW |