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

Side by Side Diff: third_party/WebKit/Source/core/dom/Text.cpp

Issue 2913133002: Check whether a text node may be about to be redistributed in ShouldUpdateLayoutByReattaching() (Closed)
Patch Set: Add comment Created 3 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
« no previous file with comments | « no previous file | 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) 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 13 matching lines...) Expand all
24 24
25 #include "bindings/core/v8/ExceptionState.h" 25 #include "bindings/core/v8/ExceptionState.h"
26 #include "core/SVGNames.h" 26 #include "core/SVGNames.h"
27 #include "core/css/resolver/StyleResolver.h" 27 #include "core/css/resolver/StyleResolver.h"
28 #include "core/dom/ExceptionCode.h" 28 #include "core/dom/ExceptionCode.h"
29 #include "core/dom/FirstLetterPseudoElement.h" 29 #include "core/dom/FirstLetterPseudoElement.h"
30 #include "core/dom/LayoutTreeBuilder.h" 30 #include "core/dom/LayoutTreeBuilder.h"
31 #include "core/dom/LayoutTreeBuilderTraversal.h" 31 #include "core/dom/LayoutTreeBuilderTraversal.h"
32 #include "core/dom/NodeComputedStyle.h" 32 #include "core/dom/NodeComputedStyle.h"
33 #include "core/dom/NodeTraversal.h" 33 #include "core/dom/NodeTraversal.h"
34 #include "core/dom/shadow/ElementShadow.h"
34 #include "core/dom/shadow/ShadowRoot.h" 35 #include "core/dom/shadow/ShadowRoot.h"
35 #include "core/events/ScopedEventQueue.h" 36 #include "core/events/ScopedEventQueue.h"
36 #include "core/layout/LayoutText.h" 37 #include "core/layout/LayoutText.h"
37 #include "core/layout/LayoutTextCombine.h" 38 #include "core/layout/LayoutTextCombine.h"
38 #include "core/layout/LayoutTextFragment.h" 39 #include "core/layout/LayoutTextFragment.h"
39 #include "core/layout/api/LayoutTextItem.h" 40 #include "core/layout/api/LayoutTextItem.h"
40 #include "core/layout/svg/LayoutSVGInlineText.h" 41 #include "core/layout/svg/LayoutSVGInlineText.h"
41 #include "core/svg/SVGForeignObjectElement.h" 42 #include "core/svg/SVGForeignObjectElement.h"
42 #include "platform/bindings/DOMDataStore.h" 43 #include "platform/bindings/DOMDataStore.h"
43 #include "platform/wtf/text/CString.h" 44 #include "platform/wtf/text/CString.h"
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 if (!text_layout_object) 440 if (!text_layout_object)
440 return true; 441 return true;
441 // In general we do not want to branch on lifecycle states such as 442 // In general we do not want to branch on lifecycle states such as
442 // |childNeedsDistributionRecalc|, but this code tries to figure out if we can 443 // |childNeedsDistributionRecalc|, but this code tries to figure out if we can
443 // use an optimized code path that avoids reattach. 444 // use an optimized code path that avoids reattach.
444 if (!text_node.GetDocument().ChildNeedsDistributionRecalc() && 445 if (!text_node.GetDocument().ChildNeedsDistributionRecalc() &&
445 !text_node.TextLayoutObjectIsNeeded(*text_layout_object->Style(), 446 !text_node.TextLayoutObjectIsNeeded(*text_layout_object->Style(),
446 *text_layout_object->Parent())) { 447 *text_layout_object->Parent())) {
447 return true; 448 return true;
448 } 449 }
450 // Check whether this node may be about to be redistributed.
451 if (text_node.ParentElementShadow() &&
yosin_UTC9 2017/06/02 07:47:43 What is happend when Text is descendant of shadow
452 text_node.ParentElementShadow()->NeedsDistributionRecalc()) {
453 return true;
454 }
449 if (text_layout_object->IsTextFragment()) { 455 if (text_layout_object->IsTextFragment()) {
450 // Changes of |textNode| may change first letter part, so we should 456 // Changes of |textNode| may change first letter part, so we should
451 // reattach. 457 // reattach.
452 return ToLayoutTextFragment(text_layout_object) 458 return ToLayoutTextFragment(text_layout_object)
453 ->GetFirstLetterPseudoElement(); 459 ->GetFirstLetterPseudoElement();
454 } 460 }
455 return false; 461 return false;
456 } 462 }
457 463
458 void Text::UpdateTextLayoutObject(unsigned offset_of_replaced_data, 464 void Text::UpdateTextLayoutObject(unsigned offset_of_replaced_data,
(...skipping 12 matching lines...) Expand all
471 477
472 Text* Text::CloneWithData(const String& data) { 478 Text* Text::CloneWithData(const String& data) {
473 return Create(GetDocument(), data); 479 return Create(GetDocument(), data);
474 } 480 }
475 481
476 DEFINE_TRACE(Text) { 482 DEFINE_TRACE(Text) {
477 CharacterData::Trace(visitor); 483 CharacterData::Trace(visitor);
478 } 484 }
479 485
480 } // namespace blink 486 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698