This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1241932 - Expose decoded CSS grid track properties in a Chrome AP…
…I. r=heycam, r=khuey
- Loading branch information
Showing
26 changed files
with
1,242 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "Grid.h" | ||
|
||
#include "GridDimension.h" | ||
#include "mozilla/dom/GridBinding.h" | ||
#include "nsGridContainerFrame.h" | ||
|
||
namespace mozilla { | ||
namespace dom { | ||
|
||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Grid, mParent, mRows, mCols) | ||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Grid) | ||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Grid) | ||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Grid) | ||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY | ||
NS_INTERFACE_MAP_ENTRY(nsISupports) | ||
NS_INTERFACE_MAP_END | ||
|
||
Grid::Grid(nsISupports* aParent, | ||
nsGridContainerFrame* aFrame) | ||
: mParent(do_QueryInterface(aParent)) | ||
, mRows(new GridDimension(this)) | ||
, mCols(new GridDimension(this)) | ||
{ | ||
MOZ_ASSERT(aFrame, | ||
"Should never be instantiated with a null nsGridContainerFrame"); | ||
|
||
const ComputedGridTrackInfo* rowTrackInfo = aFrame->GetComputedTemplateRows(); | ||
mRows->SetTrackInfo(rowTrackInfo); | ||
mRows->SetLineInfo(rowTrackInfo); | ||
|
||
const ComputedGridTrackInfo* colTrackInfo = aFrame->GetComputedTemplateColumns(); | ||
mCols->SetTrackInfo(colTrackInfo); | ||
mCols->SetLineInfo(colTrackInfo); | ||
} | ||
|
||
Grid::~Grid() | ||
{ | ||
} | ||
|
||
JSObject* | ||
Grid::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) | ||
{ | ||
return GridBinding::Wrap(aCx, this, aGivenProto); | ||
} | ||
|
||
GridDimension* | ||
Grid::Rows() const | ||
{ | ||
return mRows; | ||
} | ||
|
||
GridDimension* | ||
Grid::Cols() const | ||
{ | ||
return mCols; | ||
} | ||
|
||
} // namespace dom | ||
} // namespace mozilla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef mozilla_dom_Grid_h | ||
#define mozilla_dom_Grid_h | ||
|
||
#include "mozilla/dom/Element.h" | ||
#include "nsGridContainerFrame.h" | ||
#include "nsISupports.h" | ||
#include "nsWrapperCache.h" | ||
|
||
namespace mozilla { | ||
namespace dom { | ||
|
||
class GridDimension; | ||
|
||
class Grid : public nsISupports | ||
, public nsWrapperCache | ||
{ | ||
public: | ||
Grid(nsISupports* aParent, nsGridContainerFrame* aFrame); | ||
|
||
protected: | ||
virtual ~Grid(); | ||
|
||
public: | ||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS | ||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Grid) | ||
|
||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; | ||
Element* GetParentObject() | ||
{ | ||
return mParent; | ||
} | ||
|
||
GridDimension* Rows() const; | ||
GridDimension* Cols() const; | ||
|
||
protected: | ||
nsCOMPtr<Element> mParent; | ||
RefPtr<GridDimension> mRows; | ||
RefPtr<GridDimension> mCols; | ||
}; | ||
|
||
} // namespace dom | ||
} // namespace mozilla | ||
|
||
#endif /* mozilla_dom_Grid_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "GridDimension.h" | ||
|
||
#include "Grid.h" | ||
#include "GridLines.h" | ||
#include "GridTracks.h" | ||
#include "mozilla/dom/GridBinding.h" | ||
#include "nsGridContainerFrame.h" | ||
|
||
namespace mozilla { | ||
namespace dom { | ||
|
||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridDimension, mParent, mLines, mTracks) | ||
NS_IMPL_CYCLE_COLLECTING_ADDREF(GridDimension) | ||
NS_IMPL_CYCLE_COLLECTING_RELEASE(GridDimension) | ||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GridDimension) | ||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY | ||
NS_INTERFACE_MAP_ENTRY(nsISupports) | ||
NS_INTERFACE_MAP_END | ||
|
||
GridDimension::GridDimension(Grid* aParent) | ||
: mParent(aParent) | ||
, mLines(new GridLines(this)) | ||
, mTracks(new GridTracks(this)) | ||
{ | ||
MOZ_ASSERT(aParent, "Should never be instantiated with a null Grid"); | ||
} | ||
|
||
GridDimension::~GridDimension() | ||
{ | ||
} | ||
|
||
JSObject* | ||
GridDimension::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) | ||
{ | ||
return GridDimensionBinding::Wrap(aCx, this, aGivenProto); | ||
} | ||
|
||
GridLines* | ||
GridDimension::Lines() const | ||
{ | ||
return mLines; | ||
} | ||
|
||
GridTracks* | ||
GridDimension::Tracks() const | ||
{ | ||
return mTracks; | ||
} | ||
|
||
void | ||
GridDimension::SetTrackInfo(const ComputedGridTrackInfo* aTrackInfo) | ||
{ | ||
mTracks->SetTrackInfo(aTrackInfo); | ||
} | ||
|
||
void | ||
GridDimension::SetLineInfo(const ComputedGridTrackInfo* aTrackInfo) | ||
{ | ||
mLines->SetLineInfo(aTrackInfo); | ||
} | ||
|
||
} // namespace dom | ||
} // namespace mozilla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef mozilla_dom_GridDimension_h | ||
#define mozilla_dom_GridDimension_h | ||
|
||
#include "nsWrapperCache.h" | ||
|
||
namespace mozilla { | ||
|
||
struct ComputedGridTrackInfo; | ||
|
||
namespace dom { | ||
|
||
class Grid; | ||
class GridLines; | ||
class GridTracks; | ||
|
||
class GridDimension : public nsISupports | ||
, public nsWrapperCache | ||
{ | ||
public: | ||
GridDimension(Grid* aParent); | ||
|
||
protected: | ||
virtual ~GridDimension(); | ||
|
||
public: | ||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS | ||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GridDimension) | ||
|
||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; | ||
Grid* GetParentObject() | ||
{ | ||
return mParent; | ||
} | ||
|
||
GridLines* Lines() const; | ||
GridTracks* Tracks() const; | ||
|
||
void SetTrackInfo(const ComputedGridTrackInfo* aTrackInfo); | ||
void SetLineInfo(const ComputedGridTrackInfo* aTrackInfo); | ||
|
||
protected: | ||
RefPtr<Grid> mParent; | ||
RefPtr<GridLines> mLines; | ||
RefPtr<GridTracks> mTracks; | ||
}; | ||
|
||
} // namespace dom | ||
} // namespace mozilla | ||
|
||
#endif /* mozilla_dom_GridDimension_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "GridLine.h" | ||
|
||
#include "GridLines.h" | ||
#include "mozilla/dom/GridBinding.h" | ||
|
||
namespace mozilla { | ||
namespace dom { | ||
|
||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridLine, mParent) | ||
NS_IMPL_CYCLE_COLLECTING_ADDREF(GridLine) | ||
NS_IMPL_CYCLE_COLLECTING_RELEASE(GridLine) | ||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GridLine) | ||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY | ||
NS_INTERFACE_MAP_ENTRY(nsISupports) | ||
NS_INTERFACE_MAP_END | ||
|
||
GridLine::GridLine(GridLines *aParent) | ||
: mParent(aParent) | ||
, mStart(0.0) | ||
, mBreadth(0.0) | ||
, mNumber(0) | ||
{ | ||
MOZ_ASSERT(aParent, "Should never be instantiated with a null GridLines"); | ||
} | ||
|
||
GridLine::~GridLine() | ||
{ | ||
} | ||
|
||
void | ||
GridLine::GetNames(nsTArray<nsString>& aNames) const | ||
{ | ||
aNames = mNames; | ||
} | ||
|
||
JSObject* | ||
GridLine::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) | ||
{ | ||
return GridLineBinding::Wrap(aCx, this, aGivenProto); | ||
} | ||
|
||
double | ||
GridLine::Start() const | ||
{ | ||
return mStart; | ||
} | ||
|
||
double | ||
GridLine::Breadth() const | ||
{ | ||
return mBreadth; | ||
} | ||
|
||
uint32_t | ||
GridLine::Number() const | ||
{ | ||
return mNumber; | ||
} | ||
|
||
void | ||
GridLine::SetLineValues(double aStart, | ||
double aBreadth, | ||
uint32_t aNumber, | ||
const nsTArray<nsString>& aNames) | ||
{ | ||
mStart = aStart; | ||
mBreadth = aBreadth; | ||
mNumber = aNumber; | ||
mNames = aNames; | ||
} | ||
|
||
} // namespace dom | ||
} // namespace mozilla |
Oops, something went wrong.