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

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

Issue 2109073002: Make Text::updateLayoutTextObject() to handle first-letter pseudo element correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-29T15:54:22 Created 4 years, 5 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 | third_party/WebKit/Source/core/dom/TextTest.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) 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 reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // Passing both |textNode| and its layout object because repeated calls to 408 // Passing both |textNode| and its layout object because repeated calls to
409 // |Node::layoutObject()| are discouraged. 409 // |Node::layoutObject()| are discouraged.
410 static bool shouldUpdateLayoutByReattaching(const Text& textNode, LayoutText* te xtLayoutObject) 410 static bool shouldUpdateLayoutByReattaching(const Text& textNode, LayoutText* te xtLayoutObject)
411 { 411 {
412 DCHECK_EQ(textNode.layoutObject(), textLayoutObject); 412 DCHECK_EQ(textNode.layoutObject(), textLayoutObject);
413 if (!textLayoutObject) 413 if (!textLayoutObject)
414 return true; 414 return true;
415 if (!textNode.textLayoutObjectIsNeeded(*textLayoutObject->style(), *textLayo utObject->parent())) 415 if (!textNode.textLayoutObjectIsNeeded(*textLayoutObject->style(), *textLayo utObject->parent()))
416 return true; 416 return true;
417 if (textLayoutObject->isTextFragment()) { 417 if (textLayoutObject->isTextFragment()) {
418 FirstLetterPseudoElement* pseudo = toLayoutTextFragment(textLayoutObject )->firstLetterPseudoElement(); 418 if (!toLayoutTextFragment(textLayoutObject)->firstLetterPseudoElement()) {
tkent 2016/06/29 08:27:38 The new code is equivalent to return toLayoutT
yosin_UTC9 2016/06/29 08:41:10 Yes, it seems my brain is damaged... :-<
419 if (pseudo && !FirstLetterPseudoElement::firstLetterTextLayoutObject(*ps eudo)) 419 // When |textLayoutObject| isn't associated to first-letter, we
420 return true; 420 // change |textLayoutObject| directly.
421 return false;
422 }
423 // Changes of |textNode| may change first letter part, so we should
424 // reattach.
425 return toLayoutTextFragment(textLayoutObject)->firstLetterPseudoElement( );
421 } 426 }
422 return false; 427 return false;
423 } 428 }
424 429
425 void Text::updateTextLayoutObject(unsigned offsetOfReplacedData, unsigned length OfReplacedData, RecalcStyleBehavior recalcStyleBehavior) 430 void Text::updateTextLayoutObject(unsigned offsetOfReplacedData, unsigned length OfReplacedData, RecalcStyleBehavior recalcStyleBehavior)
426 { 431 {
427 if (!inActiveDocument()) 432 if (!inActiveDocument())
428 return; 433 return;
429 LayoutText* textLayoutObject = layoutObject(); 434 LayoutText* textLayoutObject = layoutObject();
430 if (shouldUpdateLayoutByReattaching(*this, textLayoutObject)) { 435 if (shouldUpdateLayoutByReattaching(*this, textLayoutObject)) {
(...skipping 30 matching lines...) Expand all
461 result.append("; "); 466 result.append("; ");
462 result.append("value="); 467 result.append("value=");
463 result.append(s); 468 result.append(s);
464 } 469 }
465 470
466 strncpy(buffer, result.toString().utf8().data(), length - 1); 471 strncpy(buffer, result.toString().utf8().data(), length - 1);
467 } 472 }
468 #endif 473 #endif
469 474
470 } // namespace blink 475 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/TextTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698