| 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 | 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 using namespace HTMLNames; | 275 using namespace HTMLNames; |
| 276 | 276 |
| 277 static const unsigned cMaxWriteRecursionDepth = 21; | 277 static const unsigned cMaxWriteRecursionDepth = 21; |
| 278 | 278 |
| 279 // This amount of time must have elapsed before we will even consider scheduling | 279 // This amount of time must have elapsed before we will even consider scheduling |
| 280 // a layout without a delay. | 280 // a layout without a delay. |
| 281 // FIXME: For faster machines this value can really be lowered to 200. 250 is | 281 // FIXME: For faster machines this value can really be lowered to 200. 250 is |
| 282 // adequate, but a little high for dual G5s. :) | 282 // adequate, but a little high for dual G5s. :) |
| 283 static const int cLayoutScheduleThreshold = 250; | 283 static const int cLayoutScheduleThreshold = 250; |
| 284 | 284 |
| 285 // After a document has been committed for this time, it can create a history |
| 286 // entry even if the user hasn't interacted with the document. |
| 287 static const int cElapsedTimeForHistoryEntryWithoutUserGestureMS = 5000; |
| 288 |
| 285 // DOM Level 2 says (letters added): | 289 // DOM Level 2 says (letters added): |
| 286 // | 290 // |
| 287 // a) Name start characters must have one of the categories Ll, Lu, Lo, Lt, Nl. | 291 // a) Name start characters must have one of the categories Ll, Lu, Lo, Lt, Nl. |
| 288 // b) Name characters other than Name-start characters must have one of the | 292 // b) Name characters other than Name-start characters must have one of the |
| 289 // categories Mc, Me, Mn, Lm, or Nd. | 293 // categories Mc, Me, Mn, Lm, or Nd. |
| 290 // c) Characters in the compatibility area (i.e. with character code greater | 294 // c) Characters in the compatibility area (i.e. with character code greater |
| 291 // than #xF900 and less than #xFFFE) are not allowed in XML names. | 295 // than #xF900 and less than #xFFFE) are not allowed in XML names. |
| 292 // d) Characters which have a font or compatibility decomposition (i.e. those | 296 // d) Characters which have a font or compatibility decomposition (i.e. those |
| 293 // with a "compatibility formatting tag" in field 5 of the database -- marked | 297 // with a "compatibility formatting tag" in field 5 of the database -- marked |
| 294 // by field 5 beginning with a "<") are not allowed. | 298 // by field 5 beginning with a "<") are not allowed. |
| (...skipping 2887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3182 if (documentElement() && !isHTMLHtmlElement(*documentElement())) | 3186 if (documentElement() && !isHTMLHtmlElement(*documentElement())) |
| 3183 return true; | 3187 return true; |
| 3184 | 3188 |
| 3185 return false; | 3189 return false; |
| 3186 } | 3190 } |
| 3187 | 3191 |
| 3188 int Document::elapsedTime() const { | 3192 int Document::elapsedTime() const { |
| 3189 return static_cast<int>((currentTime() - m_startTime) * 1000); | 3193 return static_cast<int>((currentTime() - m_startTime) * 1000); |
| 3190 } | 3194 } |
| 3191 | 3195 |
| 3196 bool Document::canCreateHistoryEntry() const { |
| 3197 // TODO(japhet): This flag controls an intervention to require a user gesture |
| 3198 // or a long time on page in order for a content-initiated navigation to add |
| 3199 // an entry to the back/forward list. Removing the flag and making this the |
| 3200 // default will require updating a couple hundred tests that currently depend |
| 3201 // on creating history entries without user gestures. I'm waiting to update |
| 3202 // the tests until the feature is proven to minimize churn. |
| 3203 // https://bugs.chromium.org/p/chromium/issues/detail?id=638198 |
| 3204 if (!m_frame->settings()->getHistoryEntryRequiresUserGesture()) |
| 3205 return true; |
| 3206 if (m_frame->hasReceivedUserGesture()) |
| 3207 return true; |
| 3208 return elapsedTime() >= cElapsedTimeForHistoryEntryWithoutUserGestureMS; |
| 3209 } |
| 3210 |
| 3192 void Document::write(const SegmentedString& text, | 3211 void Document::write(const SegmentedString& text, |
| 3193 Document* enteredDocument, | 3212 Document* enteredDocument, |
| 3194 ExceptionState& exceptionState) { | 3213 ExceptionState& exceptionState) { |
| 3195 if (importLoader()) { | 3214 if (importLoader()) { |
| 3196 exceptionState.throwDOMException( | 3215 exceptionState.throwDOMException( |
| 3197 InvalidStateError, "Imported document doesn't support write()."); | 3216 InvalidStateError, "Imported document doesn't support write()."); |
| 3198 return; | 3217 return; |
| 3199 } | 3218 } |
| 3200 | 3219 |
| 3201 if (!isHTMLDocument()) { | 3220 if (!isHTMLDocument()) { |
| (...skipping 3439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6641 } | 6660 } |
| 6642 | 6661 |
| 6643 void showLiveDocumentInstances() { | 6662 void showLiveDocumentInstances() { |
| 6644 WeakDocumentSet& set = liveDocumentSet(); | 6663 WeakDocumentSet& set = liveDocumentSet(); |
| 6645 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6664 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6646 for (blink::Document* document : set) | 6665 for (blink::Document* document : set) |
| 6647 fprintf(stderr, "- Document %p URL: %s\n", document, | 6666 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6648 document->url().getString().utf8().data()); | 6667 document->url().getString().utf8().data()); |
| 6649 } | 6668 } |
| 6650 #endif | 6669 #endif |
| OLD | NEW |