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
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 /* base class for ruby rendering objects that directly contain content */
8 
9 #include "nsRubyContentFrame.h"
10 
11 #include "mozilla/ComputedStyle.h"
12 #include "nsPresContext.h"
13 #include "nsCSSAnonBoxes.h"
14 
15 using namespace mozilla;
16 
17 //----------------------------------------------------------------------
18 
19 // nsRubyContentFrame Method Implementations
20 // ======================================
21 
22 /* virtual */
IsFrameOfType(uint32_t aFlags) const23 bool nsRubyContentFrame::IsFrameOfType(uint32_t aFlags) const {
24   if (aFlags & eBidiInlineContainer) {
25     return false;
26   }
27   return nsInlineFrame::IsFrameOfType(aFlags);
28 }
29 
IsIntraLevelWhitespace() const30 bool nsRubyContentFrame::IsIntraLevelWhitespace() const {
31   auto pseudoType = Style()->GetPseudoType();
32   if (pseudoType != PseudoStyleType::rubyBase &&
33       pseudoType != PseudoStyleType::rubyText) {
34     return false;
35   }
36 
37   nsIFrame* child = mFrames.OnlyChild();
38   return child && child->GetContent()->TextIsOnlyWhitespace();
39 }
40