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

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: Rebase and take review comments into consideration Created 6 years, 4 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 #include "platform/network/ContentSecurityPolicyParsers.h" 189 #include "platform/network/ContentSecurityPolicyParsers.h"
190 #include "platform/network/HTTPParsers.h" 190 #include "platform/network/HTTPParsers.h"
191 #include "platform/scroll/ScrollbarTheme.h" 191 #include "platform/scroll/ScrollbarTheme.h"
192 #include "platform/text/PlatformLocale.h" 192 #include "platform/text/PlatformLocale.h"
193 #include "platform/text/SegmentedString.h" 193 #include "platform/text/SegmentedString.h"
194 #include "platform/weborigin/OriginAccessEntry.h" 194 #include "platform/weborigin/OriginAccessEntry.h"
195 #include "platform/weborigin/SchemeRegistry.h" 195 #include "platform/weborigin/SchemeRegistry.h"
196 #include "platform/weborigin/SecurityOrigin.h" 196 #include "platform/weborigin/SecurityOrigin.h"
197 #include "public/platform/Platform.h" 197 #include "public/platform/Platform.h"
198 #include "wtf/CurrentTime.h" 198 #include "wtf/CurrentTime.h"
199 #include "wtf/DateMath.h"
199 #include "wtf/HashFunctions.h" 200 #include "wtf/HashFunctions.h"
200 #include "wtf/MainThread.h" 201 #include "wtf/MainThread.h"
201 #include "wtf/StdLibExtras.h" 202 #include "wtf/StdLibExtras.h"
202 #include "wtf/TemporaryChange.h" 203 #include "wtf/TemporaryChange.h"
203 #include "wtf/text/StringBuffer.h" 204 #include "wtf/text/StringBuffer.h"
204 #include "wtf/text/TextEncodingRegistry.h" 205 #include "wtf/text/TextEncodingRegistry.h"
205 206
206 using namespace WTF; 207 using namespace WTF;
207 using namespace Unicode; 208 using namespace Unicode;
208 209
(...skipping 3868 matching lines...) Expand 10 before | Expand all | Expand 10 after
4077 4078
4078 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified 4079 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified
4079 String Document::lastModified() const 4080 String Document::lastModified() const
4080 { 4081 {
4081 DateComponents date; 4082 DateComponents date;
4082 bool foundDate = false; 4083 bool foundDate = false;
4083 if (m_frame) { 4084 if (m_frame) {
4084 if (DocumentLoader* documentLoader = loader()) { 4085 if (DocumentLoader* documentLoader = loader()) {
4085 const AtomicString& httpLastModified = documentLoader->response().ht tpHeaderField("Last-Modified"); 4086 const AtomicString& httpLastModified = documentLoader->response().ht tpHeaderField("Last-Modified");
4086 if (!httpLastModified.isEmpty()) { 4087 if (!httpLastModified.isEmpty()) {
4087 date.setMillisecondsSinceEpochForDateTime(parseDate(httpLastModi fied)); 4088 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(par seDate(httpLastModified)));
4088 foundDate = true; 4089 foundDate = true;
4089 } 4090 }
4090 } 4091 }
4091 } 4092 }
4092 // FIXME: If this document came from the file system, the HTML5 4093 // FIXME: If this document came from the file system, the HTML5
4093 // specificiation tells us to read the last modification date from the file 4094 // specificiation tells us to read the last modification date from the file
4094 // system. 4095 // system.
4095 if (!foundDate) 4096 if (!foundDate)
4096 date.setMillisecondsSinceEpochForDateTime(currentTimeMS()); 4097 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(currentTime MS()));
4097 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second()); 4098 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second());
4098 } 4099 }
4099 4100
4100 const KURL& Document::firstPartyForCookies() const 4101 const KURL& Document::firstPartyForCookies() const
4101 { 4102 {
4102 return topDocument().url(); 4103 return topDocument().url();
4103 } 4104 }
4104 4105
4105 static bool isValidNameNonASCII(const LChar* characters, unsigned length) 4106 static bool isValidNameNonASCII(const LChar* characters, unsigned length)
4106 { 4107 {
(...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after
5874 using namespace blink; 5875 using namespace blink;
5875 void showLiveDocumentInstances() 5876 void showLiveDocumentInstances()
5876 { 5877 {
5877 WeakDocumentSet& set = liveDocumentSet(); 5878 WeakDocumentSet& set = liveDocumentSet();
5878 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5879 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5879 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 5880 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
5880 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 5881 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
5881 } 5882 }
5882 } 5883 }
5883 #endif 5884 #endif
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/resources/no-last-modified.php ('k') | Source/core/html/forms/BaseDateAndTimeInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698