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

Side by Side Diff: Source/web/WebLocalFrameImpl.cpp

Issue 317493002: Change FrameTree to return Frames instead of LocalFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed conflicts Created 6 years, 6 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 return; // Filled up the buffer. 229 return; // Filled up the buffer.
230 } 230 }
231 } 231 }
232 232
233 // The separator between frames when the frames are converted to plain text. 233 // The separator between frames when the frames are converted to plain text.
234 const LChar frameSeparator[] = { '\n', '\n' }; 234 const LChar frameSeparator[] = { '\n', '\n' };
235 const size_t frameSeparatorLength = WTF_ARRAY_LENGTH(frameSeparator); 235 const size_t frameSeparatorLength = WTF_ARRAY_LENGTH(frameSeparator);
236 236
237 // Recursively walk the children. 237 // Recursively walk the children.
238 const FrameTree& frameTree = frame->tree(); 238 const FrameTree& frameTree = frame->tree();
239 for (LocalFrame* curChild = frameTree.firstChild(); curChild; curChild = cur Child->tree().nextSibling()) { 239 for (Frame* curChild = frameTree.firstChild(); curChild; curChild = curChild ->tree().nextSibling()) {
240 if (!curChild->isLocalFrame())
241 continue;
242 LocalFrame* curLocalChild = toLocalFrame(curChild);
240 // Ignore the text of non-visible frames. 243 // Ignore the text of non-visible frames.
241 RenderView* contentRenderer = curChild->contentRenderer(); 244 RenderView* contentRenderer = curLocalChild->contentRenderer();
242 RenderPart* ownerRenderer = curChild->ownerRenderer(); 245 RenderPart* ownerRenderer = curLocalChild->ownerRenderer();
243 if (!contentRenderer || !contentRenderer->width() || !contentRenderer->h eight() 246 if (!contentRenderer || !contentRenderer->width() || !contentRenderer->h eight()
244 || (contentRenderer->x() + contentRenderer->width() <= 0) || (conten tRenderer->y() + contentRenderer->height() <= 0) 247 || (contentRenderer->x() + contentRenderer->width() <= 0) || (conten tRenderer->y() + contentRenderer->height() <= 0)
245 || (ownerRenderer && ownerRenderer->style() && ownerRenderer->style( )->visibility() != VISIBLE)) { 248 || (ownerRenderer && ownerRenderer->style() && ownerRenderer->style( )->visibility() != VISIBLE)) {
246 continue; 249 continue;
247 } 250 }
248 251
249 // Make sure the frame separator won't fill up the buffer, and give up i f 252 // Make sure the frame separator won't fill up the buffer, and give up i f
250 // it will. The danger is if the separator will make the buffer longer t han 253 // it will. The danger is if the separator will make the buffer longer t han
251 // maxChars. This will cause the computation above: 254 // maxChars. This will cause the computation above:
252 // maxChars - output->size() 255 // maxChars - output->size()
253 // to be a negative number which will crash when the subframe is added. 256 // to be a negative number which will crash when the subframe is added.
254 if (output.length() >= maxChars - frameSeparatorLength) 257 if (output.length() >= maxChars - frameSeparatorLength)
255 return; 258 return;
256 259
257 output.append(frameSeparator, frameSeparatorLength); 260 output.append(frameSeparator, frameSeparatorLength);
258 frameContentAsPlainText(maxChars, curChild, output); 261 frameContentAsPlainText(maxChars, curLocalChild, output);
259 if (output.length() >= maxChars) 262 if (output.length() >= maxChars)
260 return; // Filled up the buffer. 263 return; // Filled up the buffer.
261 } 264 }
262 } 265 }
263 266
264 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame* frame) 267 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame* frame)
265 { 268 {
266 if (!frame) 269 if (!frame)
267 return 0; 270 return 0;
268 if (!frame->document() || !frame->document()->isPluginDocument()) 271 if (!frame->document() || !frame->document()->isPluginDocument())
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 } 650 }
648 651
649 void WebLocalFrameImpl::removeChild(WebFrame* child) 652 void WebLocalFrameImpl::removeChild(WebFrame* child)
650 { 653 {
651 WebFrame::removeChild(child); 654 WebFrame::removeChild(child);
652 frame()->tree().invalidateScopedChildCount(); 655 frame()->tree().invalidateScopedChildCount();
653 } 656 }
654 657
655 WebFrame* WebLocalFrameImpl::traversePrevious(bool wrap) const 658 WebFrame* WebLocalFrameImpl::traversePrevious(bool wrap) const
656 { 659 {
657 if (!frame()) 660 if (!frame() || !frame()->tree().traversePreviousWithWrap(wrap)->isLocalFram e())
dcheng 2014/06/04 18:06:37 Put a FIXME here--this should move to WebFrame any
kenrb 2014/06/04 20:34:47 Ok, I figured this was going to change pretty soon
658 return 0; 661 return 0;
659 return fromFrame(frame()->tree().traversePreviousWithWrap(wrap)); 662 return fromFrame(toLocalFrame(frame()->tree().traversePreviousWithWrap(wrap) ));
660 } 663 }
661 664
662 WebFrame* WebLocalFrameImpl::traverseNext(bool wrap) const 665 WebFrame* WebLocalFrameImpl::traverseNext(bool wrap) const
663 { 666 {
664 if (!frame()) 667 if (!frame() || !frame()->tree().traverseNextWithWrap(wrap)->isLocalFrame())
665 return 0; 668 return 0;
666 return fromFrame(frame()->tree().traverseNextWithWrap(wrap)); 669 return fromFrame(toLocalFrame(frame()->tree().traverseNextWithWrap(wrap)));
667 } 670 }
668 671
669 WebFrame* WebLocalFrameImpl::findChildByName(const WebString& name) const 672 WebFrame* WebLocalFrameImpl::findChildByName(const WebString& name) const
670 { 673 {
671 if (!frame()) 674 if (!frame() || !frame()->tree().child(name)->isLocalFrame())
672 return 0; 675 return 0;
673 return fromFrame(frame()->tree().child(name)); 676 return fromFrame(toLocalFrame(frame()->tree().child(name)));
674 } 677 }
675 678
676 WebDocument WebLocalFrameImpl::document() const 679 WebDocument WebLocalFrameImpl::document() const
677 { 680 {
678 if (!frame() || !frame()->document()) 681 if (!frame() || !frame()->document())
679 return WebDocument(); 682 return WebDocument();
680 return WebDocument(frame()->document()); 683 return WebDocument(frame()->document());
681 } 684 }
682 685
683 WebPerformance WebLocalFrameImpl::performance() const 686 WebPerformance WebLocalFrameImpl::performance() const
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 1922
1920 void WebLocalFrameImpl::invalidateAll() const 1923 void WebLocalFrameImpl::invalidateAll() const
1921 { 1924 {
1922 ASSERT(frame() && frame()->view()); 1925 ASSERT(frame() && frame()->view());
1923 FrameView* view = frame()->view(); 1926 FrameView* view = frame()->view();
1924 view->invalidateRect(view->frameRect()); 1927 view->invalidateRect(view->frameRect());
1925 invalidateScrollbar(); 1928 invalidateScrollbar();
1926 } 1929 }
1927 1930
1928 } // namespace blink 1931 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698