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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 #include "core/page/PointerLockController.h" | 169 #include "core/page/PointerLockController.h" |
170 #include "core/page/scrolling/ScrollingCoordinator.h" | 170 #include "core/page/scrolling/ScrollingCoordinator.h" |
171 #include "core/rendering/FastTextAutosizer.h" | 171 #include "core/rendering/FastTextAutosizer.h" |
172 #include "core/rendering/HitTestResult.h" | 172 #include "core/rendering/HitTestResult.h" |
173 #include "core/rendering/RenderView.h" | 173 #include "core/rendering/RenderView.h" |
174 #include "core/rendering/RenderWidget.h" | 174 #include "core/rendering/RenderWidget.h" |
175 #include "core/rendering/TextAutosizer.h" | 175 #include "core/rendering/TextAutosizer.h" |
176 #include "core/rendering/compositing/RenderLayerCompositor.h" | 176 #include "core/rendering/compositing/RenderLayerCompositor.h" |
177 #include "core/svg/SVGDocumentExtensions.h" | 177 #include "core/svg/SVGDocumentExtensions.h" |
178 #include "core/svg/SVGFontFaceElement.h" | 178 #include "core/svg/SVGFontFaceElement.h" |
| 179 #include "core/svg/SVGTitleElement.h" |
179 #include "core/svg/SVGUseElement.h" | 180 #include "core/svg/SVGUseElement.h" |
180 #include "core/workers/SharedWorkerRepositoryClient.h" | 181 #include "core/workers/SharedWorkerRepositoryClient.h" |
181 #include "core/xml/XSLTProcessor.h" | 182 #include "core/xml/XSLTProcessor.h" |
182 #include "core/xml/parser/XMLDocumentParser.h" | 183 #include "core/xml/parser/XMLDocumentParser.h" |
183 #include "platform/DateComponents.h" | 184 #include "platform/DateComponents.h" |
184 #include "platform/Language.h" | 185 #include "platform/Language.h" |
185 #include "platform/RuntimeEnabledFeatures.h" | 186 #include "platform/RuntimeEnabledFeatures.h" |
186 #include "platform/ScriptForbiddenScope.h" | 187 #include "platform/ScriptForbiddenScope.h" |
187 #include "platform/TraceEvent.h" | 188 #include "platform/TraceEvent.h" |
188 #include "platform/network/ContentSecurityPolicyParsers.h" | 189 #include "platform/network/ContentSecurityPolicyParsers.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 , m_mutationObserverTypes(0) | 455 , m_mutationObserverTypes(0) |
455 , m_visitedLinkState(VisitedLinkState::create(*this)) | 456 , m_visitedLinkState(VisitedLinkState::create(*this)) |
456 , m_visuallyOrdered(false) | 457 , m_visuallyOrdered(false) |
457 , m_readyState(Complete) | 458 , m_readyState(Complete) |
458 , m_isParsing(false) | 459 , m_isParsing(false) |
459 , m_gotoAnchorNeededAfterStylesheetsLoad(false) | 460 , m_gotoAnchorNeededAfterStylesheetsLoad(false) |
460 , m_containsValidityStyleRules(false) | 461 , m_containsValidityStyleRules(false) |
461 , m_updateFocusAppearanceRestoresSelection(false) | 462 , m_updateFocusAppearanceRestoresSelection(false) |
462 , m_containsPlugins(false) | 463 , m_containsPlugins(false) |
463 , m_ignoreDestructiveWriteCount(0) | 464 , m_ignoreDestructiveWriteCount(0) |
464 , m_titleSetExplicitly(false) | |
465 , m_markers(adoptPtrWillBeNoop(new DocumentMarkerController)) | 465 , m_markers(adoptPtrWillBeNoop(new DocumentMarkerController)) |
466 , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFi
red) | 466 , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFi
red) |
467 , m_cssTarget(nullptr) | 467 , m_cssTarget(nullptr) |
468 , m_loadEventProgress(LoadEventNotRun) | 468 , m_loadEventProgress(LoadEventNotRun) |
469 , m_startTime(currentTime()) | 469 , m_startTime(currentTime()) |
470 , m_scriptRunner(ScriptRunner::create(this)) | 470 , m_scriptRunner(ScriptRunner::create(this)) |
471 , m_xmlVersion("1.0") | 471 , m_xmlVersion("1.0") |
472 , m_xmlStandalone(StandaloneUnspecified) | 472 , m_xmlStandalone(StandaloneUnspecified) |
473 , m_hasXMLDeclaration(0) | 473 , m_hasXMLDeclaration(0) |
474 , m_designMode(inherit) | 474 , m_designMode(inherit) |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 m_title = canonicalizedTitle<UChar>(this, m_rawTitle); | 1379 m_title = canonicalizedTitle<UChar>(this, m_rawTitle); |
1380 | 1380 |
1381 if (!m_frame || oldTitle == m_title) | 1381 if (!m_frame || oldTitle == m_title) |
1382 return; | 1382 return; |
1383 m_frame->loader().client()->dispatchDidReceiveTitle(m_title); | 1383 m_frame->loader().client()->dispatchDidReceiveTitle(m_title); |
1384 } | 1384 } |
1385 | 1385 |
1386 void Document::setTitle(const String& title) | 1386 void Document::setTitle(const String& title) |
1387 { | 1387 { |
1388 // Title set by JavaScript -- overrides any title elements. | 1388 // Title set by JavaScript -- overrides any title elements. |
1389 m_titleSetExplicitly = true; | |
1390 if (!isHTMLDocument() && !isXHTMLDocument()) | 1389 if (!isHTMLDocument() && !isXHTMLDocument()) |
1391 m_titleElement = nullptr; | 1390 m_titleElement = nullptr; |
1392 else if (!m_titleElement) { | 1391 else if (!m_titleElement) { |
1393 if (HTMLElement* headElement = head()) { | 1392 HTMLElement* headElement = head(); |
1394 m_titleElement = HTMLTitleElement::create(*this); | 1393 if (!headElement) |
1395 headElement->appendChild(m_titleElement.get()); | 1394 return; |
1396 } | 1395 m_titleElement = HTMLTitleElement::create(*this); |
| 1396 headElement->appendChild(m_titleElement.get()); |
1397 } | 1397 } |
1398 | 1398 |
1399 if (isHTMLTitleElement(m_titleElement)) | 1399 if (isHTMLTitleElement(m_titleElement)) |
1400 toHTMLTitleElement(m_titleElement)->setText(title); | 1400 toHTMLTitleElement(m_titleElement)->setText(title); |
1401 else | 1401 else |
1402 updateTitle(title); | 1402 updateTitle(title); |
1403 } | 1403 } |
1404 | 1404 |
1405 void Document::setTitleElement(const String& title, Element* titleElement) | 1405 void Document::setTitleElement(Element* titleElement) |
1406 { | 1406 { |
1407 if (titleElement != m_titleElement) { | 1407 // Only allow the first title element to change the title -- others have no
effect. |
1408 if (m_titleElement || m_titleSetExplicitly) | 1408 if (m_titleElement && m_titleElement != titleElement) { |
1409 // Only allow the first title element to change the title -- others
have no effect. | 1409 if (isHTMLDocument() || isXHTMLDocument()) { |
1410 return; | 1410 m_titleElement = Traversal<HTMLTitleElement>::firstWithin(*this); |
| 1411 } else if (isSVGDocument()) { |
| 1412 m_titleElement = Traversal<SVGTitleElement>::firstWithin(*this); |
| 1413 } |
| 1414 } else { |
1411 m_titleElement = titleElement; | 1415 m_titleElement = titleElement; |
1412 } | 1416 } |
1413 | 1417 |
1414 updateTitle(title); | 1418 if (isHTMLTitleElement(m_titleElement)) |
| 1419 updateTitle(toHTMLTitleElement(m_titleElement)->text()); |
| 1420 else if (isSVGTitleElement(m_titleElement)) |
| 1421 updateTitle(toSVGTitleElement(m_titleElement)->textContent()); |
1415 } | 1422 } |
1416 | 1423 |
1417 void Document::removeTitle(Element* titleElement) | 1424 void Document::removeTitle(Element* titleElement) |
1418 { | 1425 { |
1419 if (m_titleElement != titleElement) | 1426 if (m_titleElement != titleElement) |
1420 return; | 1427 return; |
1421 | 1428 |
1422 m_titleElement = nullptr; | 1429 m_titleElement = nullptr; |
1423 m_titleSetExplicitly = false; | |
1424 | 1430 |
1425 // FIXME: This is broken for SVG. | 1431 // Update title based on first title element in the document, if one exists. |
1426 // Update title based on first title element in the head, if one exists. | 1432 if (isHTMLDocument() || isXHTMLDocument()) { |
1427 if (HTMLElement* headElement = head()) { | 1433 if (HTMLTitleElement* title = Traversal<HTMLTitleElement>::firstWithin(*
this)) |
1428 if (HTMLTitleElement* title = Traversal<HTMLTitleElement>::firstChild(*h
eadElement)) | 1434 setTitleElement(title); |
1429 setTitleElement(title->text(), title); | 1435 } else if (isSVGDocument()) { |
| 1436 if (SVGTitleElement* title = Traversal<SVGTitleElement>::firstWithin(*th
is)) |
| 1437 setTitleElement(title); |
1430 } | 1438 } |
1431 | 1439 |
1432 if (!m_titleElement) | 1440 if (!m_titleElement) |
1433 updateTitle(String()); | 1441 updateTitle(String()); |
1434 } | 1442 } |
1435 | 1443 |
1436 const AtomicString& Document::dir() | 1444 const AtomicString& Document::dir() |
1437 { | 1445 { |
1438 Element* rootElement = documentElement(); | 1446 Element* rootElement = documentElement(); |
1439 if (isHTMLHtmlElement(rootElement)) | 1447 if (isHTMLHtmlElement(rootElement)) |
(...skipping 4447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5887 using namespace blink; | 5895 using namespace blink; |
5888 void showLiveDocumentInstances() | 5896 void showLiveDocumentInstances() |
5889 { | 5897 { |
5890 WeakDocumentSet& set = liveDocumentSet(); | 5898 WeakDocumentSet& set = liveDocumentSet(); |
5891 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5899 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5892 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { | 5900 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { |
5893 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); | 5901 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); |
5894 } | 5902 } |
5895 } | 5903 } |
5896 #endif | 5904 #endif |
OLD | NEW |