| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. |
| 5 * Copyright (C) 2011 Igalia S.L. | 5 * Copyright (C) 2011 Igalia S.L. |
| 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
| 7 * | 7 * |
| 8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
| 10 * are met: | 10 * are met: |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 return accumulator_->ShouldAnnotate(); | 114 return accumulator_->ShouldAnnotate(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 template <typename Strategy> | 117 template <typename Strategy> |
| 118 bool StyledMarkupTraverser<Strategy>::ShouldConvertBlocksToInlines() const { | 118 bool StyledMarkupTraverser<Strategy>::ShouldConvertBlocksToInlines() const { |
| 119 return accumulator_->ShouldConvertBlocksToInlines(); | 119 return accumulator_->ShouldConvertBlocksToInlines(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 template <typename Strategy> | 122 template <typename Strategy> |
| 123 StyledMarkupSerializer<Strategy>::StyledMarkupSerializer( | 123 StyledMarkupSerializer<Strategy>::StyledMarkupSerializer( |
| 124 EAbsoluteURLs should_resolve_ur_ls, | 124 EAbsoluteURLs should_resolve_urls, |
| 125 EAnnotateForInterchange should_annotate, | 125 EAnnotateForInterchange should_annotate, |
| 126 const PositionTemplate<Strategy>& start, | 126 const PositionTemplate<Strategy>& start, |
| 127 const PositionTemplate<Strategy>& end, | 127 const PositionTemplate<Strategy>& end, |
| 128 Node* highest_node_to_be_serialized, | 128 Node* highest_node_to_be_serialized, |
| 129 ConvertBlocksToInlines convert_blocks_to_inlines) | 129 ConvertBlocksToInlines convert_blocks_to_inlines) |
| 130 : start_(start), | 130 : start_(start), |
| 131 end_(end), | 131 end_(end), |
| 132 should_resolve_ur_ls_(should_resolve_ur_ls), | 132 should_resolve_urls_(should_resolve_urls), |
| 133 should_annotate_(should_annotate), | 133 should_annotate_(should_annotate), |
| 134 highest_node_to_be_serialized_(highest_node_to_be_serialized), | 134 highest_node_to_be_serialized_(highest_node_to_be_serialized), |
| 135 convert_blocks_to_inlines_(convert_blocks_to_inlines), | 135 convert_blocks_to_inlines_(convert_blocks_to_inlines), |
| 136 last_closed_(highest_node_to_be_serialized) {} | 136 last_closed_(highest_node_to_be_serialized) {} |
| 137 | 137 |
| 138 template <typename Strategy> | 138 template <typename Strategy> |
| 139 static bool NeedInterchangeNewlineAfter( | 139 static bool NeedInterchangeNewlineAfter( |
| 140 const VisiblePositionTemplate<Strategy>& v) { | 140 const VisiblePositionTemplate<Strategy>& v) { |
| 141 const VisiblePositionTemplate<Strategy> next = NextPositionOf(v); | 141 const VisiblePositionTemplate<Strategy> next = NextPositionOf(v); |
| 142 Node* upstream_node = | 142 Node* upstream_node = |
| (...skipping 30 matching lines...) Expand all Loading... |
| 173 EditingStyle* style = EditingStyle::Create(element->InlineStyle()); | 173 EditingStyle* style = EditingStyle::Create(element->InlineStyle()); |
| 174 // FIXME: Having to const_cast here is ugly, but it is quite a bit of work to | 174 // FIXME: Having to const_cast here is ugly, but it is quite a bit of work to |
| 175 // untangle the non-const-ness of styleFromMatchedRulesForElement. | 175 // untangle the non-const-ness of styleFromMatchedRulesForElement. |
| 176 style->MergeStyleFromRules(const_cast<HTMLElement*>(element)); | 176 style->MergeStyleFromRules(const_cast<HTMLElement*>(element)); |
| 177 return style; | 177 return style; |
| 178 } | 178 } |
| 179 | 179 |
| 180 template <typename Strategy> | 180 template <typename Strategy> |
| 181 String StyledMarkupSerializer<Strategy>::CreateMarkup() { | 181 String StyledMarkupSerializer<Strategy>::CreateMarkup() { |
| 182 StyledMarkupAccumulator markup_accumulator( | 182 StyledMarkupAccumulator markup_accumulator( |
| 183 should_resolve_ur_ls_, ToTextOffset(start_.ParentAnchoredEquivalent()), | 183 should_resolve_urls_, ToTextOffset(start_.ParentAnchoredEquivalent()), |
| 184 ToTextOffset(end_.ParentAnchoredEquivalent()), start_.GetDocument(), | 184 ToTextOffset(end_.ParentAnchoredEquivalent()), start_.GetDocument(), |
| 185 should_annotate_, convert_blocks_to_inlines_); | 185 should_annotate_, convert_blocks_to_inlines_); |
| 186 | 186 |
| 187 Node* past_end = end_.NodeAsRangePastLastNode(); | 187 Node* past_end = end_.NodeAsRangePastLastNode(); |
| 188 | 188 |
| 189 Node* first_node = start_.NodeAsRangeFirstNode(); | 189 Node* first_node = start_.NodeAsRangeFirstNode(); |
| 190 const VisiblePositionTemplate<Strategy> visible_start = | 190 const VisiblePositionTemplate<Strategy> visible_start = |
| 191 CreateVisiblePosition(start_); | 191 CreateVisiblePosition(start_); |
| 192 const VisiblePositionTemplate<Strategy> visible_end = | 192 const VisiblePositionTemplate<Strategy> visible_end = |
| 193 CreateVisiblePosition(end_); | 193 CreateVisiblePosition(end_); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 if (element.IsHTMLElement() && ShouldAnnotate()) | 547 if (element.IsHTMLElement() && ShouldAnnotate()) |
| 548 inline_style->MergeStyleFromRulesForSerialization(&ToHTMLElement(element)); | 548 inline_style->MergeStyleFromRulesForSerialization(&ToHTMLElement(element)); |
| 549 | 549 |
| 550 return inline_style; | 550 return inline_style; |
| 551 } | 551 } |
| 552 | 552 |
| 553 template class StyledMarkupSerializer<EditingStrategy>; | 553 template class StyledMarkupSerializer<EditingStrategy>; |
| 554 template class StyledMarkupSerializer<EditingInFlatTreeStrategy>; | 554 template class StyledMarkupSerializer<EditingInFlatTreeStrategy>; |
| 555 | 555 |
| 556 } // namespace blink | 556 } // namespace blink |
| OLD | NEW |