Bug 1550519 - Show a translucent parent highlight when a subgrid is highlighted....
[gecko.git] / dom / base / nsAttrValueOrString.cpp
blobecfa894dd294b12e0e2252854a6562020d0376f2
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsAttrValueOrString.h"
9 const nsAString& nsAttrValueOrString::String() const {
10 if (mStringPtr) {
11 return *mStringPtr;
14 if (!mAttrValue) {
15 mStringPtr = &mCheapString;
16 return *mStringPtr;
19 if (mAttrValue->Type() == nsAttrValue::eString) {
20 mCheapString = mAttrValue->GetStringValue();
21 mStringPtr = &mCheapString;
22 return *mStringPtr;
25 mAttrValue->ToString(mCheapString);
26 mStringPtr = &mCheapString;
27 return *mStringPtr;