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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2643613002: Reduce the perf overhead of our dangling markup experiments. (Closed)
Patch Set: unittest Created 3 years, 11 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 4927 matching lines...) Expand 10 before | Expand all | Expand 10 after
4938 layoutViewItem().mutableStyleRef().setRtlOrdering( 4938 layoutViewItem().mutableStyleRef().setRtlOrdering(
4939 m_visuallyOrdered ? EOrder::kVisual : EOrder::kLogical); 4939 m_visuallyOrdered ? EOrder::kVisual : EOrder::kLogical);
4940 } 4940 }
4941 setNeedsStyleRecalc(SubtreeStyleChange, 4941 setNeedsStyleRecalc(SubtreeStyleChange,
4942 StyleChangeReasonForTracing::create( 4942 StyleChangeReasonForTracing::create(
4943 StyleChangeReason::VisuallyOrdered)); 4943 StyleChangeReason::VisuallyOrdered));
4944 } 4944 }
4945 } 4945 }
4946 4946
4947 KURL Document::completeURL(const String& url) const { 4947 KURL Document::completeURL(const String& url) const {
4948 String trimmed = url.stripWhiteSpace();
4949 KURL completed = completeURLWithOverride(url, m_baseURL); 4948 KURL completed = completeURLWithOverride(url, m_baseURL);
4950 4949
4951 bool newline = trimmed.contains('\n') || trimmed.contains('\r'); 4950 if (completed.whitespaceRemoved()) {
4952 bool lessThan = trimmed.contains('<'); 4951 if (completed.protocolIsInHTTPFamily()) {
4953 if ((newline || lessThan) && completed.protocolIsInHTTPFamily()) {
4954 if (newline) {
4955 UseCounter::count(*this, 4952 UseCounter::count(*this,
4956 UseCounter::DocumentCompleteURLHTTPContainingNewline); 4953 UseCounter::DocumentCompleteURLHTTPContainingNewline);
4954 bool lessThan = url.contains('<');
4955 if (lessThan) {
4956 UseCounter::count(
4957 *this,
4958 UseCounter::DocumentCompleteURLHTTPContainingNewlineAndLessThan);
4959
4960 if (RuntimeEnabledFeatures::restrictCompleteURLCharacterSetEnabled())
4961 return KURL();
4962 }
4963 } else {
4964 UseCounter::count(
4965 *this, UseCounter::DocumentCompleteURLNonHTTPContainingNewline);
4957 } 4966 }
4958 if (lessThan) {
4959 UseCounter::count(*this,
4960 UseCounter::DocumentCompleteURLHTTPContainingLessThan);
4961 }
4962 if (newline && lessThan) {
4963 UseCounter::count(
4964 *this,
4965 UseCounter::DocumentCompleteURLHTTPContainingNewlineAndLessThan);
4966
4967 if (RuntimeEnabledFeatures::restrictCompleteURLCharacterSetEnabled())
4968 return KURL();
4969 }
4970 } else if (newline || lessThan) {
4971 UseCounter::count(
4972 *this,
4973 UseCounter::DocumentCompleteURLNonHTTPContainingNewlineOrLessThan);
4974 } 4967 }
4975 return completeURLWithOverride(url, m_baseURL); 4968 return completed;
4976 } 4969 }
4977 4970
4978 KURL Document::completeURLWithOverride(const String& url, 4971 KURL Document::completeURLWithOverride(const String& url,
4979 const KURL& baseURLOverride) const { 4972 const KURL& baseURLOverride) const {
4980 DCHECK(baseURLOverride.isEmpty() || baseURLOverride.isValid()); 4973 DCHECK(baseURLOverride.isEmpty() || baseURLOverride.isValid());
4981 4974
4982 // Always return a null URL when passed a null string. 4975 // Always return a null URL when passed a null string.
4983 // FIXME: Should we change the KURL constructor to have this behavior? 4976 // FIXME: Should we change the KURL constructor to have this behavior?
4984 // See also [CSS]StyleSheet::completeURL(const String&) 4977 // See also [CSS]StyleSheet::completeURL(const String&)
4985 if (url.isNull()) 4978 if (url.isNull())
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
6538 } 6531 }
6539 6532
6540 void showLiveDocumentInstances() { 6533 void showLiveDocumentInstances() {
6541 WeakDocumentSet& set = liveDocumentSet(); 6534 WeakDocumentSet& set = liveDocumentSet();
6542 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6535 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6543 for (Document* document : set) 6536 for (Document* document : set)
6544 fprintf(stderr, "- Document %p URL: %s\n", document, 6537 fprintf(stderr, "- Document %p URL: %s\n", document,
6545 document->url().getString().utf8().data()); 6538 document->url().getString().utf8().data());
6546 } 6539 }
6547 #endif 6540 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698