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

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

Issue 31063004: Have Frame::loader() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « Source/core/svg/graphics/SVGImage.cpp ('k') | Source/core/testing/MockPagePopupDriver.cpp » ('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) 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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 684
685 void Internals::selectColorInColorChooser(Element* element, const String& colorV alue) 685 void Internals::selectColorInColorChooser(Element* element, const String& colorV alue)
686 { 686 {
687 if (!element->hasTagName(inputTag)) 687 if (!element->hasTagName(inputTag))
688 return; 688 return;
689 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue)); 689 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue));
690 } 690 }
691 691
692 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es) 692 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es)
693 { 693 {
694 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); 694 HistoryItem* mainItem = frame()->loader().history()->previousItem();
695 if (!mainItem) { 695 if (!mainItem) {
696 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 696 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
697 return Vector<String>(); 697 return Vector<String>();
698 } 698 }
699 String uniqueName = frame()->tree().uniqueName(); 699 String uniqueName = frame()->tree().uniqueName();
700 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu eName)) { 700 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu eName)) {
701 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 701 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
702 return Vector<String>(); 702 return Vector<String>();
703 } 703 }
704 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt em->childItemWithTarget(uniqueName)->documentState(); 704 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt em->childItemWithTarget(uniqueName)->documentState();
705 } 705 }
706 706
707 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es) 707 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es)
708 { 708 {
709 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); 709 HistoryItem* mainItem = frame()->loader().history()->previousItem();
710 if (!mainItem) { 710 if (!mainItem) {
711 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 711 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
712 return; 712 return;
713 } 713 }
714 String uniqueName = frame()->tree().uniqueName(); 714 String uniqueName = frame()->tree().uniqueName();
715 if (mainItem->target() == uniqueName) 715 if (mainItem->target() == uniqueName)
716 mainItem->setDocumentState(state); 716 mainItem->setDocumentState(state);
717 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName)) 717 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName))
718 subItem->setDocumentState(state); 718 subItem->setDocumentState(state);
719 else 719 else
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 return MallocStatistics::create(); 2051 return MallocStatistics::create();
2052 } 2052 }
2053 2053
2054 PassRefPtr<TypeConversions> Internals::typeConversions() const 2054 PassRefPtr<TypeConversions> Internals::typeConversions() const
2055 { 2055 {
2056 return TypeConversions::create(); 2056 return TypeConversions::create();
2057 } 2057 }
2058 2058
2059 Vector<String> Internals::getReferencedFilePaths() const 2059 Vector<String> Internals::getReferencedFilePaths() const
2060 { 2060 {
2061 frame()->loader()->history()->saveDocumentAndScrollState(); 2061 frame()->loader().history()->saveDocumentAndScrollState();
2062 return FormController::getReferencedFilePaths(frame()->loader()->history()-> currentItem()->documentState()); 2062 return FormController::getReferencedFilePaths(frame()->loader().history()->c urrentItem()->documentState());
2063 } 2063 }
2064 2064
2065 void Internals::startTrackingRepaints(Document* document, ExceptionState& es) 2065 void Internals::startTrackingRepaints(Document* document, ExceptionState& es)
2066 { 2066 {
2067 if (!document || !document->view()) { 2067 if (!document || !document->view()) {
2068 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2068 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2069 return; 2069 return;
2070 } 2070 }
2071 2071
2072 FrameView* frameView = document->view(); 2072 FrameView* frameView = document->view();
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 } 2207 }
2208 2208
2209 PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer(PassRefPtr<ArrayB uffer> buffer) const 2209 PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer(PassRefPtr<ArrayB uffer> buffer) const
2210 { 2210 {
2211 String value(static_cast<const UChar*>(buffer->data()), buffer->byteLength() / sizeof(UChar)); 2211 String value(static_cast<const UChar*>(buffer->data()), buffer->byteLength() / sizeof(UChar));
2212 return SerializedScriptValue::createFromWire(value); 2212 return SerializedScriptValue::createFromWire(value);
2213 } 2213 }
2214 2214
2215 void Internals::forceReload(bool endToEnd) 2215 void Internals::forceReload(bool endToEnd)
2216 { 2216 {
2217 frame()->loader()->reload(endToEnd ? EndToEndReload : NormalReload); 2217 frame()->loader().reload(endToEnd ? EndToEndReload : NormalReload);
2218 } 2218 }
2219 2219
2220 PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionState& es) 2220 PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionState& es)
2221 { 2221 {
2222 Document* document = contextDocument(); 2222 Document* document = contextDocument();
2223 if (!document || !document->frame()) { 2223 if (!document || !document->frame()) {
2224 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2224 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2225 return 0; 2225 return 0;
2226 } 2226 }
2227 2227
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 return false; 2278 return false;
2279 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB); 2279 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB);
2280 // To prevent tests that call loseSharedGraphicsContext3D from being 2280 // To prevent tests that call loseSharedGraphicsContext3D from being
2281 // flaky, we call finish so that the context is guaranteed to be lost 2281 // flaky, we call finish so that the context is guaranteed to be lost
2282 // synchronously (i.e. before returning). 2282 // synchronously (i.e. before returning).
2283 sharedContext->finish(); 2283 sharedContext->finish();
2284 return true; 2284 return true;
2285 } 2285 }
2286 2286
2287 } 2287 }
OLDNEW
« no previous file with comments | « Source/core/svg/graphics/SVGImage.cpp ('k') | Source/core/testing/MockPagePopupDriver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698