Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(920)

Side by Side Diff: sky/engine/core/dom/Document.cpp

Issue 712423002: Simplify some parsing-related code (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 } 1395 }
1396 1396
1397 void Document::removeAllEventListeners() 1397 void Document::removeAllEventListeners()
1398 { 1398 {
1399 ContainerNode::removeAllEventListeners(); 1399 ContainerNode::removeAllEventListeners();
1400 1400
1401 if (LocalDOMWindow* domWindow = this->domWindow()) 1401 if (LocalDOMWindow* domWindow = this->domWindow())
1402 domWindow->removeAllEventListeners(); 1402 domWindow->removeAllEventListeners();
1403 } 1403 }
1404 1404
1405 PassRefPtr<DocumentParser> Document::createParser()
1406 {
1407 // FIXME(sky): Should we pass true for report errors like the inspector did?
1408 return HTMLDocumentParser::create(toHTMLDocument(*this), false);
1409 }
1410
1411 HTMLDocumentParser* Document::scriptableDocumentParser() const 1405 HTMLDocumentParser* Document::scriptableDocumentParser() const
1412 { 1406 {
1413 return parser() ? parser()->asHTMLDocumentParser() : 0; 1407 return parser() ? parser()->asHTMLDocumentParser() : 0;
1414 } 1408 }
1415 1409
1416 void Document::detachParser() 1410 void Document::detachParser()
1417 { 1411 {
1418 if (!m_parser) 1412 if (!m_parser)
1419 return; 1413 return;
1420 m_parser->detach(); 1414 m_parser->detach();
(...skipping 19 matching lines...) Expand all
1440 checkCompleted(); 1434 checkCompleted();
1441 } 1435 }
1442 1436
1443 void Document::startParsing() 1437 void Document::startParsing()
1444 { 1438 {
1445 ASSERT(!m_parser); 1439 ASSERT(!m_parser);
1446 ASSERT(!m_isParsing); 1440 ASSERT(!m_isParsing);
1447 ASSERT(!firstChild()); 1441 ASSERT(!firstChild());
1448 ASSERT(!m_focusedElement); 1442 ASSERT(!m_focusedElement);
1449 1443
1450 m_parser = createParser(); 1444 m_parser = HTMLDocumentParser::create(toHTMLDocument(*this), false);
1451 setParsing(true); 1445 setParsing(true);
1452 setReadyState(Loading); 1446 setReadyState(Loading);
1453 } 1447 }
1454 1448
1455 Element* Document::viewportDefiningElement(RenderStyle* rootStyle) const 1449 Element* Document::viewportDefiningElement(RenderStyle* rootStyle) const
1456 { 1450 {
1457 // If a BODY element sets non-visible overflow, it is to be propagated to th e viewport, as long 1451 // If a BODY element sets non-visible overflow, it is to be propagated to th e viewport, as long
1458 // as the following conditions are all met: 1452 // as the following conditions are all met:
1459 // (1) The root element is HTML. 1453 // (1) The root element is HTML.
1460 // (2) It is the primary BODY element (we only assert for this, expecting ca llers to behave). 1454 // (2) It is the primary BODY element (we only assert for this, expecting ca llers to behave).
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after
2977 using namespace blink; 2971 using namespace blink;
2978 void showLiveDocumentInstances() 2972 void showLiveDocumentInstances()
2979 { 2973 {
2980 WeakDocumentSet& set = liveDocumentSet(); 2974 WeakDocumentSet& set = liveDocumentSet();
2981 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 2975 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
2982 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 2976 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
2983 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 2977 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
2984 } 2978 }
2985 } 2979 }
2986 #endif 2980 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698