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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 239993011: Lazily generate HistoryItem's serialized form state (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 return mainItem->documentState(); 735 return mainItem->documentState();
736 } 736 }
737 737
738 void Internals::setFormControlStateOfHistoryItem(const Vector<String>& state, Ex ceptionState& exceptionState) 738 void Internals::setFormControlStateOfHistoryItem(const Vector<String>& state, Ex ceptionState& exceptionState)
739 { 739 {
740 HistoryItem* mainItem = frame()->loader().currentItem(); 740 HistoryItem* mainItem = frame()->loader().currentItem();
741 if (!mainItem) { 741 if (!mainItem) {
742 exceptionState.throwDOMException(InvalidAccessError, "No history item is available."); 742 exceptionState.throwDOMException(InvalidAccessError, "No history item is available.");
743 return; 743 return;
744 } 744 }
745 mainItem->clearDocumentState();
745 mainItem->setDocumentState(state); 746 mainItem->setDocumentState(state);
746 } 747 }
747 748
748 void Internals::setEnableMockPagePopup(bool enabled, ExceptionState& exceptionSt ate) 749 void Internals::setEnableMockPagePopup(bool enabled, ExceptionState& exceptionSt ate)
749 { 750 {
750 Document* document = contextDocument(); 751 Document* document = contextDocument();
751 if (!document || !document->page()) 752 if (!document || !document->page())
752 return; 753 return;
753 Page* page = document->page(); 754 Page* page = document->page();
754 if (!enabled) { 755 if (!enabled) {
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 return MallocStatistics::create(); 2093 return MallocStatistics::create();
2093 } 2094 }
2094 2095
2095 PassRefPtrWillBeRawPtr<TypeConversions> Internals::typeConversions() const 2096 PassRefPtrWillBeRawPtr<TypeConversions> Internals::typeConversions() const
2096 { 2097 {
2097 return TypeConversions::create(); 2098 return TypeConversions::create();
2098 } 2099 }
2099 2100
2100 Vector<String> Internals::getReferencedFilePaths() const 2101 Vector<String> Internals::getReferencedFilePaths() const
2101 { 2102 {
2102 frame()->loader().saveDocumentState(); 2103 return frame()->loader().currentItem()->getReferencedFilePaths();
2103 return FormController::getReferencedFilePaths(frame()->loader().currentItem( )->documentState());
2104 } 2104 }
2105 2105
2106 void Internals::startTrackingRepaints(Document* document, ExceptionState& except ionState) 2106 void Internals::startTrackingRepaints(Document* document, ExceptionState& except ionState)
2107 { 2107 {
2108 if (!document || !document->view()) { 2108 if (!document || !document->view()) {
2109 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's view cannot be retrieved." : "The document provided is invalid."); 2109 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's view cannot be retrieved." : "The document provided is invalid.");
2110 return; 2110 return;
2111 } 2111 }
2112 2112
2113 FrameView* frameView = document->view(); 2113 FrameView* frameView = document->view();
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength) 2488 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength)
2489 { 2489 {
2490 if (!node) 2490 if (!node)
2491 return String(); 2491 return String();
2492 blink::WebPoint point(x, y); 2492 blink::WebPoint point(x, y);
2493 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength); 2493 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength);
2494 return surroundingText.content(); 2494 return surroundingText.content();
2495 } 2495 }
2496 2496
2497 } 2497 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698