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

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

Issue 394903004: document.lastModified should consider user's local time zone (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix windows build error Created 6 years, 5 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
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 #include "platform/network/ContentSecurityPolicyParsers.h" 190 #include "platform/network/ContentSecurityPolicyParsers.h"
191 #include "platform/network/HTTPParsers.h" 191 #include "platform/network/HTTPParsers.h"
192 #include "platform/scroll/ScrollbarTheme.h" 192 #include "platform/scroll/ScrollbarTheme.h"
193 #include "platform/text/PlatformLocale.h" 193 #include "platform/text/PlatformLocale.h"
194 #include "platform/text/SegmentedString.h" 194 #include "platform/text/SegmentedString.h"
195 #include "platform/weborigin/OriginAccessEntry.h" 195 #include "platform/weborigin/OriginAccessEntry.h"
196 #include "platform/weborigin/SchemeRegistry.h" 196 #include "platform/weborigin/SchemeRegistry.h"
197 #include "platform/weborigin/SecurityOrigin.h" 197 #include "platform/weborigin/SecurityOrigin.h"
198 #include "public/platform/Platform.h" 198 #include "public/platform/Platform.h"
199 #include "wtf/CurrentTime.h" 199 #include "wtf/CurrentTime.h"
200 #include "wtf/DateMath.h"
200 #include "wtf/HashFunctions.h" 201 #include "wtf/HashFunctions.h"
201 #include "wtf/MainThread.h" 202 #include "wtf/MainThread.h"
202 #include "wtf/StdLibExtras.h" 203 #include "wtf/StdLibExtras.h"
203 #include "wtf/TemporaryChange.h" 204 #include "wtf/TemporaryChange.h"
204 #include "wtf/text/StringBuffer.h" 205 #include "wtf/text/StringBuffer.h"
205 #include "wtf/text/TextEncodingRegistry.h" 206 #include "wtf/text/TextEncodingRegistry.h"
206 207
207 using namespace WTF; 208 using namespace WTF;
208 using namespace Unicode; 209 using namespace Unicode;
209 210
(...skipping 3868 matching lines...) Expand 10 before | Expand all | Expand 10 after
4078 4079
4079 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified 4080 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified
4080 String Document::lastModified() const 4081 String Document::lastModified() const
4081 { 4082 {
4082 DateComponents date; 4083 DateComponents date;
4083 bool foundDate = false; 4084 bool foundDate = false;
4084 if (m_frame) { 4085 if (m_frame) {
4085 if (DocumentLoader* documentLoader = loader()) { 4086 if (DocumentLoader* documentLoader = loader()) {
4086 const AtomicString& httpLastModified = documentLoader->response().ht tpHeaderField("Last-Modified"); 4087 const AtomicString& httpLastModified = documentLoader->response().ht tpHeaderField("Last-Modified");
4087 if (!httpLastModified.isEmpty()) { 4088 if (!httpLastModified.isEmpty()) {
4088 date.setMillisecondsSinceEpochForDateTime(parseDate(httpLastModi fied)); 4089 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(par seDate(httpLastModified)));
4089 foundDate = true; 4090 foundDate = true;
4090 } 4091 }
4091 } 4092 }
4092 } 4093 }
4093 // FIXME: If this document came from the file system, the HTML5 4094 // FIXME: If this document came from the file system, the HTML5
4094 // specificiation tells us to read the last modification date from the file 4095 // specificiation tells us to read the last modification date from the file
4095 // system. 4096 // system.
4096 if (!foundDate) 4097 if (!foundDate)
4097 date.setMillisecondsSinceEpochForDateTime(currentTimeMS()); 4098 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(currentTime MS()));
4098 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second()); 4099 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second());
4099 } 4100 }
4100 4101
4101 const KURL& Document::firstPartyForCookies() const 4102 const KURL& Document::firstPartyForCookies() const
4102 { 4103 {
4103 return topDocument().url(); 4104 return topDocument().url();
4104 } 4105 }
4105 4106
4106 static bool isValidNameNonASCII(const LChar* characters, unsigned length) 4107 static bool isValidNameNonASCII(const LChar* characters, unsigned length)
4107 { 4108 {
(...skipping 1786 matching lines...) Expand 10 before | Expand all | Expand 10 after
5894 using namespace blink; 5895 using namespace blink;
5895 void showLiveDocumentInstances() 5896 void showLiveDocumentInstances()
5896 { 5897 {
5897 WeakDocumentSet& set = liveDocumentSet(); 5898 WeakDocumentSet& set = liveDocumentSet();
5898 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5899 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5899 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 5900 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
5900 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());
5901 } 5902 }
5902 } 5903 }
5903 #endif 5904 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698