Commit 9efd0375 authored by yosin@chromium.org's avatar yosin@chromium.org

Make EditingStyle to use VisibleSelection::toNormalizedEphemeralRange()...

Make EditingStyle to use VisibleSelection::toNormalizedEphemeralRange() instead of toNormalizedRange()

This patch changes |EditingStyle| class to use |toNormalizedEphemeralRange()|
in |VisibleSelection| class instead of |toNormalizedRange()| as a preparation
of templatizing |VisibleSelection| to use templatized positions instead of
DOM position to represent range and avoid registering temporary |Range|
object into |Document|.

This patch is a preparation of making selection to handle granularity for web
component, http://crrev.com/1277863002

BUG=388681, 513568
TEST=n/a; no behavior changes

Review URL: https://codereview.chromium.org/1314713004

git-svn-id: svn://svn.chromium.org/blink/trunk@201112 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b54ce9c8
...@@ -1338,8 +1338,8 @@ PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::styleAtSelectionStart(const V ...@@ -1338,8 +1338,8 @@ PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::styleAtSelectionStart(const V
// Also, if the selection is a range, ignore the background color at the start of selection, // Also, if the selection is a range, ignore the background color at the start of selection,
// and find the background color of the common ancestor. // and find the background color of the common ancestor.
if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTransparentBackgroundColor(style->m_mutableStyle.get()))) { if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTransparentBackgroundColor(style->m_mutableStyle.get()))) {
RefPtrWillBeRawPtr<Range> range(selection.toNormalizedRange()); const EphemeralRange range(selection.toNormalizedEphemeralRange());
if (PassRefPtrWillBeRawPtr<CSSValue> value = backgroundColorInEffect(range->commonAncestorContainer())) if (PassRefPtrWillBeRawPtr<CSSValue> value = backgroundColorInEffect(Range::commonAncestorContainer(range.startPosition().computeContainerNode(), range.endPosition().computeContainerNode())))
style->setProperty(CSSPropertyBackgroundColor, value->cssText()); style->setProperty(CSSPropertyBackgroundColor, value->cssText());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment