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

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

Issue 2292913002: Ensure clean layout before calling plainText() (flat tree version) (Closed)
Patch Set: 201609021415 Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.cpp ('k') | no next file » | 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 2458 matching lines...) Expand 10 before | Expand all | Expand 10 after
2469 String Internals::selectedHTMLForClipboard() 2469 String Internals::selectedHTMLForClipboard()
2470 { 2470 {
2471 if (!frame()) 2471 if (!frame())
2472 return String(); 2472 return String();
2473 2473
2474 return frame()->selection().selectedHTMLForClipboard(); 2474 return frame()->selection().selectedHTMLForClipboard();
2475 } 2475 }
2476 2476
2477 String Internals::selectedTextForClipboard() 2477 String Internals::selectedTextForClipboard()
2478 { 2478 {
2479 if (!frame()) 2479 if (!frame() || !frame()->document())
2480 return String(); 2480 return String();
2481 2481
2482 // Clean layout is required for extracting plain text from selection.
2483 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
2484
2482 return frame()->selection().selectedTextForClipboard(); 2485 return frame()->selection().selectedTextForClipboard();
2483 } 2486 }
2484 2487
2485 void Internals::setVisualViewportOffset(int x, int y) 2488 void Internals::setVisualViewportOffset(int x, int y)
2486 { 2489 {
2487 if (!frame()) 2490 if (!frame())
2488 return; 2491 return;
2489 2492
2490 frame()->host()->visualViewport().setLocation(FloatPoint(x, y)); 2493 frame()->host()->visualViewport().setLocation(FloatPoint(x, y));
2491 } 2494 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2618 2621
2619 ClientRect* Internals::visualRect(Node* node) 2622 ClientRect* Internals::visualRect(Node* node)
2620 { 2623 {
2621 if (!node || !node->layoutObject()) 2624 if (!node || !node->layoutObject())
2622 return ClientRect::create(); 2625 return ClientRect::create();
2623 2626
2624 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); 2627 return ClientRect::create(FloatRect(node->layoutObject()->visualRect()));
2625 } 2628 }
2626 2629
2627 } // namespace blink 2630 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698