Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. |
| 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2011 Igalia S.L. | 4 * Copyright (C) 2011 Igalia S.L. |
| 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 } | 234 } |
| 235 | 235 |
| 236 if (!n->layoutObject() && !enclosingElementWithTag(firstPositionInOrBefo reNode(n), selectTag)) { | 236 if (!n->layoutObject() && !enclosingElementWithTag(firstPositionInOrBefo reNode(n), selectTag)) { |
| 237 next = Strategy::nextSkippingChildren(*n); | 237 next = Strategy::nextSkippingChildren(*n); |
| 238 // Don't skip over pastEnd. | 238 // Don't skip over pastEnd. |
| 239 if (pastEnd && Strategy::isDescendantOf(*pastEnd, *n)) | 239 if (pastEnd && Strategy::isDescendantOf(*pastEnd, *n)) |
| 240 next = pastEnd; | 240 next = pastEnd; |
| 241 } else { | 241 } else { |
| 242 // Add the node to the markup if we're not skipping the descendants | 242 // Add the node to the markup if we're not skipping the descendants |
| 243 if (markupAccumulator) | 243 if (markupAccumulator) |
| 244 markupAccumulator->appendStartTag(*n); | 244 appendStartMarkup(*markupAccumulator, *n); |
| 245 | 245 |
| 246 // If node has no children, close the tag now. | 246 // If node has no children, close the tag now. |
| 247 if (Strategy::hasChildren(*n)) { | 247 if (Strategy::hasChildren(*n)) { |
| 248 ancestorsToClose.append(toContainerNode(n)); | 248 ancestorsToClose.append(toContainerNode(n)); |
| 249 continue; | 249 continue; |
| 250 } | 250 } |
| 251 if (markupAccumulator && n->isElementNode()) | 251 if (markupAccumulator && n->isElementNode()) |
| 252 markupAccumulator->appendEndTag(toElement(*n)); | 252 markupAccumulator->appendEndTag(toElement(*n)); |
| 253 lastClosed = n; | 253 lastClosed = n; |
| 254 } | 254 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 RefPtrWillBeRawPtr<EditingStyle> StyledMarkupSerializer<Strategy>::createInlineS tyleIfNeeded(StyledMarkupAccumulator& accumulator, Node& node) | 330 RefPtrWillBeRawPtr<EditingStyle> StyledMarkupSerializer<Strategy>::createInlineS tyleIfNeeded(StyledMarkupAccumulator& accumulator, Node& node) |
| 331 { | 331 { |
| 332 if (!node.isElementNode()) | 332 if (!node.isElementNode()) |
| 333 return nullptr; | 333 return nullptr; |
| 334 RefPtrWillBeRawPtr<EditingStyle> inlineStyle = accumulator.createInlineStyle (toElement(node)); | 334 RefPtrWillBeRawPtr<EditingStyle> inlineStyle = accumulator.createInlineStyle (toElement(node)); |
| 335 if (convertBlocksToInlines() && isBlock(&node)) | 335 if (convertBlocksToInlines() && isBlock(&node)) |
| 336 inlineStyle->forceInline(); | 336 inlineStyle->forceInline(); |
| 337 return inlineStyle; | 337 return inlineStyle; |
| 338 } | 338 } |
| 339 | 339 |
| 340 template<typename Strategy> | |
| 341 void StyledMarkupSerializer<Strategy>::appendStartMarkup(StyledMarkupAccumulator & accumulator, Node& node) | |
| 342 { | |
| 343 switch (node.nodeType()) { | |
| 344 case Node::TEXT_NODE: { | |
| 345 Text& text = toText(node); | |
| 346 ContainerNode* parent = Strategy::parent(text); | |
|
yosin_UTC9
2015/06/12 12:09:55
For checking text in TEXTAREA, we should take pare
hajimehoshi
2015/06/16 08:15:18
Done.
| |
| 347 if (parent && parent->isElementNode() && toElement(parent)->tagQName() = = textareaTag) { | |
| 348 accumulator.appendText(text); | |
| 349 return; | |
| 350 } | |
| 351 accumulator.appendTextWithWrappingStyle(text); | |
|
yosin_UTC9
2015/06/12 12:09:55
I think we may want to calculate inline style here
hajimehoshi
2015/06/16 08:15:18
Done.
| |
| 352 break; | |
| 353 } | |
| 354 default: | |
| 355 accumulator.appendStartMarkup(node); | |
| 356 break; | |
| 357 } | |
| 358 } | |
| 359 | |
| 340 template class StyledMarkupSerializer<EditingStrategy>; | 360 template class StyledMarkupSerializer<EditingStrategy>; |
| 341 | 361 |
| 342 } // namespace blink | 362 } // namespace blink |
| OLD | NEW |