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 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 { | 1371 { |
1372 if (m_titleElement != titleElement) | 1372 if (m_titleElement != titleElement) |
1373 return; | 1373 return; |
1374 | 1374 |
1375 m_titleElement = 0; | 1375 m_titleElement = 0; |
1376 m_titleSetExplicitly = false; | 1376 m_titleSetExplicitly = false; |
1377 | 1377 |
1378 // FIXME: This is broken for SVG. | 1378 // FIXME: This is broken for SVG. |
1379 // Update title based on first title element in the head, if one exists. | 1379 // Update title based on first title element in the head, if one exists. |
1380 if (HTMLElement* headElement = head()) { | 1380 if (HTMLElement* headElement = head()) { |
1381 for (Element* element = headElement->firstElementChild(); element; eleme
nt = element->nextElementSibling()) { | 1381 for (Element* element = ElementTraversal::firstWithin(*headElement); ele
ment; element = ElementTraversal::nextSibling(*element)) { |
1382 if (!element->hasTagName(titleTag)) | 1382 if (!element->hasTagName(titleTag)) |
1383 continue; | 1383 continue; |
1384 HTMLTitleElement* title = toHTMLTitleElement(element); | 1384 HTMLTitleElement* title = toHTMLTitleElement(element); |
1385 setTitleElement(title->text(), title); | 1385 setTitleElement(title->text(), title); |
1386 break; | 1386 break; |
1387 } | 1387 } |
1388 } | 1388 } |
1389 | 1389 |
1390 if (!m_titleElement) | 1390 if (!m_titleElement) |
1391 updateTitle(String()); | 1391 updateTitle(String()); |
(...skipping 2728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4120 void Document::setEncodingData(const DocumentEncodingData& newData) | 4120 void Document::setEncodingData(const DocumentEncodingData& newData) |
4121 { | 4121 { |
4122 // It's possible for the encoding of the document to change while we're deco
ding | 4122 // It's possible for the encoding of the document to change while we're deco
ding |
4123 // data. That can only occur while we're processing the <head> portion of th
e | 4123 // data. That can only occur while we're processing the <head> portion of th
e |
4124 // document. There isn't much user-visible content in the <head>, but there
is | 4124 // document. There isn't much user-visible content in the <head>, but there
is |
4125 // the <title> element. This function detects that situation and re-decodes
the | 4125 // the <title> element. This function detects that situation and re-decodes
the |
4126 // document's title so that the user doesn't see an incorrectly decoded titl
e | 4126 // document's title so that the user doesn't see an incorrectly decoded titl
e |
4127 // in the title bar. | 4127 // in the title bar. |
4128 if (m_titleElement | 4128 if (m_titleElement |
4129 && encoding() != newData.encoding() | 4129 && encoding() != newData.encoding() |
4130 && !m_titleElement->firstElementChild() | 4130 && !ElementTraversal::firstWithin(*m_titleElement) |
4131 && encoding() == Latin1Encoding() | 4131 && encoding() == Latin1Encoding() |
4132 && m_titleElement->textContent().containsOnlyLatin1()) { | 4132 && m_titleElement->textContent().containsOnlyLatin1()) { |
4133 | 4133 |
4134 CString originalBytes = m_titleElement->textContent().latin1(); | 4134 CString originalBytes = m_titleElement->textContent().latin1(); |
4135 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); | 4135 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); |
4136 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), true); | 4136 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), true); |
4137 m_titleElement->setTextContent(correctlyDecodedTitle); | 4137 m_titleElement->setTextContent(correctlyDecodedTitle); |
4138 } | 4138 } |
4139 | 4139 |
4140 m_encodingData = newData; | 4140 m_encodingData = newData; |
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5461 void Document::defaultEventHandler(Event* event) | 5461 void Document::defaultEventHandler(Event* event) |
5462 { | 5462 { |
5463 if (frame() && frame()->remotePlatformLayer()) { | 5463 if (frame() && frame()->remotePlatformLayer()) { |
5464 frame()->chromeClient().forwardInputEvent(this, event); | 5464 frame()->chromeClient().forwardInputEvent(this, event); |
5465 return; | 5465 return; |
5466 } | 5466 } |
5467 Node::defaultEventHandler(event); | 5467 Node::defaultEventHandler(event); |
5468 } | 5468 } |
5469 | 5469 |
5470 } // namespace WebCore | 5470 } // namespace WebCore |
OLD | NEW |